/nonoise:c4-doc-writerfrom nonoise
Maintains living C4 architecture diagrams (Context/Container/Component/Code) via Structurizr DSL. Updates diagram source and regenerates views after a validated PRD or ADR. Stack-neutral, works for any project with docs/architecture/.
Ships in nonoise. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill keeps the project's C4 architecture diagrams in sync with the validated architectural decisions. It does not brainstorm architecture (arch-brainstorm) nor validate it (arch-decision) — it is invoked after a validated PRD to update the diagram source and regenerate views.
Read this section before writing anything. The target folder is resolved per-run; it is NOT always docs/architecture/c4/.
Two modes:
docs/architecture/c4/workspace.dsl + docs/architecture/c4/CHANGELOG.md. This is the living C4 for the project's target architecture (green-field, or post-refactor / post-rewrite).docs/support/reverse/<subject-slug>/c4/workspace.dsl + docs/support/reverse/<subject-slug>/c4/CHANGELOG.md, co-located with the 00-overview.md / 01-*.md chapters produced by reverse-engineering. This is the C4 of the existing / legacy system the dossier describes..nonoise/polly-state.json exists AND handoff.skill === "c4-doc-writer" AND the handoff was engaged while the session was inside the reverse phase (look at handoff.returnTo pointing back to reverse, or the most recent event before the handoff was action: "handoff" from currentStep === "reverse"), use reverse mode. If there are multiple subjects under docs/support/reverse/, ask which one.session.currentStep === "reverse" OR (phases.reverse.done === true AND phases.sprint.done === false), reverse mode is likely — ask the user to disambiguate:
"Vedo che c'è un dossier di reverse in
docs/support/reverse/<slug>/. Metto il C4 lì (co-locato con il dossier) o nelladocs/architecture/c4/a livello progetto?"
docs/support/reverse/ has ≥1 subfolder containing 00-overview.md AND docs/architecture/c4/workspace.dsl does NOT yet exist, ask the same disambiguation question.docs/architecture/c4/.If several subfolders exist under docs/support/reverse/, list them and ask which one the C4 belongs to. You may offer "the most recent (by mtime of 00-overview.md)" as a shortcut.
Once the mode is picked, record the target as the resolved target folder. Every subsequent step in this skill (DSL write, CHANGELOG, rendered views) uses that folder — do NOT fall back to hard-coded docs/architecture/c4/ paths mid-run.
C4 diagrams for a reverse / legacy pass describe the system as-is — its warts, its accidental complexity, its integrations as they really are. They belong with that dossier because they're part of the historical snapshot that the dossier versions together. The top-level docs/architecture/c4/ is for the new target architecture (post-rewrite, post-refactor, or green-field), which may differ significantly from the legacy shape. Conflating the two overwrites the green-field placeholder with a legacy diagram — exactly the bug this section prevents.
Mermaid is great for one-off sketches but it ages fast — every view is hand-written and there is no model underneath. Structurizr DSL is:
person, softwareSystem, container, component once; the views block derives multiple diagrams from the same modelSee references/structurizr-dsl-cheatsheet.md for the canonical patterns and references/c4-levels-primer.md for what each level means and how it maps to NONoise artifacts.
arch-brainstorm ──▶ arch-decision ──PASS──▶ c4-doc-writer ──▶ sprint-manifest
│ │
│ └─▶ docs/architecture/c4/workspace.dsl (default mode)
│ + rendered views (Mermaid/PlantUML)
│
└─▶ "Impact on docs/architecture/" checklist includes
"refresh C4 via c4-doc-writer"
reverse-engineering ──▶ c4-doc-writer (reverse mode)
│
└─▶ docs/support/reverse/<subject-slug>/c4/workspace.dsl
+ rendered views, co-located with the dossier
Four valid entry points:
arch-decision PASS (primary, default mode) — the architect or Polly engages this skill to reflect the validated decision in the diagramsdocs/architecture/c4/.workspace.dsl yet: the skill scaffolds from assets/workspace.dsl.templateBefore writing anything, the skill collects context from:
nonoise.config.json — project name, stack, templatedocs/architecture/01-constraints.md and any ADRs (docs/architecture/02-*.md …) — the source of truthdocs/prd/<area>/ — only PRDs with status: validated in frontmatter. Skip draft and rejected.docs/sprints/Sprint-N/sprint-manifest.md if present — component-level breakdown hintsworkspace.dsl at the resolved target folder (see "Output location" above) if present — never overwrite blindly, always diff and propose changesdocs/support/reverse/<subject-slug>/00-overview.md / 01-*.md — they are the source of truth for the as-is modelIf the resolved mode is default and docs/architecture/ is empty, stop and tell the user to run the arch workflow first (arch-brainstorm → arch-decision). In reverse mode the pre-req is a populated reverse dossier, not docs/architecture/.
Each phase is a checkpoint. Ask for confirmation before the next one. Polly-style: one question at a time, never dump the full plan.
nonoise.config.json — extract projectName, template, aiToolsdocs/architecture/*.md — record which constraints/ADRs exist (also in reverse mode, for later cross-links)docs/prd/*/ — filter status: validated onlydocs/support/reverse/<subject-slug>/ — record which chapters exist<resolved-target-folder>/workspace.dsl already existsFound:
- project: <projectName>
- mode: default | reverse(<subject-slug>)
- target folder: <resolved-target-folder>
- constraints: 01-constraints.md (+ N ADRs)
- validated PRDs: 3 (user-signup/01-email-otp, notifications/02-pubsub, …)
- reverse chapters (if reverse mode): 00-overview.md, 01-modules.md, …
- existing workspace.dsl: yes, last modified <date>
Ask: "Proceed to propose model updates?" Wait for confirmation.
Walk the architect through the model dimensions, one question at a time. Do not write to workspace.dsl during this phase — accumulate the proposed changes in working memory first.
Canonical question set — ask only the ones that are unclear from the discovered material:
nonoise.config.json projectName. Ask only if the architect wants a different display name (e.g. code name vs product name).docs/requirements/<domain>/ personas. Ask: "I see these user roles: . Are any missing or should any be merged?"docs/calls/ mentions. Ask: "External systems this app talks to? I see mentioned in ADRs."docs/architecture/ "components" / "services" sections and the validated PRDs. Ask one at a time: "Container X — purpose, tech, one-line description?"A -> B: what does A send to B, and over what protocol?"Phase 2 output = a proposal diff printed to the chat:
Proposed DSL changes:
+ person "Compliance Officer"
+ container "ms-auth" ".NET" "Authentication service"
~ container "bff" tech updated from ".NET 8" to ".NET 10"
- container "legacy-worker" (removed — superseded by ms-notifications per PRD 02-pubsub)
Ask: "Apply this diff to workspace.dsl?" Wait for confirmation.
All paths below are relative to the resolved target folder from Phase 1 (see "Output location").
<resolved-target-folder>/workspace.dsl does not exist: render assets/workspace.dsl.template with {{projectName}} replaced (in reverse mode, prefer <subject-slug> or the dossier's title as the workspace name), then layer the Phase 2 proposals on top. Create the folder if missing.views block that contains at least:
systemContext viewsystemLandscape view (if there are external systems)container view per software systemworkspace { model { … } views { … } }), and naming uniqueness. If in doubt, tell the user to run structurizr-cli validate -workspace <resolved-target-folder>/workspace.dsl (install info in references/install-structurizr-cli.md).The skill does not run Structurizr CLI itself (framework rule: no auto-install of third-party tooling, see references/install-structurizr-cli.md). Instead, it prints the exact commands the user runs. In the snippets below, substitute <TARGET> with the resolved target folder from Phase 1 — e.g. docs/architecture/c4 (default mode) or docs/support/reverse/legacy-billing/c4 (reverse mode):
# Option A — local CLI (recommended for dev loop)
structurizr-cli export -workspace <TARGET>/workspace.dsl \
-format mermaid \
-output <TARGET>/rendered
# Option B — one-shot docker (no install)
docker run --rm -v "$PWD:/usr/local/structurizr" structurizr/cli \
export -workspace /usr/local/structurizr/<TARGET>/workspace.dsl \
-format mermaid \
-output /usr/local/structurizr/<TARGET>/rendered
# Optional — PlantUML in addition to Mermaid
structurizr-cli export -workspace <TARGET>/workspace.dsl \
-format plantuml \
-output <TARGET>/rendered
Expected output layout (example — default mode):
docs/architecture/c4/
workspace.dsl (the single source)
rendered/
structurizr-SystemContext.md (Mermaid)
structurizr-Container.md (Mermaid)
structurizr-Component-<name>.md (Mermaid, if Component views declared)
structurizr-SignupSequence.md (Mermaid dynamic view)
*.puml (PlantUML — if Option C ran)
CHANGELOG.md
In reverse mode, the same layout is nested under docs/support/reverse/<subject-slug>/c4/ and sits next to 00-overview.md, 01-*.md, etc.
If the user prefers PNG / SVG directly, Structurizr Lite in docker can render to a browser at http://localhost:8080:
docker run -it --rm -p 8080:8080 -v "$PWD/<TARGET>:/usr/local/structurizr" structurizr/lite
Tell the user, don't run it.
Append to <resolved-target-folder>/CHANGELOG.md a dated entry (i.e. docs/architecture/c4/CHANGELOG.md in default mode, or docs/support/reverse/<subject-slug>/c4/CHANGELOG.md in reverse mode — never the project-wide one when we're in reverse). Create the file if absent. Template:
## YYYY-MM-DD — <headline>
- Triggered by: <which ADR / PRD / manual run>
- Added: <new containers / actors / external systems>
- Changed: <modified tech / renamed / relocated>
- Removed: <deleted containers or relations>
- Views affected: <systemContext | container | component-<x> | dynamic-<name>>
- Rendered formats: <mermaid | plantuml | both>
Keep entries terse — one bullet per change, one paragraph max. The changelog is for humans scanning the history, not for CI machines.
Print a block like this at the end (paths reflect the resolved target folder):
C4 workspace updated.
mode : default | reverse(<subject-slug>)
source : <resolved-target-folder>/workspace.dsl
changelog: <resolved-target-folder>/CHANGELOG.md (+1 entry)
next : run `structurizr-cli export ...` (see Phase 4) to regenerate views
tracker : triggered by <arch-decision PASS on docs/prd/... | reverse dossier docs/support/reverse/<slug>/ | manual>
Return control to Polly (or to the user directly if invoked standalone). Do not invoke sprint-manifest — that's a separate decision.
If the user aborts at Phase 2 (e.g. one question too many), save no state. Next time the skill runs it re-reads the architecture and starts fresh. The DSL file on disk is the only persistent state.
workspace.dsl — always diff and confirm. Architects may have hand-edited styling, tags, or custom views.draft PRDs — only validated PRDs inform the diagrams. Draft architecture is not ground truth.arch-decision from here — wrong direction. This skill is downstream of validation, not upstream.workspace.dsl. Do not scatter DSL across per-area files. If the project is a monorepo with multiple independent systems, use multiple softwareSystem blocks inside one workspace.docs/architecture/c4/ while a reverse session is active — this is the bug the "Output location" section prevents. When Polly engaged this skill from the reverse phase, the C4 belongs with the dossier (docs/support/reverse/<slug>/c4/). Putting it under docs/architecture/c4/ overwrites the green-field placeholder and conflates the as-is model with the target architecture. Always resolve the mode in Phase 1.docs/architecture/ yet → run arch-brainstorm + arch-decision firstdocs/support/reverse/<subject-slug>/ has no 00-overview.md yet → run reverse-engineering first to build the dossierarch-decision's jobreferences/structurizr-dsl-cheatsheet.md — the DSL patterns you will use 95% of the timereferences/install-structurizr-cli.md — how the user installs the CLI (advisor-only)references/c4-levels-primer.md — what Context/Container/Component/Code mean, mapped to NONoise inputsassets/workspace.dsl.template — scaffold used when no workspace.dsl exists yetarch-decision — the upstream validator; its "Impact on docs/architecture/" checklist should mention this skillarch-brainstorm — produces the PRDs this skill readsreverse-engineering — produces the legacy dossier whose C4 lands under docs/support/reverse/<slug>/c4/ (reverse mode)polly — the orchestrator; engages this skill after arch-decision PASS or from a reverse sessionWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub russosalv/nonoise --plugin nonoise27 skills in this plugin
/arch-brainstormDialogic architectural brainstorming skill. Helps an architect study how to implement something starting from just an area name, exploring the existing codebase, reading the project's source of truth at `docs/architecture/` plus `docs/requirements/` and `docs/calls/`, and producing a narrative PRD (story of the decision, inline Mermaid diagrams, explicit anti-scope) under `docs/prd/<area>/`. USE AS STEP 1 of the end-to-end architectural workflow — brainstorm → arch-decision (Haft FPF validation via `quint-fpf`) → sprint-manifest (promotion to sprint). Triggers — "I want to study how to implement X", "how should we handle Y", "brainstorm on area Z", "open a PRD for W", "arch-brainstorm area <slug>". Also triggers without explicit mention when the user is defining a new architectural work area from scratch and wants to think it through together./arch-decisionValidate an existing draft PRD through Haft ProblemCard, solution variants and parity comparison, then route the operator's explicit Phase 5.5 choice through h-decide and project the result into PRD frontmatter. Use for architectural PRD validation when the FPF gate fires; otherwise records a lightweight decision in the PRD with no Haft run. Creates no duplicate FPF audit register.Other plugins' skills for the same job