Catalogue / repo-orientation-doc
repo-orientation-doc
Older skill: source not recordedSignedWrites a single-file orientation guide, conventionally named ARCHITECTURE.md, that gives new contributors a working mental model of an unfamiliar repository, covering the problem it solves, the path a typical request takes, a short scannable entry per top-level module with searchable symbol names, t…--- name: repo-orientation-doc description: >- Writes a single-file orientation guide, conventionally named ARCHITECTURE.md, that gives new contributors a working mental model of an unfamiliar repository, covering the problem it solves, the path a typical request takes, a short scannable entry per top-level module with searchable symbol names, the hard rules about what each layer may and may not touch, and the conventions that span the whole tree. Use when someone asks for an architecture document or a codebase tour, wants newcomers oriented before their first change, or needs a map to decide where an edit belongs. Not for API references, READMEs, setup or contribution guides, per-function documentation, or detailed design records. ---
Repo Orientation Doc
Who you are writing for
Picture an experienced developer seeing this repository for the first time. They carry exactly two questions: "If I need to change behavior X, which folder do I open?" and "If I open this folder, what am I looking at?" Their slowest hours will be spent searching, not editing. The file you produce — one markdown document, traditionally saved as ARCHITECTURE.md — exists to collapse those hours into minutes.
Slow facts only
Sort everything you learn into two buckets. Fast facts change with ordinary merges: how a function works inside, dependency versions, last month's refactor. Slow facts barely move: what each package is for, which directions dependencies may point, where state lives, what is forbidden where. This document is an archive of slow facts and nothing else. Expect it to be reread occasionally and refreshed perhaps a couple of times a year by hand — never kept mechanically synchronized with the source. Two consequences follow: spell out symbol names in backticks (a named type outlives any hyperlink, and pairs perfectly with an editor's symbol search), and refuse to include anything a routine merge would falsify.
This skill does not cover the external essay and separate companion example the original method pointed readers to; the inline guidance and worked example below replace them.
Building the file, top to bottom
Construct the document section by section. Research stays strictly read-only throughout: reading files and listing directories tells you everything you need, so never build, run, or execute the project or its scripts to learn its shape.
The opening paragraph
Read the README, the package manifest, and any docs directory to learn the project's stated purpose. Then write one paragraph saying who the software is for and what it does for them. Reason: a reader who grasps the problem will forgive imperfect detail later; a reader who does not will misread everything that follows. Leave out project history and technology-stack inventories.
The path a typical request travels
Find the entry points — the main function, CLI dispatch, server bootstrap, queue consumers — and follow one common case from arrival to completion. Describe it in two or three short paragraphs or a numbered pipeline, and state plainly where state lives and how the parts communicate (direct calls, a queue, a shared database). Reason: this narrative becomes the thread the whole document hangs on, and the module entries below are ordered along it. Trace the everyday path, not an exotic edge case.
The atlas: one entry per significant module
List the top-level directories and settle three things about each: its single responsibility, whether it is pure calculation or performs side effects, and which directories are allowed to depend on it. Then write a parallel four-line fact sheet per module, under a third-level heading containing the backticked directory path:
- Role — one sentence naming the package's one job.
- Landmarks — up to about three symbol names (types, functions, interfaces) a reader would want to search for.
- Edges — what it may depend on, and what depends on it; flag packages that act as walls the rest of the system builds against, since interfaces like those quietly constrain every implementation behind them.
- Off-limits — what must never appear inside it: network calls, SQL text, clock reads, imports of a particular layer. State these bans even though nothing in the code displays them, because a prohibition is invisible to someone browsing the source — the offending code simply is not there to find.
Order the entries along the path from the previous section. Hold each to a handful of lines; anything longer is a signal the detail belongs in doc comments next to the code itself.
House rules: what spans everything
Collect the conventions that reach into multiple packages — how failures travel and where they are caught, where tests live and what they may touch, how configuration is loaded, logging, the build. Give each one a short subsection, and note where it is enforced (a lint rule, review practice, or a single wrapper package). Omit anything contained in one package; that is atlas material. Reason: these rules go last because readers consult them on demand rather than front to back.
The trim pass
Reread the draft and delete sentences about a function's internals, every URL or line reference, version numbers, and anything describing a recent change. Then apply two tests:
- The fifty-pull-request test: would every remaining sentence still be true after the next fifty ordinary merges? Cut whichever would not.
- The stranger test: using only this file plus symbol search, can you answer "which package would I edit to change X?" for each of the system's main behaviors? Patch the atlas wherever the answer is missing.
Budget roughly 200 lines for a mid-sized repository and well under 100 for a small one. A shorter file is a reread file.
Worked example
Calibrate tone and depth against this fictional Go service, doorbell, which turns code-host webhooks into chat messages. Subscriptions live in one SQLite file; repeated events post once inside a 15-minute dedupe window; failed deliveries retry five times across 20 minutes.
# doorbell doorbell listens for webhooks from a code host and posts chat messages to subscribed channels. Administrators manage subscriptions through a small CLI; delivery is best-effort with bounded retries. ## The path an event travels An HTTPS request arrives with a signature header. The listener verifies and parses it into an `Event`, the matcher picks the subscriptions it triggers, the renderer fills a message template, the sink delivers to chat, and the ledger records the attempt: 1) accept 2) verify 3) match 4) render 5) deliver 6) record All state sits in one SQLite file. Packages never share memory; every handoff passes a plain value. ## The atlas ### `internal/listener/` - Role: terminates HTTPS, checks signatures, parses payloads; nothing else. - Landmarks: `Server`, `verifySignature`, `Event`. - Edges: the only package permitted to accept inbound connections; it hands parsed `Event` values to the matcher and nothing else. - Off-limits: no database access, no templating — a payload that fails verification never reaches any other package. ### `internal/matcher/` - Role: pure lookup deciding which subscriptions an event triggers. - Landmarks: `Subscription`, `Match`, `SelectMatches`. - Edges: depends only on the shared types package; anything may depend on it. - Off-limits: no I/O of any kind; the current time arrives as an argument so the dedupe window stays testable. The remaining entries — `internal/render/`, `internal/sink/`, `internal/store/`, `internal/types/` — follow the same shape: the sink is the only package with outbound HTTP and owns the retry schedule; the store is the only place SQL text appears; render is pure templating; types holds shared structs and nothing else. ## House rules ### Failure handling Errors are plain values typed in `internal/types`. The listener answers bad signatures with a rejection and no retry; the sink retries deliverable failures five times over 20 minutes and then parks them; the ledger dedupes on event key within a 15-minute window so a repeated webhook posts once. ### Tests Matcher and render are tested with no fixtures; listener and sink run against a fake peer over an in-process pipe. Nothing in the suite reaches the public internet.
Guardrails
- If a file with this name or a near variant already exists, never replace it silently. Save your version beside it under a new name with a draft suffix, summarize how it differs, and let the user decide whether to swap it in.
- Research is read-only end to end; the one file you write is the only thing you change.
- Never copy secrets into the document — no tokens, passwords, or environment-variable values. Record that configuration exists and where it is parsed, never its contents.
- Use no hyperlinks, file URLs, or line references anywhere in the generated file; backticked symbol names are the only pointers it contains.
- When you deliver the file, remind the user that it is built for occasional rereading, not continuous sync with the code.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 9.2 kB | b3346b4f890e |
| examples.json | 2.4 kB | aa7662fb599b |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 1.0.0 Current | Not recorded | 6 Oct 2026 |
Locking a skill to one version needs Pro.