with one click
scout
// [Investigation] Use when quickly locating relevant files and affected areas across a large codebase.
// [Investigation] Use when quickly locating relevant files and affected areas across a large codebase.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | scout |
| version | 1.1.0 |
| description | [Investigation] Use when quickly locating relevant files and affected areas across a large codebase. |
| execution-mode | subagent |
| context-budget | medium |
[BLOCKING] Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval. [BLOCKING] Before each step or sub-skill call, update task tracking: set
in_progresswhen step starts, setcompletedwhen step ends. [BLOCKING] Every completed/skipped step MUST include brief evidence or explicit skip reason. [BLOCKING] If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.
Goal: Fast, parallel codebase file discovery to locate all files relevant to a task.
Workflow:
Key Rules:
.code-graph/graph.db existsBefore spawning agents, classify the request:
| Scope | Detection | Agent Strategy |
|---|---|---|
| Backend-only | C# class names, domain entities, API handlers | Agents 1+2, skip Agent 3 |
| Frontend-only | Component names, TypeScript, Angular features | Agent 3 only |
| Full-stack | Feature name spanning both layers | All 3 agents |
| Unknown | Ambiguous prompt | Default to all 3 agents |
Think: Does prompt mention a specific layer? Does entity exist in backend, frontend, or both? Adjust agent count โ avoid spawning unnecessary agents.
NOT for: Deep code analysis (โ feature-investigation), debugging (โ debug-investigate), implementation (โ feature-implementation).
Extract from USER_PROMPT:
Spawn SCALE number of scout subagents in parallel via Agent tool (subagent_type: "scout").
WHY scout not Explore: Custom scout agents read .claude/agents/scout.md โ includes graph CLI knowledge + Bash access. Built-in Explore agents have NO graph awareness.
src/Services/*/Domain/, src/Services/*/UseCaseCommands/, src/Services/*/UseCaseQueries/src/Services/*/UseCaseEvents/, src/Services/*/Controllers/, src/Services/*/BackgroundJobs/{frontend-apps-dir}/, {frontend-libs-dir}/{domain-lib}/, {frontend-libs-dir}/{common-lib}/Per agent: 3-minute timeout. Return file paths only โ no content analysis. Use Glob (patterns), Grep (content), Bash (graph CLI).
YOU (main agent) MUST ATTENTION run graph commands YOURSELF after sub-agents return. NOT optional โ without graph, results are incomplete. Sub-agents cannot use graph โ only main agent can.
# Check graph exists
ls .code-graph/graph.db 2>/dev/null && echo "GRAPH_AVAILABLE" || echo "NO_GRAPH"
If GRAPH_AVAILABLE, pick 2-3 key files from sub-agent results (entities, commands, bus messages):
# Full dependency network of key file
python .claude/scripts/code_graph connections <key_file> --json
# All callers of key command/handler
python .claude/scripts/code_graph query callers_of <FunctionName> --json
# All importers of bus message class
python .claude/scripts/code_graph query importers_of <file_path> --json
# Batch query multiple files (most efficient)
python .claude/scripts/code_graph batch-query <file1> <file2> <file3> --json
# If graph returns "ambiguous" โ disambiguate first
python .claude/scripts/code_graph search <keyword> --kind Function --json
# Trace shortest path between two nodes
python .claude/scripts/code_graph find-path <source_qn> <target_qn> --json
# Filter by service, limit results
python .claude/scripts/code_graph query callers_of <name> --limit 5 --filter "ServiceName" --json
Grep-First Discovery (semantic queries): When prompt describes behavior/flow (not specific file), grep key terms FIRST to discover entry files, then use those as graph input:
connections, batch-query, or tracetrace --direction both on middle files (controllers, commands) for full upstream + downstreamGraph results get HIGHER priority than grep โ structural relationships > text matches. After graph expansion, grep again to verify content in discovered files.
If total files found <5 after Steps 2-3:
python .claude/scripts/code_graph search <keyword> --json to find nodes by nameCombine grep + graph into numbered, prioritized file list (see Results Format).
# HIGH PRIORITY - Core Logic
**/Domain/Entities/**/*{keyword}*.cs
**/UseCaseCommands/**/*{keyword}*.cs
**/UseCaseQueries/**/*{keyword}*.cs
**/UseCaseEvents/**/*{keyword}*.cs
**/*{keyword}*.component.ts
**/*{keyword}*.store.ts
# MEDIUM PRIORITY - Infrastructure
**/Controllers/**/*{keyword}*.cs
**/BackgroundJobs/**/*{keyword}*.cs
**/*Consumer*{keyword}*.cs
**/*{keyword}*-api.service.ts
# LOW PRIORITY - Supporting
**/*{keyword}*Helper*.cs
**/*{keyword}*Service*.cs
**/*{keyword}*.html
## Scout Results: {USER_PROMPT}
### High Priority - Core Logic
1. `src/Services/{Service}/Domain/Entities/{Entity}.cs`
2. `src/Services/{Service}/UseCaseCommands/{Feature}/Save{Entity}Command.cs`
...
### Medium Priority - Infrastructure
10. `src/Services/{Service}/Controllers/{Entity}Controller.cs`
11. `src/Services/{Service}/UseCaseEvents/{Feature}/SendNotificationOn{Entity}CreatedEventHandler.cs`
...
### Low Priority - Supporting
20. `src/Services/{Service}/Helpers/{Entity}Helper.cs`
...
### Frontend Files
30. `{frontend-libs-dir}/{domain-lib}/src/lib/{feature}/{feature}-list.component.ts`
...
**Total Files Found:** {count}
**Search Completed In:** {time}
### Suggested Starting Points
1. `{most relevant file}` - {reason}
2. `{second most relevant}` - {reason}
### Unresolved Questions
- {any questions that need clarification}
| Standard | Expectation |
|---|---|
| Speed | Complete in 3-5 minutes |
| Accuracy | Return only relevant files |
| Coverage | Search all likely directories |
| Efficiency | Minimize tool calls |
| Structure | Always use numbered, prioritized lists |
MANDATORY MUST ATTENTION โ NO EXCEPTIONS: If NOT already in workflow, MUST ATTENTION use
AskUserQuestionto ask user:
- Activate
investigationworkflow (Recommended) โ scout โ investigate- Execute
/scoutdirectly โ run this skill standalone
MANDATORY MUST ATTENTION โ NO EXCEPTIONS after completing, MUST ATTENTION use AskUserQuestion to present:
[IMPORTANT] Use
TaskCreateto break ALL work into small tasks BEFORE starting โ including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
docs/project-reference/domain-entities-reference.md โ Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models) (read directly when relevant; do not rely on hook-injected conversation text)External Memory: Complex/lengthy work โ write findings incrementally to
plans/reports/. Prevents context loss.
Evidence Gate: MANDATORY MUST ATTENTION โ every claim, finding, recommendation requires
file:lineproof with confidence % (>80% act, <80% verify first).
Graph-Assisted Investigation โ MANDATORY when
.code-graph/graph.dbexists.HARD-GATE: MUST ATTENTION run at least ONE graph command on key files before concluding any investigation.
Pattern: Grep finds files โ
trace --direction bothreveals full system flow โ Grep verifies details
Task Minimum Graph Action Investigation/Scout trace --direction bothon 2-3 entry filesFix/Debug callers_ofon buggy function +tests_forFeature/Enhancement connectionson files to be modifiedCode Review tests_foron changed functionsBlast Radius trace --direction downstreamCLI:
python .claude/scripts/code_graph {command} --json. Use--node-mode filefirst (10-30x less noise), then--node-mode functionfor detail.
Incremental Result Persistence โ MANDATORY for all sub-agents or heavy inline steps processing >3 files.
- Before starting: Create report file
plans/reports/{skill}-{date}-{slug}.md- After each file/section reviewed: Append findings to report immediately โ never hold in memory
- Return to main agent: Summary only (per SYNC:subagent-return-contract) with
Full report:path- Main agent: Reads report file only when resolving specific blockers
Why: Context cutoff mid-execution loses ALL in-memory findings. Each disk write survives compaction. Partial results are better than no results.
Report naming:
plans/reports/{skill-name}-{YYMMDD}-{HHmm}-{slug}.md
Sub-Agent Return Contract โ When this skill spawns a sub-agent, the sub-agent MUST return ONLY this structure. Main agent reads only this summary โ NEVER requests full sub-agent output inline.
## Sub-Agent Result: [skill-name] Status: โ PASS | โ ๏ธ PARTIAL | โ FAIL Confidence: [0-100]% ### Findings (Critical/High only โ max 10 bullets) - [severity] [file:line] [finding] ### Actions Taken - [file changed] [what changed] ### Blockers (if any) - [blocker description] Full report: plans/reports/[skill-name]-[date]-[slug].mdMain agent reads
Full reportfile ONLY when: (a) resolving a specific blocker, or (b) building a fix plan. Sub-agent writes full report incrementally (per SYNC:incremental-persistence) โ not held in memory.
Nested Task Expansion Contract โ For workflow-step invocation, the
[Workflow] ...row is only a parent container; the child skill still creates visible phase tasks.
- Call
TaskListfirst. If a matching active parent workflow row exists, setnested=trueand recordparentTaskId; otherwise run standalone.- Create one task per declared phase before phase work. When nested, prefix subjects
[N.M] $skill-name โ phase.- When nested, link the parent with
TaskUpdate(parentTaskId, addBlockedBy: [childIds]).- Orchestrators must pre-expand a child skill's phase list and link the workflow row before invoking that child skill or sub-agent.
- Mark exactly one child
in_progressbefore work andcompletedimmediately after evidence is written.- Complete the parent only after all child tasks are completed or explicitly cancelled with reason.
Blocked until:
TaskListdone, child phases created, parent linked when nested, first child markedin_progress.
Project Reference Docs Gate โ Run after task-tracking bootstrap and before target/source file reads, grep, edits, or analysis. Project docs override generic framework assumptions.
- Identify scope: file types, domain area, and operation.
- Required docs by trigger: always
docs/project-reference/lessons.md; doc lookupdocs-index-reference.md; reviewcode-review-rules.md; backend/CQRS/APIbackend-patterns-reference.md; domain/entitydomain-entities-reference.md; frontend/UIfrontend-patterns-reference.md; styles/designscss-styling-guide.md+design-system/README.md; integration testsintegration-test-reference.md; E2Ee2e-test-reference.md; feature docs/specsfeature-docs-reference.md; architecture/new areaproject-structure-reference.md.- Read every required doc that exists; skip absent docs as not applicable. Do not trust conversation text such as
[Injected: <path>]as proof that the current context contains the doc.- Before target work, state:
Reference docs read: ... | Missing/not applicable: ....Blocked until: scope evaluated, required docs checked/read,
lessons.mdconfirmed, citation emitted.
Task Tracking & External Report Persistence โ Bootstrap this before execution; then run project-reference doc prefetch before target/source work.
- Create a small task breakdown before target file reads, grep, edits, or analysis. On context loss, inspect the current task list first.
- Mark one task
in_progressbefore work andcompletedimmediately after evidence; never batch transitions.- For plan/review work, create
plans/reports/{skill}-{YYMMDD}-{HHmm}-{slug}.mdbefore first finding.- Append findings after each file/section/decision and synthesize from the report file at the end.
- Final output cites
Full report: plans/reports/{filename}.Blocked until: task breakdown exists, report path declared for plan/review work, first finding persisted before the next finding.
Critical Thinking Mindset โ Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act. Anti-hallucination: Never present guess as fact โ cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence โ certainty without evidence root of all hallucination.
Evidence-Based Reasoning โ Speculation is FORBIDDEN. Every claim needs proof.
- Cite
file:line, grep results, or framework docs for EVERY claim- Declare confidence: >80% act freely, 60-80% verify first, <60% DO NOT recommend
- Cross-service validation required for architectural changes
- "I don't have enough evidence" is valid and expected output
BLOCKED until:
- [ ]Evidence file path (file:line)- [ ]Grep search performed- [ ]3+ similar patterns found- [ ]Confidence level statedForbidden without proof: "obviously", "I think", "should be", "probably", "this is because" If incomplete โ output:
"Insufficient evidence. Verified: [...]. Not verified: [...]."
Cross-Service Check โ Microservices/event-driven: MANDATORY before concluding investigation, plan, spec, or feature doc. Missing downstream consumer = silent regression.
Boundary Grep terms Event producers Publish,Dispatch,Send,emit,EventBus,outbox,IntegrationEventEvent consumers Consumer,EventHandler,Subscribe,@EventListener,inboxSagas/orchestration Saga,ProcessManager,Choreography,Workflow,OrchestratorSync service calls HTTP/gRPC calls to/from other services Shared contracts OpenAPI spec, proto, shared DTO โ flag breaking changes Data ownership Other service reads/writes same table/collection โ Shared-DB anti-pattern Per touchpoint: owner service ยท message name ยท consumers ยท risk (NONE / ADDITIVE / BREAKING).
BLOCKED until: Producers scanned ยท Consumers scanned ยท Sagas checked ยท Contracts reviewed ยท Breaking-change risk flagged
Rationalization Prevention โ AI skips steps via these evasions. Recognize and reject:
Evasion Rebuttal "Too simple for a plan" Simple + wrong assumptions = wasted time. Plan anyway. "I'll test after" RED before GREEN. Write/verify test first. "Already searched" Show grep evidence with file:line. No proof = no search."Just do it" Still need TaskCreate. Skip depth, never skip tracking. "Just a small fix" Small fix in wrong location cascades. Verify file:line first. "Code is self-explanatory" Future readers need evidence trail. Document anyway. "Combine steps to save time" Combined steps dilute focus. Each step has distinct purpose.
Fix-Layer Accountability โ NEVER fix at the crash site. Trace the full flow, fix at the owning layer.
AI default behavior: see error at Place A โ fix Place A. This is WRONG. The crash site is a SYMPTOM, not the cause.
MANDATORY before ANY fix:
- Trace full data flow โ Map the complete path from data origin to crash site across ALL layers (storage โ backend โ API โ frontend โ UI). Identify where the bad state ENTERS, not where it CRASHES.
- Identify the invariant owner โ Which layer's contract guarantees this value is valid? That layer is responsible. Fix at the LOWEST layer that owns the invariant โ not the highest layer that consumes it.
- One fix, maximum protection โ Ask: "If I fix here, does it protect ALL downstream consumers with ONE change?" If fix requires touching 3+ files with defensive checks, you are at the wrong layer โ go lower.
- Verify no bypass paths โ Confirm all data flows through the fix point. Check for: direct construction skipping factories, clone/spread without re-validation, raw data not wrapped in domain models, mutations outside the model layer.
BLOCKED until:
- [ ]Full data flow traced (origin โ crash)- [ ]Invariant owner identified withfile:lineevidence- [ ]All access sites audited (grep count)- [ ]Fix layer justified (lowest layer that protects most consumers)Anti-patterns (REJECT these):
- "Fix it where it crashes" โ Crash site โ cause site. Trace upstream.
- "Add defensive checks at every consumer" โ Scattered defense = wrong layer. One authoritative fix > many scattered guards.
- "Both fix is safer" โ Pick ONE authoritative layer. Redundant checks across layers send mixed signals about who owns the invariant.
AI Mistake Prevention โ Failure modes to avoid on every task:
Check downstream references before deleting. Deleting components causes documentation and code staleness cascades. Map all referencing files before removal. Verify AI-generated content against actual code. AI hallucinates APIs, class names, and method signatures. Always grep to confirm existence before documenting or referencing. Trace full dependency chain after edits. Changing a definition misses downstream variables and consumers derived from it. Always trace the full chain. Trace ALL code paths when verifying correctness. Confirming code exists is not confirming it executes. Always trace early exits, error branches, and conditional skips โ not just happy path. When debugging, ask "whose responsibility?" before fixing. Trace whether bug is in caller (wrong data) or callee (wrong handling). Fix at responsible layer โ never patch symptom site. Assume existing values are intentional โ ask WHY before changing. Before changing any constant, limit, flag, or pattern: read comments, check git blame, examine surrounding code. Verify ALL affected outputs, not just the first. Changes touching multiple stacks require verifying EVERY output. One green check is not all green checks. Holistic-first debugging โ resist nearest-attention trap. When investigating any failure, list EVERY precondition first (config, env vars, DB names, endpoints, DI registrations, data preconditions), then verify each against evidence before forming any code-layer hypothesis. Surgical changes โ apply the diff test. Bug fix: every changed line must trace directly to the bug. Don't restyle or improve adjacent code. Enhancement task: implement improvements AND announce them explicitly. Surface ambiguity before coding โ don't pick silently. If request has multiple interpretations, present each with effort estimate and ask. Never assume all-records, file-based, or more complex path.
MUST ATTENTION cite file:line evidence for every claim. Confidence >80% to act, <60% = do NOT recommend.
MUST ATTENTION never skip steps via evasions. Plan anyway. Test first. Show grep evidence with file:line.
MUST ATTENTION run at least ONE graph command on key files before concluding when .code-graph/graph.db exists.
MUST ATTENTION trace full data flow and fix at the owning layer, not the crash site. Audit all access sites before adding ?..
MUST ATTENTION apply critical thinking โ every claim needs traced proof, confidence >80% to act. Anti-hallucination: never present guess as fact.
MUST ATTENTION apply AI mistake prevention โ holistic-first debugging, fix at responsible layer, surface ambiguity before coding, re-read files after compaction.
plans/reports/ incrementally and synthesize from disk.Reference docs read: ....lessons.md; project conventions override generic defaults.[N.M] $skill-name โ phase prefixes and one-in_progress discipline.IMPORTANT MUST ATTENTION follow declared step order for this skill; NEVER skip, reorder, or merge steps without explicit user approval
IMPORTANT MUST ATTENTION for every step/sub-skill call: set in_progress before execution, set completed after execution
IMPORTANT MUST ATTENTION every skipped step MUST include explicit reason; every completed step MUST include concise evidence
IMPORTANT MUST ATTENTION if Task tools unavailable, maintain an equivalent step-by-step plan tracker with synchronized statuses
MUST ATTENTION run Phase 0 classification BEFORE spawning agents โ scope determines agent count
MUST ATTENTION graph expand is NOT optional โ run at least ONE graph command on key files when .code-graph/graph.db exists
MUST ATTENTION if <5 files found, re-check keywords and run second pass with alternates
MUST ATTENTION use AskUserQuestion after completing โ NEVER auto-proceed to next step
MUST ATTENTION break work into TaskCreate tasks BEFORE starting
MUST ATTENTION write incremental findings to plans/reports/ โ NEVER hold all results in memory
MUST ATTENTION cite file:line evidence for every claim. Confidence >80% to act, <60% = DO NOT recommend.
Anti-Rationalization:
| Evasion | Rebuttal |
|---|---|
| "Graph step too slow, skip it" | Graph finds what 50 greps miss. NEVER skip. |
| "Only 2 files, no need for report" | Incremental write costs nothing. Skip = context loss risk. |
| "Scope obvious, skip Phase 0" | Wrong agent set = missed files. Always classify first. |
| "Already searched, results complete" | Show grep + graph evidence. No proof = incomplete. |
| "Simple scout, skip workflow question" | User decides scope. NEVER assume standalone is acceptable. |
[TASK-PLANNING] Before acting, analyze task scope and systematically break it into small todo tasks and sub-tasks using TaskCreate.