swe-workflow-skills 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +144 -0
  3. package/VERSION +1 -0
  4. package/bin/cli.mjs +44 -0
  5. package/catalog.json +225 -0
  6. package/commands/role.md +34 -0
  7. package/hooks/session-start.mjs +118 -0
  8. package/install.mjs +318 -0
  9. package/package.json +47 -0
  10. package/roles.json +194 -0
  11. package/scripts/resolve.mjs +296 -0
  12. package/skills/accessibility-design/SKILL.md +128 -0
  13. package/skills/accessibility-design/evals/evals.json +51 -0
  14. package/skills/accessibility-design/references/accessibility-patterns.md +321 -0
  15. package/skills/api-design/SKILL.md +144 -0
  16. package/skills/api-design/evals/evals.json +48 -0
  17. package/skills/api-design/references/rest-conventions.md +147 -0
  18. package/skills/api-design/templates/api-spec.md +156 -0
  19. package/skills/architecture-design/SKILL.md +86 -0
  20. package/skills/architecture-design/evals/evals.json +44 -0
  21. package/skills/architecture-design/references/clean-architecture.md +147 -0
  22. package/skills/architecture-design/references/component-principles.md +129 -0
  23. package/skills/architecture-design/references/principles.md +81 -0
  24. package/skills/architecture-design/references/solid-principles.md +106 -0
  25. package/skills/architecture-design/templates/adr.md +63 -0
  26. package/skills/architecture-documentation/SKILL.md +126 -0
  27. package/skills/architecture-documentation/evals/evals.json +44 -0
  28. package/skills/architecture-documentation/references/abstraction-levels.md +91 -0
  29. package/skills/architecture-documentation/references/diagram-tooling.md +141 -0
  30. package/skills/architecture-documentation/templates/architecture-doc.md +171 -0
  31. package/skills/bug-investigating/SKILL.md +133 -0
  32. package/skills/bug-investigating/evals/evals.json +56 -0
  33. package/skills/bug-investigating/references/common-bugs.md +62 -0
  34. package/skills/bug-investigating/references/debugging-patterns.md +94 -0
  35. package/skills/cicd-pipeline/SKILL.md +87 -0
  36. package/skills/cicd-pipeline/evals/evals.json +34 -0
  37. package/skills/cicd-pipeline/references/pipeline-patterns.md +206 -0
  38. package/skills/cicd-pipeline/templates/github-actions.md +206 -0
  39. package/skills/code-reviewing/SKILL.md +92 -0
  40. package/skills/code-reviewing/evals/evals.json +62 -0
  41. package/skills/code-reviewing/references/error-handling.md +108 -0
  42. package/skills/code-reviewing/references/review-checklist.md +144 -0
  43. package/skills/configuration-strategy/SKILL.md +109 -0
  44. package/skills/configuration-strategy/evals/evals.json +41 -0
  45. package/skills/configuration-strategy/references/config-patterns.md +161 -0
  46. package/skills/containerization/SKILL.md +90 -0
  47. package/skills/containerization/evals/evals.json +36 -0
  48. package/skills/containerization/references/dockerfile-patterns.md +168 -0
  49. package/skills/containerization/templates/dockerfile.md +154 -0
  50. package/skills/data-modeling/SKILL.md +83 -0
  51. package/skills/data-modeling/evals/evals.json +43 -0
  52. package/skills/data-modeling/references/conventions.md +57 -0
  53. package/skills/data-modeling/templates/schema.md +120 -0
  54. package/skills/dependency-impact-analysis/SKILL.md +113 -0
  55. package/skills/dependency-impact-analysis/evals/evals.json +41 -0
  56. package/skills/dependency-impact-analysis/references/impact-patterns.md +150 -0
  57. package/skills/dependency-management/SKILL.md +161 -0
  58. package/skills/dependency-management/evals/evals.json +48 -0
  59. package/skills/dependency-management/references/evaluation-checklist.md +127 -0
  60. package/skills/deployment-checklist/SKILL.md +132 -0
  61. package/skills/deployment-checklist/evals/evals.json +58 -0
  62. package/skills/deployment-checklist/references/pre-deploy-gates.md +91 -0
  63. package/skills/deployment-repo/SKILL.md +190 -0
  64. package/skills/deployment-repo/evals/evals.json +44 -0
  65. package/skills/deployment-repo/references/deployment-repo-patterns.md +258 -0
  66. package/skills/deployment-repo/references/version-compatibility.md +227 -0
  67. package/skills/deployment-repo/templates/deployment-repo-structure.md +226 -0
  68. package/skills/effort-estimation/SKILL.md +95 -0
  69. package/skills/effort-estimation/evals/evals.json +32 -0
  70. package/skills/effort-estimation/references/estimation-methods.md +154 -0
  71. package/skills/feature-planning/SKILL.md +84 -0
  72. package/skills/feature-planning/evals/evals.json +44 -0
  73. package/skills/feature-planning/templates/plan.md +55 -0
  74. package/skills/feature-planning/templates/task.md +26 -0
  75. package/skills/frontend-architecture/SKILL.md +154 -0
  76. package/skills/frontend-architecture/evals/evals.json +34 -0
  77. package/skills/frontend-architecture/references/component-patterns.md +264 -0
  78. package/skills/frontend-architecture/templates/folder-structure.md +203 -0
  79. package/skills/git-workflow/SKILL.md +127 -0
  80. package/skills/git-workflow/evals/evals.json +44 -0
  81. package/skills/git-workflow/references/conventions.md +142 -0
  82. package/skills/git-workflow/templates/pull-request.md +57 -0
  83. package/skills/gitops-delivery/SKILL.md +319 -0
  84. package/skills/gitops-delivery/evals/evals.json +44 -0
  85. package/skills/gitops-delivery/references/gitops-patterns.md +478 -0
  86. package/skills/gitops-delivery/templates/gitops-config.md +196 -0
  87. package/skills/incident-response/SKILL.md +130 -0
  88. package/skills/incident-response/evals/evals.json +55 -0
  89. package/skills/incident-response/references/communication-templates.md +134 -0
  90. package/skills/incident-response/references/severity-levels.md +77 -0
  91. package/skills/incident-response/templates/incident-timeline.md +57 -0
  92. package/skills/infrastructure-as-code/SKILL.md +86 -0
  93. package/skills/infrastructure-as-code/evals/evals.json +33 -0
  94. package/skills/infrastructure-as-code/references/iac-patterns.md +179 -0
  95. package/skills/infrastructure-as-code/templates/terraform-module.md +158 -0
  96. package/skills/metrics-and-okrs/SKILL.md +113 -0
  97. package/skills/metrics-and-okrs/evals/evals.json +33 -0
  98. package/skills/metrics-and-okrs/references/metric-catalog.md +90 -0
  99. package/skills/metrics-and-okrs/templates/okr-document.md +61 -0
  100. package/skills/ml-experiment-tracking/SKILL.md +96 -0
  101. package/skills/ml-experiment-tracking/evals/evals.json +32 -0
  102. package/skills/ml-experiment-tracking/references/tracking-tools.md +127 -0
  103. package/skills/ml-model-deployment/SKILL.md +106 -0
  104. package/skills/ml-model-deployment/evals/evals.json +34 -0
  105. package/skills/ml-model-deployment/references/serving-patterns.md +162 -0
  106. package/skills/ml-pipeline-design/SKILL.md +162 -0
  107. package/skills/ml-pipeline-design/evals/evals.json +34 -0
  108. package/skills/ml-pipeline-design/references/pipeline-components.md +174 -0
  109. package/skills/observability-design/SKILL.md +162 -0
  110. package/skills/observability-design/evals/evals.json +52 -0
  111. package/skills/observability-design/references/logging-patterns.md +229 -0
  112. package/skills/observability-design/references/slo-framework.md +151 -0
  113. package/skills/observability-design/templates/slo-document.md +80 -0
  114. package/skills/performance-optimization/SKILL.md +83 -0
  115. package/skills/performance-optimization/evals/evals.json +47 -0
  116. package/skills/performance-optimization/references/bottleneck-patterns.md +256 -0
  117. package/skills/performance-optimization/references/concurrency.md +101 -0
  118. package/skills/prd-writing/SKILL.md +109 -0
  119. package/skills/prd-writing/evals/evals.json +33 -0
  120. package/skills/prd-writing/references/prd-examples.md +132 -0
  121. package/skills/prd-writing/templates/prd.md +71 -0
  122. package/skills/prd-writing/templates/rfc.md +79 -0
  123. package/skills/project-documentation/SKILL.md +104 -0
  124. package/skills/project-documentation/evals/evals.json +48 -0
  125. package/skills/project-documentation/references/contributing-guide.md +100 -0
  126. package/skills/project-documentation/templates/changelog.md +59 -0
  127. package/skills/project-documentation/templates/readme.md +121 -0
  128. package/skills/project-proposal/SKILL.md +90 -0
  129. package/skills/project-proposal/evals/evals.json +31 -0
  130. package/skills/project-proposal/references/proposal-examples.md +140 -0
  131. package/skills/project-proposal/templates/proposal.md +76 -0
  132. package/skills/project-review/SKILL.md +111 -0
  133. package/skills/project-review/evals/evals.json +42 -0
  134. package/skills/refactoring/SKILL.md +90 -0
  135. package/skills/refactoring/evals/evals.json +44 -0
  136. package/skills/refactoring/references/transformations.md +132 -0
  137. package/skills/retrospective/SKILL.md +157 -0
  138. package/skills/retrospective/evals/evals.json +34 -0
  139. package/skills/retrospective/references/facilitation-guide.md +130 -0
  140. package/skills/retrospective/templates/post-mortem.md +121 -0
  141. package/skills/rollback-strategy/SKILL.md +116 -0
  142. package/skills/rollback-strategy/evals/evals.json +55 -0
  143. package/skills/rollback-strategy/references/rollback-patterns.md +125 -0
  144. package/skills/rollback-strategy/templates/rollback-plan.md +69 -0
  145. package/skills/security-audit/SKILL.md +146 -0
  146. package/skills/security-audit/evals/evals.json +66 -0
  147. package/skills/security-audit/references/owasp-top-10.md +167 -0
  148. package/skills/security-audit/templates/security-report.md +79 -0
  149. package/skills/skill-router/SKILL.md +171 -0
  150. package/skills/skill-router/evals/evals.json +39 -0
  151. package/skills/strategic-review/SKILL.md +106 -0
  152. package/skills/strategic-review/evals/evals.json +42 -0
  153. package/skills/strategic-review/templates/full-review-prompt.md +84 -0
  154. package/skills/tdd-workflow/SKILL.md +147 -0
  155. package/skills/tdd-workflow/evals/evals.json +58 -0
  156. package/skills/tdd-workflow/references/test-quality.md +71 -0
  157. package/skills/technical-debt-review/SKILL.md +113 -0
  158. package/skills/technical-debt-review/evals/evals.json +41 -0
  159. package/skills/technical-debt-review/references/debt-taxonomy.md +124 -0
  160. package/skills/technical-debt-review/templates/debt-audit.md +85 -0
  161. package/skills/test-data-strategy/SKILL.md +129 -0
  162. package/skills/test-data-strategy/evals/evals.json +49 -0
  163. package/skills/test-data-strategy/references/data-generation-patterns.md +341 -0
  164. package/skills/test-suite-design/SKILL.md +137 -0
  165. package/skills/test-suite-design/evals/evals.json +69 -0
  166. package/skills/test-suite-design/references/test-infrastructure.md +175 -0
  167. package/skills/test-suite-design/references/testing-pyramid.md +140 -0
  168. package/skills/ui-ux-design/SKILL.md +117 -0
  169. package/skills/ui-ux-design/evals/evals.json +35 -0
  170. package/skills/ui-ux-design/references/interaction-patterns.md +145 -0
  171. package/skills/ui-ux-design/templates/screen-spec.md +97 -0
  172. package/skills/verification-before-completion/SKILL.md +85 -0
  173. package/skills/verification-before-completion/evals/evals.json +53 -0
  174. package/skills/writing-skills/SKILL.md +87 -0
  175. package/skills/writing-skills/evals/evals.json +41 -0
  176. package/skills/writing-skills/references/pressure-testing.md +69 -0
  177. package/uninstall.mjs +182 -0
@@ -0,0 +1,106 @@
1
+ # SOLID Principles Reference
2
+
3
+ ## Contents
4
+ - Open/Closed Principle (OCP)
5
+ - Liskov Substitution Principle (LSP)
6
+ - Interface Segregation Principle (ISP)
7
+ - Dependency Inversion Principle (DIP)
8
+
9
+ SRP is already covered extensively in the review checklist and refactoring skill. This reference focuses on the four principles that are less intuitive and more often misapplied.
10
+
11
+ ## Open/Closed Principle (OCP)
12
+
13
+ **Software entities should be open for extension but closed for modification.**
14
+
15
+ When a new requirement arrives, you should be able to add new behavior without changing existing, tested code. Changing existing code risks breaking things that already work.
16
+
17
+ How to achieve it:
18
+ - **Polymorphism**: Define a base type with a contract. New behaviors become new implementations, not if/else branches in existing code.
19
+ - **Strategy pattern**: Pass behavior as a parameter instead of hard-coding it.
20
+ - **Plugin architecture**: Define extension points where new functionality can be registered.
21
+
22
+ When OCP matters most:
23
+ - Code that is stable and widely depended upon — changing it has high blast radius
24
+ - Frameworks and libraries consumed by others
25
+ - Business rule engines where rules are added frequently
26
+
27
+ When to relax OCP:
28
+ - Early in a feature's life when the abstraction isn't clear yet — premature abstraction violates KISS
29
+ - Internal code with few consumers — just change it
30
+ - When the "extension" mechanism would be more complex than the modification it avoids
31
+
32
+ **The smell**: A growing switch/if-else chain where each new case modifies the same function. This is the classic OCP violation — each addition risks breaking existing cases.
33
+
34
+ ## Liskov Substitution Principle (LSP)
35
+
36
+ **Subtypes must be substitutable for their base types without altering the correctness of the program.**
37
+
38
+ If code works with a base type, it must also work with any subtype. Violations create bugs that surface far from the offending code — a subtype behaves unexpectedly in a context that expects the base type's contract.
39
+
40
+ The contract includes:
41
+ - **Preconditions**: A subtype cannot strengthen preconditions (require more from callers)
42
+ - **Postconditions**: A subtype cannot weaken postconditions (promise less to callers)
43
+ - **Invariants**: A subtype must maintain all invariants of the base type
44
+ - **History constraint**: A subtype cannot change state in ways the base type cannot
45
+
46
+ Classic violations:
47
+ - `Square extends Rectangle` where setting width also sets height — breaks `Rectangle`'s contract that width and height are independent
48
+ - A `ReadOnlyList` that throws on `add()` — callers of `List` expect `add()` to work
49
+ - A cache implementation that silently drops entries — callers expect `get()` after `put()` to return the value
50
+
51
+ How to detect LSP violations:
52
+ - Look for `instanceof` / type checks in code consuming the base type — these indicate the base type's contract is insufficient
53
+ - Look for overridden methods that throw `UnsupportedOperationException` — the subtype can't fulfill the contract
54
+ - Look for subtypes that ignore or no-op base type methods
55
+
56
+ How to fix:
57
+ - Redesign the hierarchy — often the inheritance relationship is wrong
58
+ - Use composition instead of inheritance
59
+ - Split the base type into smaller interfaces (leads naturally to ISP)
60
+
61
+ ## Interface Segregation Principle (ISP)
62
+
63
+ **Clients should not be forced to depend on interfaces they do not use.**
64
+
65
+ Fat interfaces create unnecessary coupling. When a client depends on methods it never calls, changes to those methods can still force recompilation, redeployment, or unexpected breakage.
66
+
67
+ Signs of ISP violation:
68
+ - An interface with 10+ methods where most implementors only use a subset
69
+ - Classes that implement interface methods with empty bodies or `throw new NotImplementedException()`
70
+ - A "god interface" that every module depends on but each uses a different slice
71
+
72
+ How to apply ISP:
73
+ - Split large interfaces into smaller, role-specific ones: `Readable`, `Writable`, `Closeable` instead of `FileHandler`
74
+ - Define interfaces from the client's perspective — what does the consumer need? — not from the implementor's perspective
75
+ - A class can implement multiple small interfaces, so splitting costs nothing
76
+
77
+ Relationship to other principles:
78
+ - ISP violations often cause LSP violations (implementors that can't fulfill the full contract)
79
+ - ISP supports DIP (small, focused abstractions are easier to depend on)
80
+ - ISP aligns with CRP at the component level (don't depend on what you don't use)
81
+
82
+ ## Dependency Inversion Principle (DIP)
83
+
84
+ **High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions.**
85
+
86
+ This is the architectural principle behind Clean Architecture's Dependency Rule. Without DIP, high-level business logic becomes coupled to infrastructure — changing a database or API client forces changes to business rules.
87
+
88
+ How it works:
89
+ 1. High-level module defines an interface for what it needs (e.g., `OrderRepository`)
90
+ 2. Low-level module implements that interface (e.g., `PostgresOrderRepository`)
91
+ 3. Both depend on the abstraction — the high-level module owns the interface definition
92
+ 4. A composition root (main, DI container) wires implementations to interfaces
93
+
94
+ Key insight: **the interface belongs to the consumer, not the provider**. `OrderService` defines `OrderRepository`; the database layer implements it. This means the database layer depends on the business layer, not the other way around.
95
+
96
+ When DIP matters:
97
+ - Business logic that should survive infrastructure changes (database, API, messaging)
98
+ - Code that needs to be testable in isolation (inject test doubles through the interface)
99
+ - Boundaries between teams — interface ownership defines the dependency direction
100
+
101
+ When to skip DIP:
102
+ - Internal code where the "low-level" module will never change (e.g., wrapping a string utility)
103
+ - When there's only one possible implementation and no testing benefit — the abstraction adds noise
104
+ - Early prototyping where speed matters more than structure
105
+
106
+ **The test**: Can you test your business logic without a database, network, or file system? If not, DIP is likely missing at a critical boundary.
@@ -0,0 +1,63 @@
1
+ # ADR Template
2
+
3
+ ```markdown
4
+ # ADR-[NNN]: [Decision Title]
5
+
6
+ **Date**: [YYYY-MM-DD]
7
+ **Status**: Proposed | Accepted | Deprecated | Superseded by ADR-[NNN]
8
+ **Deciders**: [Names/roles]
9
+
10
+ ## Context
11
+
12
+ [What is the situation? What forces are at play? What triggered this decision?
13
+ Include relevant technical context, business constraints, and team factors.]
14
+
15
+ ## Decision
16
+
17
+ [State the decision clearly in 1-2 sentences.]
18
+
19
+ We will [decision].
20
+
21
+ ## Options Considered
22
+
23
+ ### Option 1: [Name]
24
+ [2-3 sentence description]
25
+
26
+ **Pros**: [what this option does well]
27
+ **Cons**: [what this option does poorly]
28
+ **Complexity**: [Low/Medium/High]
29
+ **Reversibility**: [Easy/Moderate/Difficult]
30
+
31
+ ### Option 2: [Name]
32
+ [Same structure]
33
+
34
+ ### Option 3: [Name] (if applicable)
35
+ [Same structure]
36
+
37
+ ## Decision Rationale
38
+
39
+ [Why this option over the others. Reference specific quality attributes,
40
+ principles, and constraints. Acknowledge what you're trading off.]
41
+
42
+ ## Consequences
43
+
44
+ ### Positive
45
+ - [Expected benefit 1]
46
+ - [Expected benefit 2]
47
+
48
+ ### Negative
49
+ - [Accepted trade-off 1]
50
+ - [Accepted trade-off 2]
51
+
52
+ ### Risks
53
+ - [Risk and its mitigation]
54
+
55
+ ## Revisit Triggers
56
+
57
+ Revisit this decision if any of these conditions arise:
58
+ - [Condition 1, e.g., "request volume exceeds 10K/sec"]
59
+ - [Condition 2, e.g., "team grows beyond 8 engineers"]
60
+
61
+ ## References
62
+ - [Related ADRs, design docs, or external resources]
63
+ ```
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: architecture-documentation
3
+ description: "Design and maintain architecture documentation with multi-level diagrams (C4) and docs-as-code. Triggers: architecture diagram, document the architecture, C4 diagram, system context, container diagram, component diagram, architecture docs, docs-as-code, PlantUML, Structurizr, D2, Mermaid architecture, infrastructure diagram, runtime flow. Use architecture-design for ADRs."
4
+ model: opus
5
+ allowed-tools: Read, Grep, Glob, Write, Edit
6
+ ---
7
+
8
+ # Architecture Documentation
9
+
10
+ Help the user create and maintain architecture documentation that is version-controlled, multi-layered, and useful. Good architecture docs answer "what exists and how does it connect?" — not by drawing everything, but by drawing the right things at the right abstraction level.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1: Assess Documentation Scope
15
+
16
+ Understand what exists and what's needed before creating anything:
17
+
18
+ - **Current state**: Are there existing diagrams, READMEs with architecture sections, or whiteboard photos? Scan the repo for `docs/`, `architecture/`, `.puml`, `.d2`, or Mermaid blocks in markdown.
19
+ - **Audience**: Who will read this? New hires need conceptual overviews. Ops teams need runtime topology. Architects need structural boundaries.
20
+ - **System complexity**: How many services, data stores, and external dependencies? This determines which abstraction levels are worth creating.
21
+
22
+ A simple monolith may only need one conceptual diagram. A distributed system with 5+ services likely needs canonical and runtime levels too.
23
+
24
+ ### Step 2: Choose Abstraction Levels
25
+
26
+ Architecture documentation works at three distinct levels. Not every system needs all three — apply YAGNI.
27
+
28
+ | Level | Purpose | Answers | Stability |
29
+ |-------|---------|---------|-----------|
30
+ | **Canonical** | What exists structurally | "What are the building blocks?" | Stable — changes with architecture |
31
+ | **Runtime** | How it behaves operationally | "How does data flow? Where does code run?" | Medium — changes with deployment |
32
+ | **Conceptual** | How to explain it | "What's the mental model?" | Ephemeral — changes with audience |
33
+
34
+ **Guidelines for selection:**
35
+ - **Always start with Conceptual** — even a quick sketch helps align understanding
36
+ - **Add Canonical** when the system has multiple services, teams, or bounded contexts
37
+ - **Add Runtime** when deployment topology, data flows, or infrastructure matter for operations
38
+
39
+ See [references/abstraction-levels.md](references/abstraction-levels.md) for detailed guidance on each level, traceability rules, and the promotion model.
40
+
41
+ ### Step 3: Select Tooling and Establish Conventions
42
+
43
+ Choose tools that fit the team's stack. The framework is tool-agnostic — what matters is consistent usage, not specific tools.
44
+
45
+ **Recommended defaults by level:**
46
+
47
+ | Level | Recommended Tools | Alternatives |
48
+ |-------|------------------|--------------|
49
+ | Canonical | C4-PlantUML, Structurizr DSL | Mermaid C4 extension, Ilograph |
50
+ | Runtime | D2, Mermaid | PlantUML sequence/deployment, Diagrams-as-code (Python) |
51
+ | Conceptual | Mermaid, Excalidraw | Whiteboard photos, ASCII diagrams |
52
+
53
+ **Conventions to establish:**
54
+ - **Shared vocabulary**: Create a glossary of system names. Every diagram must use these names exactly — no aliasing or renaming per diagram.
55
+ - **File naming**: Use a consistent pattern like `{level}-{scope}.{ext}` (e.g., `canonical-system-context.puml`, `runtime-checkout-flow.d2`)
56
+ - **Repository structure**: Set up `docs/architecture/` using the template at [templates/architecture-doc.md](templates/architecture-doc.md)
57
+ - **Docs-as-code**: All diagrams must be text-based, version-controlled, and reviewable in PRs
58
+
59
+ See [references/diagram-tooling.md](references/diagram-tooling.md) for tool comparison and syntax examples.
60
+
61
+ ### Step 4: Create Diagrams
62
+
63
+ Work top-down — start at the highest level and add detail only where needed:
64
+
65
+ 1. **System Context** (canonical): The system as a black box, showing users and external dependencies. This is the single most valuable diagram.
66
+ 2. **Container diagram** (canonical): Zoom into the system — services, data stores, message brokers, frontends.
67
+ 3. **Runtime views** (as needed): Data flow diagrams, sequence diagrams for key interactions, deployment/infrastructure topology.
68
+ 4. **Component diagrams** (rarely): Internal structure of a single service. Only create when a service is complex enough to warrant it.
69
+
70
+ **Per diagram:**
71
+ - Define scope — one diagram, one concern
72
+ - Identify elements and relationships
73
+ - Add brief annotations explaining non-obvious connections
74
+ - Ensure traceability: every element in a detailed diagram should trace to a parent in a higher-level diagram
75
+
76
+ **Linking to decisions:** When an ADR changes architecture, reference the affected diagrams in the ADR and update them. For ADR creation, use the `architecture-design` skill.
77
+
78
+ ### Step 5: Validate
79
+
80
+ Run through the validation checklist before considering documentation complete:
81
+
82
+ - [ ] All services/systems in the codebase appear in canonical diagrams
83
+ - [ ] Runtime diagrams reference only elements defined in canonical diagrams (infrastructure-only components like load balancers are exceptions)
84
+ - [ ] Naming is consistent across all diagrams and matches the glossary
85
+ - [ ] ADRs that changed architecture reference affected diagrams
86
+ - [ ] Diagrams are version-controlled and render correctly
87
+ - [ ] Conceptual diagrams are clearly labeled as non-canonical
88
+ - [ ] A new team member can orient themselves using only these docs
89
+
90
+ ### Step 6: Establish Maintenance Governance
91
+
92
+ Documentation that isn't maintained becomes misleading. Define when and how diagrams get updated:
93
+
94
+ **Update triggers:**
95
+ - New service or data store added
96
+ - Service boundary changed or service split/merged
97
+ - New external dependency integrated
98
+ - ADR accepted that affects architecture (use `architecture-design` skill)
99
+
100
+ **Promotion model:** Diagrams mature over time:
101
+ ```
102
+ Conceptual sketch (idea / RFC)
103
+ ↓ proves valuable, referenced repeatedly
104
+ Runtime diagram (structured, tooled)
105
+ ↓ represents stable structural change
106
+ Canonical diagram (source of truth)
107
+ ```
108
+
109
+ **Review cadence:**
110
+ - Canonical diagrams: review quarterly or after major architecture changes
111
+ - Runtime diagrams: review when deployment topology changes
112
+ - Conceptual diagrams: no formal review — treat as disposable
113
+
114
+ ## Principles Applied
115
+
116
+ - **KISS**: Start with one system context diagram. Add layers only when they serve a clear audience.
117
+ - **YAGNI**: A monolith doesn't need four C4 levels. Document what exists, not what might exist.
118
+ - **Separation of Concerns**: Each abstraction level serves a different purpose. Don't mix structural truth with runtime behavior in the same diagram.
119
+ - **DRY**: Canonical diagrams are the single source of truth for system structure. Other diagrams reference — never redefine — those elements.
120
+
121
+ ## Cross-Skill References
122
+
123
+ - **architecture-design**: For making and documenting architectural decisions (ADRs). Use when a documentation effort reveals undocumented or contested decisions.
124
+ - **project-documentation**: For README, CONTRIBUTING, API docs, and other non-architecture documentation.
125
+ - **infrastructure-as-code**: For aligning runtime/deployment diagrams with actual IaC definitions.
126
+ - **containerization**: For Kubernetes-specific topology diagrams that align with actual manifests.
@@ -0,0 +1,44 @@
1
+ [
2
+ {
3
+ "name": "Microservices architecture documentation from scratch",
4
+ "description": "Happy path: documenting a moderately complex distributed system for new hires",
5
+ "prompt": "We have a system with 8 microservices: a React frontend, a BFF API gateway, a user service, an order service, a payment service, a notification service, a search service, and a recommendation engine. We use PostgreSQL, Redis, RabbitMQ, and Elasticsearch. Everything runs on Kubernetes. We have no architecture diagrams and need to document this for new hires joining next month.",
6
+ "assertions": [
7
+ "Recommends starting with a system context diagram showing the system, users, and external dependencies",
8
+ "Identifies that all three abstraction levels are appropriate for this complexity",
9
+ "Prioritizes canonical and conceptual levels for the onboarding use case",
10
+ "Proposes a repository structure for organizing diagrams",
11
+ "Establishes or recommends a glossary with consistent naming for all 8 services",
12
+ "Suggests specific tooling appropriate for each level",
13
+ "Does not try to create all diagrams at once — suggests a phased approach",
14
+ "Produces at least a system context diagram as the first deliverable"
15
+ ]
16
+ },
17
+ {
18
+ "name": "Over-documentation for simple system",
19
+ "description": "Edge case: pushing back on unnecessary documentation complexity",
20
+ "prompt": "I have a simple CRUD application — Express.js backend, PostgreSQL database, deployed on a single EC2 instance behind nginx. My manager read about C4 and wants me to create all four C4 levels plus deployment diagrams plus data flow diagrams. Can you help me set this up?",
21
+ "assertions": [
22
+ "Pushes back on creating all four C4 levels for a simple monolith",
23
+ "Applies YAGNI — recommends only the diagrams that add value for this system's complexity",
24
+ "Recommends at most a system context and a single container diagram",
25
+ "Explains that Code-level C4 diagrams are almost never worth maintaining manually",
26
+ "Does not refuse the request entirely — provides a pragmatic subset",
27
+ "Suggests conceptual-level documentation may be sufficient for this system",
28
+ "Explains what would trigger the need for more detailed documentation in the future"
29
+ ]
30
+ },
31
+ {
32
+ "name": "Architecture decision vs architecture documentation",
33
+ "description": "Scope boundary: separating decision-making from documentation",
34
+ "prompt": "We're debating whether to extract our authentication logic into a separate service or keep it in the monolith. Can you also create architecture diagrams showing what the system would look like after the split?",
35
+ "assertions": [
36
+ "Recognizes the decision-making aspect and defers to the architecture-design skill for the ADR",
37
+ "Does not make the architectural decision within this skill's workflow",
38
+ "Offers to diagram the proposed architecture as a conceptual or draft diagram to support the decision",
39
+ "Clearly separates the decision process from the documentation process",
40
+ "If diagramming the proposed state, labels it as non-canonical since the decision hasn't been made yet",
41
+ "Suggests that canonical diagrams should only be updated after the decision is accepted"
42
+ ]
43
+ }
44
+ ]
@@ -0,0 +1,91 @@
1
+ # Abstraction Levels for Architecture Documentation
2
+
3
+ Architecture documentation must operate at different abstraction levels to serve different audiences and purposes. Mixing levels in a single diagram creates confusion — a system context diagram cluttered with Kubernetes pods, or a deployment diagram that also tries to show business boundaries.
4
+
5
+ ## The Three Levels
6
+
7
+ ### Canonical (Structural Truth)
8
+
9
+ The authoritative representation of what exists in the system. Uses the C4 model hierarchy:
10
+
11
+ 1. **System Context**: The system as a whole, its users, and external systems it depends on or integrates with. Every architecture should have this diagram.
12
+ 2. **Container**: The major deployable units inside the system — services, databases, message brokers, frontends, batch jobs. This is the most commonly useful C4 level.
13
+ 3. **Component**: Internal structure of a single container — modules, major classes, or subsystems. Only create when a service is complex enough that its internals are architecturally significant.
14
+ 4. **Code**: Class diagrams or module diagrams. Almost never worth maintaining manually — IDEs generate these on demand.
15
+
16
+ **Rules:**
17
+ - Canonical diagrams define system structure. If a service, data store, or external dependency exists, it should appear here.
18
+ - Changes to canonical diagrams represent actual architectural changes — these should be infrequent and deliberate.
19
+ - Canonical diagrams should be minimal and stable. Resist adding runtime or deployment details.
20
+
21
+ ### Runtime (Operational Behavior)
22
+
23
+ How the system behaves when running. These diagrams show movement, flow, and infrastructure:
24
+
25
+ - **Data flow diagrams**: How data moves through the system (e.g., RAG pipeline, ETL flow, event streaming)
26
+ - **Sequence diagrams**: Step-by-step interaction for key scenarios (e.g., checkout flow, authentication handshake)
27
+ - **Deployment/infrastructure topology**: Where code runs — Kubernetes clusters, cloud regions, CDNs, load balancers
28
+ - **Integration diagrams**: How external systems connect at runtime (webhooks, polling, file drops)
29
+
30
+ **Rules:**
31
+ - Runtime diagrams must reference elements defined in canonical diagrams. Don't introduce new system names here.
32
+ - Infrastructure-only components (load balancers, ingress controllers, service meshes, CI runners) are exceptions — they may appear only at the runtime level since they're not architecturally significant at the canonical level.
33
+ - Focus on relationships and flows, not ownership or boundaries (those belong in canonical diagrams).
34
+
35
+ ### Conceptual (Communication)
36
+
37
+ Lightweight diagrams for human understanding. These serve communication, not governance:
38
+
39
+ - **Onboarding overviews**: Simplified system maps for new team members
40
+ - **RFC/ADR illustrations**: Quick visuals to support a written proposal
41
+ - **Presentation diagrams**: Architecture slides for stakeholders
42
+ - **PR explanations**: "Here's what this change does" diagrams
43
+
44
+ **Rules:**
45
+ - Conceptual diagrams are non-canonical. They may simplify, omit, or group elements for clarity.
46
+ - They should never be treated as the source of truth.
47
+ - Label them clearly (e.g., "Simplified overview — see canonical diagrams for authoritative structure").
48
+ - They are disposable by default. If one proves valuable and gets referenced repeatedly, promote it.
49
+
50
+ ## Traceability
51
+
52
+ Elements should be traceable across levels:
53
+
54
+ ```
55
+ Decision (ADR)
56
+ ↓ justifies why the architecture looks this way
57
+ Canonical (C4)
58
+ ↓ defines what exists structurally
59
+ Runtime (D2/sequence/deployment)
60
+ ↓ shows how it behaves operationally
61
+ Code / Deployment
62
+ ↓ implements the architecture
63
+ ```
64
+
65
+ **Practical traceability rules:**
66
+ - Every container in a canonical diagram should correspond to a deployable unit in the codebase
67
+ - Every element in a runtime diagram should trace to a container or external system in the canonical diagram (with the infrastructure-only exception noted above)
68
+ - ADRs that change architecture should reference the canonical diagrams they affect
69
+ - Conceptual diagrams are exempt from strict traceability — they serve communication, not governance
70
+
71
+ ## The Promotion Model
72
+
73
+ Diagrams have a maturity lifecycle. Not every sketch needs to become a canonical diagram.
74
+
75
+ ```
76
+ Conceptual (sketch / idea / RFC)
77
+ ↓ proves valuable — referenced repeatedly, used for onboarding
78
+ Runtime (structured, uses proper tooling, follows naming conventions)
79
+ ↓ represents a stable structural change to the system
80
+ Canonical (source of truth, reviewed, maintained)
81
+ ```
82
+
83
+ **When to promote:**
84
+ - A conceptual diagram gets referenced in 3+ documents or conversations → consider promoting to runtime level with proper tooling
85
+ - A runtime diagram reveals a structural boundary that isn't captured canonically → update the canonical diagrams
86
+ - An ADR introduces a new service or changes boundaries → update canonical diagrams directly (skip promotion)
87
+
88
+ **When NOT to promote:**
89
+ - A conceptual diagram was useful for one presentation but isn't referenced again → let it age naturally
90
+ - A runtime diagram shows a temporary deployment configuration → keep at runtime level
91
+ - The system is simple enough that canonical diagrams capture everything needed → don't create runtime diagrams just to have them
@@ -0,0 +1,141 @@
1
+ # Diagram Tooling Reference
2
+
3
+ This reference helps select and use diagram tools for architecture documentation. The framework is tool-agnostic — choose tools that fit your team. What matters is consistent usage and docs-as-code practices, not specific tools.
4
+
5
+ ## Tool Comparison
6
+
7
+ ### Canonical Architecture (C4 Model)
8
+
9
+ | Tool | Pros | Cons | Best For |
10
+ |------|------|------|----------|
11
+ | **C4-PlantUML** | Mature ecosystem, CI-friendly, extensive C4 support | Verbose syntax, layout control is limited | Teams already using PlantUML |
12
+ | **Structurizr DSL** | Purpose-built for C4, model-first approach, generates multiple views from one model | Requires Structurizr tooling (Lite/Cloud) | Teams wanting a single model with multiple diagram outputs |
13
+ | **Mermaid C4 extension** | Renders in GitHub/GitLab markdown natively, low friction | Limited C4 support, fewer styling options | Teams prioritizing zero-tooling rendering |
14
+ | **Ilograph** | Interactive, explorable diagrams | Commercial tool, not text-only | Teams wanting interactive exploration |
15
+
16
+ ### Runtime / Infrastructure / Data Flow
17
+
18
+ | Tool | Pros | Cons | Best For |
19
+ |------|------|------|----------|
20
+ | **D2** | Clean syntax, auto-layout, built-in themes, good for topology | Newer tool, smaller community | Infrastructure topology, data flows |
21
+ | **Mermaid** | Wide rendering support, familiar syntax | Limited layout control, complex diagrams get messy | Sequence diagrams, simple flowcharts |
22
+ | **PlantUML** | Sequence and deployment diagram support, mature | Verbose, requires server for rendering | Detailed sequence diagrams |
23
+ | **Diagrams (Python)** | Programmatic, uses real cloud provider icons | Requires Python, not declarative | Cloud architecture with provider-specific icons |
24
+
25
+ ### Conceptual / Communication
26
+
27
+ | Tool | Pros | Cons | Best For |
28
+ |------|------|------|----------|
29
+ | **Mermaid** | Renders in markdown, no build step | Limited styling | Quick diagrams in docs and PRs |
30
+ | **Excalidraw** | Hand-drawn aesthetic, collaborative | Not text-based (JSON), harder to diff | Whiteboard-style brainstorming |
31
+ | **ASCII diagrams** | Zero dependencies, works everywhere | Limited expressiveness | Inline code comments, terminal output |
32
+
33
+ ## Docs-as-Code Requirements
34
+
35
+ Regardless of tool choice, architecture diagrams should follow docs-as-code practices:
36
+
37
+ 1. **Text-based source**: Diagrams defined in text files (`.puml`, `.d2`, `.mmd`, `.dsl`), not binary formats
38
+ 2. **Version-controlled**: Stored in git alongside code or in a central docs repo
39
+ 3. **Reviewable**: Changes visible in PR diffs (text diffs for source, rendered previews where possible)
40
+ 4. **Renderable in CI**: Automated rendering to PNG/SVG on merge (optional but recommended)
41
+ 5. **No manual editing of rendered output**: Always regenerate from source
42
+
43
+ ## Quick Syntax Reference
44
+
45
+ ### C4-PlantUML — System Context
46
+
47
+ ```plantuml
48
+ @startuml
49
+ !include <C4/C4_Context>
50
+
51
+ title System Context - Payments Platform
52
+
53
+ Person(user, "Customer", "Places orders and makes payments")
54
+ System(payments, "Payments Platform", "Processes payments and manages billing")
55
+ System_Ext(stripe, "Stripe", "Payment gateway")
56
+ System_Ext(bank, "Bank API", "Account verification")
57
+
58
+ Rel(user, payments, "Submits payment")
59
+ Rel(payments, stripe, "Processes charge", "HTTPS/REST")
60
+ Rel(payments, bank, "Verifies account", "HTTPS/REST")
61
+ @enduml
62
+ ```
63
+
64
+ ### Structurizr DSL — Container
65
+
66
+ ```dsl
67
+ workspace {
68
+ model {
69
+ customer = person "Customer"
70
+ payments = softwareSystem "Payments Platform" {
71
+ api = container "Payments API" "Handles payment requests" "Node.js"
72
+ db = container "Payments DB" "Stores transactions" "PostgreSQL"
73
+ worker = container "Payment Worker" "Async payment processing" "Node.js"
74
+ queue = container "Job Queue" "Payment job queue" "Redis"
75
+ }
76
+ stripe = softwareSystem "Stripe" "Payment gateway"
77
+
78
+ customer -> api "Submits payment"
79
+ api -> queue "Enqueues job"
80
+ worker -> queue "Dequeues job"
81
+ worker -> stripe "Processes charge"
82
+ api -> db "Reads/writes"
83
+ worker -> db "Updates status"
84
+ }
85
+ views {
86
+ container payments {
87
+ include *
88
+ autolayout lr
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ ### D2 — Runtime Flow
95
+
96
+ ```d2
97
+ direction: right
98
+
99
+ customer: Customer {shape: person}
100
+ lb: Load Balancer {shape: cloud}
101
+ api: Payments API
102
+ queue: Redis Queue
103
+ worker: Payment Worker
104
+ stripe: Stripe API {style.stroke-dash: 3}
105
+ db: PostgreSQL
106
+
107
+ customer -> lb: HTTPS
108
+ lb -> api: Route
109
+ api -> queue: Enqueue job
110
+ api -> db: Read/write
111
+ queue -> worker: Dequeue
112
+ worker -> stripe: Process charge
113
+ worker -> db: Update status
114
+ ```
115
+
116
+ ### Mermaid — Conceptual Overview
117
+
118
+ ```mermaid
119
+ graph LR
120
+ Customer -->|HTTPS| API[Payments API]
121
+ API --> Queue[Redis Queue]
122
+ API --> DB[(PostgreSQL)]
123
+ Queue --> Worker[Payment Worker]
124
+ Worker --> Stripe[Stripe API]
125
+ Worker --> DB
126
+ ```
127
+
128
+ ## Rendering Pipeline
129
+
130
+ For teams that want automated rendering:
131
+
132
+ **GitHub Actions example (Mermaid + PlantUML):**
133
+ - Mermaid renders natively in GitHub markdown — no action needed
134
+ - PlantUML: use a GitHub Action with the PlantUML server to render `.puml` to `.svg` on push
135
+ - D2: use the `d2` CLI in CI to render `.d2` to `.svg`
136
+
137
+ **Structurizr:**
138
+ - Use Structurizr Lite (Docker) locally or in CI to render from the DSL
139
+ - Generates multiple diagram views from a single model file
140
+
141
+ **Keep rendered outputs in a predictable location** (e.g., `docs/architecture/rendered/`) and add them to `.gitignore` if regenerated in CI, or commit them if the team prefers browsable outputs without running tools.