AGENTS.md Generation Capability
This skill enables the agent to analyze any repository and generate a comprehensive AGENTS.md file that serves as a contributor guide for AI agents working on the codebase.
When to Use This Skill
Activate this skill when asked to:
- "Generate AGENTS.md"
- "Create a contributor guide for AI agents"
- "Analyze the repository structure"
- "Document the codebase for AI assistants"
- "Create documentation for this project"
- "Help AI understand this repository"
Workflow Overview
- Measure Repository Size: Use
tokei to count LOC and determine character limits
- Analyze Structure: Inspect directory tree, key files, and code patterns
- Extract Patterns: Review code samples to identify conventions and behaviors
- Generate Document: Create AGENTS.md with 5 standardized sections
- Validate: Ensure output meets character limits and includes all required sections
Core Capability
- Function: Analyze repository structure and generate a standardized
AGENTS.md document
- Output Format: Markdown file with structured sections
- Character Limit: Dynamic, based on repository LOC (Lines of Code)
- Analysis Method: Read-only commands only (no execution, testing, or building)
Output Sections
The generated AGENTS.md consists of exactly 5 sections:
| # |
Section |
Purpose |
| 1 |
Overview |
1-2 sentence project description (abstract, no tool/framework lists) |
| 2 |
Folder Structure |
Key directories and their contents |
| 3 |
Core Behaviors & Patterns |
Logging, error handling, control flow patterns observed in code |
| 4 |
Conventions |
Naming, comments, code style derived from analysis |
| 5 |
Working Agreements |
Rules for agent behavior and communication |
Domain Knowledge
Constraints & Safety
- Read-Only Analysis: Repository inspection uses only non-destructive commands
- No Run/Test/Build/Deploy: Generated AGENTS.md excludes execution instructions
- Files to Ignore: Lock files (
pnpm-lock.yaml, package-lock.json, yarn.lock, etc.)
- Respect .gitignore: Exclude build artifacts, node_modules, and generated files
- Character Limits: Strictly enforce limits based on repository size
Step-by-Step Generation Process
Step 1: Measure Repository Size
- Run
tokei to count LOC (see ./references/loc_measurement.md)
- Determine character limit based on total LOC:
- ≤ 10K LOC: 10,000 chars
- 10K-50K LOC: 10,000 chars
- 50K-100K LOC: 10,000 chars
- 100K-500K LOC: 15,000 chars
- 500K-1M LOC: 20,000 chars
1M LOC: 30,000 chars
Step 2: Analyze Repository Structure
- Use
tree to visualize directory hierarchy (ignore node_modules, .git, build artifacts)
- Identify key directories and their architectural roles
- Read configuration files (.editorconfig, eslintrc, prettierrc, etc.)
- Review README.md and documentation for context
Step 3: Extract Code Patterns
- Use
rg (ripgrep) to search for common patterns (preferred over grep)
- Sample up to 800 lines per file (excluding imports)
- Identify:
- Logging and debugging patterns
- Error handling approaches
- Control flow conventions
- Module organization
Step 4: Identify Conventions
- Analyze naming patterns (camelCase, PascalCase, snake_case)
- Review comment styles and documentation patterns
- Note code organization and file structure preferences
- Identify testing frameworks if present
Step 5: Generate AGENTS.md
- Write 5 sections in order (see ./references/agents_md_template.md):
- Overview (1-2 sentences)
- Folder Structure (hierarchical, role-focused)
- Core Behaviors & Patterns (from code analysis)
- Conventions (naming, comments, style)
- Working Agreements (compressed format)
- Validate total character count
- Write file to repository root
Example Output Quality
Good Overview Example
## 1. Overview
A Groovy-based IntelliJ IDEA plugin providing AI-assisted code generation and refactoring capabilities.
Bad Overview Example (Too Detailed)
## 1. Overview
This is an IntelliJ IDEA plugin written in Groovy using Gradle 8.5 and JDK 17. It uses Micronaut for dependency injection, Spock for testing, and integrates with OpenAI's API. The plugin provides features like code generation, refactoring suggestions, and natural language processing.
Common Mistakes to Avoid
- Flat folder structure: Always show hierarchy with nested bullets
- Generic descriptions: Explain roles, not just names ("UI components" not "UI folder")
- Missing conventions: Always analyze actual code patterns, don't assume
- Character overflow: Validate final output against limits
- Execution instructions: Never include build/run/test commands
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: agents-md-generator-43description: Analyze repository structure and generate standardized AGENTS.md files that serve as contributor guides for AI agents. Measures LOC to determine character limits and produces 5-section documents covering overview, folder structure, patterns, conventions, and working agreements. Use when this capability is needed.4---56# AGENTS.md Generation Capability78This skill enables the agent to analyze any repository and generate a comprehensive `AGENTS.md` file that serves as a contributor guide for AI agents working on the codebase.910## When to Use This Skill1112Activate this skill when asked to:13- "Generate AGENTS.md"14- "Create a contributor guide for AI agents"15- "Analyze the repository structure"16- "Document the codebase for AI assistants"17- "Create documentation for this project"18- "Help AI understand this repository"1920## Workflow Overview21221. **Measure Repository Size**: Use `tokei` to count LOC and determine character limits232. **Analyze Structure**: Inspect directory tree, key files, and code patterns243. **Extract Patterns**: Review code samples to identify conventions and behaviors254. **Generate Document**: Create AGENTS.md with 5 standardized sections265. **Validate**: Ensure output meets character limits and includes all required sections2728## Core Capability2930- **Function**: Analyze repository structure and generate a standardized `AGENTS.md` document31- **Output Format**: Markdown file with structured sections32- **Character Limit**: Dynamic, based on repository LOC (Lines of Code)33- **Analysis Method**: Read-only commands only (no execution, testing, or building)3435## Output Sections3637The generated `AGENTS.md` consists of exactly 5 sections:3839| # | Section | Purpose |40|---|---------|---------|41| 1 | Overview | 1-2 sentence project description (abstract, no tool/framework lists) |42| 2 | Folder Structure | Key directories and their contents |43| 3 | Core Behaviors & Patterns | Logging, error handling, control flow patterns observed in code |44| 4 | Conventions | Naming, comments, code style derived from analysis |45| 5 | Working Agreements | Rules for agent behavior and communication |4647## Domain Knowledge4849- **LOC Measurement**: Capability to measure repository size and determine character limits. See [./references/loc_measurement.md](./references/loc_measurement.md)50- **Repository Analysis**: Capability to inspect and understand codebase structure. See [./references/read_only_commands.md](./references/read_only_commands.md)51- **Output Template**: Standardized AGENTS.md structure specification. See [./references/agents_md_template.md](./references/agents_md_template.md)52- **Working Agreements**: Agent behavior rules for generated documents. See [./references/working_agreements.md](./references/working_agreements.md)5354## Constraints & Safety5556- **Read-Only Analysis**: Repository inspection uses only non-destructive commands57- **No Run/Test/Build/Deploy**: Generated AGENTS.md excludes execution instructions58- **Files to Ignore**: Lock files (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, etc.)59- **Respect .gitignore**: Exclude build artifacts, node_modules, and generated files60- **Character Limits**: Strictly enforce limits based on repository size6162## Step-by-Step Generation Process6364### Step 1: Measure Repository Size65661. Run `tokei` to count LOC (see [./references/loc_measurement.md](./references/loc_measurement.md))672. Determine character limit based on total LOC:68 - ≤ 10K LOC: 10,000 chars69 - 10K-50K LOC: 10,000 chars70 - 50K-100K LOC: 10,000 chars71 - 100K-500K LOC: 15,000 chars72 - 500K-1M LOC: 20,000 chars73 - > 1M LOC: 30,000 chars7475### Step 2: Analyze Repository Structure76771. Use `tree` to visualize directory hierarchy (ignore node_modules, .git, build artifacts)782. Identify key directories and their architectural roles793. Read configuration files (.editorconfig, eslintrc, prettierrc, etc.)804. Review README.md and documentation for context8182### Step 3: Extract Code Patterns83841. Use `rg` (ripgrep) to search for common patterns (preferred over grep)852. Sample up to 800 lines per file (excluding imports)863. Identify:87 - Logging and debugging patterns88 - Error handling approaches89 - Control flow conventions90 - Module organization9192### Step 4: Identify Conventions93941. Analyze naming patterns (camelCase, PascalCase, snake_case)952. Review comment styles and documentation patterns963. Note code organization and file structure preferences974. Identify testing frameworks if present9899### Step 5: Generate AGENTS.md1001011. Write 5 sections in order (see [./references/agents_md_template.md](./references/agents_md_template.md)):102 - Overview (1-2 sentences)103 - Folder Structure (hierarchical, role-focused)104 - Core Behaviors & Patterns (from code analysis)105 - Conventions (naming, comments, style)106 - Working Agreements (compressed format)1072. Validate total character count1083. Write file to repository root109110## Example Output Quality111112### Good Overview Example113```markdown114## 1. Overview115116A Groovy-based IntelliJ IDEA plugin providing AI-assisted code generation and refactoring capabilities.117```118119### Bad Overview Example (Too Detailed)120```markdown121## 1. Overview122123This is an IntelliJ IDEA plugin written in Groovy using Gradle 8.5 and JDK 17. It uses Micronaut for dependency injection, Spock for testing, and integrates with OpenAI's API. The plugin provides features like code generation, refactoring suggestions, and natural language processing.124```125126## Common Mistakes to Avoid127128- **Flat folder structure**: Always show hierarchy with nested bullets129- **Generic descriptions**: Explain roles, not just names ("UI components" not "UI folder")130- **Missing conventions**: Always analyze actual code patterns, don't assume131- **Character overflow**: Validate final output against limits132- **Execution instructions**: Never include build/run/test commands133134---135> Converted and distributed by [TomeVault](https://tomevault.io/claim/mlim-usfca) — claim your Tome and manage your conversions.136<!-- tomevault:4.0:skill_md:2026-04-14 -->