Diagram a codebase
One diagram that shows everything explains nothing. To explain a repository (a monorepo, a set of microservices, an app and its backend), read first and draw a small set: one overview and a few key flows. This is the recipe the agent skill follows; you can give it to any agent with “diagram this repo”.
1. Read the system, not the files
Section titled “1. Read the system, not the files”Look where the architecture is declared, in this order:
- Deployment:
docker-compose*.yml, Kubernetes or Helm manifests,serverless.yml,wrangler.*, Terraform,Procfile. Every service, database, queue and cache usually appears here. - Workspaces:
package.jsonworkspaces,pnpm-workspace.yaml,go.work,Cargo.toml, top-levelapps/andservices/. One package or app is usually one block. - Entry points and routes:
main.*,server.*, routers, controllers, OpenAPI, GraphQL or.protofiles. - Who calls whom: HTTP clients and base URLs (
ORDERS_URL), gRPC stubs, queue producers and consumers, database clients, third-party SDKs. - The README, last, to confirm names and intent.
2. Draw a set
Section titled “2. Draw a set”- Overview (
architecture): layers top to bottom, for example Clients → Edge → Services → Data → External. One block per deployable service or data store, 15 at most. - Two to four key flows (
sequence): the requests that matter most (sign-up, checkout, the main job). Messages in order, labelled with the endpoint or event (POST /orders,order.created). - Optional: a
flowfor a business process, or atreeof the packages if the question is about code organization.
Name each file after what it explains: overview.flux.json, checkout.flux.json.
3. Rules
Section titled “3. Rules”- Use the names the team uses in code, with a plain
descriptionof the job (“charges cards”). - Show the main path with
flowandcarries("carries": "order.created"), not every call. - Leave out what you can’t confirm from the code instead of guessing.
- For onboarding, write
noteson each step: retries, idempotency, which folder holds it. Then present it.