From add
Generates or syncs a portable AGENTS.md file from ADD project state. Supports write, drift-check, merge with hand-curated content, and dry-run modes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/add:agents-md [--write|--check|--merge|--import] [--dry-run][--write|--check|--merge|--import] [--dry-run]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate a portable [`AGENTS.md`](https://agents.md) at project root from the project's `.add/` state. `AGENTS.md` is the cross-tool open standard for project-level agent instructions — any agent (Claude Code, Cursor, Codex CLI, Windsurf, Amp, Devin, Copilot) will read it on session start. Publishing one lets mixed-toolchain teams respect the same invariants without installing ADD.
Generate a portable AGENTS.md at project root from the project's .add/ state. AGENTS.md is the cross-tool open standard for project-level agent instructions — any agent (Claude Code, Cursor, Codex CLI, Windsurf, Amp, Devin, Copilot) will read it on session start. Publishing one lets mixed-toolchain teams respect the same invariants without installing ADD.
This skill is the only way to regenerate AGENTS.md. A PostToolUse hook marks the file stale when source inputs change — the human triggers the actual regeneration.
/add:agents-md # default: --write
/add:agents-md --check # drift detection, CI-friendly (exit 1 on drift)
/add:agents-md --merge # prepend ADD block to an existing hand-curated AGENTS.md
/add:agents-md --import # one-time absorption (same as --merge; explicit intent)
/add:agents-md --dry-run # preview without writing (combines with any mode)
Read .add/config.json
project.name, project.descriptionmaturity.level (poc | alpha | beta | ga)architecture.languages — determines whether the TDD Discipline section appliesenvironments.*.autoPromote — determines the autonomy ceiling summaryRead docs/prd.md if present
project.description from configRead .add/handoff.md if present
specs/*.md match in the file)specs/*.md by mtimeCheck .add/agents-md.stale
--writeDetect existing AGENTS.md
--write creates it fresh--write replaces managed content, preserves user-authored content outside the markers--write aborts with guidance to use --merge or --import+++) at top is preserved verbatimThe skill delegates to scripts/generate-agents-md.py:
python3 scripts/generate-agents-md.py # --write (default)
python3 scripts/generate-agents-md.py --check
python3 scripts/generate-agents-md.py --merge
python3 scripts/generate-agents-md.py --import
python3 scripts/generate-agents-md.py --dry-run
The script is deterministic given the same inputs plus --generated and --skill-version overrides (used by fixture tests for reproducibility). Normal invocation stamps the current UTC timestamp and reads the skill version from core/VERSION.
<!-- ADD:MANAGED:START version=0.9.0 maturity=beta generated=2026-04-22T14:32:01Z -->
... ADD-owned content ...
<!-- ADD:MANAGED:END -->
--check can short-circuit on metadata mismatch before full diffUser-authored content lives outside these markers and is never touched by regeneration. --merge wraps existing content in <!-- USER:AUTHORED:START --> / <!-- USER:AUTHORED:END --> below the ADD block for clarity.
The generator selects a rendering branch based on maturity.level:
| Maturity | Sections | Target |
|---|---|---|
poc | Project identity, 3–5 critical rules as bullets, pointers | <500 tokens |
alpha | Identity, Engagement Protocol, Spec-First Invariants, pointers | <1K tokens |
beta | All Alpha sections + TDD Discipline (when applicable), Maturity & Autonomy Ceiling, Currently Active Spec | <2K tokens |
ga | All Beta sections + Team Conventions, Environment Promotion Ladder | <2.5K tokens |
TDD Discipline is omitted when architecture.languages contains only Markdown / JSON / YAML / TOML — the project is documentation-only, strict TDD does not apply.
--write (default)AGENTS.md..add/agents-md.stale if present.--checkAGENTS.md.Designed for CI: python3 scripts/generate-agents-md.py --check can gate builds.
--mergeUsed when the project already has a hand-curated AGENTS.md without ADD markers.
<!-- USER:AUTHORED:START --> / <!-- USER:AUTHORED:END -->.Future --write regenerations only touch content between the ADD markers. User-authored content is preserved forever.
--importAlias for --merge with explicit "one-time migration" intent. Identical behavior; separate flag for documentation and audit clarity.
--dry-runCombines with any mode. Prints the output to stdout without touching disk.
A PostToolUse hook (see runtimes/claude/hooks/post-write.sh) writes .add/agents-md.stale when any of these source files changes and AGENTS.md exists:
.add/config.jsoncore/rules/*.md (ADD-managed projects)core/skills/*/SKILL.md (ADD-managed projects)Marker contents:
{
"timestamp": "2026-04-22T14:32:01Z",
"changed": ["core/rules/tdd-enforcement.md"]
}
The hook does not rewrite AGENTS.md. The next /add:agents-md invocation announces the stale state, lists the changed sources, then regenerates when the human runs --write.
/add:init — calls /add:agents-md at the end of the init flow to write the initial AGENTS.md./add:spec — after a new spec becomes the "spec under work", prompts: "Update AGENTS.md active-spec pointer? (Y/n)". On yes, runs /add:agents-md --write./add:verify — opt-in Gate 4.5: if agentsMd.gateOnVerify: true is set in .add/config.json, /add:verify runs --check and fails the gate on drift. Off by default./add:promote — maturity bumps recommend a regen (since the verbosity level changes) but do not auto-rewrite.{
"agentsMd": {
"gateOnVerify": false,
"autoInitOnPromote": false
}
}
Both keys are optional. If absent, defaults apply (gate off, no auto-init).
| Case | Behavior |
|---|---|
No AGENTS.md exists | --write creates it fresh; no merge prompt needed |
| File with marker block | --write regenerates only the ADD section |
| File without marker block | --write aborts with exit 2 and a directive to use --merge |
| Frontmatter present | Preserved verbatim; ADD block is placed after it |
| No PRD | project.description from config is used as project identity |
Maturity poc + no rules | Minimal identity-only output; 5 critical rules baked into the skill |
| Markdown/JSON-only project | TDD Discipline section omitted |
| Multiple specs | Most recently mutated wins; others not listed in v0.9.0 |
| Marker partially deleted | Treated as missing; --merge required to recover |
| User edits inside ADD block | Overwritten on next --write; --check warns about this |
| Hook fires mid-task | .add/agents-md.stale write is atomic; no race |
.add/agents-md.stale exists but file is in sync | Regen is idempotent; marker cleared |
| Nested per-subdirectory AGENTS.md | Out of scope for v0.9.0; single root file only |
After a successful --write:
Wrote AGENTS.md
Maturity: alpha
Sections rendered: Identity, Engagement Protocol, Spec-First Invariants, Pointers
Marker block: ADD:MANAGED (version=0.9.0, generated=2026-04-22T14:32:01Z)
Staleness marker: cleared
After --check drift:
AGENTS.md drift detected.
--- AGENTS.md (current)
+++ AGENTS.md (would-be)
@@ ... @@
...unified diff...
Run /add:agents-md --write to regenerate.
Exit code: 1
After completing this skill, do BOTH:
Append one observation line to .add/observations.md:
{YYYY-MM-DD HH:MM} | agents-md | {mode} | {write|check|merge|import} | {notes}
If .add/observations.md does not exist, create it with a # Process Observations header first.
Write a structured JSON learning entry per the checkpoint trigger in rules/learning.md if the session surfaced anything that should persist (e.g., AGENTS.md marker convention, rules summary gaps, first-time merge workflow friction). Classify scope, write to the appropriate JSON file, and regenerate the markdown view.
npx claudepluginhub mountainunicorn/add --plugin addGenerates and maintains AGENTS.md files for AI agents by detecting project structure, extracting commands, CI rules, and architecture boundaries. Useful for onboarding agents and standardizing documentation.
Generates or updates standardized AGENTS.md contributor guides for AI agents. Supports single-repo and monorepo structures, with dynamic character limits based on LOC. Use when setting up a new repo, onboarding agents, or refreshing after meaningful changes.
Creates and maintains minimal AGENTS.md/CLAUDE.md files using research-backed best practices for concise, high-signal agent documentation under 60 lines.