Exploration playbook¶
Where the truth lives, most reliable first¶
- Deployment and orchestration files: what actually runs, and what talks to what (ports,
depends_on, env vars pointing at other services). - Entrypoints:
main.*,app.*,server.*,cmd/,bin/,manage.py, thescripts/[project.scripts]section of the manifest, DockerfileCMD/ENTRYPOINT. - Route and handler registration: the public surface of each service.
- Schema: migrations, ORM models,
.proto, OpenAPI, GraphQL schema, JSON Schema, ontologies. The data model is the domain. See "Data definitions: where they hide" below. - Tests: integration and end-to-end tests read like flow descriptions.
- README and docs: good for intent and vocabulary, often stale on structure. When docs and code disagree, the code wins and the disagreement is worth mentioning.
Finding things fast¶
| Looking for | Search for |
|---|---|
| Containers | services: in compose files, kind: Deployment, FROM in Dockerfiles, workspace members |
| Where it runs (deployment) | docker-compose*.yml (services:, ports:, volumes:), k8s/, deploy/, charts/ (kind: Deployment, replicas:, kind: Ingress, HorizontalPodAutoscaler), *.tf (resource "aws_, google_, azurerm_), Dockerfile (FROM, EXPOSE, CMD), Procfile, fly.toml, render.yaml, app.yaml, vercel.json, netlify.toml, CI deploy jobs (.github/workflows/*deploy*, environment:) |
| HTTP surface | @app.get, @router., app.use(, router., @RestController, http.HandleFunc, urlpatterns |
| Background work | celery, rq, bullmq, sidekiq, @task, cron, schedule, consumer, subscribe |
| Datastores | connection strings in .env.example, DATABASE_URL, REDIS_URL, S3_, BUCKET, ORM setup |
| External systems | HTTP client construction, SDK imports (boto3, stripe, openai, octokit), webhook handlers, OAuth config |
| Roles and actors | role, permission, is_admin, scope, auth middleware, route guards |
| State machines | status, state, enum, transition, columns named *_status |
| Service-to-service calls | env vars ending _URL/_HOST, generated clients, queue names shared between two services |
| Data definitions | CREATE TABLE, migrations/, __tablename__, @Entity, schema.prisma, *.schema.json, openapi.*, *.graphql, *.proto, *.avsc, *.ttl, *.owl, @context, BaseModel, z.object( |
| Identifiers across stores | *_key, *_url, Key=, put_object, upload_file, f-strings building paths, enqueue(, .delay(, send_task, publish( |
Glob for structure first, grep for patterns second, read whole files last.
Deployment facts: where the containers run¶
A deployment diagram (the explorer's deployment, one per environment) is built from these files only; note for each fact the file and line it comes from.
- Environments: each real target a file describes: a compose file is usually local development, a Kubernetes or Terraform folder per cluster or account, a CI job's
environment:(staging, production), a platform config (fly.tomlapp,render.yamlservice). Different files for the same target are one environment. - Nodes: what hosts what, nested as the files nest it: account and region (Terraform provider,
region =), cluster (aws_eks_cluster, a kubeconfig context), namespace (metadata.namespace), a workload (kind: Deployment,StatefulSet), a VM (aws_instance), a managed database (aws_db_instance), the Docker host of a compose file. - Instances: which container of the model each workload or compose service runs (match the image, the build context, the command), and how many (
replicas:, an autoscaler'sminReplicas,--scale). - Infrastructure: load balancers (
aws_lb,kind: Ingress, an ingress controller chart), DNS (aws_route53_record), CDNs, firewalls and security groups when they shape traffic. - What travels: published ports, ingress rules and listeners say what reaches what from outside; the model's relationships already say who calls whom.
When the repository has no deployment files, there is no deployment diagram: say so in the brief rather than guessing.
Data definitions: where they hide¶
| Kind | Where to look | What it gives |
|---|---|---|
| Relational schema | migrations/, db/, *.sql, Alembic versions/, Django migrations/, Rails db/schema.rb, Flyway / Liquibase, schema.prisma, dbt models/ + schema.yml |
Tables, columns, types, keys, CHECK values, indexes. The migration is what the database enforces. |
| ORM models | SQLAlchemy __tablename__, Django models.py, TypeORM / JPA @Entity, ActiveRecord, Prisma, Sequelize, GORM tags |
The mapping to code, and behaviour only the ORM has (onupdate, session cascades, lazy loading). |
| Payload types | Pydantic BaseModel, Zod z.object, TypeScript interfaces, dataclasses, serialiser functions that return dicts, response_model= |
What the API sends and accepts. Where there is no type, the serialiser is the definition. |
| Specs | openapi.yaml / .json, *.schema.json, *.graphql, *.proto, *.avsc, AsyncAPI |
The published contract; check it against the code that serves it. |
| Semantics | *.ttl, *.owl, *.rdf, SHACL shapes, *.jsonld / @context files, SKOS vocabularies |
Classes, properties, alignments to other vocabularies, the IRIs a JSON key expands to. |
| Object-store layouts | put_object, upload_file, Key=, bucket constants, f-strings that build keys, bucket creation in compose or IaC |
The key layout (<batch>/<uuid>-<name>), which ids it embeds, which column stores it. |
| Messages | enqueue(, .delay(, send_task, publish(, producer and consumer signatures, event classes |
The message or job type, its routing (queue, topic), its arguments. |
Record each with its path and line, and the identifiers that join them across stores: a column holding an object key, a job argument that is a row id, an id copied into an exported file, a presigned URL in a payload.
Tracing what a step reads and writes¶
At every hop of a flow that touches data, open the statement and note exactly what it uses:
- SQL: the tables and columns in the
SELECTlist, theWHERE, theSET; anINSERTwrites the whole row. With an ORM, the query builder call (select(Task).where(Task.status == …)) and the commit (which also writesonupdatecolumns), and the lazy loads a serialiser triggers when it touches a relationship. - Object storage: the bucket and the key of each
get_object/put_object; who signs URLs for which key. - Queues: what is enqueued (the job or event and its arguments) and what the consumer reads from the store with them.
- Payloads: which function builds the response and from which fields.
Write it next to the step ("reads images.storage_key", "writes images.thumbnail_key, width, height"). Guessing from a function's name is how a data diagram goes wrong.
Deciding where to go deep¶
Go to component level for a container when at least one holds:
- it contains the domain logic the audience asked about;
- it has many inbound or outbound edges (it is the hub);
- it is where the flows you are tracing spend most of their steps.
Leave datastores, brokers and thin proxies as single boxes.
Tracing a flow¶
- Pick the trigger (a user clicks submit, a cron fires, a webhook arrives).
- Find the entrypoint that receives it (route, consumer, command).
- Follow calls across module and service boundaries, noting at each hop: who calls whom, with what, sync or async, and what is persisted.
- Stop at the user-visible result or the terminal state.
- Write it as 5–10 numbered steps with file references. More than about ten steps means two flows.
Note where a flow crosses from synchronous to asynchronous (enqueue → worker); these are the points readers find hardest and diagrams explain best.
Shapes that are not "a set of services"¶
- Library / SDK. Context = the applications that import it and the systems it wraps. One container: the package as it is installed; its public API surface, core, and adapters/backends are its components (a library runs inside the applications that import it, so it has no containers of its own to find). Flows are typical call sequences.
- CLI tool. Actors are the user and CI. Containers are the binary plus what it reads and writes (files, APIs, config). Flows are the main commands.
- Data / ML pipeline. Containers are stages and stores. The primary diagram is the data flow; add the schedule or orchestrator as its own box. Record data formats on the edges.
- Monorepo with many apps. Do Level 1 and 2 for the whole thing, then ask which apps deserve Level 3. Do not try to cover everything evenly.
- Frontend-only app. Containers are the app, the APIs it calls, and any BFF. Components are routes/pages, state management, and the API layer.
- Infrastructure repository. Containers are the provisioned resources grouped by purpose; edges are network paths and IAM grants.
Large repositories¶
- Budget: orient on everything, go deep on at most three areas.
- Fan out read-only subagents, one per top-level service or package, each asked for the same structured answer: responsibility, entrypoints, inbound and outbound dependencies, data owned, with file references. Merge and resolve contradictions yourself.
- Record what you did not look at in the brief's "not covered" list.
Common mistakes¶
- Drawing a box for something that is only a library inside another process.
- Edges without direction or label.
- Mixing levels: a database table next to a whole service.
- Inventing standard components (API gateway, cache, load balancer) that the repository does not contain.
- Treating a local-development compose file as the production topology without checking.
- Documenting the folder structure instead of the runtime structure.
Source
This page is skills/explore-project/references/exploration-playbook.md, the guide the skill reads while it works. Edit it there; the documentation includes it as is.