skills/architecture-docs/SKILL.md
TRIGGERS for Workflow 10 (Release Architecture Version) — invoke this skill FIRST, do not plan or ask clarifying questions, when user says any of: 'release my architecture', 'release architecture', 'release architecture version', 'publish architecture', 'ship architecture', 'tag architecture version', 'freeze architecture', 'bump architecture version', 'finalize architecture' — these route here, NOT to architecture-docs-export (which only produces Word .docx files). Also use this skill for: creating/updating/maintaining ARCHITECTURE.md, generating Mermaid / C4 diagrams (Workflow 8), migrating to docs/ multi-file layout (Workflow 9), validating/auditing architecture (BIAN, META, standards), answering questions about documented components, data structures, integrations, security, performance, deployment, technology stack, or architectural decisions.
npx skillsauth add shadowx4fox/solutions-architect-skills architecture-docsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides comprehensive guidelines for creating and maintaining ARCHITECTURE.md files using the standardized template from ARCHITECTURE_DOCUMENTATION_GUIDE.md. It enforces consistency across all documentation sections through the Foundational Context Anchor Protocol — a dependency-aware editing workflow that loads required upstream context before any downstream section edit, requires source attribution for derived claims, and detects downstream impact when any section changes.
Internal section numbers (S1-S13) and file prefix numbers (01-11) are independent and do NOT align.
| Internal Section | Name | File |
|---|---|---|
| S1+S2 | Executive Summary + System Overview | docs/01-system-overview.md |
| S3 | Architecture Principles | docs/02-architecture-principles.md |
| S4 | Architecture Layers | docs/03-architecture-layers.md |
| S5 | Component Details | docs/components/ |
| S6 | Data Flow Patterns | docs/04-data-flow-patterns.md |
| S7 | Integration Points | docs/05-integration-points.md |
| S8 | Technology Stack | docs/06-technology-stack.md |
| S9 | Security Architecture | docs/07-security-architecture.md |
| S10 | Scalability & Performance | docs/08-scalability-and-performance.md |
| S11 | Operational Considerations | docs/09-operational-considerations.md |
| S12 | ADRs | adr/ directory |
| S13 | Risks and Technical Debt | docs/10-risks-and-technical-debt.md |
Rules:
docs/07-security-architecture.md, NOT docs/09-*docs/09-operational-considerations.md = S11, not Section 9NN equals section number Ndocs/10-references.md with no docs/10-risks-and-technical-debt.md. Any workflow operating on an existing multi-file project MUST run Workflow 11 (Layout Migration Gate) as a preflight before proceeding.Automatically activate when:
On any invocation of this skill, if ARCHITECTURE.md contains a <!-- ARCHITECTURE_VERSION: --> comment AND the project is under git:
git tag -l 'architecture-v*' --sort=-version:refname | head -1 to get the latest architecture-v* tagℹ️ Architecture v{doc} is not tagged in git. Run Workflow 10 (Release Architecture Version) to publish a tag.⚠️ Architecture tag architecture-v{tag} exists in git but the doc shows v{doc}. Possible regression — verify before committing.Drift detection is informational only — it does not block other workflows. See RELEASE_WORKFLOW.md → "Drift Detection" for full details.
This skill automatically activates when users ask questions about documented architecture, including:
Reference Patterns:
Technical Query Keywords:
Multi-section Queries:
Do NOT activate for (redirect to the correct skill):
architecture-traceability skillarchitecture-component-guardian skillarchitecture-peer-review skillarchitecture-compliance skillComponent Operations Delegation Rule:
All structural operations on docs/components/ MUST delegate to architecture-component-guardian:
docs/components/README.md → delegate to guardian (sync action)migrate action)IMPORTANT: Immediately upon skill invocation, analyze the user's request to detect their intent.
Check the user's original message (before /architecture-docs was invoked) for these patterns:
Triggers:
Action when detected:
Scope clarification: Workflow 8 is for regenerating, updating, or auditing diagrams on an existing ARCHITECTURE.md. It is NOT how new architectures get their first diagrams — Workflow 1 (initial creation) auto-runs diagram generation as Step 7 (Mandatory Diagram Generation) and will not complete until the BLOCKING DIAGRAMS_GATE in Step 7.3 passes. If the user is creating a new architecture, route to Workflow 1, not Workflow 8.
Triggers:
Action when detected:
Triggers:
Action when detected:
RELEASE_WORKFLOW.md for the full procedureIf the user's request matches other documented workflows (1-10), follow their respective trigger patterns.
Note: Workflow 1 (new ARCHITECTURE.md creation) starts at Step 0 (PO Spec prerequisite check), then Step 0.3 (Enterprise Alignment Gate — MANDATORY, no skip) verifies ENTERPRISE_ALIGNMENT.md exists at the project root and blocks otherwise (directing the user to /sa-skills:architecture-enterprise-alignment; cascading-skip when PO Spec was skipped), then Step 0.5 (ADR pre-identification) establishes the ADR Context Block — a list of ADR candidates derived from PO Spec analysis that is maintained through all creation steps for decision consistency. Workflow 1 always concludes with Step 7 (Mandatory Diagram Generation), which produces the 4 standard diagrams (Logical View ASCII, C4 L1, C4 L2, Detailed View) into docs/03-architecture-layers.md and a mode-aware set of sequence diagrams into docs/04-data-flow-patterns.md: in Phase Catalog mode (default — see ARCHITECTURE_DOCUMENTATION_GUIDE.md → Section 6 → "Mode selection") one sequenceDiagram per phase H4 in ## Phase Catalog plus one full wire sequence per UC in ## End-to-End Wire Sequences; in Single-Flow mode (legacy fallback) one sequenceDiagram per ### [Flow Name] Flow H3. Step 7.3 is a BLOCKING audit gate (DIAGRAMS_GATE) — Workflow 1 does NOT print ✅ Architecture creation complete until every mandatory diagram is verified present and Pre-Write-Validation-clean. There is no SKIP DIAGRAMS override. See ARCHITECTURE_TYPE_SELECTION_WORKFLOW.md for the full flow and examples/04-data-flow-patterns.example.md for a Phase Catalog mode reference.
If the user's request doesn't match any workflow triggers:
This skill ships with several large reference guides that are loaded only when the matching workflow fires, never speculatively. Each guide is 350–2,000 lines; loading one outside its trigger consumes Opus context unnecessarily and invalidates downstream prompt-cache prefixes when the user later switches workflows.
| Guide | Size (lines) | Triggering workflow / signal |
|---|---|---|
| ARCHITECTURE_DOCUMENTATION_GUIDE.md | ~2,009 | Workflow 1 (new ARCHITECTURE.md), section editing requiring template structure |
| ARCHITECTURE_TYPE_SELECTION_WORKFLOW.md | ~1,200 | Workflow 1 Step 0 (PO Spec gate) + Step 0.3 (Enterprise Alignment gate, MANDATORY) + type selection |
| MERMAID_DIAGRAMS_GUIDE.md | ~1,024 | Workflow 8 (diagram generation) |
| references/DIAGRAM-GENERATION-GUIDE.md | ~743 | Workflow 8 (diagram generation) |
| RELEASE_WORKFLOW.md | ~687 | Workflow 10 (release) — also for the drift-detection text deep-dive |
| QUERY_SECTION_MAPPING.md | ~650 | Workflow 7 (informational query) when section mapping is needed |
| DESIGN_DRIVER_CALCULATIONS.md | ~593 | "calculate / update design drivers", "architecture review" Design Drivers branch |
| PRINCIPLE_VALIDATION.md | ~474 | Section 3 Enforcement Gate — every write to docs/02-architecture-principles.md |
| METRIC_CALCULATIONS.md | ~350 | Section 1 Key Metrics edits, "verify metrics", "audit metrics" |
| RESTRUCTURING_GUIDE.md | ~146 | Workflow 9 (multi-file migration) |
| references/{TYPE}-ARCHITECTURE.md + {TYPE}-TO-C4-TRANSLATION.md | ~400–1,000 each | Workflow 1 type selection (load only the chosen type's pair) |
Rules:
MICROSERVICES, BIAN, META, 3-TIER, N-LAYER), load only the pair that matches the architecture's <!-- ARCHITECTURE_TYPE: --> value — never load all five.PRINCIPLE_VALIDATION.md is the only large guide loaded mid-edit (Layer 1); the Layer 2 sub-agent loads the foundational architecture files separately and is invoked via the Agent tool, so its reads do not pollute the orchestrator's context.This contract is what keeps the orchestrator's main-session context narrow enough that SKILL.md + the active workflow's guides fit in cache; speculative pre-loads would burst the working set and force prefix re-evaluation on every tool call.
IMPORTANT: All architecture documentation uses the multi-file docs/ structure.
ARCHITECTURE.md at the project root is the navigation index only (~130 lines)docs/ as numbered Markdown filesdocs/components/ — one file per componentFile naming pattern: NN-kebab-case-name.md — lowercase, hyphens only, no spaces, no uppercase, no underscores.
docs/01-system-overview.md, docs/06-technology-stack.mddocs/components/01-api-gateway.md, docs/components/02-payment-service.mdSee RESTRUCTURING_GUIDE.md for the full directory structure and naming conventions.
ARCHITECTURE.md — always at the project rootdocs/ — always at the project root (sibling to ARCHITECTURE.md)docs/components/ — inside docs/ARCHITECTURE.md + docs/IMPORTANT: The multi-file structure makes context loading simple — individual docs/ files are 50–400 lines each (full file fits in context). No line-offset tricks needed.
Find the target section
ARCHITECTURE.md navigation table to identify which docs/NN-name.md file contains the target sectiondocs/07-security-architecture.mdLoad Context Anchor (REQUIRED for downstream sections)
docs/02-architecture-principles.md):
skills/architecture-docs/PRINCIPLE_VALIDATION.md and execute every rule in order. Each rule's report MUST quote its grep output verbatim — a finding without quoted output is treated as FAIL (anti-self-attestation). Emit the PRINCIPLE_VALIDATION_REPORT block at the end. If any BLOCKING finding, regenerate docs/02-architecture-principles.md per the recommendations and re-run from rule 1. Increment round counter.agents/reviewers/principle-quality-reviewer.md with the appropriate mode (first-write for new docs; edit-delta for edits). Pass principles_file, arch_type (read from <!-- ARCHITECTURE_TYPE: --> in docs/03-architecture-layers.md), system_overview_file, arch_layers_file, tech_stack_file, adr_index_glob, round. If status: FAIL with BLOCKING findings, regenerate per recommendations and re-run from Layer 1.grep: command not found): treat as fail-closed → escalate immediately. The user fixes the environment or overrides.docs/01-system-overview.md only, or for typo/formatting-only fixesdocs/02-architecture-principles.md: load docs/01-system-overview.md, docs/03-architecture-layers.md, docs/06-technology-stack.md, and the ADR index BEFORE editing — the Section 3 Enforcement Gate above runs after the editdocs/03-architecture-layers.md through docs/09-operational-considerations.md, or any docs/components/*.md filedocs/01-system-overview.md + docs/02-architecture-principles.mdARCHITECTURE.md navigation table against target section keywords; load matched ADRsRead the entire target file
docs/ files are small enough to read in fullRead(file_path="docs/07-security-architecture.md") — no offset/limit neededEdit the target file directly
docs/NN-name.md file(see [Key Metrics](01-system-overview.md#key-metrics))per [ADR-NNN](../adr/ADR-NNN-title.md)per [Principle Name](02-architecture-principles.md#anchor)<!-- TODO: Add source reference --> markerPost-Write Alignment & Traceability Audit
<!-- TODO: Add source reference --> markers → count and report5.5. Downstream Documentation Propagation
Runs immediately after the Post-Write Alignment Audit passes. Detects downstream files whose content may be stale due to the edit and offers to update them.
Run when: The edit changed substantive content — metrics, technology names, component names, architectural patterns, constraints, requirements, or interface definitions.
Skip silently when: The edit was cosmetic — typo fixes, formatting, grammar, markdown structure, comment updates, <!-- TODO --> markers, or source attribution links. Heuristic: if the diff contains only whitespace/punctuation/link/formatting changes with no word-level changes to technical terms, skip entirely.
Anti-recursion rule: Propagation updates (Phase 3 edits) do NOT re-trigger Step 5.5.
| Edited Section | File | Downstream Section Files |
|---|---|---|
| S1+S2 (System Overview) | docs/01-system-overview.md | ALL sections (S4–S11) + docs/components/* |
| S3 (Principles) | docs/02-architecture-principles.md | ALL sections (S4–S11) + docs/components/* |
| S4 (Layers) | docs/03-architecture-layers.md | S5 (docs/components/*), S8 (docs/06-technology-stack.md) |
| S5 (Components) | docs/components/*.md | S6 (docs/04-data-flow-patterns.md), S7 (docs/05-integration-points.md), S8 (docs/06-technology-stack.md), S9 (docs/07-security-architecture.md), S10 (docs/08-scalability-and-performance.md), S11 (docs/09-operational-considerations.md), Refs (docs/11-references.md), + S3 semantic re-check (Phase 1.5 — invoke principle-quality-reviewer in mode: downstream-impact with downstream_file = docs/02-architecture-principles.md; flag any principle whose Implementation/Trade-offs the new component contradicts) |
| S6 (Data Flow) | docs/04-data-flow-patterns.md | (leaf — no downstream sections) |
| S7 (Integration) | docs/05-integration-points.md | S9 (docs/07-security-architecture.md) |
| S8 (Tech Stack) | docs/06-technology-stack.md | S9 (docs/07-security-architecture.md), S10 (docs/08-scalability-and-performance.md), S11 (docs/09-operational-considerations.md), Refs (docs/11-references.md) |
| S9 (Security) | docs/07-security-architecture.md | (leaf) |
| S10 (Scalability) | docs/08-scalability-and-performance.md | S11 (docs/09-operational-considerations.md) |
| S11 (Operations) | docs/09-operational-considerations.md | (leaf) |
| S12 (ADRs) | ARCHITECTURE.md (navigation table) | adr/ directory → delegate to /skill architecture-definition-record, Refs (docs/11-references.md) |
| S13 (Risks & Technical Debt) | docs/10-risks-and-technical-debt.md | (leaf — full TDRs live at /tdr/ and are managed by the technical-debt-records skill) |
Cross-cutting (always scanned regardless of table): docs/components/, handoffs/, docs/11-references.md
docs/11-references.md) propagationdocs/11-references.md is a cross-cutting file that aggregates links from multiple sections. It MUST be included in the downstream scan when any of these change:
| Change Type | What to update in 10-references.md |
|---|---|
| ADR added, removed, renamed, or status changed (adr/*.md) | ADR index table — add/remove/rename row, update status |
| New technology in S5 components or S8 tech stack | Technology documentation links — add official doc URL |
| Technology removed or replaced | Technology documentation links — remove or replace entry |
| New glossary-worthy term introduced in any section | Glossary — add definition |
When 10-references.md is flagged for update during Phase 2 (Generate Checklist), present specific sub-items showing which table(s) need updating (ADR index, technology links, glossary).
When the edited file is ARCHITECTURE.md and the edit added or modified rows in the Section 12 ADR table:
| [ADR-NNN](...) | ... |adr/ADR-NNN-slug.md already exists/skill architecture-definition-record with context:
adr/ADR-NNN-slug.md already exists — skippedAfter ADR file creation (or skip), always update docs/11-references.md:
This rule runs instead of the standard Phase 1–3 propagation for S12 changes. ADR table changes do not trigger downstream section updates — they trigger ADR file creation and references update.
1a. Fact-delta extraction — Compare the file content before and after the edit. Produce a concrete bullet list of what changed (e.g., "Database: PostgreSQL → CockroachDB", "Added: Redis caching layer", "Removed: legacy SOAP endpoint"). If zero substantive deltas → skip propagation entirely.
1b. Structural dependency scan — Look up the edited section in the reverse dependency table above. Collect all downstream section files.
1c. Cross-reference scan — Grep across docs/, docs/components/, handoffs/ for explicit references to the edited filename (links, section anchors, (see [...](...))).
grep -rl "{edited_filename}" docs/ docs/components/ handoffs/ 2>/dev/null
1d. Handoff scan — For each fact-delta keyword (component names, technology names, pattern names), grep handoffs/ for matching terms.
1e. Merge and deduplicate — Combine results from 1b+1c+1d. Remove duplicates and remove the edited file itself.
Runs only when the edited file is docs/02-architecture-principles.md AND Phase 1a's fact-delta extraction reported substantive word-level changes in any of {Description, Implementation, Trade-offs} subsections.
Trigger gate — skip Phase 1.5 silently when:
Audit procedure when the gate fires:
Extract per-principle deltas from the diff. For each principle that changed, capture:
principleNumber, principleNameprincipleName of every changed principle.ADR-NNN token (regex ADR-\d{3}) that appears in either the before-text or the after-text of changed Description / Implementation / Trade-offs subsections.docs/06-technology-stack.md (i.e., a tech this system actually uses). Intersecting with the tech stack avoids matching English words that happen to be tech-name-shaped. Compare case-insensitive on whole-token boundaries.This token set powers the pruning step below; if the set ends up empty (e.g., the diff only rephrased Description prose with no concrete principle names, ADR IDs, or system-tech tokens) the fall-back is conservative — fan out to all candidates without pruning.
Pre-fan-out pruning — Token-grep each candidate downstream file against the token set from step 1 to drop files with zero references to anything that changed. The reviewer is Opus and the median S3 edit touches one principle's Implementation, so most downstream files don't even mention the changed content. Skipping them on the basis of a cheap structural grep avoids spending Opus on guaranteed NO_IMPACT verdicts.
Candidate set = the reverse dependency files for S3 (S4–S11 + every docs/components/**/*.md listed in docs/components/README.md).
Pruning rule (per candidate file):
grep -liE 'Principle Name 1|Principle Name 4|ADR-005|ADR-012|Spring Boot|PostgreSQL|Redis' \
docs/03-architecture-layers.md docs/04-data-flow-patterns.md \
docs/05-integration-points.md docs/06-technology-stack.md \
docs/07-security-architecture.md docs/08-scalability-and-performance.md \
docs/09-operational-considerations.md docs/components/*.md
ℹ️ {file} — no token references to changed principles, cited ADRs, or affected tech; semantic review skipped (Phase 1.5 pruning).
Empty kept-set after pruning — when zero candidate files token-match (and the token set was non-empty, so the prune was real), emit one consolidated Phase 2 note ("Principle Alignment Audit: no downstream files reference any of the changed principles, cited ADRs, or affected tech — nothing to review.") and skip steps 3–6 of this Audit procedure. Phase 2 still runs with the structural impact list from Phase 1b–1d.
Fail-open — if grep is unavailable or returns an unexpected error, emit a one-line Phase 2 warning ("Phase 1.5 pruning unavailable; fanned out to the full candidate set") and fall through to step 3 with all candidates kept. Pruning is an optimization, not a gate.
Why this is recall-safe — the token set includes principle names AND cited ADR IDs AND affected tech, all three. Most "implicit contradiction" cases (a downstream file paraphrases a principle without naming it) still surface because the file usually mentions either the cited ADR or the affected tech. The conservative empty-set fallback covers the long tail (pure prose changes with no concrete tokens).
Fan out to principle-quality-reviewer in mode: downstream-impact. The orchestrator MUST construct the sub-agent prompt using the stable-prefix → dynamic-suffix template below so parallel calls in the same batch share the maximum cacheable prefix (Anthropic prompt cache hits on byte-identical prefixes within the 5-min TTL).
Read-once foundational context. Before dispatching any sub-agent in this fan-out, read the four foundational files once in the orchestrator's session and capture their content. The five blocks below are byte-identical across every sub-agent call in the fan-out, so inlining them lets calls 2..N hit the prompt cache for the entire prefix instead of each agent re-Reading the same files independently:
docs/02-architecture-principles.md (post-edit) → <principles> blockdocs/01-system-overview.md → <system_overview> blockdocs/03-architecture-layers.md → <arch_layers> blockdocs/06-technology-stack.md → <tech_stack> blockGlob('adr/*.md') ID list (one ADR-NNN per line, sorted) → <adr_index> block (the IDs alone — bodies are not needed for existence checks)Prompt template — positional, order must not change. Lines above the marker are stable across the batch; only downstream_file (last line) differs per call:
mode: downstream-impact
round: <int>
arch_type: <MICROSERVICES|META|BIAN|3-TIER|N-LAYER|unknown>
principles_file: docs/02-architecture-principles.md
principles_diff: |
<per-principle deltas from step 1, identical for every call in this batch>
<principles>
{full content of docs/02-architecture-principles.md (post-edit)}
</principles>
<system_overview>
{full content of docs/01-system-overview.md}
</system_overview>
<arch_layers>
{full content of docs/03-architecture-layers.md}
</arch_layers>
<tech_stack>
{full content of docs/06-technology-stack.md}
</tech_stack>
<adr_index>
{one ADR-NNN id per line, sorted}
</adr_index>
# === Stable prefix ends here. Only the line below differs per call. ===
downstream_file: {absolute path to the specific downstream file under audit}
The agent's Step 1 consumes the five inlined blocks directly — it does NOT re-Read the four foundational files when the blocks are present. See agents/reviewers/principle-quality-reviewer.md Step 1 (Inlined-blocks fast path) for the consumption contract.
Why the order matters: Anthropic's prompt cache is a prefix matcher. Any per-call discriminator above the marker would split the cache and force every parallel call to be a cache miss. Keep downstream_file as the LAST line; keep principles_diff and the five inlined blocks above it; keep them in the order shown so all calls in the batch share a byte-identical prefix.
Backward compatibility: when running the reviewer outside this orchestrator (e.g., direct invocation, older callers), the agent still accepts path-only inputs and falls back to Read / Glob. The path parameters (system_overview_file, arch_layers_file, tech_stack_file, adr_index_glob) remain in the prompt as fallback values; they are ignored when the inlined blocks are present.
Parallelism: dispatch in batches of 4 (mirrors v3.16.0 explorer fan-out pattern). Wait for each batch before starting the next.
Cache-warm sequencing (first batch only): in the FIRST batch of any Phase 1.5 fan-out, fire one sub-agent call first and wait for its response to settle before firing the remaining 1–3 calls in parallel. The first call's response writes the byte-identical stable prefix (the five inlined blocks above) into Anthropic's prompt cache; the remaining calls in that batch — and every call in every subsequent batch within the 5-min cache TTL — read the prefix from cache instead of re-paying it. After the first batch completes, dispatch subsequent batches normally (full parallel of 4); the cache is already warm.
The latency cost is one extra serialized call (~30–60s) paid only on the first batch of each Phase 1.5 fan-out. For typical S3 edits where step 2 pruning leaves 2–4 candidate files, this adds < 1 minute of wall-clock time. For wider fan-outs (8+ files post-pruning) the savings compound across batches because each non-first batch hits cache for the full prefix instead of re-writing it.
Aggregate results — each sub-agent returns one of:
status: PASS with findings: [] and a finding checkType: downstream-impact, severity: NO_IMPACT → file unaffected; no action.status: PASS with WARNING findings → surface in Phase 2 checklist as [principle-impact] items but don't block.status: FAIL with BLOCKING findings → file contradicts a changed principle; surface in Phase 2 checklist as [principle-impact-BLOCKING] items requiring user review.Fail-open clauses:
{file} — principle alignment review unavailable; manual review required"). Do not block./skill architecture-peer-review after edits land if reliability matters for this change.") and proceed to standard Phase 2 with structural impacts only.Inject findings into Phase 2 checklist — semantic findings appear as a dedicated subsection labeled "Principle Alignment Findings" between the structural impact list and the "Approve all?" prompt. Pruning notes from step 2 (skipped files) appear in the same subsection under a "Skipped (no token references)" sub-heading so the user retains visibility into what was deliberately not reviewed. User can approve / deselect / skip per file (same UX as structural impacts).
Anti-recursion: Phase 1.5 sub-agent calls do NOT trigger another Phase 1.5 invocation when their findings translate into Phase 3 edits.
Present a structured checklist grouped by file type:
═══════════════════════════════════════════════════════════
DOWNSTREAM UPDATES REQUIRED — {edited_file} ({section_name})
═══════════════════════════════════════════════════════════
Changes detected:
- {bullet list from Phase 1a}
─── Downstream Sections ──────────────────────────────────
[ ] 1. docs/07-security-architecture.md — references {changed_tech}; security controls may need updating
[ ] 2. docs/09-operational-considerations.md — mentions {old_value}; align with new value
─── Component Files ──────────────────────────────────────
[ ] 3. docs/components/03-payment-service.md — uses {changed_component}; integration details may be stale
─── Handoff Docs ─────────────────────────────────────────
[ ] 4. handoffs/03-payment-service-handoff.md — Section 4 references {old_tech}
─── No Updates Required ──────────────────────────────────
ℹ️ docs/04-data-flow-patterns.md — no references to changed content
═══════════════════════════════════════════════════════════
Approve all? ('all', comma-separated numbers to deselect, or 'skip')
Wait for user response before proceeding.
Process approved files in tier order (lower tiers first → higher tiers last) so each updated file is available as context for files that depend on it.
For each approved docs/*.md or docs/components/*.md file:
per [Section X](../...))[x]For approved handoffs/*.md files: Read, locate affected passages, update following the dev-handoff Documentation Fidelity Policy. Mark as [x].
If user selected skip: Add <!-- PROPAGATION PENDING: upstream {edited_file} changed ({date}) — downstream not yet updated --> comment at the top of the edited file.
When the edited file is docs/components/*.md (not a section file):
docs/ fileshandoffs/{component}-handoff.md if it existsdocs/components/README.md needs updating, delegate to the architecture-component-guardian skill═══════════════════════════════════════════════════════════
DOWNSTREAM PROPAGATION — COMPLETION REPORT
═══════════════════════════════════════════════════════════
Source: {edited_file} ({section_name})
Changes: {summary from Phase 1a}
Completed:
[x] docs/07-security-architecture.md — {what was updated}
[x] docs/components/03-payment-service.md — {what was updated}
Verified (no change needed):
✓ docs/08-scalability-and-performance.md — content still accurate
Deselected (manual update required):
[ ] docs/09-operational-considerations.md — user chose manual update
Failed (require manual review):
⚠️ {any files where edit could not be applied cleanly}
═══════════════════════════════════════════════════════════
Runs after: Phase 4 report is displayed.
Also runs when: User selected skip in Phase 2 and handoff files exist in handoffs/ — in this case, note that handoff text was also not updated.
Skip silently when: No handoffs/*.md files appeared in the Phase 3 update list (completed, deselected, or failed) AND propagation was not skipped.
Step 5a — Detect asset-impacting changes: Scan the fact-deltas from Phase 1a for asset-impact keywords (case-insensitive):
| Keywords | Potentially Stale Asset |
|----------|------------------------|
| API, endpoint, REST, GraphQL, gRPC, route, path, method, request, response, header, status code | openapi.yaml |
| database, table, column, schema, index, constraint, migration, DDL, SQL | ddl.sql |
| Redis, cache, key, TTL, expiration, eviction | redis-key-schema.md |
| deployment, container, pod, replica, port, resource, limit, CPU, memory, image, Kubernetes, K8s | deployment.yaml |
| message, event, topic, queue, consumer, producer, Kafka, RabbitMQ, stream | asyncapi.yaml |
| Avro, schema registry | schema.avsc |
| Protobuf, proto | schema.proto |
| cron, schedule, batch, job, CronJob | cronjob.yaml |
If no keywords match → skip this phase silently.
Step 5b — Identify affected components: For each handoffs/*-handoff.md file that was touched in Phase 3 (or would have been if propagation was skipped/deselected), check whether handoffs/assets/NN-<component-name>/ exists and contains any of the matched asset types. Exclude components with no asset directory or no matching asset files on disk.
If zero components remain after filtering → skip silently.
Step 5c — Present advisory:
───────────────────────────────────────────────────────────
ASSET REGENERATION ADVISORY
───────────────────────────────────────────────────────────
The propagation above updated handoff document text, but
the following scaffolded assets may now be stale:
Component: {component-name}
→ openapi.yaml (changes mention: endpoint, API)
→ ddl.sql (changes mention: table, column)
Component: {component-name-2}
→ deployment.yaml (changes mention: container, port)
These assets were generated by the dev-handoff skill and
contain structured specs derived from architecture docs.
In-place text patches do not regenerate them.
Would you like to regenerate handoff documents and assets
for the affected components?
[Yes] → I will provide the commands to run
[No] → No action needed right now
Note: You can regenerate all handoffs at any time with:
/skill architecture-dev-handoff
───────────────────────────────────────────────────────────
If propagation was skipped: prepend to the advisory:
Note: Propagation was skipped — handoff document text was also not updated. Full regeneration is recommended.
Wait for user response.
Run: /skill architecture-dev-handoff (for each affected component by name). Do NOT invoke the skill automatically.docs/ file to verify changesWhen the target section is not obvious, read ARCHITECTURE.md first:
# Step 1: Read navigation table
nav_content = Read(file_path="ARCHITECTURE.md")
# Step 2: Parse the Documentation table to find the target file
# Example row: | 8 | Security Architecture | [docs/07-security-architecture.md](docs/07-security-architecture.md) | ... |
# Step 3: Read that specific docs/ file in full
target_content = Read(file_path="docs/07-security-architecture.md")
When creating NEW component documentation (Workflow 1, Section 5), and the component's Technology field references specific frameworks, libraries, or tools, use the context7 MCP tool to fetch current documentation for those technologies.
Prerequisite: The context7 MCP tool must be available (resolve-library-id and get-library-docs functions). If not available, skip silently — component doc generation proceeds normally.
When to use:
Procedure:
Extract technology names from the component's Technology field (e.g., "Java 17, Spring Boot 3.1.5, PostgreSQL 15").
For each distinct technology, call resolve-library-id (e.g., spring-boot, postgresql, nestjs).
For each resolved library, call get-library-docs with a topic hint scoped to configuration patterns and version features for the documented version (e.g., "Spring Boot 3.1 actuator endpoints and configuration properties").
Present a Technology Context Brief to the user as an advisory checklist — do NOT auto-fill any document fields:
Technology Context Brief — [Component Name]
Spring Boot 3.1.5:
- Key config patterns: application.yml (spring.datasource.*, management.endpoints.*)
- Health check endpoints: /actuator/health (liveness), /actuator/health/readiness
- Suggested fields to document: connection pool settings, JPA dialect, security filter chain
PostgreSQL 15:
- Notable in v15: MERGE statement, improved JSON path, pg_walinspect
- Suggested fields to document: connection pool strategy (PgBouncer?), vacuum/autovacuum, extensions used
The architect decides which items to include in the component doc. The skill does NOT auto-populate any fields from this brief.
What this is NOT:
Update ARCHITECTURE.md only when:
docs/docs/components/Do NOT update ARCHITECTURE.md for content edits within existing docs/ files.
Full workflow for guiding users through architecture type selection (Banking/BIAN, Microservices, Monolith, etc.), the PO Spec prerequisite check, template loading, and diagram generation is in ARCHITECTURE_TYPE_SELECTION_WORKFLOW.md.
Read it when:
The workflow runs Steps 0–7 (PO Spec gate → type selection → template load → metadata → multi-file creation → ADR delegation → diagrams).
ADR operations: Any ADR creation, update, or supersede must delegate to /skill architecture-definition-record. This skill reads adr/*.md for context only.
Activate this workflow when:
Prerequisite: Step 0 (PO Spec check) runs before Step 1 for all new document creation triggers
Skip this workflow when:
See ARCHITECTURE_TYPE_SELECTION_WORKFLOW.md for full workflow details.
When to update the navigation index in ARCHITECTURE.md:
docs/NN-*.md file is addeddocs/NN-*.md file is renamed or removedarchitecture-component-guardian for docs/components/README.md)Do NOT update for:
docs/NN-*.md files (no line ranges to maintain)Workflow:
ls docs/*.md against the Documentation table in ARCHITECTURE.mdThe navigation index has no line numbers — each row links directly to a docs/NN-*.md file that is read in full when needed.
Full workflow and reference details are in METRIC_CALCULATIONS.md (Read it when this workflow is needed).
Quick summary: Automatically detects and reviews metric inconsistencies when Section 1 Key Metrics are updated, scanning the entire document for stale duplicates and presenting a structured audit report before applying changes.
When to invoke: After editing Section 1 Executive Summary Key Metrics, or when user requests "check metric consistency", "verify metrics", or "audit metrics".
Full workflow and reference details are in ARCHITECTURE_DOCUMENTATION_GUIDE.md (Read it when this workflow is needed).
Quick summary: Dependency-aware editing workflow that loads required upstream context (S1+S2, S3, ADRs, and section-specific parents) before any downstream section edit, requires source attribution for derived claims, and detects downstream impact when any section changes (executed via Step 5.5 Downstream Documentation Propagation).
When to invoke: Before editing any docs/ file from docs/03-architecture-layers.md through docs/09-operational-considerations.md, or any docs/components/*.md file.
Full workflow and reference details are in DESIGN_DRIVER_CALCULATIONS.md (Read it when this workflow is needed).
Quick summary: Automatically calculates and maintains Design Drivers impact metrics (Value Delivery, Scale, Impacts) from Sections 1, 2.3, 5, and 8, using a 6-phase workflow to extract data, present findings, and update Section 2.2.1.
When to invoke: When user requests "architecture review", "calculate design drivers", "update design drivers", or "assess design impact".
The references/ directory contains the architecture rules and C4 translation guides for each architecture type. These are loaded during Step 3 of the Architecture Type Selection Workflow.
| File | Purpose |
|------|---------|
| references/ICEPANEL-C4-MODEL.md | Governing C4 reference — defines C4 abstractions, diagram levels, boundary test. Constrains component documentation behavior. |
| references/MICROSERVICES-ARCHITECTURE.md | Microservices architecture rules and patterns |
| references/MICROSERVICES-TO-C4-TRANSLATION.md | Microservices → C4 mapping (services=containers, not systems) |
| references/3-TIER-ARCHITECTURE.md | 3-Tier architecture rules (Presentation, Logic, Data) |
| references/3-TIER-TO-C4-TRANSLATION.md | 3-Tier → C4 mapping (tier≠container distinction) |
| references/N-LAYER-ARCHITECTURE.md | N-Layer variants (DDD, Clean, Hexagonal, 5-Layer Extended) |
| references/N-LAYER-TO-C4-TRANSLATION.md | N-Layer → C4 mapping (inner layers=C3, infra=C2) |
| references/META-ARCHITECTURE.md | META 6-layer banking architecture rules |
| references/META-TO-C4-TRANSLATION.md | META → C4 mapping (layers as visual groupings at C2) |
| references/BIAN-ARCHITECTURE.md | BIAN V12.0 5-layer architecture rules |
| references/BIAN-TO-C4-TRANSLATION.md | BIAN → C4 mapping (Service Domains as containers) |
| references/DIAGRAM-GENERATION-GUIDE.md | Diagram generation reference — defines 4 standard architecture diagrams with type-specific templates for META, BIAN, 3-Tier, N-Layer, and Microservices. Includes C4 color conventions, Mermaid compatibility rules, and generation workflow. |
Critical rule: Every architecture type MUST have both reference docs. Types without them are greyed out in the selection menu and cannot be used.
Full workflow and reference details are in QUERY_SECTION_MAPPING.md (Read it when this workflow is needed).
Quick summary: Covers when and how to use ARCHITECTURE_DOCUMENTATION_GUIDE.md for creating, documenting, and maintaining architecture docs, the 9 required Architecture Principles, the 12 required section names with exact format, and the Workflow 7 Informational Query workflow for answering questions from architecture documentation.
When to invoke: When creating new architecture documents, documenting existing projects, maintaining architecture docs, or answering user questions about documented architecture content.
Two reference files (read both when this workflow is needed):
references/DIAGRAM-GENERATION-GUIDE.md — Primary generation reference: defines the 4 standard diagrams (Logical View ASCII, C4 L1 Context, C4 L2 Container, Detailed View Mermaid), architecture-type-specific templates for all 5 types (META, BIAN, 3-Tier, N-Layer, Microservices), data sources, C4 color conventions, Mermaid compatibility rules, and the generation workflow algorithm.MERMAID_DIAGRAMS_GUIDE.md — Authoring reference: Mermaid syntax patterns, component guidelines, data flow conventions, standard color scheme, common scenarios, and best practices.Quick summary: Generate all 4 standard diagrams in order (ASCII logical → C4 L1 → C4 L2 → Detailed) under ## Architecture Diagrams in docs/03-architecture-layers.md. Each diagram adapts its grouping, naming, and color conventions to the detected architecture type and theme preference (light/dark). Theme is detected from <!-- DIAGRAM_THEME: light|dark --> in docs/03-architecture-layers.md — if absent, ask the user once and persist. Dark theme applies %%{init: {'theme': 'dark'}}%% to C4/sequence diagrams and uses the dark classDef palette for the Detailed View. Data Flow sequence diagrams are generated separately in docs/04-data-flow-patterns.md. External diagram reconciliation, canonical location enforcement, and completeness audit rules apply.
When to invoke: When user requests "generate diagrams", "create diagrams", "add diagrams", "update diagrams", or references Mermaid/architecture/visual diagrams.
Full workflow and reference details are in RESTRUCTURING_GUIDE.md (Read it when this workflow is needed).
Quick summary: Covers migrating a monolithic ARCHITECTURE.md to the multi-file docs/ structure (6 steps: analyze, propose target layout, extract files, rewrite ARCHITECTURE.md as navigation index, update external references, verify), plus optional enhancements and reference document inventory.
When to invoke: When user mentions "migrate", "restructure", "split", "reorganize", or "convert" with "architecture" or "ARCHITECTURE.md", or when the file is "too large" or "hard to navigate".
Full workflow and reference details are in RELEASE_WORKFLOW.md (Read it when this workflow is needed).
Quick summary: Formal release of a new architecture version. Bumps the semver version, generates a docs/CHANGELOG.md entry from detected changes (new/modified components, accepted/superseded ADRs, section edits), updates version metadata across ARCHITECTURE.md and all component files, and creates an annotated git tag architecture-v{version} on HEAD (when repo is under git, working tree is clean). If the project is NOT under git, creates an immutable archive snapshot at archive/v{version}/ as the baseline mechanism; git projects can opt into the archive for audit compliance.
When to invoke: When user asks to "release architecture", "release architecture version", "bump architecture version", "freeze architecture", "tag architecture version", or transitions an architecture from Draft to Released status.
Preconditions:
ARCHITECTURE.md exists with <!-- ARCHITECTURE_VERSION: --> metadata blockarchitecture-v{new-version} tag must not already existDrift detection (informational, on every architecture-docs invocation): if doc version ≠ latest architecture-v* git tag, emit a one-line warning. Does not block other workflows. See RELEASE_WORKFLOW.md → "Drift Detection" for details.
Purpose: Migrate older multi-file docs/ layouts to the current numbering convention. Older versions of this skill placed References at docs/10-references.md (with no Risks & Technical Debt section). The current convention puts Risks & Technical Debt (S13) at docs/10-risks-and-technical-debt.md and shifts References to docs/11-references.md so the cross-cutting References file remains the highest-numbered file by convention.
Auto-trigger preflight: Every workflow that operates on an existing multi-file project (Workflows 2 / 3 / 8 / 10 and any informational query against docs/*.md) MUST run the detection check below before proceeding. New-project creation (Workflow 1) and the single-file → multi-file restructure (Workflow 9) emit the current layout directly and skip this gate.
When to invoke explicitly: User says "migrate layout", "upgrade architecture file numbering", "fix references file position", or any other workflow auto-fires the preflight.
Detection (legacy layout signature) — both conditions must hold:
docs/10-references.md exists, ANDdocs/10-risks-and-technical-debt.md does NOT existIf both true → legacy layout, run the steps below. Otherwise → current layout, exit with ℹ️ Layout already current — nothing to migrate.
Steps:
Confirm with user before any rename:
⚠️ Legacy layout detected: docs/10-references.md occupies the cross-cutting
"last file" slot, but the current convention reserves docs/10-* for
Risks & Technical Debt (S13) and shifts References to docs/11-*.
Migrate now? [Y/n]
If n → halt and emit a one-line skip note. The calling workflow does NOT proceed; the user must either re-run and accept, or invoke Workflow 11 explicitly later.
Rename References file: docs/10-references.md → docs/11-references.md.
git mv docs/10-references.md docs/11-references.mdmv docs/10-references.md docs/11-references.mdCreate Risks & Technical Debt file: write docs/10-risks-and-technical-debt.md from the Section 13 template in ARCHITECTURE_DOCUMENTATION_GUIDE.md (empty 13.1 Risks and 13.2 Technical Debt tables, plus the conventions block).
Rewrite internal cross-references: locate every link to docs/10-references.md across docs/, docs/components/, adr/, and ARCHITECTURE.md, then rewrite to docs/11-references.md.
grep -rl "docs/10-references" docs/ adr/ ARCHITECTURE.md 2>/dev/null \
| xargs -r sed -i 's|docs/10-references|docs/11-references|g'
Update the navigation table in ARCHITECTURE.md: locate the Documentation table (rows of the form | NN | <Section Name> | [docs/...](docs/...) | ... |) and:
docs/11-references.md| 13 | Risks and Technical Debt | [docs/10-risks-and-technical-debt.md](docs/10-risks-and-technical-debt.md) | ... | if S13 is not yet listedReport:
✅ Layout migrated:
- References: docs/10-references.md → docs/11-references.md
- Risks & Technical Debt: created docs/10-risks-and-technical-debt.md (empty Section 13 template)
- Internal links updated: {N} cross-references rewritten across {M} files
- Navigation table: updated in ARCHITECTURE.md
The calling workflow can now proceed.
Resume the original workflow (the one whose preflight detected the legacy layout). The user does NOT re-issue the original command — Workflow 11 hands control back automatically.
Idempotency: Workflow 11 is safe to re-run. After a successful migration the detection check returns false and the workflow exits with ℹ️ Layout already current — nothing to migrate.
Out of scope: this workflow does NOT alter section content, ADRs, component files, or version metadata. It is purely a file-renumber + S13 scaffold + cross-reference rewrite + navigation-table update.
development
Run risk and design-characteristics analyses over ARCHITECTURE.md documentation. Produces date-stamped reports in analysis/ covering ten lenses across two groups: HIGH-priority runtime/security — SPOF (single points of failure), Blast Radius (downstream cascade impact), Bottleneck (throughput chokepoints), Cost Hotspots (Pareto cost concentration), STRIDE (per-trust-boundary security threats); Strategic/sustainability — Vendor Lock-in (portability risk and exit cost), Latency Budget (per-hop SLO decomposition), Tech Debt/EOL (currency and deprecated tech), Coupling (fan-in/fan-out and cycles), Data Sensitivity (PII flow and encryption gaps). Each analysis can be requested individually, as a group, or all ten run in parallel. A consolidated Security Posture option (analysis 12) merges the STRIDE and Data Sensitivity reports into a single reviewer-fillable validation checklist of every security control to validate (markdown-only; exportable to a Word worksheet via architecture-docs-export). Output: analysis/<TYPE>-<YYYY-MM-DD>.md (default) OR analysis/<TYPE>-<YYYY-MM-DD>.html (interactive d3.js report; format is selected at runtime — Step 2.4). Requires ARCHITECTURE.md to exist (created by architecture-docs skill). Do NOT invoke for compliance contracts (use architecture-compliance), peer quality review (use architecture-peer-review), or ADR management (use architecture-definition-record).
development
On-demand export of architecture documents to professional Word (.docx) files. Exports are never automatic — invoke explicitly when ready to produce deliverables. Solution Architecture mode synthesizes an Executive Summary from docs/01-system-overview.md, the component index, and the compliance manifest (if present), then exports individual ADR docs. Handoff mode exports selected component development handoffs from handoffs/. Compliance mode exports selected compliance contracts from compliance-docs/. Security Posture mode exports the consolidated security validation checklist (analysis/SECURITY-POSTURE-<date>.md, from architecture-analysis) as a reviewer-fillable worksheet. IMPORTANT — this skill ONLY produces Word .docx files. It does NOT handle releasing, publishing, tagging, freezing, bumping, or finalizing an architecture version. For the Draft → Released lifecycle (git tag architecture-v{version}, archive snapshot, semver bump), use the `architecture-docs` skill (Workflow 10) instead. Do NOT invoke this skill when the user says "release my architecture", "release architecture", "publish architecture", "ship architecture", "tag architecture version", "freeze architecture", "bump architecture version", or "finalize architecture" — those route to `architecture-docs`.
testing
Generate Compliance Contracts (Contratos de Adherencia) from ARCHITECTURE.md files
testing
Use this skill whenever the user mentions deferred work, known compromises, shortcuts taken, "we'll fix this later," temporary workarounds, missing controls, or any architectural trade-off that should be made visible and tracked. Also trigger when arc42 Section 11 (Risks and Technical Debt) is being authored or updated, when a TDR / Technical Debt Record is requested by name, or when an ADR documents a decision that intentionally accepts debt. Do NOT use for general bug reports, feature requests, or backlog items — TDRs are for architectural or systemic compromises, not ordinary defects.