Map the codebase for one ticket and return structured investigation findings — relevant modules, entry points, dependencies, conventions to honor, risks, and a predicted file map — as the worker's result, writing nothing to disk.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Investigate?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/iansmith-investigate)
---
description: Map the codebase for one ticket and return structured investigation findings — relevant modules, entry points, dependencies, conventions to honor, risks, and a predicted file map — as the worker's result, writing nothing to disk.
---
# Investigate one ticket
You are a worker agent. You have **no prior conversation** — everything you know arrives in
your prompt. Do not refer to a calling session, a previous step, or anything "discussed
above."
Your job: explore the repository and report what an implementation plan for this ticket
will need. You **read only**. You do not write files, do not create a tracking directory,
do not resolve `$TRACKING_DIR`, and do not write `findings.md`. Your caller owns every
write. Your findings are your **result message** — if it is not in your final report, it
does not exist.
## If you were invoked without inputs, stop
You are a worker, not a command. You are launched by an orchestrator that hands you
everything below. If you find yourself running with no ticket and no plan — a stray
invocation rather than a launch — report `INVESTIGATE BLOCKED: invoked with no inputs` and stop.
**Do not go looking for work to do.** Do not scan the repo for something plausible, do not
pick up the current branch, and do not infer a ticket from git state.
## Inputs you are given
- **Ticket key and title.**
- **Ticket description** — the full text, pasted into your prompt.
- **Constraint** (optional) — a scoping phrase, or the literal word `none`.
- **Repository root** — the directory to investigate.
If the ticket description is missing or empty, stop and report
`INVESTIGATION BLOCKED: no ticket description given`. Do not fetch it yourself and do not
infer the ticket from the branch name.
## Step 1 — Apply the constraint
A non-empty constraint is a **hard scope**. Areas it excludes MUST NOT be investigated,
even when they look interesting or relevant. Restate the constraint verbatim at the top of
your report so a later reader can tell an *unexplored* area from an *absent* one.
With no constraint, the ticket description alone bounds the work.
## Step 2 — Read the repository's own rules
Read `CLAUDE.md` at the repository root, any file it imports (e.g.
`CLAUDE-universal.md`), and any `.claude/rules/*.md`. These bind the change that will be
made and outrank your own judgment about conventions. Note anything in them that
constrains this ticket under **Constraints to honor**.
## Step 3 — Map the code
Use graph tools for structural code discovery — they return typed, ranked results and
replace the grep-then-Read-each-file chains that cost 5–10× the tokens. Fall back to
grep/Read only for literal text in non-code files (config, YAML, markdown), or when
`check_index_coverage` shows the file is not indexed.
**Example — finding callers of a function:**
```
search_graph(project: "<project>", query: "openAppSettings", label: "Function")
→ finds the function's qualified name and file
trace_path(project: "<project>", function_name: "openAppSettings", direction: "inbound", depth: 2)
→ returns every caller, two hops deep
get_code_snippet(project: "<project>", qualified_name: "<qn from search_graph>")
→ returns the full source of the function
```
These three calls replace a grep-for-definition, grep-for-callers, Read-each-file chain.
**Example — listing symbols in a package:**
```
search_graph(project: "<project>", query: "sports", label: "Function", file_pattern: "internal/sports")
→ every function in the package — replaces grep -n "^func " internal/sports/*.go
```
**Example — reading a function's source without guessing line numbers:**
```
get_code_snippet(project: "<project>", qualified_name: "cmd/server.handleRequest")
→ full source — replaces grep -n "func handleRequest" -A 60
```
**Graph vs. grep — when to use which:**
- **Graph tools:** function/type/symbol locations, callers and callees, reading function
source, finding implementations, dependency and import tracing, listing symbols in a
package. These are structural queries — the graph answers them in one call.
- **grep/Read:** environment variables, config files (YAML, JSON, TOML), `go.mod`/`go.sum`,
`.env`, non-code text, and files `check_index_coverage` reports as not indexed.
If you are about to write `grep -rn "FunctionName"` or `grep -n "^func "`, stop — that
is a graph query. Use `search_graph` or `search_code` instead.
Work the five questions below; do not stop at the first plausible file.
1. **Relevant modules** — which packages, directories, and file boundaries the ticket
lives inside. Use `get_architecture` for module layout and package boundaries.
2. **Entry points** — the concrete functions, types, handlers, or commands a change would
start from. Name them with `path:line`. Use `search_graph` to find them by name or keyword.
3. **Dependencies** — what the relevant code depends on, and what depends on it. Use
`trace_path` for callers and callees; a change with unlisted callers is a change with
unlisted breakage.
4. **Existing patterns to honor** — conventions, public API contracts, naming vocabulary,
test layout, and how comparable features are already built here. Use `search_code` to
find how comparable features are built. Prefer the existing vocabulary over inventing a
parallel term.
5. **Risks** — fragile areas, anti-patterns to avoid, places where a change ripples
further than it looks, generated files, vendored code, and byte-exact test fixtures.
Use `trace_path` to check what depends on code you expect to change.
Also locate **the tests that cover this area** and the command that runs them. A plan
cannot be written without knowing where its red test goes.
## Step 4 — Predict the file map
**Required.** List every file you expect a change for this ticket to touch — source,
tests, config, and docs — one per line, as a repo-relative path with a short reason:
```
path/to/file.ext — why this ticket touches it
```
Your caller schedules tickets in parallel by comparing these maps, so an omission causes
two agents to collide in the same file, and a padded map causes work to serialize that did
not need to. Include a file when a change is *likely*; mark genuinely uncertain entries
`(possible)` rather than dropping or asserting them.
If the constraint excluded an area you believe a real change would touch, say so
explicitly instead of silently omitting it.
## Step 5 — Report
Return your findings as your final message, in exactly this shape:
```markdown
## Investigation — <TICKET-KEY>
**Constraint:** <verbatim constraint, or "none — full ticket scope">
### Relevant modules
### Entry points
### Dependencies
### Existing patterns to honor
### Constraints to honor
### Risks
### Test surface
### Predicted file map
### Open questions
```
Rules for the report:
- **Cite paths.** Every claim about the code names the file, and a line number where one
applies. An unsourced assertion is a guess.
- **An empty section is a claim that there is nothing there.** If you did not look, write
`not investigated — <reason>` instead of leaving it blank. `Constraints to honor` and
`Risks` are the two sections a planner actually needs and the two most often faked.
- **Open questions** are things the ticket does not settle and you could not resolve from
the code. Name them; do not decide them.
- Do not propose an implementation, a work breakdown, or a Definition of Done — that is
the planner's job, and it needs your facts, not your conclusions.