context-doctor
Skill9 starsChanged 23 days agoMITView on GitHub
Audits a repo's agent context — system prompt, CLAUDE.md/AGENTS.md, skills, and references — against context-engineering lessons for Claude 4/5 models (model detected from the running session, or set via --model), then writes claude-optimization.md with a Summary table. Use to right-size an agent setup, cutting over-constraint, redundancy, always-upfront context, and conflicting instructions.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- Mark-Life/agent-skillstheir own version, first seen Nov 6, 2026
- josechifflet/setuptheir own version, first seen Oct 15, 2026
- jpc4729/setuptheir own version, first seen Oct 13, 2026
- KushalP1/context-doctortheir own version, first seen Oct 9, 2026
- HarveyZgit/agentstheir own version, first seen Aug 23, 2026
- mfielding92/claude-code-experttheir own version, first seen Mar 23, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- Mark-Life/agent-skills★ 4same name
- KushalP1/context-doctor★ 2same name
- unhealthy-outlander317/context-doctor★ 2same name
- HarveyZgit/agents★ 1same name
- josechifflet/setup★ 0same name
- jpc4729/setup★ 0same name
- mfielding92/claude-code-expert★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-auditSkill
- bulk-readSkill
- canon-slidesSkill
- captureSkill
- context-checkSkill
- dead-code-cleanupSkill
- doc-auditSkill
- learnings-sweepSkill
- mikadoSkill
- mutation-testSkill
- output-validatorSkill
- promote-learningsSkill
- pr-reviewSkill
- repo-auditSkill
- repo-workflow-auditSkill
- sdlc-auditSkill
- skill-evalSkill
- skill-exportSkill
- sprintSkill
- wrapupSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 11 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Not for: running or testing the target app (static read only), general code review, or a single sprint diff.
- Distinctive: line 53
Static analysis only: Read the context files. Never run the repo, execute skills, or call a model.
- Very specific: line 59
Repo-agnostic + graceful: If an artifact is absent (CLAUDE.md, .claude/skills/, etc.), say so and continue — an absent file is a valid …
- Distinctive: line 82
Check for absolute rules that are wrong in some cases: "never write comments", "always do X", rigid formatting dictates.
- Distinctive: line 89
Check tool/command definitions: do they lean on long "here's how to call it" examples, or do clear parameter names, enums, and defaults …
- Distinctive: line 95
Check for always-loaded content used by a minority of tasks (verification/review steps, rare workflows, deep references).
- Distinctive: line 101
Check for guidance repeated in the system prompt/CLAUDE.md *and* a tool/skill description, or the same rule copied across files.
- Distinctive: line 106
Check for heavy manual "save this to memory" instructions.
- Distinctive: line 112
Check whether specs/designs are prose or screenshots where a higher-fidelity reference exists: a code file to port, a test suite as the …
- Distinctive: line 127
Check for guidance that would block on "Want me to…?"/"Shall I…?" for reversible, in-scope actions, or that omits when pausing is actually …
- Distinctive: line 134
Check whether workflows that report progress (multi-step skills, autonomous loops) instruct grounding each claim in a tool result from the …
- Very specific: line 149
Check skills/CLAUDE.md for "explain your reasoning", "show your work", or similar asked of the *response* (not thinking blocks).
- Very specific: line 161
Fable 5 / 5.1: default high; xhigh for the most capability-sensitive workloads.
- Very specific: line 163
Opus 5: default high, like Fable.
- Very specific: line 164
Opus 5.5: default medium (Opus 5 defaults to high, so a carried-over setting runs a level off).
- Very specific: line 167
Check for blanket xhigh/max on routine work, or no effort guidance at all on a repo doing capability-sensitive work, and for an Opus 5.5 …
- Very specific: line 189
No numeric score. Any lens rated action forces at least trim.
- Very specific: line 194
Do not write without y. On confirmation, write claude-optimization.md at the repo root (overwrite — it is a point-in-time snapshot, not a …
- Distinctive: line 233
No context artifacts found?: If the repo has no CLAUDE.md/AGENTS.md/skills/agent config, say so and stop with a limited-scope note — do not …
- Very specific: line 241
No numeric score: If tempted to write "7/10" or a percentage, stop — use per-lens status plus the lean/trim/overloaded verdict.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Doctor
Static audit of a repository's agent context — everything a coding agent loads before it sees a
user prompt: CLAUDE.md/AGENTS.md, skill and command files, tool descriptions, and referenced
specs/mockups. Rates each of seven lenses, prints a Summary table, and writes
claude-optimization.md at the repo root. Human-facing name: Context Doctor.
The seven lenses come from Anthropic's guidance on context engineering for modern Claude models: https://claude.com/blog/the-new-rules-of-context-engineering-for-claude-5-generation-models — the same lessons behind removing ~80% of Claude Code's system prompt. This skill is a portable checkup against those lessons.
Self-contained. It depends on nothing outside this folder — no build tools, no other skills, no
network. Drop it into any repo's .claude/skills/ or upload it to Claude Desktop and run it.
When to use
Triggers: "audit my agent setup", "is my CLAUDE.md bloated", "right-size my skills", "check my context for over-constraint / conflicting instructions", "run context-doctor". Run it periodically, or after a CLAUDE.md/skills grow large.
Not for: running or testing the target app (static read only), general code review, or a single sprint diff.
Target model
Two checkup modes, gating which Claude-5-specific checks run:
5(default) — full checkup for a Fable 5/5.1 or Opus 5.5 target: the seven lenses below, plus four checks (reasoning-extraction avoidance, effort-default guidance, checkpoint/pause discipline, progress-claim grounding). A repo targeting Opus 5 also runs in5, but check 10 is not raised for it and check 11 uses thehighdefault.4— the seven lenses only, plus the two checks that are model-agnostic (checkpoint/pause discipline, progress-claim grounding). Skip reasoning-extraction avoidance and effort-default guidance — those failure modes are specific to Claude 5-generation models and would be false positives for a repo targeting Opus 4.8.
Detect the default from the running session's own model identity (stated in the system prompt).
Override with --model 4 or --model 5 when the repo's target differs from the session model —
e.g. auditing on Sonnet 5 a repo whose skills are written for an Opus 4.8 production deploy. State
which mode was used, and how it was determined (detected vs. --model override), in the report
header.
Operating constraints
- Static analysis only. Read the context files. Never run the repo, execute skills, or call a model. No dynamic probing.
- Judgement, not a checklist score. Report a per-lens status and one overall verdict — never a numeric score or percentage. A number hides which lens is weak.
- Evidence, not theory. Cite
file:line(orfile+ a short quote) for every finding. Flag a lensaction/advisoryonly with a concrete instance, not a hypothetical. - Repo-agnostic + graceful. If an artifact is absent (
CLAUDE.md,.claude/skills/, etc.), say so and continue — an absent file is a valid result, not a finding. - Read, don't rewrite. This skill diagnoses and recommends. It does not edit the audited files; it only writes the one report.
What to inspect
Gather the context artifacts that exist in the target repo (skip any that are absent, note which):
CLAUDE.md(repo root and any nested),AGENTS.md,.cursorrules/other agent-instruction files.claude/skills/(orskills/) — eachSKILL.md, plus anyreference//gates/sub-files- Tool/command definitions and their descriptions
@-imported or referenced standards/config injected into every session- Referenced specs, plans, mockups (are they prose, or code/HTML/tests?)
Line counts are a proxy for context weight, not exact tokens.
The seven lenses
Rate each: aligned (follows the lesson), advisory (minor drift, worth trimming), or action (clear instance to fix). Cite evidence.
- Rules → judgement. Blanket prohibitions/mandates a capable model handles via judgment.
- Check for absolute rules that are wrong in some cases: "never write comments", "always do X", rigid formatting dictates. Prefer judgment-framed guidance ("match the surrounding code's comment density, naming, and idiom").
actionwhen a blanket rule would produce wrong behavior for a reasonable subset of tasks.
- Examples → interface design. Over-reliance on usage examples where an expressive interface
would guide better.
- Check tool/command definitions: do they lean on long "here's how to call it" examples, or do clear parameter names, enums, and defaults make correct use obvious?
advisorywhen examples substitute for a self-describing interface.
- Upfront → progressive disclosure. Context injected on every session that is only
conditionally needed.
- Check for always-loaded content used by a minority of tasks (verification/review steps, rare
workflows, deep references). Recommend moving it behind on-demand skills/reference files loaded
when needed. Note oversized always-on files (a long root
CLAUDE.md, a monolithic SKILL.md). actionwhen a large block is always injected but rarely used.
- Check for always-loaded content used by a minority of tasks (verification/review steps, rare
workflows, deep references). Recommend moving it behind on-demand skills/reference files loaded
when needed. Note oversized always-on files (a long root
- Repeat yourself → simple descriptions. The same instruction duplicated across places.
- Check for guidance repeated in the system prompt/
CLAUDE.mdand a tool/skill description, or the same rule copied across files. Recommend one owner; put tool usage in the tool description. advisory/actionper how much duplication and drift risk exists.
- Check for guidance repeated in the system prompt/
- Memory: manual → durable. How cross-session knowledge is captured.
- Check for heavy manual "save this to memory" instructions. Note that modern harnesses can auto-capture relevant memory. Portable, repo-native memory (decision logs, handoff notes) is a legitimate deliberate choice — flag only redundant manual bookkeeping, not durable records.
- Usually
advisory.
- Simple specs → rich references. Fidelity of the references the agent works from.
- Check whether specs/designs are prose or screenshots where a higher-fidelity reference exists: a code file to port, a test suite as the spec, an HTML mockup instead of a description or screenshot, or a rubric a verifier can check against. Recommend code/HTML/test references.
advisory/actionwhen a prose/screenshot reference could be a code/HTML/test artifact.
- Conflicting instructions. Contradictory directives across the loaded context.
- Cross-read the artifacts for clashes (e.g. "leave documentation as appropriate" vs "DO NOT add comments"; "keep it minimal" vs "be thorough"). Contradictions force the model to spend reasoning reconciling them. Quote both sides.
actionfor any direct contradiction;advisoryfor tension worth clarifying.
Model-agnostic checks (both 4 and 5)
- Checkpoint/pause discipline. Instructions that make Claude stop or ask permission more than
the task needs.
- Check for guidance that would block on "Want me to…?"/"Shall I…?" for reversible, in-scope actions, or that omits when pausing is actually warranted (destructive/irreversible actions, real scope changes, input only the user can provide).
actionwhen a skill/CLAUDE.md lacks any checkpoint guidance for a long-running or autonomous workflow;advisorywhen guidance exists but is vague.
- Progress-claim grounding. Long-run status reporting that isn't tied to verifiable evidence.
- Check whether workflows that report progress (multi-step skills, autonomous loops) instruct grounding each claim in a tool result from the session, and stating explicitly what wasn't verified.
advisoryunless the repo has evidence of prior fabricated status reports, thenaction.
Claude 5-specific checks (5 only)
Which model the repo targets decides the details of both checks. Take it from the model ids the
repo's own skills/agents/settings name; if none, from the running session's model; if still unclear,
report both models' guidance as advisory rather than picking one. (Sources: Anthropic's
Prompting Claude Opus 5.5
and Effort pages.)
- Reasoning-extraction avoidance. Instructions that ask Claude to echo, transcribe, or explain
its internal reasoning as response text.
- Check skills/CLAUDE.md for "explain your reasoning", "show your work", or similar asked of the
response (not
thinkingblocks). This can trigger thereasoning_extractionrefusal category on Fable 5 and Opus 5.5 (new on Opus 5.5 relative to Opus 5). Fix: drop the instruction and read the reasoning from summarized thinking blocks instead. Server-side fallback does not retry areasoning_extractiondecline on either model — it comes back to the caller, so another model does not silently take over. actionwhen found — do not raise this check in4mode, or for a repo targeting Opus 5 (which lacks the category); the Anthropic pages don't document it for earlier models, so treat it as not applicable there rather than asserting it.
- Check skills/CLAUDE.md for "explain your reasoning", "show your work", or similar asked of the
response (not
- Effort-default guidance. Whether effort-level usage matches the target model's cost/latency
curve. The defaults differ by model:
- Fable 5 / 5.1: default
high;xhighfor the most capability-sensitive workloads;medium/lowfor routine work. - Opus 5: default
high, like Fable. - Opus 5.5: default
medium(Opus 5 defaults tohigh, so a carried-over setting runs a level off). Set effort explicitly, sweep levels against the repo's own evals, and reservexhigh/maxfor work with a measured quality gain. - Check for blanket
xhigh/maxon routine work, or no effort guidance at all on a repo doing capability-sensitive work, and for an Opus 5.5 repo that assumeshighis the default. advisory— these are tuning recommendations, not a correctness bug; do not raise this check in4mode, since Opus 4.8's effort/quality tradeoff differs. Judgement-heavy review gates (canon's own reviewer/evaluator) can legitimately stay athigh: the source itself says to test before lowering effort.
- Fable 5 / 5.1: default
Summary and verdict
Open the report with a Summary table — one row per lens:
| Lens | Status | Evidence | Recommendation |
Then an overall posture verdict:
| Verdict | Criteria |
| lean | No action lenses; at most minor advisory notes. Context is well right-sized. |
| trim | One or more action lenses, each with a concrete, scoped fix. Worth a cleanup pass. |
| overloaded | Multiple action lenses or a structural problem (large always-on context, several conflicts) needing a deliberate restructure. |
No numeric score. Any lens rated action forces at least trim.
Report
Print the Summary table inline. Then ask: Write claude-optimization.md to the repo root? (y to confirm).
Do not write without y. On confirmation, write claude-optimization.md at the repo root (overwrite
— it is a point-in-time snapshot, not a log):
context-doctor run: MM-DD-YYYY hh:mm
Audited against: Claude <4|5> context-engineering guidance (<detected from session | --model override>)
## Context optimization: <repo-name>
Scope: <artifacts inspected; which were absent>
| Lens | Status | Evidence | Recommendation |
|---|---|---|---|
| Rules → judgement | <status> | <file:line or quote> | <one-line fix> |
| Examples → interfaces | ... | ... | ... |
| Upfront → progressive disclosure | ... | ... | ... |
| Repeat → simple descriptions | ... | ... | ... |
| Memory: manual → durable | ... | ... | ... |
| Specs → rich references | ... | ... | ... |
| Conflicting instructions | ... | ... | ... |
| Checkpoint/pause discipline | ... | ... | ... |
| Progress-claim grounding | ... | ... | ... |
| Reasoning-extraction avoidance (5 only) | ... | ... | ... |
| Effort-default guidance (5 only) | ... | ... | ... |
Omit the last two rows entirely in `4` mode — don't print them as "n/a".
### Details
<one short paragraph per lens rated advisory/action, each with file:line evidence>
### Not inspected
- <artifact absent — why it was skipped>
context-doctor verdict: lean | trim | overloadedThe final context-doctor verdict: line is required.
Gotchas
- No context artifacts found? If the repo has no
CLAUDE.md/AGENTS.md/skills/agent config, say so and stop with a limited-scope note — do not invent findings. A repo with no agent context is a valid, clean result. - Durable memory is not clutter. A decision log or handoff file is deliberate cross-session memory, not the manual-bookkeeping the memory lens flags. Don't recommend deleting durable records.
- Don't over-apply "rules → judgement". Constraints that guard genuinely dangerous or irreversible actions (destructive commands, security boundaries, mandatory review gates) should stay explicit — the lesson is to relax advisory over-constraint, not safety-critical rules.
- No numeric score. If tempted to write "7/10" or a percentage, stop — use per-lens status plus the lean/trim/overloaded verdict.
- Optional canon companion. In a repo that uses canon,
context-checkgives a deeper always-on budget audit (line-by-line size/redundancy). context-doctor does not require it and never calls it — mention it only as a follow-up if present.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

