mcpField
W
writing-a-good-agents-md

writing-a-good-agents-md

github.com/bseneAgent workflows7133 installsUpdated 1w ago
Repository

About writing-a-good-agents-md

A skill for writing, auditing, and improving AGENTS.md and related harness files. It treats AGENTS.md as onboarding for implementers and offers checks for concise structure, progressive disclosure, and avoiding duplicated instructions.

Key features

  1. 01Defines the purpose of AGENTS.md
  2. 02Provides an audit checklist and length guidance
  3. 03Separates shared guidance from harness adapters
  4. 04Encourages on-demand domain documentation
  5. 05Covers common structure and maintenance issues

Use cases

  1. 01Write an AGENTS.md for a project
  2. 02Audit and shorten existing agent guidance
  3. 03Organize shared instructions for multiple coding tools

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/bsene/skills --skill writing-a-good-agents-md

After installing, type/writing-a-good-agents-mdin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
anti-patterns-and-local-files.md
real-world-structure-patterns.md
six-principles-detailed.md
subagent-context-loading.md

Details

From the project README

Writing a Good AGENTS.md

Help users write, audit, and improve AGENTS.md — and the harness-specific files that sit alongside or import it.

Core Model

AGENTS.md is an onboarding document, not a configuration dump. It answers three questions:

  • WHY — purpose of the project and its components
  • WHAT — stack and structure the implementer needs to act, not an explorer's tour (see Sub-Agent Context Loading)
  • HOW — build, test, verify commands the agent runs

Everything else lives elsewhere: linter config, sub-documents, one-off instructions, and orientation material (README/ADR), which search agents find on their own.

Audit Checklist

CheckQuestion
UniversalityDoes every instruction apply to every task?
AudienceEvery line for a producer or judge agent, never an explorer?
LengthUnder ~150 lines? Ideally 50–100?
Linter workCode style rules a formatter could enforce instead?
Stale snippetsPasted code that could go stale? Use file:line refs
Instruction countApproaching 20–30+ discrete rules?
Auto-generatedRaw /init output (classic or interactive)? Rewrite from scratch, don't prune
Progressive disclosureDomain docs referenced, not inlined?
Hotfix accumulationOne-off workarounds instead of structure?
Duplication across toolsSame content pasted into CLAUDE.md/.cursorrules instead of imported?

Template: Minimal AGENTS.md

# Project Name

Brief description of what this project does and why it exists (2-3 sentences).

## Stack & Structure

- **Frontend**: [framework, location]
- **Backend**: [framework, location]
- **Shared packages**: [names and purpose]
- **Key config**: [important files/locations]

## Working on This Project

Build: `<command>`
Test: `<command>`
Typecheck: `<command>`
Lint: `<command>`

Always verify your changes compile and tests pass before considering a task done.

## Boundaries

- Never modify files in `<generated-dir>/`.
- Never commit `.env` or any file containing secrets.

## Git

- [Merge strategy, commit message format, branch naming]

## Reference Docs

Read these files when relevant to your current task — don't read all of them upfront:

| File                         | When to read                |
| ---------------------------- | --------------------------- |
| `agent_docs/architecture.md` | Understanding system design |
| `agent_docs/database.md`     | Working with data models    |
| `agent_docs/testing.md`      | Writing or running tests    |
| `agent_docs/deployment.md`   | Deploying or CI/CD work     |

No frontmatter, no required fields — plain Markdown by design, which is what makes it portable across harnesses.

Harness Adapters

AGENTS.md is the shared source of truth; harness files are thin adapters, never copies:

HarnessAdapter
Claude CodeCLAUDE.md whose first line imports it: @AGENTS.md
CursorShort .mdc rule referencing it; glob scoping only for Cursor-specific rules
Gemini CLIGEMINI.md — same relationship as CLAUDE.md
Codex, Windsurf, Zed, OpenCodeRead AGENTS.md natively; no adapter

Single tool → just write AGENTS.md. Multiple tools → adapters, never copy-paste: three copies guarantee drift.

Read On Demand

Read WhenFile
Principle details, research evidence, reasoningSix Principles Detailed
Who actually loads the file (Explore/Plan never do), audience splitSub-Agent Context Loading
Writing workflow, anti-pattern fixes, directory-scoped files, driftAnti-Patterns & Local Files
What real production AGENTS files look like (add-on sections)Real-World Structure Patterns

Benchmark

Scenario: .benchmarks/scenarios/writing-a-good-agents-md-001-consolidate.md · Run: 2026-08-31 · Log: .benchmarks/runs/2026-08-31/writing-a-good-agents-md-001-consolidate.json

ModelWithoutWithDelta
claude-opus-4-850%100%+50%
claude-sonnet-4-667%100%+33%
claude-haiku-4-583%100%+17%

PASS (run 2026-08-31). Gains on all models; consolidation criteria land. Gate per .agents/skills/skill-optimizer/rules/release-gates.md.

Comments

Markdown supported