Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

arch-doc

БесплатноЗапускает вложенные скриптыНе проверен

Writes an architecture document for a package, subsystem, or pipeline in any codebase: a map of who owns what and how control and data flow, built from…

Roasbeefот Roasbeef★ 33 звезды на GitHub

Об этом скилле

Architecture document

The deliverable is one Markdown file under docs/ that lets an engineer who knows the domain but not this code answer three questions: which component owns which state, which goroutine (thread, process) touches it, and what happens, message by message, between a request arriving and a durable result. The reference example is docs/sync-architecture.md in lightninglabs/neutrino (PR 407). Read its structure in references/worked-example.md before writing.

The document describes the code as it is at one commit. It is not a design proposal, a changelog, or a tutorial, and it does not restate godoc.

1. Scope and anchor

Parse $ARGUMENTS. Fix four things before reading code, asking with AskUserQuestion only for what the arguments and the repo do not settle:

  • Subject. The package, subsystem, or pipeline. If it is a pipeline that crosses packages, list the packages.
  • Anchor. The commit, tag, or PR range the document reflects. Record the output of git rev-parse --short HEAD now, and say in the intro which commit or series the text is true of.
  • Reader. An engineer new to this code who knows the domain (for example, Bitcoin or Lightning, a database engine, a web framework). Do not explain the domain; explain this code.
  • Output. docs/<subject>-architecture.md unless --out says otherwise. Read the repo's existing docs/, README, and any CLAUDE.md first, and match heading style and link conventions. Link related docs instead of repeating them.

Then read the subject's top-level files yourself: the entry constructor, the main types, the package list. You need this to cut the work into subsystems and to judge the subagent summaries later.

2. Gather raw material in parallel

Cut the subject into three to six subsystems along ownership lines (one actor, one store, one scheduler), not along directories. Spawn one reader subagent per subsystem in a single message so they run concurrently. Use references/reader-brief.md as the prompt template; fill in the subsystem, the files, the anchor commit, and the names of the neighbouring subsystems so that each reader describes its boundary.

Each reader returns a structured summary with six parts: type responsibilities (including what each type does not own), flows message by message, every state machine with exact states and the function or event that causes each transition, the owner of each piece of mutable state, constants with values and file:line, and open questions. The summaries are inputs. Do not paste them into the document, and do not accept a claim from one without a grep: readers paraphrase, and a paraphrased constant is the most common error in these documents.

When two summaries disagree about a boundary (both claim to own a map, or neither mentions who closes a channel), resolve it by reading the code yourself before writing the Components table.

3. Write to the skeleton

Write the document yourself, in one pass, from the summaries. The skeleton below is fixed in order but adapted in content: drop a section the subject lacks, add one pipeline section per real pipeline. references/skeleton.md has the Mermaid templates and the exact shape of each table.

Section Contents
Title and intro One paragraph: what the subsystem keeps in step, its scope, the anchor (commit or series), and links to related docs.
Components A flowchart with one subgraph per component and labeled edges, one paragraph of lead-in, then a Responsibilities table with Owns and Does not own columns.
Startup (or lifecycle) A sequenceDiagram of construction and start, with alt and opt blocks for configuration branches. One sentence on why the order matters.
One section per pipeline Intro paragraph; a stateDiagram-v2 where state exists; a flowchart from start to durable result, including failure branches; a numbered list of steps with bold leads.
Shared state machines Peer, connection, or session states used by more than one pipeline, as a stateDiagram-v2, then the rule that the diagram cannot show.
Storage A backend comparison table, an erDiagram with PK and UK markers and short comments, one paragraph on transactions and caching, and a sequenceDiagram for any migration or import.
Concurrency A table of goroutine against what it owns, then prose rules: what timers may do, and the gotchas a caller must know.
Known gaps What the document does not cover or could not verify.

Section by section:

  • State diagrams carry the most value. Transition labels name the real function or event, and say what changes on the transition (epoch, lease, owner, counter). Include terminal states and failure states. Follow the diagram with prose for what the diagram cannot show: terminal transitions that bypass the machine, invariants over the whole machine.
  • Flowcharts run from the trigger to the durable result and show every failure br
Полный SKILL.md на GitHub

Установить arch-doc в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Task
Read
Write
Edit
Grep
Glob
Bash
Skill
AskUserQuestion

Вложенные файлы

references/example-hop-architecture.mdreferences/reader-brief.mdreferences/skeleton.mdreferences/verification.mdreferences/worked-example.mdscripts/check_identifiers.shscripts/check_mermaid.sh

FAQ

Что делает скилл arch-doc?

Writes an architecture document for a package, subsystem, or pipeline in any codebase: a map of who owns what and how control and data flow, built from mermaid diagrams (component flowchart, startup sequence, state diagrams, per-pipeline flowcharts, ER schema) plus Owns / Does-not-own and goroutine-ownership tables, at a fixed prose weight. Gathers facts with one reader subagent per subsystem, writes the document itself, greps every quoted number against the code, renders every diagram, and opens a docs-only PR. Modeled on lightninglabs/neutrino docs/sync-architecture.md (PR 407). Use when the user wants an architecture overview, a design map, or onboarding docs for existing code, or invoke via /arch-doc.

Как установить скилл arch-doc?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл arch-doc запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить arch-doc с