Skip to main content

Claude Code Prompt to Auto-Generate Project Documentation

Use Claude Code to auto-generate project docs from your codebase: README, API reference, ADRs, Mermaid schema diagrams, deployment and troubleshooting guides.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This is a single instruction that turns Claude Code into a documentation pass over your whole repository. It asks for ten linked artifacts — README, API reference, Architecture Decision Records, CONTRIBUTING, a Mermaid ER diagram of your schema, a config reference, a deployment guide, a troubleshooting FAQ, a changelog, and per-module docs — instead of one generic README. The numbered, explicit list is the whole point: Claude Code already has repo access, so a flat "write docs" prompt wanders, but ten named deliverables force it to actually read routes, migrations, config files, and git log to fill each one.

It works because every section is anchored to something real in the code. ADRs come from "decisions visible in the code," the FAQ from "common issues from code patterns," the schema diagram from your actual migrations, and the changelog from recent git history — so the output describes your system, not a tutorial. The closing rule, "keep docs close to code they document," nudges Claude Code to place files where engineers expect them rather than dumping one giant Markdown blob.

When to use it

  • You inherited or built a project that has zero docs and need a credible baseline in one pass.
  • You're open-sourcing a repo and need README, CONTRIBUTING, and a changelog before going public.
  • You want ADRs reconstructed after the fact for decisions nobody wrote down at the time.
  • A new engineer is onboarding next week and you need a config reference plus module docs fast.
  • You're prepping a handoff to a client or another team and want a self-contained doc set.
  • You need a Mermaid ER diagram for a design review and don't want to hand-draw your schema.

Example output

docs/
├── README.md              # overview, setup, usage, architecture
├── CONTRIBUTING.md        # branch flow, test + lint commands
├── CHANGELOG.md           # grouped from git log since last tag
├── adr/
│   ├── 0001-postgres-over-mysql.md
│   └── 0002-jwt-stateless-auth.md
├── api/payments.md        # POST /v1/charges → curl + JSON sample
└── database/schema.md     # Mermaid erDiagram: users ||--o{ orders

# database/schema.md excerpt
erDiagram
    USERS ||--o{ ORDERS : places
    ORDERS ||--|{ ORDER_ITEMS : contains

Pro tips

  • Set [decision_count] low (3-5) and [key_modules] to your genuinely load-bearing modules — over-asking produces filler ADRs for trivial choices nobody debates.
  • Be exact in [api_endpoints]: "the routes in routes/api.php" beats "all public endpoints" because it points Claude Code at a file instead of guessing surface area.
  • Match [deploy_target] to your real pipeline (e.g. "Docker + GitHub Actions to AWS ECS"); a vague target yields a generic deploy guide you'll rewrite anyway.
  • Run it on a clean branch and review the ADRs first — reconstructed decisions are where the model is most likely to invent a rationale you never had. Treat them as drafts to correct.
  • Pair it with a second pass: after generating, ask Claude Code to add a docs-lint step to CI so the README setup commands actually get tested and don't rot.

Frequently Asked Questions

Will Claude Code make up architecture decisions in the ADRs?
It can. ADRs are reconstructed from what's visible in the code, so the structural fact (you chose Postgres, or JWT auth) is usually right, but the stated rationale is the model's inference. Always review the ADR 'context' and 'consequences' sections and correct any reasoning that wasn't actually yours before committing them.
Does it write the files into my repo or just print them?
When run with file access (its default agentic mode), Claude Code creates the files directly, and the prompt's closing rule tells it to keep docs next to the code they document. Run it on a clean branch so the generated docs/ tree, ADRs, and Mermaid files land as a reviewable diff you can accept or roll back.
What if my project has no API or no database?
Drop the parts that don't apply. The template is a checklist, not a contract — remove the API documentation and schema diagram items for a CLI or library, or set [api_endpoints] to 'none' and keep README, ADRs, CONTRIBUTING, and module docs. Trimming the list gives sharper output than leaving empty sections.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Claude Code Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support