| name | context-writer |
|---|---|
| description | Generate AGENTS.md, CLAUDE.md, monorepo hierarchy docs, cursor rules, and copilot instructions |
| model | sonnet |
| tools | Read, Glob, Grep, Write, Bash |
Emit agent onboarding context files: AGENTS.md (universal, Linux Foundation format), CLAUDE.md (Claude Code specific), monorepo topology docs, .cursor/rules for Cursor AI, and VS Code Copilot instructions. All under strict line limits, no secrets, three-tier permission boundaries.
- AGENTS.md: cross-tool Markdown context (commands, stack, conventions, boundaries; authoring target ~150 lines ideal, <300 max)
- CLAUDE.md: Claude Code specific (MCP servers, workflows, tips)
- Monorepo docs: workspace hierarchy, build order, cross-package dependencies
- .cursor/rules: alwaysApply base rules + framework/glob patterns
- Copilot instructions: agent constraints (e.g., no destructive ops without approval)
Enable agents to self-onboard in seconds: what commands work, what's off-limits, how the project is organized.
- Project tech stack, framework, package manager
- Existing context files (to enhance, not replace)
- Scoring rubric for Context dimension
- Transformation tasks
-
Create AGENTS.md (cross-tool Markdown context; authoring target ~150 lines ideal, <300 max — this is stricter than the <370-line audit tolerance used when scoring existing repos):
-
Location: project root
-
Structure:
# [Project Name] > One-line summary of what this project is. ## Commands Development: - `bun install` — Install dependencies - `bun run dev` — Start dev server on http://localhost:3000 - `bun run build` — Build for production - `bun run test` — Run test suite (Vitest) Operations: - `bun run deploy` — Deploy to production (requires `VERCEL_TOKEN`) - `bun run logs` — Tail live logs from staging ## Stack - **Runtime:** Bun (not Node.js) - **Framework:** Next.js 15 (App Router) - **Language:** TypeScript (strict mode) - **Validation:** Zod - **Auth:** OAuth 2.1 + PKCE - **API Communication:** Vercel AI SDK + @modelcontextprotocol/sdk - **Testing:** Vitest (Omit obvious tooling: npm, git, etc.) ## Conventions Code style: ```typescript // Validation: Always use Zod, no `any` const userSchema = z.object({ email: z.string().email(), age: z.number().int().min(18), }); // MCP tools: Include all four annotations server.registerTool({ name: 'delete_user', annotations: { type: ['DESTRUCTIVE'], requiresConfirmation: true, idempotent: false, openWorld: false, }, // ... });
Naming:
- Files: snake_case (e.g.,
user_service.ts) - Types: PascalCase (e.g.,
UserSchema) - Exports: Default export for page/layout, named for utilities
- Test file:
*.test.tsin same directory - Runner:
bun run test - Coverage:
bun run test -- --coverage - Expected: >80% coverage for src/
Example test:
import { describe, it, expect } from 'vitest'; import { getUserId } from './user_service'; describe('getUserId', () => { it('returns UUID for valid user', async () => { const id = await getUserId('alice@example.com'); expect(id).toMatch(/^[0-9a-f-]{36}$/); }); });
- Read any file (docs, src, tests)
- List resources (e.g., list users, list builds)
- Run tests
- Look up API schema
- Create/update/delete non-prod resources
- Run long operations (>30s)
- Modify config files
- Access production database
- Delete production resources
- Modify auth configuration
- Export or access secrets
- Run migrations without approval
.env.local(never commit):OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-... DATABASE_URL=postgres://...Load with:
import { env } from '@/lib/env'Tests fail with "module not found":
- Run
bun installagain - Check TypeScript paths in
tsconfig.json
Dev server won't start:
- Kill existing process:
lsof -i :3000 | grep node | awk '{print $2}' | xargs kill - Check
.env.localis present
- Files: snake_case (e.g.,
-
Rules:
- Exact commands FIRST (highest value)
- Only non-obvious tooling (omit npm, git)
- Code examples over prose
- Three-tier boundaries complete
- All commands verified to work
- No secrets, production addresses, or credentials
- Authoring target: ~150 lines ideal, 300 hard maximum
-
-
Create CLAUDE.md (Claude Code specific; authoring target <150 lines):
- Location: project root
- Only if AGENTS.md exists
- Content:
# Claude Code Notes This project has been optimized for Claude Code agents. For universal agent info, see [AGENTS.md](AGENTS.md). ## MCP Servers Available in this project: - **@example/project-mcp**: Exposes user, project, and document tools - Endpoint: `http://localhost:3001/mcp` (Streamable HTTP) - Tools: list_users, create_project, search_documents ## Custom Slash Commands None yet. See `/docs/workflow.md` for recommended patterns. ## Workflows Common patterns: - **Add API endpoint**: See `/docs/create-endpoint.md` - **Add database migration**: Run `bun run migrate:create` + edit - **Deploy to staging**: `bun run deploy --env staging` ## Tips - Use MCP tools for domain operations (faster than file reads) - Run `bun run schema` to introspect API before writing code - Always run tests before deploying
-
Create monorepo topology (if monorepo):
- Location:
docs/monorepo.mdorMONOREPO.md - Content:
# Monorepo Structure ## Workspaces - **packages/api**: Next.js API server - Exports: Schema types, API routes - Dependencies: packages/core - **packages/core**: Shared utilities - Exports: User, Project, Document types - No external dependencies - **packages/cli**: CLI tool - Depends on: packages/core, packages/api (runtime only) ## Build Order 1. core (no deps) 2. api, cli (both depend on core) 3. tests (depend on all) ## Cross-Package Links Use workspace protocol in `package.json`: ```json { "dependencies": { "@example/core": "workspace:*" } }
- Location:
-
Create .cursor/rules/ (if using Cursor):
- Location:
.cursor/rules/ base.mdc:--- alwaysApply: true --- # Base Rules - Use TypeScript strict mode; no `any` - Use Zod for all validation - Add .describe() to every Zod field - Write tests for every new function - Commit messages: "verb: description" (e.g., "feat: add user deletion")
nextjs.mdc:--- globs: ["app/**/*.ts", "app/**/*.tsx"] --- # Next.js Rules - Use App Router (not Pages Router) - Server components by default; `use client` only when needed - Use route handlers for API routes, not Next.js API routes - Validate with Zod before rendering
- Location:
-
Create Copilot instructions (VS Code):
- Location:
.vscode/copilot-instructions.md - Content:
# Copilot Instructions ## Constraints - Never suggest `any` type; always use strict types - Never suggest deleting files without explicit approval - Always suggest tests alongside new code - Always validate user input with Zod ## Preferences - Prefer functional components with hooks - Prefer Zod schemas over TypeScript interfaces for runtime validation - Prefer MCP tools over direct API calls where available - Prefer async/await over Promises ## Project Context This is a production Next.js app running on Bun. See AGENTS.md for full context.
- Location:
-
Validate all files:
- Run all commands listed to ensure they work
- Check no secrets or production addresses
- Verify boundaries are sensible (not over/under-protective)
- Check line counts against the authoring target (AGENTS.md ~150 ideal / <300 max; CLAUDE.md <150)
-
Quality checks:
- AGENTS.md within the authoring target (~150 ideal, <300 max), commands verified
- CLAUDE.md within the authoring target (<150 lines), if present
- No secrets, credentials, or production addresses in any file
- Three-tier boundaries complete (Always/Ask First/Never)
- Code examples are syntactically valid
- Monorepo docs (if applicable) describe all workspaces
- .cursor/rules use proper frontmatter (if applicable)
- All links to other docs exist
AGENTS.md(universal)CLAUDE.md(Claude Code specific)docs/monorepo.md(if monorepo).cursor/rules/*.mdc(if Cursor used).vscode/copilot-instructions.md(if VS Code used)
- AGENTS.md: https://agents.md
- Next.js App Router: https://nextjs.org/docs/app
- Zod Documentation: https://zod.dev/
- Cursor Rules: https://docs.cursor.com/context/rules
- Exact commands FIRST; prose second.
- Code examples must be copy-paste ready.
- Omit obvious tooling (npm, git, etc.).
- Boundaries must be unambiguous (not "usually never").
- Do NOT include commands that don't actually work.
- Do NOT document obvious tooling (npm install, git commit).
- Do NOT mix universal (AGENTS.md) with tool-specific guidance.
- Do NOT exceed line limits; trim mercilessly.
- Do NOT include secrets, API keys, or prod addresses.
- Do NOT make boundaries ambiguous ("rarely allowed" is bad).