write-agents-md

Writes and maintains hierarchical AGENTS.md intent-node files with word budgets and sync workflows.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/brandhaug/skills --skill write-agents-md-brandhaug
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: write-agents-md
Source: https://github.com/brandhaug/skills/tree/main/write-agents-md
Command: npx skills add https://github.com/brandhaug/skills --skill write-agents-md-brandhaug

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agent context files like AGENTS.md and CLAUDE.md tend to bloat, drift out of sync with the code, and duplicate facts across directories, which wastes context tokens and misleads coding agents. This Skill builds and maintains a hierarchy of small, dense intent nodes at semantic boundaries so agents inherit only the architectural context they need. ## Core Features & Use Cases - Build workflow: Captures intent nodes leaf-first at semantic boundaries, interviews the user for hidden invariants, then summarizes bottom-up into parent nodes with deduplication at the least common ancestor. - Sync workflow: Reconciles existing nodes against a git diff, proposing additions, modifications, and removals with per-change reasons instead of append-only updates. - Hard word budgets: Enforces per-node word ceilings (300–750 words depending on node kind) with a dedicated cut-to-budget phase, a delete-on-sight list, and a six-section intent node schema. - Use Case: After a large refactor, run the sync workflow to re-audit every affected AGENTS.md node, verify symbols and paths with grep, and prune stale rules before merging. ## Quick Start Ask the agent to run the write-agents-md build workflow on your repository to generate a hierarchy of AGENTS.md intent nodes, or run the sync workflow to reconcile existing nodes with recent code changes.

Frequently Asked Questions about write-agents-md

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create AGENTS.md files for my repository?▼

Run the build workflow, which chunks the repo at semantic boundaries, drafts leaf nodes first, interviews you for hidden invariants, then summarizes parents bottom-up. Each node follows a six-section schema and a hard word budget checked with wc -w.

How do I keep CLAUDE.md or AGENTS.md files in sync with code changes?▼

Use the sync workflow, which diffs against a git ref, maps changed files to their nearest ancestor nodes, audits existing content for stale references, and proposes additions, modifications, and removals with one-line reasons per removal.

What should an AGENTS.md file contain for AI coding agents?▼

A node should hold cross-file invariants, never/always rules, landmines, and pointers to ADRs or child nodes. It should exclude greppable facts like export lists, restated code, README prose, and numbers that go stale.

Should I use AGENTS.md or CLAUDE.md as the filename?▼

The skill detects the existing convention: if CLAUDE.md files already exist it uses CLAUDE.md, if AGENTS.md exists it uses AGENTS.md, and otherwise it defaults to AGENTS.md.

What are the limitations of the sync workflow?▼

Sync is designed for merge or post-commit points, not on every save. It requires a meaningful git diff, and when uncertain about a removal it leaves a TODO(intent) marker rather than silently deleting potentially load-bearing context.