write-agents-files
Use when setting up or improving agent instructions in AGENTS.md, CLAUDE.md or other coding agents instructions files.
What this skill does
# Writing Effective AGENTS.md Files
Create and maintain effective AGENTS.md files following best practices.
Keep instructions brief, unlock agentic loops, document gotchas, and reference task-specific files.
## Table of Contents
- [Core Principle: Map, Not Manual](#core-principle-map-not-manual)
- [Common Sections in AGENTS.md](#common-sections-in-agentsmd)
- [Instructions](#instructions)
- [1. Understand Context](#1-understand-context)
- [2. Draft Core Instructions](#2-draft-core-instructions)
- [3. Add Agentic Loop Tools](#3-add-agentic-loop-tools)
- [4. Create Gotchas Section](#4-create-gotchas-section)
- [5. Reference Task-Specific Files](#5-reference-task-specific-files)
- [6. Validate Against Best Practices](#6-validate-against-best-practices)
- [Best Practices](#best-practices)
- [Examples](#examples)
- [Requirements](#requirements)
- [See Also](#see-also)
## Core Principle: Map, Not Manual
Use **progressive disclosure**: the main AGENTS.md is a small, stable entry point that tells the agent where to look next.
Treat the file as a **table of contents**, not an encyclopedia:
- **Context is scarce**: long instruction blobs crowd out the task and the code.
- **Too much guidance becomes non-guidance**: when everything is "important", the agent pattern-matches instead of navigating.
- **Monoliths rot**: big manuals get stale quickly and humans stop maintaining them.
- **Hard to verify**: blobs are difficult to lint for freshness, ownership, and cross-links.
Practical rule of thumb:
- Keep the main AGENTS.md around ~100 lines.
- Put deeper sources of truth in dedicated files (often a structured `docs/` directory) and link to them from AGENTS.md.
Example in-repo knowledge store layout (adapt as needed):
```text
AGENTS.md
ARCHITECTURE.md
docs/
├── design-docs/
│ └── index.md
├── product-specs/
│ └── index.md
├── exec-plans/
│ ├── active/
│ └── completed/
└── references/
└── topic-llms.txt
```
## Common Sections in AGENTS.md
Based on OpenAI best practices, effective AGENTS.md files typically include these common sections:
1. **Project overview and structure** - Brief description and key directories
2. **Build and test commands** - Concrete verification commands
3. **Helpful CLI tools and MCP servers** - Tools and servers the agent can use
4. **Workflow for implementing a feature** - Step-by-step feature implementation
5. **Pointers to task-specific guidance** - Links to specialized documentation
## Instructions
### 1. Understand Context
Before creating or updating an AGENTS.md file:
**Gather information:**
- Ask the user about their project type (web app, CLI tool, library, etc.)
- Identify key workflows (testing, building, deploying)
- Determine what tools the agent should use (linters, test runners, formatters)
- Understand common mistakes or gotchas in their codebase
**Read existing context:**
- Check for existing AGENTS.md, README.md, or CONTRIBUTING.md files
- Scan recent commit messages for patterns
- Review test and build scripts
### 2. Draft Core Instructions
**Keep it brief and focused:**
- Target: Under 100 lines for main AGENTS.md (most OpenAI AGENTS.md files are under 100 lines)
- Use clear, imperative language (verb-first)
- Focus on WHAT and WHY, not HOW (agents are smart enough)
- Avoid over-explaining concepts the agent already knows
- Prefer **progressive disclosure**: keep the top-level file scannable and link to deeper guidance.
**Structure:**
````markdown
# Project Name
Brief 1-2 sentence project description.
## Project Overview
Brief description of the project purpose and scope.
## Repository Structure
Key directories and files:
- `src/` - Source code
- `tests/` - Test files
- `docs/` - Documentation
- `config/` - Configuration files
## Build
Commands to build the project:
```bash
npm run build
```
## Testing
Commands to run tests:
```bash
npm test
```
## Helpful Tools (CLI + MCP)
Tools and servers the agent can use:
- **CLI tools**
- Linter: `npm run lint`
- Type checker: `npm run typecheck`
- Test runner: `npm test`
- Build tool: `npm run build`
- **MCP servers**
- List the MCP servers available in your environment
- Include what each is for and when to use it
## Feature Workflow
Step-by-step feature implementation:
1. Identify entry points and relevant files
2. Make a small plan (if non-trivial)
3. Implement and update/add tests
4. Run verification commands
5. Update gotchas/docs if new pitfalls discovered
6. Summarize changes and remaining risks
## Gotchas Codex
[See Gotchas section below]
## Detailed Guidelines
For specific workflows, see:
- **Architecture**: [ARCHITECTURE.md](./ARCHITECTURE.md)
- **API Design**: [API.md](./API.md)
- **Testing**: [TESTING.md](./TESTING.md)
````
**Example brief instruction:**
````markdown
## Testing
Run the full test suite before committing:
```bash
npm test
```
Fix any failing tests immediately. Do not commit failing tests.
````
### 3. Add Agentic Loop Tools
**Unlock agentic loops** by explicitly listing tools the agent can call to verify its own work.
**Common verification tools:**
- **Linters**: ESLint, Pylint, Ruff, Clippy
- **Formatters**: Prettier, Black, rustfmt
- **Type checkers**: TypeScript, mypy, pyright
- **Test runners**: Jest, pytest, cargo test
- **Build tools**: npm run build, cargo build, make
- **Git hooks**: pre-commit, husky
**Template:**
````markdown
## Build
Commands to build the project:
```bash
npm run build
```
## Testing
Commands to run tests:
```bash
npm test
```
## Helpful Tools (CLI + MCP)
Tools and servers the agent can use:
- **CLI tools**
- Linter: `npm run lint` - Check code style and catch errors
- Type checker: `npm run typecheck` - Verify type safety
- Tests: `npm test` - Run full test suite
- Build: `npm run build` - Ensure production build succeeds
- **MCP servers**
- List the MCP servers available in your environment
- Include what each is for and when to use it
- Example: Context7 for library API lookups, Exa for code context
````
**Key principle:** Show the agent what success looks like by listing concrete verification commands.
### 4. Create Gotchas Section
**Continuously update with real mistakes.** Maintain a living "Gotchas Codex" section that evolves through:
- Pull request reviews
- Production incidents
- Repeated mistakes by the agent or team
**Format:**
```markdown
## Gotchas Codex
Common mistakes to avoid (updated from real issues):
### API Rate Limits
- The external API has a 100 req/min limit
- Always implement exponential backoff
- Cache responses when possible
- Added: 2025-01-15 (PR #123)
### Database Migrations
- Never auto-generate migration names
- Use descriptive names: `YYYY-MM-DD-description.sql`
- Test rollback before deploying
- Added: 2025-01-10 (Incident #456)
### Test Flakiness
- Tests depending on `Date.now()` are flaky
- Use `jest.useFakeTimers()` for time-dependent tests
- Added: 2025-01-08 (PR #789)
```
**Update protocol:**
- Add new gotchas with date and source (PR number, issue, incident)
- Keep gotchas specific and actionable
- Remove resolved gotchas (if root cause is fixed)
- Review quarterly to keep relevant
### 5. Reference Task-Specific Files
**Point to task-specific .md files** instead of bloating the main AGENTS.md.
For larger repos, prefer a dedicated knowledge base (often `docs/`) and link to it from the main AGENTS.md. Keep it navigable with an index and clear "where to look next" pointers.
**Common specialized files:**
- **PLANS.md**: Design and iteration guidelines before implementation
- **ARCHITECTURE.md**: System design, component relationships
- **API.md**: API design standards and patterns
- **TESTING.md**: Detailed testing strategies and patterns
- **DEPLOYMENT.md**: Release and deployment procedures
- **CONTRIBUTING.md**: Contribution guidelines
**Reference format:**
```markdown
# Project Name
Core instructions here (keep under 100 lines).
## Detailed Guidelines
For specific worRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.