c/agents › command
0votes

Generate an AGENTS.md from an existing codebase

PromptLow risk Tested
submitted by CommandVault editors to c/agents · 1 use

Have your coding agent read the repo and write an accurate AGENTS.md instead of guessing.

Prompt · 2 variables
Read this repository and write an AGENTS.md at the root that a new coding agent could follow on day one.

Investigate before writing:
1. package.json / pyproject / Makefile / CI files: the real install, dev, test, lint and build commands.
2. The folder structure: where routes, business logic, data access and tests live.
3. Existing conventions: naming, error handling, how data is fetched, how styles are written.
4. Anything dangerous: migrations, generated files, secrets, production scripts.

Write AGENTS.md with these sections: Overview (3 lines), Commands (exact, copy-pasteable), Where things live, Conventions, Never do, Definition of done.

Rules:
- Only state things you verified in the code; mark guesses with "(check)".
- Keep it under {{max_lines}} lines.
- Focus on {{focus_area}} if the repo is large.

Then list the 3 things you were least sure about.
0 commentsreport

Guide

What you get: The agent reads the repo and writes an AGENTS.md (Overview, Commands, Where things live, Conventions, Never do, Definition of done) under your line limit, then lists the 3 things it was least sure about. Best for Anyone adding coding agents to an existing repository..

Before you start

  • A repository the agent can read
  • Fill max_lines and focus_area (we used 80 and the orders API)
  • Run every command it lists before you commit the file

Worked example (Nov 14, 2026, Claude Code 2.1.318 (claude-opus-5-5); Codex 0.151.0 (gpt-5.6-sol))

Input

bakehouse-api: Express 5 + TypeScript, npm scripts for dev/test/lint/typecheck/build/db:migrate/generate:types, CI workflow, a generated types file, a dangerous scripts/reset-prod-db.sh and one already-failing test. max_lines=80, focus_area=the orders API (src/routes and src/services).

Result

Claude Code (60 lines): "Never run `scripts/reset-prod-db.sh`: it drops the production `public` schema via `$PROD_DATABASE_URL`." Codex (64 lines): "Generate API types: `npm run generate:types` (`openapi-typescript` is not declared; dependency policy is (check))".

We ran every command in both files in a fresh copy: npm ci, lint, typecheck, build, db:migrate, start and dev work; npm test fails 1 test (planted, and both files say so); npm run generate:types fails (openapi-typescript isn't installed). Codex flagged that; Claude Code listed it as a working command, its one inaccuracy. Every path in both files exists. Both flagged the prod reset script, the generated file and secrets. Claude Code added one unmarked policy ('Never weaken or delete a test'); Codex added a line about its own sandbox (Supertest 'listen EPERM'), which doesn't belong in a project file.

How to check it worked

  • Run every command listed
  • Check every path exists
  • Delete anything about the agent's own environment

Common problems

  • A script that exists in package.json but can't run (missing binary) gets listed as working
  • Sandbox-specific notes leaking into the shared file
  • Policies stated as repo facts

Try it here

Fill in {{max_lines}}, {{focus_area}} above first for a better answer, or run it as is and the AI will assume sensible values.

or open in ChatGPT · Claude · Perplexity

How to use this prompt

  1. Fill in the 2 blanks above. The more specific you are, the better the answer.
  2. Copy it and paste it into Claude, Cursor, Codex, ChatGPT or Gemini, or use "Try it here" for a quick test.
  3. Read the answer critically: check anything it claims about your code or data before you rely on it.
  • {{max_lines}} Max lines
  • {{focus_area}} Focus area

More from c/agents

See all of c/agents →
0 comments

Log in to join the discussion.