Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi.
日本語の概要は準備中です。原文の説明を表示しています。
Use when a repo needs agent setup, AGENTS.md added or made lean, CLAUDE.md audited, or agent instructions scored or pruned. Not for remote, credential, publish, deploy, or irreversible changes.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
| Field | Bound contract |
|---|---|
| Trigger | User asks to set up a repo for agents, add AGENTS.md, audit CLAUDE.md, make a repo agent-friendly, score agent instructions, prune long/generic/stale instructions, or produce a lean pointer-only AGENTS.md |
| Authority | Reversible local: writes only AGENTS.md, CLAUDE.md (or a symlink to AGENTS.md when a target tool reads solely CLAUDE.md), CLAUDE.local.md, .claude/settings.json, .cursor/rules/*.mdc, Cursor hooks.json, and supporting instruction files after user confirmation; rollback is restoring the pre-edit snapshot. No remote mutation. |
| Side effect | Local write to agent instruction files in the repo; no remote, credential, paid, published, deployed, or VCS mutation |
| Done | Repo has working, scored, non-contradictory AGENTS.md for every target tool, plus a CLAUDE.md only when a target tool reads solely CLAUDE.md; every surviving line passes the three-check admission gate (non-discoverable, operationally significant, actionable); lean variants stay under 100 lines with pointer-only sections |
AGENTS.md files are execution contracts, not knowledge bases. Every line must help an agent execute correctly with minimal context. AGENTS.md is temporary guidance, not permanent configuration: when a recurring issue has a fixable root cause in code or tooling (a lint rule, test, script, or structural change), prefer that fix and keep only the minimum instruction needed until the root cause is solved.
Discover files and survey discoverability. Find every agent instruction file in the repo:
find . \( -name "AGENTS.md" -o -name "CLAUDE.md" -o -name "CLAUDE.local.md" \) 2>/dev/null | sort
Also check ~/.claude/CLAUDE.md (applies to every session). For monorepos, include workspace-level files. Audit each level independently: root holds universal rules, child files hold directory-specific rules. Then survey source files to learn what is already discoverable: README, PROJECT.md, cursor rules (.cursor/rules/ or .cursorrules), Copilot instructions (.github/copilot-instructions.md), GEMINI.md, CI/workflow files, package manager config, CONTRIBUTING.md, and docs/. Record what an agent can infer from these alone; anything discoverable need not be restated.
Choose a mode.
Setup: decide which files exist and which tool reads each.
AGENTS.md at the repo root is the source of truth. Claude Code, Codex, Cursor, Copilot, Gemini CLI, Aider, Windsurf, and Zed all read it natively. Every other agent file is a pointer or tool-specific supplement, never a second copy. Two copies of a rule drift silently because nothing in the codebase contradicts either one.CLAUDE.md -> AGENTS.md as a symlink only when a tool in use reads solely CLAUDE.md; a symlink keeps one source of truth where a copy would drift. Use .claude/settings.json for hooks and CLAUDE.local.md (gitignored) for personal overrides..cursor/rules/*.mdc only for rules needing Cursor glob scoping. Frontmatter is required; alwaysApply: true with empty globs duplicates AGENTS.md..gitignore: if agent config is ignored, decide per file whether it is personal (leave ignored) or repo knowledge (commit it). Do not put shared knowledge under .claude/; that path reads as Claude-only and is commonly gitignored.@import is Claude Code only. Codex and Cursor ignore @import lines without warning, so a rule behind an import is absent from most sessions while the file looks correct. Anything every tool must obey goes inline in AGENTS.md. Reserve @import for depth only Claude Code needs, never for safety, data-loss, or format-contract rules. @import chains stop resolving at 5 hops; deeper content silently disappears. @import lines do not evaluate inside code spans or fenced blocks..claude/settings.json, Cursor hooks.json). Tool-native hooks are the last rung because they cover one tool only. Move a prose rule down to an exit code whenever the check is mechanical, and delete the prose once the gate exists.Audit: score each root file independently. Exclude N/A checks from the denominator.
NEVER write comments becomes match the comment density of the file you are editing. Absolutes still earn their place for safety, data loss, format contracts, and rules agents have actually been observed to break.Refactor: for bloated, stale, or low-signal files. Bound scope before mutation: identify the target AGENTS.md path(s), the root file and any module-local variants the user named. Do not create or edit a file outside this set.
generic, duplicate, stale, moved (to a reference), reworded, or omitted (unverifiable: cannot be grounded in a file actually read; never speculate or fabricate). This log makes the final report traceable, and reworded keeps the safety re-check from treating a rewritten rule as lost content.reworded..agents/, docs/, workspace-level AGENTS.md in monorepos), then link from root with @import. Guidance needed in fewer than ~30% of tasks moves out of root. For large repos, prefer hierarchical module-local AGENTS.md files near relevant modules instead of one monolithic root file.pnpm exec vitest run <file> --reporter=dot), high-frequency failure modes with fixes, non-obvious conventions that change implementation choices, required environment/setup facts, and pointers to deeper docs on committed tool-neutral paths.Writing from scratch. Gather real commands from the manifest (package.json, Makefile, CI config). Use this skeleton, filled with verified commands and known gotchas:
# <Project name>
One-line description.
## Commands
- `<dev command>`
- `<test command>`
- `<targeted test command, quiet flags included>`
- `<build command>`
- `<lint/typecheck command>`
## Gotchas
- `<failure mode> -> <corrective action>`
## Conventions
- `<project-specific convention that changes implementation choices>`
## References
- @docs/architecture.md
- @.claude/testing.md
For monorepos, add a workspace map pointing to each workspace's own AGENTS.md. For multi-language monorepos, add per-language setup commands and cross-language boundary rules. Never ship a skeleton verbatim; a shipped placeholder is worse than no file. Prefer bullets over paragraphs. Keep root within 60–150 lines for typical active repos. 3–8 gotchas from real failures beat 20 hypothetical ones. When a convention has an exemplar in the repo, name the file path instead of describing the pattern in prose: code cannot be vague and cannot drift from itself.
docs/, .github/), write pointer-only sections: **Topic**: see <path-or-url>, one pointer per line, never restate policy. Keep the total file at or under 100 lines; prefer bullet tables over prose. Add a commit attribution line at the bottom: <!-- commit: <owner or "agent"> -->. If no conventions are found, scaffold a minimal file with a placeholder attribution line and no convention sections; do not fabricate conventions.Propose minimal diffs. In priority order:
@import or to child files.Validate changes.
dev, test, build, lint/typecheck) where the environment allows; otherwise verify the script exists in the manifest and note the limitation. A passing quick score does not prove commands run; stale commands hide behind checklist passes.@imported path resolves.Apply and report. Apply approved edits, re-score with the same checklist, report before/after scores and line counts. Per future PR, add at most one new gotcha, only if it prevented or fixed a real mistake. Prune stale instructions aggressively: the file shrinks over time as root causes get fixed in code or tooling.
@import lines do not evaluate inside code spans or fenced blocks: a real import wrapped in backticks silently never loads, while example imports inside fences are safe to show.@import reaches Claude Code only. Codex and Cursor ignore import lines without warning, so in a multi-tool repo an imported safety or format rule is absent from most sessions while the file still looks correct.@import chains stop resolving at 5 hops; deeper content silently disappears from context.~/.claude/CLAUDE.md; it loads every session, so one repository's development command becomes noise or a wrong command everywhere else.CLAUDE.local.md as strictly as AGENTS.md; it is gitignored personal config. Flag only broken commands and contradictions with the shared file.generic that was a safety, migration, release, or incident rule. Restore it immediately.<!-- commit: agent --> and no convention sections; do not fabricate conventions.generic, duplicate, stale, moved, reworded, omitted) and a before/after summary table, plus an omission list of unverifiable candidates so the user can see what was cut and why.まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi.
日本語の概要は準備中です。原文の説明を表示しています。
Use when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal.
日本語の概要は準備中です。原文の説明を表示しています。
Use when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.
日本語の概要は準備中です。原文の説明を表示しています。
Use when a completed session needs an agent-environment retrospective. Not for an engineering retrospective from telemetry: use engineering-retrospective.
日本語の概要は準備中です。原文の説明を表示しています。
Use when a redacted, trimmed agent transcript must be appended to a GitHub PR or issue body, with human approval and preview. Not for automated or model-initiated insertion.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user describes an AI workflow gap or uses an ambiguous cross-session reference such as 'the PR Bob mentioned'. Not for tasks that require source or remote-system changes.
日本語の概要は準備中です。原文の説明を表示しています。