agile-context-engineering 0.3.0 → 0.5.1
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.
- package/.claude-plugin/marketplace.json +18 -0
- package/.claude-plugin/plugin.json +10 -0
- package/CHANGELOG.md +7 -1
- package/LICENSE +51 -51
- package/README.md +330 -318
- package/agents/ace-code-discovery-analyst.md +245 -245
- package/agents/ace-code-integration-analyst.md +248 -248
- package/agents/ace-code-reviewer.md +375 -375
- package/agents/ace-product-owner.md +365 -361
- package/agents/ace-project-researcher.md +606 -606
- package/agents/ace-research-synthesizer.md +228 -228
- package/agents/ace-technical-application-architect.md +315 -315
- package/agents/ace-wiki-mapper.md +449 -445
- package/bin/install.js +605 -195
- package/hooks/ace-check-update.js +71 -62
- package/hooks/ace-statusline.js +107 -89
- package/hooks/hooks.json +14 -0
- package/package.json +7 -5
- package/shared/lib/ace-core.js +361 -0
- package/shared/lib/ace-core.test.js +308 -0
- package/shared/lib/ace-github.js +753 -0
- package/shared/lib/ace-story.js +400 -0
- package/shared/lib/ace-story.test.js +250 -0
- package/{agile-context-engineering → shared}/utils/questioning.xml +110 -110
- package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
- package/{commands/ace/execute-story.md → skills/execute-story/SKILL.md} +116 -138
- package/skills/execute-story/script.js +291 -0
- package/skills/execute-story/script.test.js +261 -0
- package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +451 -451
- package/skills/execute-story/walkthrough-template.xml +255 -0
- package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +1221 -1219
- package/skills/help/SKILL.md +71 -0
- package/skills/help/script.js +315 -0
- package/skills/help/script.test.js +183 -0
- package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +544 -533
- package/{commands/ace/init-coding-standards.md → skills/init-coding-standards/SKILL.md} +91 -83
- package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +531 -531
- package/skills/init-coding-standards/script.js +50 -0
- package/skills/init-coding-standards/script.test.js +70 -0
- package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +381 -386
- package/skills/map-cross-cutting/SKILL.md +126 -0
- package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +197 -197
- package/skills/map-cross-cutting/workflow.xml +330 -0
- package/skills/map-guide/SKILL.md +126 -0
- package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +137 -137
- package/skills/map-guide/workflow.xml +320 -0
- package/skills/map-pattern/SKILL.md +125 -0
- package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +159 -159
- package/skills/map-pattern/workflow.xml +331 -0
- package/{commands/ace/map-story.md → skills/map-story/SKILL.md} +180 -165
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +115 -115
- package/skills/map-story/templates/guide.xml +137 -0
- package/skills/map-story/templates/pattern.xml +159 -0
- package/skills/map-story/templates/system-cross-cutting.xml +197 -0
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +381 -381
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +125 -125
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/walkthrough.xml +255 -255
- package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +1046 -1046
- package/{commands/ace/map-subsystem.md → skills/map-subsystem/SKILL.md} +155 -140
- package/skills/map-subsystem/script.js +51 -0
- package/skills/map-subsystem/script.test.js +68 -0
- package/skills/map-subsystem/templates/decizions.xml +115 -0
- package/skills/map-subsystem/templates/guide.xml +137 -0
- package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +174 -174
- package/skills/map-subsystem/templates/pattern.xml +159 -0
- package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +343 -343
- package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +234 -234
- package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
- package/skills/map-subsystem/templates/system.xml +381 -0
- package/skills/map-subsystem/templates/walkthrough.xml +255 -0
- package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +1173 -1178
- package/skills/map-sys-doc/SKILL.md +125 -0
- package/skills/map-sys-doc/system.xml +381 -0
- package/skills/map-sys-doc/workflow.xml +336 -0
- package/{commands/ace/map-system.md → skills/map-system/SKILL.md} +103 -92
- package/skills/map-system/script.js +75 -0
- package/skills/map-system/script.test.js +73 -0
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +254 -254
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +177 -177
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +283 -283
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/wiki-readme.xml +296 -296
- package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +667 -672
- package/{commands/ace/map-walkthrough.md → skills/map-walkthrough/SKILL.md} +140 -127
- package/skills/map-walkthrough/walkthrough.xml +255 -0
- package/{agile-context-engineering/workflows/map-walkthrough.xml → skills/map-walkthrough/workflow.xml} +457 -457
- package/{commands/ace/plan-backlog.md → skills/plan-backlog/SKILL.md} +93 -83
- package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +231 -231
- package/skills/plan-backlog/script.js +121 -0
- package/skills/plan-backlog/script.test.js +83 -0
- package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +1348 -1356
- package/{commands/ace/plan-feature.md → skills/plan-feature/SKILL.md} +99 -89
- package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +361 -361
- package/skills/plan-feature/script.js +131 -0
- package/skills/plan-feature/script.test.js +80 -0
- package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +1487 -1495
- package/{commands/ace/plan-product-vision.md → skills/plan-product-vision/SKILL.md} +91 -81
- package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +227 -227
- package/skills/plan-product-vision/script.js +51 -0
- package/skills/plan-product-vision/script.test.js +69 -0
- package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +337 -342
- package/{commands/ace/plan-story.md → skills/plan-story/SKILL.md} +139 -159
- package/skills/plan-story/script.js +295 -0
- package/skills/plan-story/script.test.js +240 -0
- package/skills/plan-story/story-template.xml +458 -0
- package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1301 -944
- package/{commands/ace/research-external-solution.md → skills/research-external-solution/SKILL.md} +120 -138
- package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +832 -832
- package/skills/research-external-solution/script.js +229 -0
- package/skills/research-external-solution/script.test.js +134 -0
- package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +657 -659
- package/{commands/ace/research-integration-solution.md → skills/research-integration-solution/SKILL.md} +121 -135
- package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +1015 -1015
- package/skills/research-integration-solution/script.js +223 -0
- package/skills/research-integration-solution/script.test.js +134 -0
- package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +711 -713
- package/{commands/ace/research-story-wiki.md → skills/research-story-wiki/SKILL.md} +101 -116
- package/skills/research-story-wiki/script.js +223 -0
- package/skills/research-story-wiki/script.test.js +138 -0
- package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +194 -194
- package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +473 -475
- package/{commands/ace/research-technical-solution.md → skills/research-technical-solution/SKILL.md} +131 -147
- package/skills/research-technical-solution/script.js +223 -0
- package/skills/research-technical-solution/script.test.js +134 -0
- package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +1025 -1025
- package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +761 -763
- package/{commands/ace/review-story.md → skills/review-story/SKILL.md} +99 -109
- package/skills/review-story/script.js +249 -0
- package/skills/review-story/script.test.js +169 -0
- package/skills/review-story/story-template.xml +451 -0
- package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +279 -281
- package/{commands/ace/update.md → skills/update/SKILL.md} +65 -56
- package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +33 -18
- package/agile-context-engineering/src/ace-tools.js +0 -2881
- package/agile-context-engineering/src/ace-tools.test.js +0 -1089
- package/agile-context-engineering/templates/_command.md +0 -54
- package/agile-context-engineering/templates/_workflow.xml +0 -17
- package/agile-context-engineering/templates/config.json +0 -0
- package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
- package/commands/ace/help.md +0 -93
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: map-pattern
|
|
3
|
+
description: Create or update a pattern document in .docs/wiki/subsystems/[name]/patterns/ — reusable implementation patterns
|
|
4
|
+
argument-hint: "text='Template Method pattern used by all drawing paths' subsystem='qarc-charts-v2' commits=3"
|
|
5
|
+
disable-model-invocation: false
|
|
6
|
+
allowed-tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Write
|
|
12
|
+
- Edit
|
|
13
|
+
- AskUserQuestion
|
|
14
|
+
model: opus
|
|
15
|
+
effort: max
|
|
16
|
+
context: fork
|
|
17
|
+
agent: ace-wiki-mapper
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Supporting Resources (auto-loaded)
|
|
21
|
+
|
|
22
|
+
!`cat "${CLAUDE_SKILL_DIR}/workflow.xml"`
|
|
23
|
+
|
|
24
|
+
!`cat "${CLAUDE_SKILL_DIR}/pattern.xml"`
|
|
25
|
+
|
|
26
|
+
!`cat "${CLAUDE_SKILL_DIR}/../../shared/utils/questioning.xml"`
|
|
27
|
+
|
|
28
|
+
!`cat "${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md"`
|
|
29
|
+
|
|
30
|
+
```xml
|
|
31
|
+
<command>
|
|
32
|
+
|
|
33
|
+
<execution-time>
|
|
34
|
+
<runs-after>
|
|
35
|
+
<trigger>When a reusable structural pattern needs documentation</trigger>
|
|
36
|
+
<trigger>After identifying a recurring approach used by 2+ implementations</trigger>
|
|
37
|
+
<trigger>When agents need to understand HOW to implement something following an established pattern</trigger>
|
|
38
|
+
</runs-after>
|
|
39
|
+
<use-when>
|
|
40
|
+
<condition>A structural approach appears across 2+ implementations</condition>
|
|
41
|
+
<condition>New code must follow the same pattern for consistency</condition>
|
|
42
|
+
<condition>An agent needs to know the abstract structure + concrete steps to add a new implementation</condition>
|
|
43
|
+
</use-when>
|
|
44
|
+
</execution-time>
|
|
45
|
+
|
|
46
|
+
<input>
|
|
47
|
+
<flags>
|
|
48
|
+
</flags>
|
|
49
|
+
|
|
50
|
+
<parameters>
|
|
51
|
+
<required>
|
|
52
|
+
<param name="text" type="text">
|
|
53
|
+
Natural language description of the pattern to document. Describes WHAT
|
|
54
|
+
the pattern is and WHERE it appears in the codebase.
|
|
55
|
+
|
|
56
|
+
E.g.:
|
|
57
|
+
- "Template Method pattern used by all drawing paths"
|
|
58
|
+
- "Repository pattern for all database access"
|
|
59
|
+
- "CQRS command/query handler pattern"
|
|
60
|
+
|
|
61
|
+
If not provided, pause and ask the user.
|
|
62
|
+
</param>
|
|
63
|
+
<param name="subsystem" type="path | text">
|
|
64
|
+
Subsystem where this pattern doc belongs.
|
|
65
|
+
Wiki location: `.docs/wiki/subsystems/[subsystem]/patterns/`.
|
|
66
|
+
If not provided, pause and ask the user.
|
|
67
|
+
</param>
|
|
68
|
+
</required>
|
|
69
|
+
|
|
70
|
+
<optional>
|
|
71
|
+
<param name="story-context" type="path | GitHub issue">
|
|
72
|
+
Path to story artifacts folder (in `.ace/artifacts/`) OR GitHub issue
|
|
73
|
+
number/URL. Provides context about a story that introduced or modified
|
|
74
|
+
this pattern.
|
|
75
|
+
When not provided, the agent discovers the pattern from codebase analysis.
|
|
76
|
+
</param>
|
|
77
|
+
<param name="commits" type="number | comma-separated commit SHAs">
|
|
78
|
+
Specifies which commits to analyze for understanding pattern changes.
|
|
79
|
+
As a number: analyze the N most recent commits (e.g., commits=3).
|
|
80
|
+
As commit SHAs: analyze specific commits (e.g., commits='abc123,def456').
|
|
81
|
+
When not provided: search the codebase directly to find all implementations
|
|
82
|
+
and extract the pattern structure.
|
|
83
|
+
</param>
|
|
84
|
+
</optional>
|
|
85
|
+
</parameters>
|
|
86
|
+
</input>
|
|
87
|
+
|
|
88
|
+
<execution-context>
|
|
89
|
+
<!-- All supporting files are auto-loaded in the Supporting Resources section above.
|
|
90
|
+
The model does NOT need to Read these files — they are already in context. -->
|
|
91
|
+
</execution-context>
|
|
92
|
+
|
|
93
|
+
<output>
|
|
94
|
+
<objective>
|
|
95
|
+
Create or update a pattern document that describes a reusable structural approach —
|
|
96
|
+
structure diagram (mermaid classDiagram), how it works step-by-step, how to apply
|
|
97
|
+
it for new implementations, current implementations list, and gotchas.
|
|
98
|
+
|
|
99
|
+
The document an AI agent reads to ensure new code follows established conventions.
|
|
100
|
+
</objective>
|
|
101
|
+
|
|
102
|
+
<artifacts>
|
|
103
|
+
.docs/wiki/subsystems/[subsystem-name]/patterns/[pattern-name].md
|
|
104
|
+
</artifacts>
|
|
105
|
+
</output>
|
|
106
|
+
|
|
107
|
+
<process>
|
|
108
|
+
For this command use the `ace-wiki-mapper` agent
|
|
109
|
+
that's specialized in wiki exploration and documentation writing.
|
|
110
|
+
|
|
111
|
+
Execute the map-pattern workflow from
|
|
112
|
+
`workflow.xml` end-to-end.
|
|
113
|
+
Preserve all workflow gates (validation, user questions, commits).
|
|
114
|
+
</process>
|
|
115
|
+
|
|
116
|
+
<next-steps>
|
|
117
|
+
<step>/clear first for a fresh context window</step>
|
|
118
|
+
<step>/ace:map-pattern — create another pattern document</step>
|
|
119
|
+
<step>/ace:map-guide — create a guide that uses this pattern</step>
|
|
120
|
+
<step>/ace:map-sys-doc — document a system that uses this pattern</step>
|
|
121
|
+
<step>Review file at .docs/wiki/subsystems/[subsystem-name]/patterns/</step>
|
|
122
|
+
</next-steps>
|
|
123
|
+
|
|
124
|
+
</command>
|
|
125
|
+
```
|
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
<pattern>
|
|
2
|
-
<purpose>
|
|
3
|
-
Template for `.docs/wiki/subsystems/[subsystem-name]/patterns/<pattern-name>.md` — a reusable
|
|
4
|
-
implementation pattern within a codebase subsystem. Answers "HOW do I implement something
|
|
5
|
-
that follows this pattern?"
|
|
6
|
-
|
|
7
|
-
Each pattern doc describes a structural template that appears across multiple implementations.
|
|
8
|
-
It is the document an AI agent reads to ensure new code follows established conventions.
|
|
9
|
-
|
|
10
|
-
A "pattern" is a recurring structural approach used by 2+ implementations:
|
|
11
|
-
e.g., Template Method (Path base class with 5 factory methods), Repository Pattern,
|
|
12
|
-
Mapper Pattern, Factory/Registry, CQRS Command/Query handlers.
|
|
13
|
-
|
|
14
|
-
Complements:
|
|
15
|
-
- systems/ docs (WHAT exists — the domain subsystems that USE these patterns)
|
|
16
|
-
- guides/ docs (step-by-step recipes that COMBINE multiple patterns into a task)
|
|
17
|
-
- cross-cutting/ docs (shared infrastructure that patterns depend on)
|
|
18
|
-
</purpose>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<the-pattern>
|
|
22
|
-
# [Pattern Name]
|
|
23
|
-
|
|
24
|
-
## The Pattern
|
|
25
|
-
What it is, when to use it. One paragraph max.
|
|
26
|
-
</the-pattern>
|
|
27
|
-
|
|
28
|
-
<structure>
|
|
29
|
-
## Structure
|
|
30
|
-
|
|
31
|
-
Class/interface diagram showing the pattern's structure.
|
|
32
|
-
|
|
33
|
-
```mermaid
|
|
34
|
-
classDiagram
|
|
35
|
-
class IContract {
|
|
36
|
-
<<interface>>
|
|
37
|
-
+method() ReturnType
|
|
38
|
-
}
|
|
39
|
-
class AbstractBase {
|
|
40
|
-
<<abstract>>
|
|
41
|
-
+templateMethod()
|
|
42
|
-
#factoryMethod()* ReturnType
|
|
43
|
-
}
|
|
44
|
-
IContract <|.. AbstractBase
|
|
45
|
-
AbstractBase <|-- ConcreteA
|
|
46
|
-
AbstractBase <|-- ConcreteB
|
|
47
|
-
```
|
|
48
|
-
</structure>
|
|
49
|
-
|
|
50
|
-
<how-it-works>
|
|
51
|
-
## How It Works
|
|
52
|
-
|
|
53
|
-
Step-by-step of the pattern mechanics. Reference actual code locations.
|
|
54
|
-
|
|
55
|
-
1. **Step**: Description at `file:ClassName.method`
|
|
56
|
-
2. **Step**: Description at `file:ClassName.method`
|
|
57
|
-
3. **Step**: Description at `file:ClassName.method`
|
|
58
|
-
</how-it-works>
|
|
59
|
-
|
|
60
|
-
<how-to-apply>
|
|
61
|
-
## How to Apply
|
|
62
|
-
|
|
63
|
-
When implementing something new that uses this pattern:
|
|
64
|
-
|
|
65
|
-
1. [First step] (reference: `file:ClassName.method`)
|
|
66
|
-
2. [Second step]
|
|
67
|
-
3. [Third step]
|
|
68
|
-
...
|
|
69
|
-
</how-to-apply>
|
|
70
|
-
|
|
71
|
-
<current-implementations>
|
|
72
|
-
## Current Implementations
|
|
73
|
-
|
|
74
|
-
Where this pattern is currently used:
|
|
75
|
-
- `TrendLine` at `src/infrastructure/primitives/trend-line/TrendLine.ts`
|
|
76
|
-
- `ParallelChannel` at `src/infrastructure/primitives/parallel-channel/ParallelChannel.ts`
|
|
77
|
-
- ...
|
|
78
|
-
</current-implementations>
|
|
79
|
-
|
|
80
|
-
<gotchas>
|
|
81
|
-
## Gotchas
|
|
82
|
-
|
|
83
|
-
Things that commonly go wrong or are easy to forget when applying this pattern.
|
|
84
|
-
- [Common mistake 1]
|
|
85
|
-
- [Common mistake 2]
|
|
86
|
-
</gotchas>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<guidelines>
|
|
90
|
-
|
|
91
|
-
**Documentation Style:**
|
|
92
|
-
- EXTREMELY SUCCINCT — every word must add value
|
|
93
|
-
- NO FLUFF — direct, actionable information only
|
|
94
|
-
- Bullet points over paragraphs
|
|
95
|
-
- Code references as `file-path:ClassName.methodName` (not line numbers)
|
|
96
|
-
- Inline snippets ONLY for interface contracts and pattern structure definitions
|
|
97
|
-
- **ALL visual representations of architecture, dependencies, flows, or relationships MUST be ```mermaid fenced code blocks (use `classDiagram` for structure). NO ASCII arrows (->), NO dependency trees, NO PlantUML. Only mermaid. The ONLY ASCII exception is file trees.**
|
|
98
|
-
|
|
99
|
-
**The Pattern:**
|
|
100
|
-
- ONE paragraph. Name the GoF/industry pattern if applicable, then explain how it
|
|
101
|
-
manifests in THIS codebase. Not a textbook definition — the codebase-specific version.
|
|
102
|
-
|
|
103
|
-
**Structure:**
|
|
104
|
-
- Mermaid classDiagram showing the abstract/interface hierarchy.
|
|
105
|
-
- Show the pattern skeleton only — not every concrete implementation.
|
|
106
|
-
- Include key method signatures that define the contract.
|
|
107
|
-
|
|
108
|
-
**How It Works:**
|
|
109
|
-
- Numbered steps tracing the pattern's execution flow.
|
|
110
|
-
- Every step references actual code with `file:ClassName.method`.
|
|
111
|
-
- Focus on the mechanics an agent needs to understand to add a new implementation.
|
|
112
|
-
|
|
113
|
-
**How to Apply:**
|
|
114
|
-
- The MOST ACTIONABLE section. An agent follows these steps to create a new instance.
|
|
115
|
-
- Reference existing implementations as "copy from" targets.
|
|
116
|
-
- Include which files to create, which registrations to add, which factories to update.
|
|
117
|
-
|
|
118
|
-
**Current Implementations:**
|
|
119
|
-
- Complete list of all known implementations with file paths.
|
|
120
|
-
- Agent uses this as a reference gallery — "pick the closest one and copy its structure."
|
|
121
|
-
- Update when new implementations are added.
|
|
122
|
-
|
|
123
|
-
**Gotchas:**
|
|
124
|
-
- Timing issues, naming conventions, registration requirements, common mistakes.
|
|
125
|
-
- Anything an agent would get wrong on first attempt without being told.
|
|
126
|
-
|
|
127
|
-
**What does NOT belong here:**
|
|
128
|
-
- System-specific domain logic (that's in systems/ docs)
|
|
129
|
-
- Step-by-step task recipes that combine multiple patterns (that's in guides/)
|
|
130
|
-
- Cross-cutting infrastructure details (that's in cross-cutting/)
|
|
131
|
-
- Story numbers, sprint context, revision history
|
|
132
|
-
- Testing instructions, performance benchmarks
|
|
133
|
-
|
|
134
|
-
</guidelines>
|
|
135
|
-
|
|
136
|
-
<evolution>
|
|
137
|
-
|
|
138
|
-
This is a LIVING document — updated when the pattern itself evolves.
|
|
139
|
-
|
|
140
|
-
**Update triggers:**
|
|
141
|
-
- New implementation added (update Current Implementations list)
|
|
142
|
-
- Pattern structure changed (new factory method, new interface method)
|
|
143
|
-
- How to Apply steps changed (new registration requirement, new file to create)
|
|
144
|
-
- New gotcha discovered during implementation
|
|
145
|
-
|
|
146
|
-
**NOT an update trigger:**
|
|
147
|
-
- New feature that follows the existing pattern without changing it
|
|
148
|
-
- Bug fix in one implementation
|
|
149
|
-
- Internal refactoring that doesn't change the pattern contract
|
|
150
|
-
|
|
151
|
-
**Update rules:**
|
|
152
|
-
- ADD new implementations to the list
|
|
153
|
-
- UPDATE How to Apply if the recipe changed
|
|
154
|
-
- ADD new gotchas as they are discovered
|
|
155
|
-
- Do NOT remove historical gotchas unless they are no longer relevant
|
|
156
|
-
|
|
157
|
-
</evolution>
|
|
158
|
-
|
|
159
|
-
</pattern>
|
|
1
|
+
<pattern>
|
|
2
|
+
<purpose>
|
|
3
|
+
Template for `.docs/wiki/subsystems/[subsystem-name]/patterns/<pattern-name>.md` — a reusable
|
|
4
|
+
implementation pattern within a codebase subsystem. Answers "HOW do I implement something
|
|
5
|
+
that follows this pattern?"
|
|
6
|
+
|
|
7
|
+
Each pattern doc describes a structural template that appears across multiple implementations.
|
|
8
|
+
It is the document an AI agent reads to ensure new code follows established conventions.
|
|
9
|
+
|
|
10
|
+
A "pattern" is a recurring structural approach used by 2+ implementations:
|
|
11
|
+
e.g., Template Method (Path base class with 5 factory methods), Repository Pattern,
|
|
12
|
+
Mapper Pattern, Factory/Registry, CQRS Command/Query handlers.
|
|
13
|
+
|
|
14
|
+
Complements:
|
|
15
|
+
- systems/ docs (WHAT exists — the domain subsystems that USE these patterns)
|
|
16
|
+
- guides/ docs (step-by-step recipes that COMBINE multiple patterns into a task)
|
|
17
|
+
- cross-cutting/ docs (shared infrastructure that patterns depend on)
|
|
18
|
+
</purpose>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<the-pattern>
|
|
22
|
+
# [Pattern Name]
|
|
23
|
+
|
|
24
|
+
## The Pattern
|
|
25
|
+
What it is, when to use it. One paragraph max.
|
|
26
|
+
</the-pattern>
|
|
27
|
+
|
|
28
|
+
<structure>
|
|
29
|
+
## Structure
|
|
30
|
+
|
|
31
|
+
Class/interface diagram showing the pattern's structure.
|
|
32
|
+
|
|
33
|
+
```mermaid
|
|
34
|
+
classDiagram
|
|
35
|
+
class IContract {
|
|
36
|
+
<<interface>>
|
|
37
|
+
+method() ReturnType
|
|
38
|
+
}
|
|
39
|
+
class AbstractBase {
|
|
40
|
+
<<abstract>>
|
|
41
|
+
+templateMethod()
|
|
42
|
+
#factoryMethod()* ReturnType
|
|
43
|
+
}
|
|
44
|
+
IContract <|.. AbstractBase
|
|
45
|
+
AbstractBase <|-- ConcreteA
|
|
46
|
+
AbstractBase <|-- ConcreteB
|
|
47
|
+
```
|
|
48
|
+
</structure>
|
|
49
|
+
|
|
50
|
+
<how-it-works>
|
|
51
|
+
## How It Works
|
|
52
|
+
|
|
53
|
+
Step-by-step of the pattern mechanics. Reference actual code locations.
|
|
54
|
+
|
|
55
|
+
1. **Step**: Description at `file:ClassName.method`
|
|
56
|
+
2. **Step**: Description at `file:ClassName.method`
|
|
57
|
+
3. **Step**: Description at `file:ClassName.method`
|
|
58
|
+
</how-it-works>
|
|
59
|
+
|
|
60
|
+
<how-to-apply>
|
|
61
|
+
## How to Apply
|
|
62
|
+
|
|
63
|
+
When implementing something new that uses this pattern:
|
|
64
|
+
|
|
65
|
+
1. [First step] (reference: `file:ClassName.method`)
|
|
66
|
+
2. [Second step]
|
|
67
|
+
3. [Third step]
|
|
68
|
+
...
|
|
69
|
+
</how-to-apply>
|
|
70
|
+
|
|
71
|
+
<current-implementations>
|
|
72
|
+
## Current Implementations
|
|
73
|
+
|
|
74
|
+
Where this pattern is currently used:
|
|
75
|
+
- `TrendLine` at `src/infrastructure/primitives/trend-line/TrendLine.ts`
|
|
76
|
+
- `ParallelChannel` at `src/infrastructure/primitives/parallel-channel/ParallelChannel.ts`
|
|
77
|
+
- ...
|
|
78
|
+
</current-implementations>
|
|
79
|
+
|
|
80
|
+
<gotchas>
|
|
81
|
+
## Gotchas
|
|
82
|
+
|
|
83
|
+
Things that commonly go wrong or are easy to forget when applying this pattern.
|
|
84
|
+
- [Common mistake 1]
|
|
85
|
+
- [Common mistake 2]
|
|
86
|
+
</gotchas>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<guidelines>
|
|
90
|
+
|
|
91
|
+
**Documentation Style:**
|
|
92
|
+
- EXTREMELY SUCCINCT — every word must add value
|
|
93
|
+
- NO FLUFF — direct, actionable information only
|
|
94
|
+
- Bullet points over paragraphs
|
|
95
|
+
- Code references as `file-path:ClassName.methodName` (not line numbers)
|
|
96
|
+
- Inline snippets ONLY for interface contracts and pattern structure definitions
|
|
97
|
+
- **ALL visual representations of architecture, dependencies, flows, or relationships MUST be ```mermaid fenced code blocks (use `classDiagram` for structure). NO ASCII arrows (->), NO dependency trees, NO PlantUML. Only mermaid. The ONLY ASCII exception is file trees.**
|
|
98
|
+
|
|
99
|
+
**The Pattern:**
|
|
100
|
+
- ONE paragraph. Name the GoF/industry pattern if applicable, then explain how it
|
|
101
|
+
manifests in THIS codebase. Not a textbook definition — the codebase-specific version.
|
|
102
|
+
|
|
103
|
+
**Structure:**
|
|
104
|
+
- Mermaid classDiagram showing the abstract/interface hierarchy.
|
|
105
|
+
- Show the pattern skeleton only — not every concrete implementation.
|
|
106
|
+
- Include key method signatures that define the contract.
|
|
107
|
+
|
|
108
|
+
**How It Works:**
|
|
109
|
+
- Numbered steps tracing the pattern's execution flow.
|
|
110
|
+
- Every step references actual code with `file:ClassName.method`.
|
|
111
|
+
- Focus on the mechanics an agent needs to understand to add a new implementation.
|
|
112
|
+
|
|
113
|
+
**How to Apply:**
|
|
114
|
+
- The MOST ACTIONABLE section. An agent follows these steps to create a new instance.
|
|
115
|
+
- Reference existing implementations as "copy from" targets.
|
|
116
|
+
- Include which files to create, which registrations to add, which factories to update.
|
|
117
|
+
|
|
118
|
+
**Current Implementations:**
|
|
119
|
+
- Complete list of all known implementations with file paths.
|
|
120
|
+
- Agent uses this as a reference gallery — "pick the closest one and copy its structure."
|
|
121
|
+
- Update when new implementations are added.
|
|
122
|
+
|
|
123
|
+
**Gotchas:**
|
|
124
|
+
- Timing issues, naming conventions, registration requirements, common mistakes.
|
|
125
|
+
- Anything an agent would get wrong on first attempt without being told.
|
|
126
|
+
|
|
127
|
+
**What does NOT belong here:**
|
|
128
|
+
- System-specific domain logic (that's in systems/ docs)
|
|
129
|
+
- Step-by-step task recipes that combine multiple patterns (that's in guides/)
|
|
130
|
+
- Cross-cutting infrastructure details (that's in cross-cutting/)
|
|
131
|
+
- Story numbers, sprint context, revision history
|
|
132
|
+
- Testing instructions, performance benchmarks
|
|
133
|
+
|
|
134
|
+
</guidelines>
|
|
135
|
+
|
|
136
|
+
<evolution>
|
|
137
|
+
|
|
138
|
+
This is a LIVING document — updated when the pattern itself evolves.
|
|
139
|
+
|
|
140
|
+
**Update triggers:**
|
|
141
|
+
- New implementation added (update Current Implementations list)
|
|
142
|
+
- Pattern structure changed (new factory method, new interface method)
|
|
143
|
+
- How to Apply steps changed (new registration requirement, new file to create)
|
|
144
|
+
- New gotcha discovered during implementation
|
|
145
|
+
|
|
146
|
+
**NOT an update trigger:**
|
|
147
|
+
- New feature that follows the existing pattern without changing it
|
|
148
|
+
- Bug fix in one implementation
|
|
149
|
+
- Internal refactoring that doesn't change the pattern contract
|
|
150
|
+
|
|
151
|
+
**Update rules:**
|
|
152
|
+
- ADD new implementations to the list
|
|
153
|
+
- UPDATE How to Apply if the recipe changed
|
|
154
|
+
- ADD new gotchas as they are discovered
|
|
155
|
+
- Do NOT remove historical gotchas unless they are no longer relevant
|
|
156
|
+
|
|
157
|
+
</evolution>
|
|
158
|
+
|
|
159
|
+
</pattern>
|