tune-agent-docs
Reviews every markdown file in a repository that steers an AI coding agent as one corpus, then tightens them. The corpus covers CLAUDE.md, AGENTS.md, GEMINI.md, `.cursor/rules/*.mdc`, `.clinerules`, `.windsurfrules`, `.github/copilot-instructions.md`, Kiro `.kiro/steering/*.md`, and files like them. Use when the user wants to audit, tune, reconcile, or clean up the instructions a repo gives its AI agents, or asks why an agent keeps missing, contradicting, or burning tokens on its own steering docs. Use it even when the user names one file, because the value comes from reading that file next to its neighbors. Checks terminology consistency, front-loaded directives, the size of each doc against the stated limit of its format, always-loaded content the harness can scope, duplicated guidance, no-op instructions, and the degrees of freedom of each instruction. For one `SKILL.md` on its own, use review-skill instead.
- License 许可
- MIT
- 最近更新
- 2026-11-06
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- tune-agent-docs
- description
- Reviews every markdown file in a repository that steers an AI coding agent as one corpus, then tightens them. The corpus covers CLAUDE.md, AGENTS.md, GEMINI.md, `.cursor/rules/*.mdc`, `.clinerules`, `.windsurfrules`, `.github/copilot-instructions.md`, Kiro `.kiro/steering/*.md`, and files like them. Use when the user wants to audit, tune, reconcile, or clean up the instructions a repo gives its AI agents, or asks why an agent keeps missing, contradicting, or burning tokens on its own steering docs. Use it even when the user names one file, because the value comes from reading that file next to its neighbors. Checks terminology consistency, front-loaded directives, the size of each doc against the stated limit of its format, always-loaded content the harness can scope, duplicated guidance, no-op instructions, and the degrees of freedom of each instruction. For one `SKILL.md` on its own, use review-skill instead.
- allowed-tools
- [ "Read", "Glob", "Grep", "Edit", "Write", "AskUserQuestion" ]
- argument-hint
- [path or glob, optional. Defaults to the whole repo]
02 资源文件 1
- 参考文档references/steering-formats.md7.8 KB
03 SKILL.md 正文
Tune Agent Docs
Whatever agent starts work in a repo reads that repo's AI-steering docs, and often loads several of them into one context window. A root CLAUDE.md is rarely the only text an agent takes as instruction. The agent pays a silent tax on every run when these docs disagree. It pays the same tax when they use different words for one thing, bury their point, or demand more rigor than the task needs. This skill treats every steering doc in the repo as one corpus.
Work in two phases: critique first, edit second. Build the full picture, present the findings, and only then touch a file.
Find the corpus
Use Glob for the conventions that a harness recognizes today. Read references/steering-formats.md for the current list, and for the frontmatter and inclusion rules of each format. The conventions start with CLAUDE.md and CLAUDE.local.md, including nested per-directory copies and .claude/rules/**/*.md. They continue with AGENTS.md, GEMINI.md, .cursor/rules/**/*.mdc, and .cursorrules. They finish with .clinerules or .clinerules/**/*.md, .windsurfrules or .windsurf/rules/**/*.md, .devin/rules/**/*.md, .github/copilot-instructions.md, .github/instructions/**/*.instructions.md, and .kiro/steering/**/*.md. Where a harness has a local or gitignored variant, include it next to its checked-in counterpart. That pair is a common duplication site, so include both files.
Then follow every pointer that a doc in the corpus makes to another markdown file. A pointer is a "See docs/x.md for..." link, an @import, or a relative link in a "Where things are" or "further reading" section. A steering doc that tells the agent to consult another file delegates its steering to that file, whether or not the target matches a convention. Pull the target in without asking, because the pointer is the corpus doc that vouches for it.
Then sweep the remaining .md files in the repo. Look for files that read as agent-directed but match no known convention and no pointer. The signs are imperative language addressed to "you", "the agent", or "Claude", and frontmatter with an inclusion-like key. List every candidate that this sweep finds. Put the full list to the user with AskUserQuestion before you fold any of it in. Do not shorten the list to the files you are unsure about and read the rest in silence. The user decides the scope. An unfamiliar file that turns out to be a changelog or a design doc must not get graded as steering prose.
Read every file in the corpus in full, including every file that a pointer pulled in. A line count or a partial skim is not a read, because the findings live in how these docs relate to each other.
Load the lenses
- The standards: find the authoring conventions that govern this corpus. Look for a
CLAUDE.md, aCONTRIBUTING.md, a docs style guide, a skill-authoring style guide, or an equivalent file. Apply them to every doc in the corpus, not only to the docs they were written for. A repo that holds itsSKILL.mdfiles to a standard holds itsAGENTS.mdto the same one. A convention the repo settled is settled, so do not raise it as a finding. Take the conventions only from the repo under review. Another repo'sCLAUDE.mdthat sits in your context governs its own scope, and so do the user's global conventions. - Cross-harness format knowledge:
references/steering-formats.mdholds the frontmatter fields, the inclusion or scoping mechanism, and the size guidance for each recognized format, taken from the documentation of each vendor. It also holds format-agnostic principles from Anthropic's Skill authoring guidance. Read it once per review. These formats change, so never rebuild the list from memory.
What to check
- Token budget: this is the largest lever a steering doc has over what an agent pays before it does real work, so check it first. Compare the length of each doc against the ceiling of its own format in
references/steering-formats.md. The ceiling is 200 lines forCLAUDE.md, 500 lines forSKILL.md, and a per-character cap for Windsurf. A doc under its ceiling is a starting point, not a pass. Length costs tokens whatever its cause, so every line in a short doc still owes a justification against the checks below. Then find content that loads unconditionally throughalwaysApply: true,inclusion: always, or an unscoped.claude/rules/*.md, and that matters for one file type or directory alone. Such content belongs in the conditional-loading mechanism of the harness. A doc split into Claude Code@importstatements is easier to navigate but the same size, because imports still load in full. Never count that split as a token-budget fix. - Duplication: one meaning, one home. Compare guidance by what it means, not by string match. Two docs that say one thing in different words duplicate it as fully as two that say it word for word. Paraphrase is the common case, because different hands wrote the docs at different times. The same defect runs inside a single doc, where one rule restated three sections apart reads as three rules. Compare each checked-in doc against its local counterpart. Duplication pays its token cost twice today, and it becomes a contradiction the day one copy gets edited. Prefer one canonical doc plus a pointer or an import over a second copy. Put the surviving copy at the narrowest scope that still covers everywhere the guidance applies. Where a restatement is one idea circled three times, the repair is often a single word that the model already carries priors for. Repeat that word as a term instead of re-explaining the idea in a sentence.
- No-ops: an instruction the model already follows by default changes nothing and still costs context every session. Examples are "write clean code", "follow best practices", "be careful when editing files", and "think before you change things". Steering docs collect these because adding a line feels free. Test each sentence on its own against one question: does an agent that never saw this doc behave differently? Judge sentence by sentence, not section by section, because a live section carries dead sentences. When a sentence fails the test, delete the sentence. Do not rewrite it tighter. A reworded no-op is still a no-op, and the reach for a rewrite is what leaves these docs long. Cut hard here. This is usually the largest single cut available.
- Structural fit per harness: once a token-budget or leanness finding calls for a split or a narrower scope, judge the fix against what the format itself supports, per
references/steering-formats.md. The available mechanisms are a nestedCLAUDE.md, a glob-scoped.mdcrule, and a KirofileMatchsteering file. Where the harness has no such mechanism, report the size as a leanness finding instead of recommending a mechanism the harness cannot use. Also flag content that is a multi-step procedure rather than a standing fact. An always-loaded doc holds what is true every session. A workflow belongs in a skill that loads on demand, or in a path-scoped rule. - Consistent terminology: across the whole corpus, one role, tool, or convention carries one name. Hunt synonym drift, such as
the agentagainstClaudeagainstthe assistant,skillagainstcapabilityagainstworkflow, andworktreeagainstworkspace. A term used two ways inside one doc is the same defect at a smaller scale. - Front-loading: each instruction must open on its actionable verb or keyword, with no throat-clearing in front of it. This check reaches past
descriptionfields. A bullet, a header, or a frontmatterdescriptionthat leads with context before the directive makes a skimming agent miss the point. It also weakens the retrieval match of the harness. Keep this check separate from the leading word in the Leitwort sense, which is a compact pretrained concept that the agent thinks with. That belongs to the duplication repair above. - Degrees of freedom: match the specificity of each instruction to how fragile the thing it governs is. An exact, low-freedom script constrains an agent that needs to reason about a judgment call. Loose, high-freedom prose invites improvisation around an exact operation that must run in order.
- Negation: a prohibition names the banned behavior into the agent's context, where it competes with the ban. A doc built from
never,do not, andMUST NOTwalls must state the behavior it wants instead. Keep a prohibition for a guardrail that has no positive phrasing, and pair even that one with what to do in its place. - Leanness and staleness: cut what the agent can derive by reading the codebase itself, such as directory layouts, dependency lists, and architecture overviews. Keep what it cannot derive, such as pitfalls, rationale, and conventions that differ from the defaults of the tool. This cut differs from the no-op check: a derivable fact is true but free to look up, and a no-op is behavior the model already has. Flag time-boxed conditionals such as "until the migration finishes, do X", because they go stale in silence. A dated fold or an old-patterns section ages better than a conditional that still sounds live.
- Frontmatter validity: check the frontmatter of each doc against the real schema of its format. Three examples of a violation follow. The first is a Kiro
inclusionvalue outsidealways,fileMatch, andmanual. The second is a Cursor.mdcfile that omits the field its activation mode depends on. The third is aSKILL.mdnamethat breaks the character or charset limit.
Resolve conflicts by scope, not by asking
When two docs give contradictory guidance for one thing, resolve it the way these harnesses layer context at runtime. The doc scoped to the narrower area wins for the area it covers, over a repo-wide doc that always loads. A narrower doc is a nested CLAUDE.md, a rule scoped by fileMatch or paths, or a glob-scoped .mdc file. Fall back to AskUserQuestion only when both sides sit at the same scope and precedence gives no signal. That case is a real tie, not a shortcut around judgment.
Present findings, then apply
Open with a one-line verdict. Then list the findings ranked by severity, not grouped by check:
- Blocking: an active contradiction between docs, an instruction that will make the agent do the wrong thing, or a doc past a hard format limit. Past a hard limit, such as a Windsurf character cap, the tail is truncated in silence and never loads.
- Important: terminology drift, a buried directive, or a no-op instruction. It also covers an oversized or always-loaded doc that its harness can scope, and one meaning kept in two places or restated inside one doc. It covers a prohibition wall with no positive target, miscalibrated degrees of freedom, and a convention violation.
- Nit: cosmetic polish.
Tag each finding with its dimension, its exact file, and its line. Then offer to apply the findings. Offer three choices: every blocking and important finding, everything, or a subset the user picks. Edit the files directly. A terminology fix or a front-loading fix must land in every occurrence in every file of the corpus. A partial rename leaves the corpus less consistent than before.
Before you finish
Re-read the diff as a skeptical teammate, and look for these six errors:
- A rename that missed a nested
CLAUDE.mdor a nested rule file. - A degrees-of-freedom fix that overcorrected into the opposite miscalibration.
- A "contradiction" that was two docs correctly scoped to different areas, now wrongly collapsed into one.
- A scoping fix that narrowed the
paths,globs, orfileMatchPatternof a rule past the areas that need it. The agent then stops seeing guidance it relies on. - A no-op that got reworded instead of deleted, so the finding was reported and the line survived.
- A paraphrase collapsed onto the broader of the two docs, so the surviving copy now applies where the guidance never did.
04 同仓库更多 Skills
work-item
Drafts a well-formed work item with testable acceptance criteria, then creates it in whatever tracker is connected, when the user asks for that explicitly. Applies the same standard to tighten an existing work item. Use when the user invokes /work-item, or asks to draft, write up, create, or fix up a ticket, issue, task, story, bug report, or sub-task, for Jira, GitHub, Azure DevOps, Linear, or any other tracker. Use it even when the user names no tracker and never says "ticket", as in "log a bug for...", "file an issue about...", "write up a task for...", "can you create a story for...", and "this ticket has no acceptance criteria, can you add some". Do NOT use it for general prose writing, a PR description, or a commit message, because those follow different conventions.
triage-work-item
Triages a tracker work item, which is a bug, a task, or a story, end-to-end against the codebase. It reads the item with its full comment thread, links, and parent epic, cross-references related items, investigates the codebases behind the affected feature, corroborates with attached evidence and observability data, then posts a verified analysis comment back to the item. That comment gives the root cause for a bug, or the current behavior, the approach, and the effort for a change request. Ships with Jira and GitHub Issues tracker adapters, plus Grafana and CloudWatch observability adapters, and degrades to any reachable platform. Use when the user gives a work-item URL or key, on Jira (`…atlassian.net/browse/KEY`) or GitHub (`github.com/<o>/<r>/issues/<n>`), and asks to triage, investigate, diagnose, or root-cause it, even without the word "triage", as in "look into TICKET-123 and post what you find". Do not use it to read or summarize a work item with no code investigation, or to write new work items.
update-branch
Brings a branch up to date with its base branch, usually main. It rebases onto origin/<base>, or merges when the user agrees, then builds and runs the relevant tests. It pushes on its own when the risk is low, and asks first, with the reason, when it is not. It never uses a plain --force, and it never disturbs uncommitted work: a clone on another branch gets a separate git worktree. This skill is user-only: it runs only when the user invokes /update-branch [branch] [--base <branch>] [merge]. When the user wants to update a branch with main, rebase onto main, or fix "branch is behind main", suggest this command.
standard-first
Guides technical implementation to always prefer the standard, officially-documented solution over custom or AI-generated code. Use when you are about to write new code for a feature, suggest or add a library or package, scaffold a new project, or configure a framework, in any language, including .NET and C#, Node.js and npm, Python, Go, Java, and the rest. Use it above all when the problem sounds like something that a built-in framework feature or a package registry already solves, such as logging enrichment, auth, serialization, retries, health checks, or migrations. Do not skip this skill because the answer feels obvious from training data.
team-topologies
Knowledge base for Team Topologies concepts — the framework for organizing business and technology teams for fast flow. Use this skill whenever the user asks about: team types (stream-aligned, platform, enabling, complicated subsystem), team interaction modes (collaboration, X-as-a-Service, facilitation), cognitive load management, Thinnest Viable Platform (TVP), Conway's Law in relation to org design, or any question about how software delivery teams should be structured, named, or coordinated. Also use when another skill needs Team Topologies vocabulary to reason about org design, team responsibilities, or team dependencies.
pareto
Processes the user's request through the Pareto Principle. It ranks the causes that generate most of the outcome, spends roughly a fifth of the effort on the interventions that address them, and reports what that effort bought. This skill is user-only: it runs only when the user invokes /pareto [request]. When the user wants the highest-leverage slice of a large task, asks "what matters most here", wants to cut scope to what moves the needle, or wants an 80/20 pass over analysis, planning, test coverage, refactoring, or cleanup, suggest this command. Do not use it for work whose value depends on being complete, such as a security fix, a compliance change, a migration, or a specific reported bug.