A document has a specific reader

Documentation turns verified information from code, configuration, tests, logs, and runs into a description that a specific person can understand. Claude Code helps create the structure and draft, but it does not replace verification by a developer.

It is better to have several short documents with clear purposes than one universal README that mixes onboarding, API details, troubleshooting, and architecture.

ArtifactPurpose
README.mdBasic purpose and startup
docs/onboarding.mdFirst steps for a new team member
docs/refund-flow.mdDescription of a specific functional flow
CODEBASE_INVENTORY.mdMap of the repository structure
API_MAP.mdRoutes, handlers, and integrations
Troubleshooting noteDiagnosis of a specific problem

Prepare sources before writing

  1. Identify the specific controllers, services, clients, and tests.
  2. Add manifests, configurations, and .env.example when relevant.
  3. Run a separate read-only investigation when needed.
  4. Write a constrained prompt and prohibit inventing entities.
  5. Obtain a draft of the sections, explanations, and constraints.
  6. Check every non-trivial claim before publication.

A documentation request

Based on the listed files, prepare a draft document.
Do not invent classes, commands, or integrations.
Cite a source for important claims.
Mark unconfirmed information, constraints,
and questions that require verification separately.

Check execution commands

  • the command name must match the scripts in the relevant manifest;
  • the wrapper file must exist in the repository;
  • ports, the database, and environment variables must be specified for the required environment;
  • a local run should be confirmed in practice, not merely read in the README;
  • external webhooks or integrations may not be reproducible locally.

Update documentation with the code

After changes to services, routes, or configuration, check the related documents again. State the boundaries of your knowledge explicitly: it is better to say “the fact was not found” or “an external webhook is required” than to present a guess as an implemented feature.

Canonical lesson source · JavaRush

Open JavaRush material