Systematically trace code flows, locate implementations, diagnose performance issues, and map system architecture. Use when understanding how existing systems work, researching concepts, exploring code structure, or answering "how/where/why is X implemented?" questions.
Trace execution end-to-end from entry point to outcome.
Steps:
Find where functionality lives in the codebase.
Steps:
Diagnose bottlenecks using 3-phase approach.
Phase 1: Locate bottleneck
Phase 2: Root cause (if unclear)
Phase 3: Fix or instrument
Common performance patterns:
| Pattern | Symptoms | Fix Direction | |---------|----------|---------------| | N+1 queries | Sequential DB calls | Batch/eager loading | | Algorithmic complexity | Grows with data | Optimize algorithm | | Large payload | Network time high | Pagination/filtering | | Missing cache | Same data fetched repeatedly | Add caching | | Sequential operations | Waits in series | Parallelize |
Understand system organization, components, and integration points.
Steps:
Read in this order:
docs/product-requirements.md — project overview and features (F-##)docs/feature-spec/F-##-*.md — technical detailsdocs/system-design.md — architecturedocs/api-contracts.yaml — API referenceFor known file paths:
Read — examine specific files directlyFor pattern searches:
Grep — find exact text matches (function names, imports, error messages)Glob — discover files by name patternFor semantic queries:
Explore agent for complex, multi-file pattern discoverysenior-engineer agent for subtle performance bottlenecksLaunch 2-4 independent agents for large codebases:
Full-stack flow:
Multi-service architecture:
Performance issues:
## How [Feature] Works
### Purpose
[Brief description and why it exists]
### High-Level Flow
1. User action triggers [component/function] (file:line)
2. [Step 2 with file:line reference]
3. [Step 3 with file:line reference]
4. Final outcome
### Key Files
- `path/to/file.ts:123` - [Purpose]
- `path/to/other.ts:45` - [Purpose]
### Important Details
- Error handling: [Approach with file references]
- Edge cases: [How handled]
- Security: [Considerations if applicable]
## Location: [Functionality]
### Main Implementation
`path/to/file.ts:45-120` - [Purpose]
### Related Files
- `path/component.tsx` - UI layer
- `path/service.ts` - Business logic
- `path/api.ts` - API integration
### Entry Points
1. [How users trigger this]
2. [System-initiated triggers]
## Performance Analysis: [Feature]
### Symptoms
- Slow when: [Condition]
- Observed: [X] seconds
- Expected: [Y] seconds
### Root Cause
[What's causing it with file:line evidence]
### Fix Options
**Option A: [Name]**
- Change: [What to do]
- Impact: [Expected improvement]
- Effort: [Time estimate]
**Recommendation:** [Which option and why]
## Architecture: [System/Feature]
### Overview
[High-level description]
### Component Breakdown
**[Layer/Module Name]:**
- Responsibility: [What it does]
- Key files: [File paths]
- Dependencies: [What it needs]
### Data Flow
[Step-by-step or diagram]
### Integration Points
- [External services]
- [Related features]
file:line format for all findingsfile:line for evidencenpx skills add CaptainCrouton89/Investigating Code Patterns下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer