Help us improve
Share bugs, ideas, or general feedback.
From claude-agent-dev
Create, audit, refactor, or trim AGENTS.md, CLAUDE.md, GEMINI.md, and onboarding guides. Trigger on 'agent docs', 'instructions', 'onboard me', 'understand this repo', 'setup AGENTS.md', 'this file is too long', 'trim CLAUDE.md', 'improve agent instructions', 'add conventions', 'update instructions file', or when the user shares an existing AGENTS.md/CLAUDE.md and asks to improve, review, or clean it up.
npx claudepluginhub j0hanz/claude-agent-dev-pluginHow this skill is triggered — by the user, by Claude, or both
Slash command
/claude-agent-dev:agents-maintainerThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Produces a lean, high-signal `AGENTS.md` (and symlinked `CLAUDE.md`/`GEMINI.md`) grounded in the _actual_ project — package manager, scripts, layout, conventions — not generic boilerplate.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Guides systematic root-cause debugging when tests fail, builds break, or unexpected errors occur. Provides a structured triage checklist to preserve evidence, localize, and fix issues instead of guessing.
Share bugs, ideas, or general feedback.
Produces a lean, high-signal AGENTS.md (and symlinked CLAUDE.md/GEMINI.md) grounded in the actual project — package manager, scripts, layout, conventions — not generic boilerplate.
The file is read into every agent's context on every turn. Every line costs tokens and attention. Treat it like a hot config file, not human documentation.
This file runs in every agent context, every turn. Every token competes with the user's actual request. Design for a reader who is skimming at 200 words per second.
This is a three-phase process. Do not skip phases.
Resolving
<skill-dir>: Every script command below uses<skill-dir>as a placeholder for the absolute path to this skill's directory. In Claude Code, resolve it as$CLAUDE_PLUGIN_ROOT/skills/agents-maintaineror use the path returned by the skill loader. Example:python /home/user/.claude/skills/agents-maintainer/scripts/run.py analyze-env .
Use Express Mode only when ALL of the following are true:
If any condition is uncertain, run the full 3-phase workflow.
Express Mode steps:
AGENTS.md directly using the appropriate template.Do not skip Phase 1 and assume a stack without confirmation — AGENTS.md built on wrong assumptions silently misleads every agent that loads it.
Run these analysis subcommands against the project root to discover its structure, tooling, and conventions:
python <skill-dir>/scripts/run.py analyze-env .
python <skill-dir>/scripts/run.py find-dependencies .
python <skill-dir>/scripts/run.py scan-structure . --max-depth 2
Or run all three at once:
python <skill-dir>/scripts/run.py analyze-all . --max-depth 2
What each subcommand does:
run.py analyze-env [dir] — Detects package manager, test runner, linter, monorepo structurerun.py find-dependencies [dir] — Locates installed dependency directories with sizes (silent if none found)run.py scan-structure [dir] [--max-depth N] — Outputs directory tree while respecting .gitignore rulesrun.py analyze-all [dir] [--max-depth N] — Runs all three above sequentiallyIf a project signal is missing or ambiguous, ask the user before guessing. NEVER hallucinate test runners or linters.
If any command fails to run, fall back to manual inspection using these parallel checks:
package.json, go.mod, Cargo.toml, pyproject.toml, pom.xml, build.gradle, Gemfile, composer.json, mix.exs, pubspec.yamlnext.config.*, nuxt.config.*, angular.json, vite.config.*, django settings, flask app factory, fastapi main, rails configmain.*, index.*, app.*, server.*, cmd/, src/main/.eslintrc*, .prettierrc*, tsconfig.json, Makefile, Dockerfile, docker-compose*, .github/workflows/, CI configstests/, test/, __tests__/, *_test.go, *.spec.ts, *.test.js, pytest.ini, jest.config.*, vitest.config.*MANDATORY — READ ENTIRE FILE: references/phase-1.5-architecture.md — architecture pattern detection, tech stack extraction, and template selection decision tree. Do NOT skip this phase.
MANDATORY — READ Section 1 of references/guide.md before composing your draft.
You now have Phase 1.5 findings. Use the decision tree below to select the right template, then compose only the sections your project needs.
Use the template selected in Phase 1.5 (references/phase-1.5-architecture.md), then customize:
Core principles:
CONTRIBUTING.md for setup" beats restating setup. The agent will read the linked file if needed..venv"). This helps agents understand the workspace environment and avoid accidental deletion or re-installation..eslintrc says no console.log, that's the linter's job. Lint output will surface it.pnpm tsc --noEmit src/foo.ts is 10× cheaper than pnpm build. Always include the per-file versions when the toolchain supports them.docs/TESTING.md, docs/TYPESCRIPT.md). Root AGENTS.md references them with a one-liner: "For TypeScript conventions, see docs/TYPESCRIPT.md". Rules load only when relevant — other tasks pay no token cost.ls. Point at 2-3 critical files to read — not a directory listing.Validation happens in two passes: automated checks, then manual review.
Run this first:
python <skill-dir>/scripts/run.py lint-agents-md <path/to/AGENTS.md>
The linter checks:
Co-Authored-By: attribution presentIf linter fails: Fix issues and rerun. Don't proceed to Pass 2 until PASS.
After Pass 1 PASS — spawn the reviewer subagent (agents/reviewer.md):
Agent(
description: "Semantic quality review of AGENTS.md",
prompt: |
agents_md_path: [absolute path to the AGENTS.md file]
project_root: [project root directory, if available]
)
The agent scores the file on five semantic dimensions (signal density, convention specificity, command completeness, progressive disclosure, anti-pattern freedom) that the structural linter cannot catch. Review the returned improvement_suggestions sorted by priority. Address all high-priority suggestions before Pass 2. The strengths array confirms what to keep.
Even after linter PASS, work through this checklist manually:
CONTRIBUTING.md") actually exists in the repo.If any checklist item fails, go back to Phase 2 and refine.
MANDATORY — READ ENTIRE FILE: references/guide.md to finish wiring.
Use the wire-agents subcommand to wire AGENTS.md to agent-specific files. It attempts symlink first, then hardlink, then file copy:
python <skill-dir>/scripts/run.py wire-agents AGENTS.md CLAUDE.md GEMINI.md
As a final gut-check: would any section be embarrassing on a code review for being obvious or vague? If yes, cut it.
Every AGENTS.md MUST have these. Skip anything else unless it earns its place.
| Section | Rule |
|---|---|
| Top-Level Header | MUST begin with # Agent Instructions or # <ProjectName> Agent Instructions. |
| Project description | One sentence immediately following the header. Anchors every agent decision. No paragraphs. |
| Package manager + key commands | What to use and why if the reason is non-obvious (e.g., "npm install will break the lockfile"). |
| Dependency Locations | Document where dependencies are stored (e.g., node_modules, .venv) IF non-standard or relevant for agent environment setup/inspection. |
| File-scoped commands | Table of typecheck / lint / test commands targeting a single file. Omit rows the toolchain can't do. |
| Commit attribution | Co-Authored-By: trailer with the agent model's name and byline. |
| Key conventions | 3–7 bullets of project-specific patterns not enforced by linters (e.g., naming conventions, error handling styles, testing patterns). More than 7 is a documentation problem. |
See Section 1 of references/guide.md for formatted examples of each section.
The "Key conventions" section is critical because it captures what the linter can't enforce. Write them to be specific and actionable, not vague:
.handler.ts (e.g., login.handler.ts); utilities are generic"AppError in src/errors.ts; include statusCode and userMessage"pnpm migrate create --name feature for new migrations"async/await in routers and services; callbacks in middleware"@Autowired field injection)"docs/PATTERNS.md and link from AGENTS.mdFor each convention bullet, answer:
Example:
"API routes: HTTP validation and response formatting in handlers; business logic in services. Keeps concerns separate and makes services reusable."
*.handler.ts not *Handler.ts)MANDATORY — READ ENTIRE FILE: references/guide.md if you are refactoring an existing instructions file.
The most common failure modes and why they hurt are documented in references/guide.md. Read it once if you're refactoring an existing file — the patterns there are what you're cutting.
NEVER include the following in agent instructions:
DO load references/guide.md when the user shows you an existing bloated file and asks to trim or refactor it.
Do NOT load references/guide.md when drafting from scratch with clear project signals — the templates are sufficient.