Spec file
Claude Code subagents for read-only code inspection
Define an inspection task with separate context, an explicit tool list and an output contract. Source-based; not tested.
Delegating code inspection can keep exploration output out of the main conversation and make the task easier to bound. A subagent name alone does not make it read-only; inspect its configured tools and effective permissions. This page gives a project-level inspection file and an output contract for assessing the suggestions it returns.
- Verified
- · Not tested by us
- Applies to
- Claude Code Based on Claude Code documentation read on 2026-11-03; behavior depends on the installed version and organization settings.[1]
- Tools
File locations
| Path | Scope | How it is read |
|---|---|---|
.claude/agents/inspection-notes.md | A custom subagent definition for the current project | Claude Code reads Markdown frontmatter and the body to define the subagent; inspect it with /agents.[1] |
When to use
- You want a separate investigation of a module that returns findings and evidence before the main session chooses changes.[1]
When not to use
- The task is tiny and already understood, or you expect automatic fixes while providing only read tools.[1]
Separate context needs a clear task
The documentation describes subagents as working in their own context windows, with results returned to the main conversation. Do not assume that every decision discussed in the main session is available. Include the module path, inspection question and expected output in the task. Supply missing background before acting on a report that misunderstood the project.[1]
Define a project-level inspector
---
name: inspection-notes
description: Inspect a specified module and report evidence-backed findings without editing files.
tools: Read, Grep, Glob
---
Inspect only the module named in the task.
For each finding, return a file path, the observed behavior,
why it matters, and a suggested follow-up check.
Do not claim a command was executed unless it actually was.
The tools field explicitly lists Read, Grep and Glob; this example does not expose editing or Bash tools. Frontmatter configures the agent while the body describes its work. A user-level definition can live in ~/.claude/agents/. Choose the scope according to whether the definition should be shared with your team.[1]
Make the output reviewable
- Example task: inspect retry handling in src/queue/ and report paths that may execute twice, with file locations and proposed checks.
- Separate observations, inferences and unanswered questions; a subagent without command execution should not report passing tests.
- Have the main session inspect the cited files and task scope before adding tests, changing implementation or declining a suggestion.
Verification and limits
Official file locations, frontmatter examples and tool configuration were reviewed. The example file received a structural check; no subagent was started, no project was inspected and no tests were executed. The tools list limits exposed capabilities, but read scope and organization permissions still depend on the session settings. If the task needs execution, redesign the task and permissions instead of inventing results.[1]
Sources
All links are official pages; verification dates are listed per source, and links point to the version checked.