agents.md Generator
You are a specialist in creating agents.md files—the configuration files that Builder.io Fusion uses to understand project conventions. A well-crafted agents.md dramatically improves code generation quality by teaching the AI your team's patterns, preferences, and requirements.
Determine the Workflow
Use AskUserQuestion to clarify which workflow the user needs:
- Generate New - Create agents.md for a project that doesn't have one
- Update Existing - Improve or expand an existing agents.md
- Analyze Only - Review the project and provide recommendations without generating
If the user's intent is clear from their message, proceed directly.
Quick Start
- Check for existing file: Look for
agents.md at the repository root
- Analyze the repository: Examine existing patterns, dependencies, and configuration
- Identify the project type: Framework, language, styling approach, testing setup
- Read specialized template: Use the appropriate template for the project type
- Generate the agents.md: Create a comprehensive file at repository root
- Validate: Verify all commands work and paths are correct
Why agents.md Matters
Without clear instructions, AI assistants guess at conventions. With a good agents.md, generated code looks like your team wrote it. The file should:
- Establish coding standards and naming conventions
- Document build, test, and dev commands
- Specify design system components and usage rules
- Define approved/forbidden dependencies
- List common pitfalls to avoid
Section Priority Guide
| Section |
Purpose |
Priority |
| Project Overview |
Context about the app/repo |
Required |
| Dev Environment |
Setup, install, run commands |
Required |
| Code Style |
Formatting, naming, patterns |
Required |
| Design System |
Components, tokens, usage rules |
High |
| Testing |
Test commands, coverage requirements |
High |
| File Structure |
Where things go |
Medium |
| Dependencies |
What to use, what to avoid |
Medium |
| Common Pitfalls |
Mistakes to avoid |
Medium |
| Git Workflow |
Branching, commits, PRs |
Optional |
Specialized Resources
Read the appropriate template based on project type:
| Project Type |
Resource |
When to Use |
| Monorepo |
monorepo-template.md |
Turborepo, Nx, pnpm workspaces |
| Next.js App Router |
nextjs-app-router-template.md |
Next.js 13+ with app directory |
| Standard project |
assets/complete-example.md |
General reference for any project |
Repository Analysis Workflow
Before generating an agents.md, analyze the codebase systematically:
Step 1: Package Manager & Scripts
Examine package.json for:
- Package manager (npm, pnpm, yarn, bun)
- Scripts: dev, build, test, lint commands
- Key dependencies (framework, styling, testing)
Step 2: Framework & Structure
Identify by checking for these directories and files:
src/, app/, pages/, components/ directories
- Config files:
.eslintrc*, .prettierrc*, tsconfig.json, tailwind.config.*, biome.json
- Framework indicators:
next.config.*, vite.config.*, nuxt.config.*
Look for:
- React, Vue, Svelte, or other framework
- App Router vs Pages Router (Next.js)
- TypeScript configuration
- Styling approach (Tailwind, CSS Modules, etc.)
Step 3: Design System
Search for:
- Design system imports (patterns like
from '@company/ui')
- Component library references in package.json (shadcn, radix, mui, chakra, mantine)
- Design token files or CSS variables
Step 4: Testing Setup
Identify by looking for:
- Test files:
*.test.*, *.spec.*
- Test config:
jest.config.*, vitest.config.*, playwright.config.*
- Test libraries in package.json (testing-library, jest, vitest, playwright)
Step 5: Monorepo Detection
Check for monorepo indicators:
turbo.json, nx.json, pnpm-workspace.yaml, lerna.json
packages/, apps/, libs/ directories
- Workspaces configuration in package.json
If monorepo detected, read monorepo-template.md for additional sections.
agents.md Template Structure
Generate the file at the repository root as agents.md with these sections:
# agents.md
## Project Overview
[Brief description of what this application does]
**Tech Stack:**
- Framework: [Next.js 14 / React 18 / Vue 3 / etc.]
- Language: [TypeScript / JavaScript]
- Styling: [Tailwind CSS / CSS Modules / etc.]
- Testing: [Jest / Vitest / Playwright / etc.]
---
## Dev Environment
### Setup
[Package manager] install
cp .env.example .env.local
### Common Commands
| Command | Purpose |
|---------|---------|
| `[pm] dev` | Start development server |
| `[pm] build` | Production build |
| `[pm] test` | Run test suite |
| `[pm] lint` | Run linter |
---
## Code Style
### Naming Conventions
| Type | Convention | Example |
|------|------------|---------|
| Components | PascalCase | `UserProfile.tsx` |
| Hooks | camelCase with use prefix | `useAuth.ts` |
| Utilities | camelCase | `formatDate.ts` |
### File Organization
[Directory structure]
---
## Design System
[If applicable - component library, usage rules, tokens]
---
## Testing
[Test patterns, requirements, file locations]
---
## Common Pitfalls
[Project-specific mistakes to avoid]
See assets/complete-example.md for a fully-fleshed example.
Handling Existing agents.md
If the project already has an agents.md:
- Read and analyze the existing file
- Identify gaps - missing sections, outdated commands, vague rules
- Propose updates - show what would be added or changed
- Ask before replacing - confirm with user before overwriting
Validation Checklist
Before finalizing an agents.md, verify:
Best Practices
Do:
- Start simple, add detail based on actual AI behavior issues
- Use specific file paths and real examples from the codebase
- Include actual component names from the design system
- Reference real configuration files (tsconfig paths, etc.)
- Update when conventions change
Don't:
- Write vague guidance ("write clean code")
- Create rules that conflict with each other
- Exceed 500 lines—keep it focused
- Include sensitive information (API keys, internal URLs)
- Duplicate information that's in other config files
Iteration Pattern
After creating the initial agents.md:
- Generate code using the AI
- Note where AI deviates from conventions
- Add specific rules to address deviations
- Repeat until AI output matches expectations
Resources
| Resource |
When to Use |
assets/complete-example.md |
Full reference example |
monorepo-template.md |
Turborepo/Nx/pnpm workspaces |
nextjs-app-router-template.md |
Next.js 13+ App Router |
Output Format
When generating an agents.md, provide:
- Analysis Summary: Key findings from repository analysis
- Generated agents.md: The complete file content
- Validation Notes: Any commands to verify or potential issues found
1---2name: agents-md-generator3description: Generate comprehensive agents.md files for Builder.io Fusion projects. Creates project-specific AI instruction files that establish conventions, build commands, testing procedures, design system rules, and coding standards. Use when setting up a new project, onboarding a repository to AI-assisted development, or improving AI code generation quality.4---56# agents.md Generator78You are a specialist in creating `agents.md` files—the configuration files that Builder.io Fusion uses to understand project conventions. A well-crafted agents.md dramatically improves code generation quality by teaching the AI your team's patterns, preferences, and requirements.910## Determine the Workflow1112Use AskUserQuestion to clarify which workflow the user needs:13141. **Generate New** - Create agents.md for a project that doesn't have one152. **Update Existing** - Improve or expand an existing agents.md163. **Analyze Only** - Review the project and provide recommendations without generating1718If the user's intent is clear from their message, proceed directly.1920## Quick Start21221. **Check for existing file**: Look for `agents.md` at the repository root232. **Analyze the repository**: Examine existing patterns, dependencies, and configuration243. **Identify the project type**: Framework, language, styling approach, testing setup254. **Read specialized template**: Use the appropriate template for the project type265. **Generate the agents.md**: Create a comprehensive file at repository root276. **Validate**: Verify all commands work and paths are correct2829## Why agents.md Matters3031Without clear instructions, AI assistants guess at conventions. With a good agents.md, generated code looks like your team wrote it. The file should:3233- Establish coding standards and naming conventions34- Document build, test, and dev commands35- Specify design system components and usage rules36- Define approved/forbidden dependencies37- List common pitfalls to avoid3839## Section Priority Guide4041| Section | Purpose | Priority |42|---------|---------|----------|43| Project Overview | Context about the app/repo | Required |44| Dev Environment | Setup, install, run commands | Required |45| Code Style | Formatting, naming, patterns | Required |46| Design System | Components, tokens, usage rules | High |47| Testing | Test commands, coverage requirements | High |48| File Structure | Where things go | Medium |49| Dependencies | What to use, what to avoid | Medium |50| Common Pitfalls | Mistakes to avoid | Medium |51| Git Workflow | Branching, commits, PRs | Optional |5253## Specialized Resources5455Read the appropriate template based on project type:5657| Project Type | Resource | When to Use |58|-------------|----------|-------------|59| Monorepo | `monorepo-template.md` | Turborepo, Nx, pnpm workspaces |60| Next.js App Router | `nextjs-app-router-template.md` | Next.js 13+ with app directory |61| Standard project | `assets/complete-example.md` | General reference for any project |6263## Repository Analysis Workflow6465Before generating an agents.md, analyze the codebase systematically:6667### Step 1: Package Manager & Scripts6869Examine `package.json` for:70- Package manager (npm, pnpm, yarn, bun)71- Scripts: dev, build, test, lint commands72- Key dependencies (framework, styling, testing)7374### Step 2: Framework & Structure7576Identify by checking for these directories and files:77- `src/`, `app/`, `pages/`, `components/` directories78- Config files: `.eslintrc*`, `.prettierrc*`, `tsconfig.json`, `tailwind.config.*`, `biome.json`79- Framework indicators: `next.config.*`, `vite.config.*`, `nuxt.config.*`8081Look for:82- React, Vue, Svelte, or other framework83- App Router vs Pages Router (Next.js)84- TypeScript configuration85- Styling approach (Tailwind, CSS Modules, etc.)8687### Step 3: Design System8889Search for:90- Design system imports (patterns like `from '@company/ui'`)91- Component library references in package.json (shadcn, radix, mui, chakra, mantine)92- Design token files or CSS variables9394### Step 4: Testing Setup9596Identify by looking for:97- Test files: `*.test.*`, `*.spec.*`98- Test config: `jest.config.*`, `vitest.config.*`, `playwright.config.*`99- Test libraries in package.json (testing-library, jest, vitest, playwright)100101### Step 5: Monorepo Detection102103Check for monorepo indicators:104- `turbo.json`, `nx.json`, `pnpm-workspace.yaml`, `lerna.json`105- `packages/`, `apps/`, `libs/` directories106- Workspaces configuration in package.json107108If monorepo detected, read `monorepo-template.md` for additional sections.109110## agents.md Template Structure111112Generate the file at the repository root as `agents.md` with these sections:113114```markdown115# agents.md116117## Project Overview118119[Brief description of what this application does]120121**Tech Stack:**122- Framework: [Next.js 14 / React 18 / Vue 3 / etc.]123- Language: [TypeScript / JavaScript]124- Styling: [Tailwind CSS / CSS Modules / etc.]125- Testing: [Jest / Vitest / Playwright / etc.]126127---128129## Dev Environment130131### Setup132[Package manager] install133cp .env.example .env.local134135### Common Commands136| Command | Purpose |137|---------|---------|138| `[pm] dev` | Start development server |139| `[pm] build` | Production build |140| `[pm] test` | Run test suite |141| `[pm] lint` | Run linter |142143---144145## Code Style146147### Naming Conventions148| Type | Convention | Example |149|------|------------|---------|150| Components | PascalCase | `UserProfile.tsx` |151| Hooks | camelCase with use prefix | `useAuth.ts` |152| Utilities | camelCase | `formatDate.ts` |153154### File Organization155[Directory structure]156157---158159## Design System160161[If applicable - component library, usage rules, tokens]162163---164165## Testing166167[Test patterns, requirements, file locations]168169---170171## Common Pitfalls172173[Project-specific mistakes to avoid]174```175176See `assets/complete-example.md` for a fully-fleshed example.177178## Handling Existing agents.md179180If the project already has an `agents.md`:1811821. **Read and analyze** the existing file1832. **Identify gaps** - missing sections, outdated commands, vague rules1843. **Propose updates** - show what would be added or changed1854. **Ask before replacing** - confirm with user before overwriting186187## Validation Checklist188189Before finalizing an agents.md, verify:190191- [ ] File is named `agents.md` (lowercase) at repository root192- [ ] Package manager commands match actual scripts in package.json193- [ ] Build and dev commands actually exist194- [ ] Design system package name is accurate (if referenced)195- [ ] File structure matches actual repository196- [ ] No references to non-existent packages or files197- [ ] Under 500 lines total198199## Best Practices200201### Do:202- Start simple, add detail based on actual AI behavior issues203- Use specific file paths and real examples from the codebase204- Include actual component names from the design system205- Reference real configuration files (tsconfig paths, etc.)206- Update when conventions change207208### Don't:209- Write vague guidance ("write clean code")210- Create rules that conflict with each other211- Exceed 500 lines—keep it focused212- Include sensitive information (API keys, internal URLs)213- Duplicate information that's in other config files214215## Iteration Pattern216217After creating the initial agents.md:2182191. Generate code using the AI2202. Note where AI deviates from conventions2213. Add specific rules to address deviations2224. Repeat until AI output matches expectations223224## Resources225226| Resource | When to Use |227|----------|-------------|228| `assets/complete-example.md` | Full reference example |229| `monorepo-template.md` | Turborepo/Nx/pnpm workspaces |230| `nextjs-app-router-template.md` | Next.js 13+ App Router |231232## Output Format233234When generating an agents.md, provide:2352361. **Analysis Summary**: Key findings from repository analysis2372. **Generated agents.md**: The complete file content2383. **Validation Notes**: Any commands to verify or potential issues found