agile-context-engineering 0.3.0 → 0.5.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 (147) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/LICENSE +51 -51
  3. package/README.md +332 -324
  4. package/agents/ace-product-owner.md +1 -1
  5. package/agents/ace-research-synthesizer.md +228 -228
  6. package/agents/ace-wiki-mapper.md +449 -445
  7. package/bin/install.js +60 -64
  8. package/hooks/ace-check-update.js +70 -62
  9. package/hooks/ace-statusline.js +89 -89
  10. package/package.json +5 -4
  11. package/shared/lib/ace-core.js +308 -0
  12. package/shared/lib/ace-core.test.js +308 -0
  13. package/shared/lib/ace-github.js +753 -0
  14. package/shared/lib/ace-story.js +400 -0
  15. package/shared/lib/ace-story.test.js +250 -0
  16. package/{agile-context-engineering → shared}/utils/questioning.xml +110 -110
  17. package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
  18. package/skills/execute-story/SKILL.md +110 -0
  19. package/skills/execute-story/script.js +305 -0
  20. package/skills/execute-story/script.test.js +261 -0
  21. package/skills/execute-story/walkthrough-template.xml +255 -0
  22. package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +1219 -1219
  23. package/skills/help/SKILL.md +69 -0
  24. package/skills/help/script.js +318 -0
  25. package/skills/help/script.test.js +183 -0
  26. package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +540 -540
  27. package/skills/init-coding-standards/SKILL.md +72 -0
  28. package/skills/init-coding-standards/script.js +59 -0
  29. package/skills/init-coding-standards/script.test.js +70 -0
  30. package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +381 -386
  31. package/skills/map-cross-cutting/SKILL.md +89 -0
  32. package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +197 -197
  33. package/skills/map-cross-cutting/workflow.xml +330 -0
  34. package/skills/map-guide/SKILL.md +89 -0
  35. package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +137 -137
  36. package/skills/map-guide/workflow.xml +320 -0
  37. package/skills/map-pattern/SKILL.md +89 -0
  38. package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +159 -159
  39. package/skills/map-pattern/workflow.xml +331 -0
  40. package/skills/map-story/SKILL.md +127 -0
  41. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +115 -115
  42. package/skills/map-story/templates/guide.xml +137 -0
  43. package/skills/map-story/templates/pattern.xml +159 -0
  44. package/skills/map-story/templates/system-cross-cutting.xml +197 -0
  45. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +381 -381
  46. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/walkthrough.xml +255 -255
  47. package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +1046 -1046
  48. package/skills/map-subsystem/SKILL.md +111 -0
  49. package/skills/map-subsystem/script.js +60 -0
  50. package/skills/map-subsystem/script.test.js +68 -0
  51. package/skills/map-subsystem/templates/decizions.xml +115 -0
  52. package/skills/map-subsystem/templates/guide.xml +137 -0
  53. package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +174 -174
  54. package/skills/map-subsystem/templates/pattern.xml +159 -0
  55. package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
  56. package/skills/map-subsystem/templates/system.xml +381 -0
  57. package/skills/map-subsystem/templates/walkthrough.xml +255 -0
  58. package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +15 -20
  59. package/skills/map-sys-doc/SKILL.md +90 -0
  60. package/skills/map-sys-doc/system.xml +381 -0
  61. package/skills/map-sys-doc/workflow.xml +336 -0
  62. package/skills/map-system/SKILL.md +85 -0
  63. package/skills/map-system/script.js +84 -0
  64. package/skills/map-system/script.test.js +73 -0
  65. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +254 -254
  66. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/wiki-readme.xml +296 -296
  67. package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +11 -16
  68. package/skills/map-walkthrough/SKILL.md +92 -0
  69. package/skills/map-walkthrough/walkthrough.xml +255 -0
  70. package/skills/plan-backlog/SKILL.md +75 -0
  71. package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +231 -231
  72. package/skills/plan-backlog/script.js +136 -0
  73. package/skills/plan-backlog/script.test.js +83 -0
  74. package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +13 -21
  75. package/skills/plan-feature/SKILL.md +76 -0
  76. package/skills/plan-feature/script.js +148 -0
  77. package/skills/plan-feature/script.test.js +80 -0
  78. package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +1487 -1495
  79. package/skills/plan-product-vision/SKILL.md +75 -0
  80. package/skills/plan-product-vision/script.js +60 -0
  81. package/skills/plan-product-vision/script.test.js +69 -0
  82. package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +4 -9
  83. package/skills/plan-story/SKILL.md +116 -0
  84. package/skills/plan-story/script.js +326 -0
  85. package/skills/plan-story/script.test.js +240 -0
  86. package/skills/plan-story/story-template.xml +451 -0
  87. package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1285 -944
  88. package/skills/research-external-solution/SKILL.md +107 -0
  89. package/skills/research-external-solution/script.js +238 -0
  90. package/skills/research-external-solution/script.test.js +134 -0
  91. package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +4 -6
  92. package/skills/research-integration-solution/SKILL.md +98 -0
  93. package/skills/research-integration-solution/script.js +231 -0
  94. package/skills/research-integration-solution/script.test.js +134 -0
  95. package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +3 -5
  96. package/skills/research-story-wiki/SKILL.md +92 -0
  97. package/skills/research-story-wiki/script.js +231 -0
  98. package/skills/research-story-wiki/script.test.js +138 -0
  99. package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +3 -5
  100. package/skills/research-technical-solution/SKILL.md +103 -0
  101. package/skills/research-technical-solution/script.js +231 -0
  102. package/skills/research-technical-solution/script.test.js +134 -0
  103. package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +3 -5
  104. package/skills/review-story/SKILL.md +100 -0
  105. package/skills/review-story/script.js +257 -0
  106. package/skills/review-story/script.test.js +169 -0
  107. package/skills/review-story/story-template.xml +451 -0
  108. package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +279 -281
  109. package/skills/update/SKILL.md +53 -0
  110. package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +12 -13
  111. package/agile-context-engineering/src/ace-tools.js +0 -2881
  112. package/agile-context-engineering/src/ace-tools.test.js +0 -1089
  113. package/agile-context-engineering/templates/_command.md +0 -54
  114. package/agile-context-engineering/templates/_workflow.xml +0 -17
  115. package/agile-context-engineering/templates/config.json +0 -0
  116. package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
  117. package/commands/ace/execute-story.md +0 -138
  118. package/commands/ace/help.md +0 -93
  119. package/commands/ace/init-coding-standards.md +0 -83
  120. package/commands/ace/map-story.md +0 -165
  121. package/commands/ace/map-subsystem.md +0 -140
  122. package/commands/ace/map-system.md +0 -92
  123. package/commands/ace/map-walkthrough.md +0 -127
  124. package/commands/ace/plan-backlog.md +0 -83
  125. package/commands/ace/plan-feature.md +0 -89
  126. package/commands/ace/plan-product-vision.md +0 -81
  127. package/commands/ace/plan-story.md +0 -159
  128. package/commands/ace/research-external-solution.md +0 -138
  129. package/commands/ace/research-integration-solution.md +0 -135
  130. package/commands/ace/research-story-wiki.md +0 -116
  131. package/commands/ace/research-technical-solution.md +0 -147
  132. package/commands/ace/review-story.md +0 -109
  133. package/commands/ace/update.md +0 -56
  134. /package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +0 -0
  135. /package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +0 -0
  136. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +0 -0
  137. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +0 -0
  138. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +0 -0
  139. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +0 -0
  140. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +0 -0
  141. /package/{agile-context-engineering/workflows/map-walkthrough.xml → skills/map-walkthrough/workflow.xml} +0 -0
  142. /package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +0 -0
  143. /package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +0 -0
  144. /package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +0 -0
  145. /package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +0 -0
  146. /package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +0 -0
  147. /package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +0 -0
@@ -1,386 +1,381 @@
1
- <workflow>
2
-
3
- <purpose>
4
- Orchestrate coding standards generation through environment detection, user interview,
5
- and document writing. Produces `.docs/wiki/system-wide/coding-standards.md` — a prescriptive,
6
- paradigm-aware coding standards document tailored to the project.
7
-
8
- Brownfield projects: detect language/paradigm/frameworks from codebase, then interview.
9
- Greenfield projects: gather tech choices from user interview directly.
10
- </purpose>
11
-
12
- <mandatory-context>
13
- Read all files referenced by the invoking command's execution-context before starting.
14
- Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
15
- </mandatory-context>
16
-
17
- <process>
18
-
19
- <!-- ══════════════════════════════════════════════════════════════════ -->
20
- <!-- STEP 1: SETUP -->
21
- <!-- ══════════════════════════════════════════════════════════════════ -->
22
-
23
- <step name="setup" order="1">
24
- **MANDATORY FIRST STEP — Execute environment detection before any user interaction:**
25
-
26
- ```bash
27
- INIT=$(node ~/.claude/agile-context-engineering/src/ace-tools.js init coding-standards)
28
- ```
29
-
30
- Parse JSON for: `commit_docs`, `is_brownfield`, `is_greenfield`, `has_existing_code`,
31
- `has_package_file`, `has_coding_standards`, `wiki_dir_exists`, `has_system_architecture`,
32
- `has_system_structure`, `has_git`.
33
-
34
- Also resolve the mapper model for spawning the wiki-mapper agent:
35
- ```bash
36
- MAPPER_MODEL=$(node ~/.claude/agile-context-engineering/src/ace-tools.js resolve-model ace-wiki-mapper --raw)
37
- ```
38
-
39
- Display stage banner:
40
-
41
- ```
42
- ╔══════════════════════════════════════════════════╗
43
- ║ ACE > Coding Standards ║
44
- ╚══════════════════════════════════════════════════╝
45
- ```
46
-
47
- **If `has_coding_standards` is true:**
48
-
49
- Use AskUserQuestion:
50
- - header: "Standards exist"
51
- - question: "Coding standards already exist at `.docs/wiki/system-wide/coding-standards.md`. What would you like to do?"
52
- - options:
53
- - "Update" Refine the existing standards through a new interview
54
- - "Start fresh" Discard and create new standards from scratch
55
- - "Skip" — Keep the current standards as-is
56
-
57
- If "Update": Read existing file, hold as seed context, continue to step 2
58
- If "Start fresh": Ignore existing file, continue to step 2
59
- If "Skip": Exit workflow
60
-
61
- **If `has_git` is false:** Initialize git:
62
- ```bash
63
- git init
64
- ```
65
- </step>
66
-
67
- <!-- ══════════════════════════════════════════════════════════════════ -->
68
- <!-- STEP 2: DETECT (brownfield) or SKIP (greenfield) -->
69
- <!-- ══════════════════════════════════════════════════════════════════ -->
70
-
71
- <step name="detect" order="2">
72
-
73
- **If `is_greenfield` is true:**
74
-
75
- There is no codebase to analyze. Skip detection entirely — the interview (step 3)
76
- will gather language, paradigm, and framework preferences directly from the user.
77
-
78
- Hold detection results as: `DETECTION = null` (signals greenfield to step 3).
79
-
80
- Continue directly to step 3 (interview).
81
-
82
- **If `is_brownfield` is true:**
83
-
84
- Spawn a detection agent to analyze the existing codebase. Use a Task agent to
85
- avoid filling main context with file scanning:
86
-
87
- ```
88
- Task(
89
- prompt="Analyze this project's technical profile for coding standards generation.
90
-
91
- **Step 1 — Detect languages:**
92
- Check for: package.json, tsconfig.json, *.csproj, *.sln, Cargo.toml, go.mod,
93
- pyproject.toml, setup.py, requirements.txt, build.gradle, pom.xml, Gemfile,
94
- mix.exs, *.cabal, pubspec.yaml, Package.swift, composer.json
95
-
96
- **Step 2 Detect paradigm:**
97
- Scan 5-10 representative source files. Classify as:
98
- - OOP-heavy: classes, interfaces, DI containers, inheritance
99
- - Functional-heavy: pure functions, pipelines, algebraic types, pattern matching
100
- - Multi-paradigm: mix of both
101
- - Systems: ownership, manual memory, error-by-return
102
-
103
- **Step 3 — Detect frameworks and tooling:**
104
- Check package files and imports for: React, Angular, Vue, Express, ASP.NET,
105
- Spring, Django, Phoenix, Gin, Actix, Jest, xUnit, pytest, etc.
106
- Check for: .eslintrc, .prettierrc, ruff.toml, .editorconfig, biome.json
107
-
108
- **Step 4 — Detect existing standards:**
109
- Check for existing CLAUDE.md, .docs/ standards, lint configs, .editorconfig
110
-
111
- **Step 5 Detect project structure patterns:**
112
- Find where constants, config, DI registration, and shared code live.
113
-
114
- **Return format structured summary only:**
115
- LANGUAGES: [list with confidence]
116
- PARADIGM: [OOP / Functional / Multi-paradigm / Systems]
117
- FRAMEWORKS: [list]
118
- TOOLING: [linters, formatters, configs found]
119
- EXISTING_STANDARDS: [any existing standards docs found]
120
- CONSTANTS_LOCATION: [where constants/config values live]
121
- DI_LOCATION: [where dependency injection is configured, if applicable]
122
- PATTERNS_OBSERVED: [3-5 key patterns seen in the code]",
123
- subagent_type="Explore",
124
- model="{MAPPER_MODEL}",
125
- description="Detect project technical profile"
126
- )
127
- ```
128
-
129
- Hold detection results for the interview step.
130
- </step>
131
-
132
- <!-- ══════════════════════════════════════════════════════════════════ -->
133
- <!-- STEP 3: INTERVIEW -->
134
- <!-- ══════════════════════════════════════════════════════════════════ -->
135
-
136
- <step name="interview" order="3">
137
- Follow the questioning guide from `questioning.xml`. You are a thinking partner
138
- helping the user articulate their coding philosophy.
139
-
140
- **Opening — adapt based on greenfield vs brownfield:**
141
-
142
- If BROWNFIELD (detection results available):
143
- ```
144
- I analyzed your project. Here's what I found:
145
-
146
- - Language(s): [detected]
147
- - Paradigm: [detected]
148
- - Frameworks: [detected]
149
- - Existing tooling: [linters/formatters found]
150
- [If existing standards found: "You already have [doc] — I'll build on that."]
151
-
152
- Let me understand your coding standards preferences.
153
- ```
154
-
155
- If GREENFIELD (no detection results):
156
- ```
157
- This is a greenfield project — no existing code to analyze yet.
158
- I'll need to understand your plans to create the right standards.
159
- ```
160
-
161
- Then ask about the tech stack using AskUserQuestion:
162
- - header: "Language"
163
- - question: "What language(s) will this project use?"
164
- - options: (pick the 3-4 most common, based on context if any)
165
- e.g., "TypeScript", "Python", "C#", "Go"
166
-
167
- Follow up with paradigm preference:
168
- - header: "Paradigm"
169
- - question: "What programming paradigm will you primarily use?"
170
- - options adapt to the language chosen:
171
- - For TypeScript: "Class-based OOP", "Functional", "React components + hooks"
172
- - For Python: "OOP with classes", "Functional/procedural", "Mixed"
173
- - For C#/Java: "OOP with SOLID" (only realistic option, confirm don't ask)
174
- - For Go: "Go idioms" (Go has its own paradigm, confirm don't ask)
175
- - For Rust: "Rust idioms" (traits + ownership, confirm don't ask)
176
-
177
- Then ask about frameworks if not already known.
178
-
179
- **Key areas to explore (adapt based on conversation, don't checklist):**
180
-
181
- 1. **Strictness level**
182
- "How strict do you want the coding standards to be?"
183
- - "Enterprise-grade strict" Zero tolerance for violations, every rule enforced
184
- - "Pragmatic but principled" Strong guidelines with room for justified exceptions
185
- - "Minimal essentials" — Only rules that prevent real problems
186
-
187
- 2. **Pain points THE MOST VALUABLE QUESTION**
188
- "What mistakes have you seen Claude or developers make repeatedly?"
189
- Follow up on every pain point. Each one becomes an emphatic rule.
190
- Examples they might mention:
191
- - "Claude puts multiple classes in one file"
192
- - "Claude swallows errors silently"
193
- - "Claude hardcodes values"
194
- - "Claude over-engineers simple things"
195
- - "Claude doesn't check what already exists"
196
-
197
- 3. **Paradigm preference** (if multi-paradigm language)
198
- Already gathered for greenfield; confirm for brownfield if multi-paradigm detected.
199
- - For Python: "OOP with classes" / "Functional/procedural" / "Mix"
200
- - For TypeScript: "Class-based OOP" / "Functional with types" / "React hooks"
201
- - For Kotlin/Scala: "OOP with interfaces" / "Functional with sealed classes" / "Mix"
202
-
203
- 4. **Architecture enforcement**
204
- "Do you want the standards to enforce architecture patterns?"
205
- - SOLID principles, Clean Architecture layers, DI requirements
206
- - Or just code-level rules without architectural mandates
207
-
208
- 5. **File organization rules**
209
- "One class/module per file strictly, or are small related types OK together?"
210
- "Max file length preference?"
211
-
212
- 6. **Error handling philosophy**
213
- "How should errors be handled?"
214
- - Fail fast with exceptions
215
- - Result/Either types for expected failures
216
- - Language-specific patterns
217
-
218
- 7. **Testability requirements**
219
- "Should the standards mandate testability patterns?"
220
- - Always code against interfaces/abstractions
221
- - Pure functions where possible
222
- - DI for all dependencies
223
-
224
- 8. **Custom rules**
225
- "Any specific rules from your experience that you want enforced?"
226
- Capture these verbatim — they are the user's hard-won lessons.
227
-
228
- If the user provided a context document ($ARGUMENTS), absorb it first and use it
229
- to skip questions that are already answered. Probe gaps and ambiguities instead.
230
-
231
- **Decision gate:**
232
-
233
- When you understand their philosophy, pain points, and specific preferences:
234
- - header: "Ready?"
235
- - question: "I understand your coding philosophy. Ready to generate your coding standards?"
236
- - options:
237
- - "Generate standards" — Create the document
238
- - "Keep exploring" — I have more to share
239
-
240
- Loop until "Generate standards" selected.
241
- </step>
242
-
243
- <!-- ══════════════════════════════════════════════════════════════════ -->
244
- <!-- STEP 4: GENERATE -->
245
- <!-- ══════════════════════════════════════════════════════════════════ -->
246
-
247
- <step name="generate" order="4">
248
- **Create directory structure:**
249
- ```bash
250
- mkdir -p .docs/wiki/system-wide
251
- ```
252
-
253
- **Prepare a context brief (300-500 words) that distills:**
254
- - Project type: greenfield or brownfield
255
- - Detection results OR user-stated tech choices (languages, paradigm, frameworks, tooling)
256
- - User's strictness preference
257
- - User's pain points (listed explicitly — these become emphatic rules)
258
- - Paradigm preference and which template modules to include
259
- - Architecture enforcement preferences
260
- - File organization rules (construct per file, max length)
261
- - Error handling philosophy
262
- - Testability requirements
263
- - Custom rules (verbatim from user)
264
- - Constants location, DI config location (from detection or "TBD" for greenfield)
265
- - If updating existing standards: what to preserve vs. change
266
-
267
- **Spawn the ace-wiki-mapper agent to write the document:**
268
-
269
- ```
270
- Task(
271
- prompt="You are writing a prescriptive coding standards document for the project wiki.
272
-
273
- **Context brief from detection + interview:**
274
- {paste the context brief here}
275
-
276
- **Instructions:**
277
- 1. Read the coding standards template:
278
- ~/.claude/agile-context-engineering/templates/wiki/coding-standards.xml
279
- 2. Assemble the document following the template's assembly guidelines:
280
- - ALWAYS include universal-standards (adapt placeholders to the project's language)
281
- - Include paradigm modules based on context brief (OOP, functional, systems, or multiple)
282
- - Generate language-conventions section from detection results or user-stated choices
283
- - Include project-specific-rules from user's pain points and custom rules
284
- - For greenfield: use [TBD] markers for project-specific paths (constants dir, DI config)
285
- that will be filled once the codebase exists
286
- 3. If brownfield: explore the codebase to cross-reference actual file paths for
287
- constants directories, DI configuration, shared utilities, etc.
288
- 4. Tone: DIRECT and EMPHATIC. Bold for emphasis, caps for critical words.
289
- This is a mandate document, not suggestions.
290
- 5. Target length: 150-350 lines. Comprehensive but not bloated.
291
- 6. Write the file to `.docs/wiki/system-wide/coding-standards.md`
292
-
293
- **Return format ONLY this, nothing else:**
294
- DONE
295
- - Paradigm modules included: [list]
296
- - Total sections: [N]
297
- - Line count: [N]
298
- - Top 3 emphatic rules: [list the most critical rules]",
299
- subagent_type="ace-wiki-mapper",
300
- model="{MAPPER_MODEL}",
301
- description="Write coding standards document"
302
- )
303
- ```
304
- </step>
305
-
306
- <!-- ══════════════════════════════════════════════════════════════════ -->
307
- <!-- STEP 5: REVIEW AND APPROVE -->
308
- <!-- ══════════════════════════════════════════════════════════════════ -->
309
-
310
- <step name="review" order="5">
311
- Show the agent's returned summary to the user. Then:
312
-
313
- - header: "Standards"
314
- - question: "Coding standards written to `.docs/wiki/system-wide/coding-standards.md`. Does this look right? Review the full file in your editor for details."
315
- - options:
316
- - "Approve" Looks good, commit it
317
- - "Adjust" I want to change some things
318
- - "Redo interview" — Let's go back and discuss more
319
-
320
- **If "Adjust":**
321
- - Ask what they want to change
322
- - Spawn the ace-wiki-mapper agent to adjust:
323
- ```
324
- Task(
325
- prompt="Read `.docs/wiki/system-wide/coding-standards.md` and make these changes:
326
- {user's requested changes}.
327
- If changes reference codebase paths or patterns, explore the codebase to verify.
328
- Use the Edit tool to modify in place. Return only a confirmation of what changed.",
329
- subagent_type="ace-wiki-mapper",
330
- model="{MAPPER_MODEL}",
331
- description="Adjust coding standards"
332
- )
333
- ```
334
- - Present for review again. Loop until approved.
335
-
336
- **If "Redo interview":**
337
- - Return to step 3 (interview), preserve detection results
338
- - Hold previous answers as context
339
-
340
- **If "Approve":**
341
- Continue to commit step.
342
- </step>
343
-
344
- <!-- ══════════════════════════════════════════════════════════════════ -->
345
- <!-- STEP 6: COMMIT -->
346
- <!-- ══════════════════════════════════════════════════════════════════ -->
347
-
348
- <step name="commit" order="6">
349
- Commit the coding standards:
350
-
351
- ```bash
352
- git add .docs/wiki/system-wide/coding-standards.md
353
- git commit -m "docs: initialize coding standards"
354
- ```
355
-
356
- Display completion:
357
-
358
- ```
359
- ╔══════════════════════════════════════════════════╗
360
- ACE > Coding Standards Created ║
361
- ╚══════════════════════════════════════════════════╝
362
-
363
- + .docs/wiki/system-wide/coding-standards.md committed.
364
-
365
- i These standards will be used as context by ACE commands
366
- when planning and executing stories.
367
-
368
- Next > /ace:map-system
369
- Map your codebase structure and architecture.
370
- ```
371
- </step>
372
-
373
- </process>
374
-
375
- <success_criteria>
376
- - Init function executed (brownfield/greenfield detected, existing standards checked)
377
- - Brownfield: project technical profile detected via Explore agent
378
- - Greenfield: language, paradigm, frameworks gathered from user interview
379
- - User interviewed about coding philosophy and pain points
380
- - coding-standards.md written with appropriate paradigm modules
381
- - Document is prescriptive and emphatic, not descriptive
382
- - User reviewed and approved the document
383
- - Document committed to .docs/wiki/system-wide/
384
- </success_criteria>
385
-
386
- </workflow>
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Orchestrate coding standards generation through environment detection, user interview,
5
+ and document writing. Produces `.docs/wiki/system-wide/coding-standards.md` — a prescriptive,
6
+ paradigm-aware coding standards document tailored to the project.
7
+
8
+ Brownfield projects: detect language/paradigm/frameworks from codebase, then interview.
9
+ Greenfield projects: gather tech choices from user interview directly.
10
+ </purpose>
11
+
12
+ <mandatory-context>
13
+ Read all files referenced by the invoking command's execution-context before starting.
14
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
15
+ </mandatory-context>
16
+
17
+ <process>
18
+
19
+ <!-- ══════════════════════════════════════════════════════════════════ -->
20
+ <!-- STEP 1: SETUP -->
21
+ <!-- ══════════════════════════════════════════════════════════════════ -->
22
+
23
+ <step name="setup" order="1">
24
+ **MANDATORY FIRST STEP — Execute environment detection before any user interaction:**
25
+
26
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
27
+
28
+ Parse INIT JSON for: `commit_docs`, `is_brownfield`, `is_greenfield`, `has_existing_code`,
29
+ `has_package_file`, `has_coding_standards`, `wiki_dir_exists`, `has_system_architecture`,
30
+ `has_system_structure`, `has_git`.
31
+
32
+ MAPPER_MODEL is available from INIT.mapper_model — do NOT re-run resolve-model.
33
+
34
+ Display stage banner:
35
+
36
+ ```
37
+ ╔══════════════════════════════════════════════════╗
38
+ ║ ACE > Coding Standards ║
39
+ ╚══════════════════════════════════════════════════╝
40
+ ```
41
+
42
+ **If `has_coding_standards` is true:**
43
+
44
+ Use AskUserQuestion:
45
+ - header: "Standards exist"
46
+ - question: "Coding standards already exist at `.docs/wiki/system-wide/coding-standards.md`. What would you like to do?"
47
+ - options:
48
+ - "Update" — Refine the existing standards through a new interview
49
+ - "Start fresh" — Discard and create new standards from scratch
50
+ - "Skip" — Keep the current standards as-is
51
+
52
+ If "Update": Read existing file, hold as seed context, continue to step 2
53
+ If "Start fresh": Ignore existing file, continue to step 2
54
+ If "Skip": Exit workflow
55
+
56
+ **If `has_git` is false:** Initialize git:
57
+ ```bash
58
+ git init
59
+ ```
60
+ </step>
61
+
62
+ <!-- ══════════════════════════════════════════════════════════════════ -->
63
+ <!-- STEP 2: DETECT (brownfield) or SKIP (greenfield) -->
64
+ <!-- ══════════════════════════════════════════════════════════════════ -->
65
+
66
+ <step name="detect" order="2">
67
+
68
+ **If `is_greenfield` is true:**
69
+
70
+ There is no codebase to analyze. Skip detection entirely — the interview (step 3)
71
+ will gather language, paradigm, and framework preferences directly from the user.
72
+
73
+ Hold detection results as: `DETECTION = null` (signals greenfield to step 3).
74
+
75
+ Continue directly to step 3 (interview).
76
+
77
+ **If `is_brownfield` is true:**
78
+
79
+ Spawn a detection agent to analyze the existing codebase. Use a Task agent to
80
+ avoid filling main context with file scanning:
81
+
82
+ ```
83
+ Task(
84
+ prompt="Analyze this project's technical profile for coding standards generation.
85
+
86
+ **Step 1 — Detect languages:**
87
+ Check for: package.json, tsconfig.json, *.csproj, *.sln, Cargo.toml, go.mod,
88
+ pyproject.toml, setup.py, requirements.txt, build.gradle, pom.xml, Gemfile,
89
+ mix.exs, *.cabal, pubspec.yaml, Package.swift, composer.json
90
+
91
+ **Step 2 — Detect paradigm:**
92
+ Scan 5-10 representative source files. Classify as:
93
+ - OOP-heavy: classes, interfaces, DI containers, inheritance
94
+ - Functional-heavy: pure functions, pipelines, algebraic types, pattern matching
95
+ - Multi-paradigm: mix of both
96
+ - Systems: ownership, manual memory, error-by-return
97
+
98
+ **Step 3 Detect frameworks and tooling:**
99
+ Check package files and imports for: React, Angular, Vue, Express, ASP.NET,
100
+ Spring, Django, Phoenix, Gin, Actix, Jest, xUnit, pytest, etc.
101
+ Check for: .eslintrc, .prettierrc, ruff.toml, .editorconfig, biome.json
102
+
103
+ **Step 4 — Detect existing standards:**
104
+ Check for existing CLAUDE.md, .docs/ standards, lint configs, .editorconfig
105
+
106
+ **Step 5 Detect project structure patterns:**
107
+ Find where constants, config, DI registration, and shared code live.
108
+
109
+ **Return format structured summary only:**
110
+ LANGUAGES: [list with confidence]
111
+ PARADIGM: [OOP / Functional / Multi-paradigm / Systems]
112
+ FRAMEWORKS: [list]
113
+ TOOLING: [linters, formatters, configs found]
114
+ EXISTING_STANDARDS: [any existing standards docs found]
115
+ CONSTANTS_LOCATION: [where constants/config values live]
116
+ DI_LOCATION: [where dependency injection is configured, if applicable]
117
+ PATTERNS_OBSERVED: [3-5 key patterns seen in the code]",
118
+ subagent_type="Explore",
119
+ model="{MAPPER_MODEL}",
120
+ description="Detect project technical profile"
121
+ )
122
+ ```
123
+
124
+ Hold detection results for the interview step.
125
+ </step>
126
+
127
+ <!-- ══════════════════════════════════════════════════════════════════ -->
128
+ <!-- STEP 3: INTERVIEW -->
129
+ <!-- ══════════════════════════════════════════════════════════════════ -->
130
+
131
+ <step name="interview" order="3">
132
+ Follow the questioning guide from `questioning.xml`. You are a thinking partner
133
+ helping the user articulate their coding philosophy.
134
+
135
+ **Opening — adapt based on greenfield vs brownfield:**
136
+
137
+ If BROWNFIELD (detection results available):
138
+ ```
139
+ I analyzed your project. Here's what I found:
140
+
141
+ - Language(s): [detected]
142
+ - Paradigm: [detected]
143
+ - Frameworks: [detected]
144
+ - Existing tooling: [linters/formatters found]
145
+ [If existing standards found: "You already have [doc] — I'll build on that."]
146
+
147
+ Let me understand your coding standards preferences.
148
+ ```
149
+
150
+ If GREENFIELD (no detection results):
151
+ ```
152
+ This is a greenfield project no existing code to analyze yet.
153
+ I'll need to understand your plans to create the right standards.
154
+ ```
155
+
156
+ Then ask about the tech stack using AskUserQuestion:
157
+ - header: "Language"
158
+ - question: "What language(s) will this project use?"
159
+ - options: (pick the 3-4 most common, based on context if any)
160
+ e.g., "TypeScript", "Python", "C#", "Go"
161
+
162
+ Follow up with paradigm preference:
163
+ - header: "Paradigm"
164
+ - question: "What programming paradigm will you primarily use?"
165
+ - options adapt to the language chosen:
166
+ - For TypeScript: "Class-based OOP", "Functional", "React components + hooks"
167
+ - For Python: "OOP with classes", "Functional/procedural", "Mixed"
168
+ - For C#/Java: "OOP with SOLID" (only realistic option, confirm don't ask)
169
+ - For Go: "Go idioms" (Go has its own paradigm, confirm don't ask)
170
+ - For Rust: "Rust idioms" (traits + ownership, confirm don't ask)
171
+
172
+ Then ask about frameworks if not already known.
173
+
174
+ **Key areas to explore (adapt based on conversation, don't checklist):**
175
+
176
+ 1. **Strictness level**
177
+ "How strict do you want the coding standards to be?"
178
+ - "Enterprise-grade strict" — Zero tolerance for violations, every rule enforced
179
+ - "Pragmatic but principled" Strong guidelines with room for justified exceptions
180
+ - "Minimal essentials" — Only rules that prevent real problems
181
+
182
+ 2. **Pain points THE MOST VALUABLE QUESTION**
183
+ "What mistakes have you seen Claude or developers make repeatedly?"
184
+ Follow up on every pain point. Each one becomes an emphatic rule.
185
+ Examples they might mention:
186
+ - "Claude puts multiple classes in one file"
187
+ - "Claude swallows errors silently"
188
+ - "Claude hardcodes values"
189
+ - "Claude over-engineers simple things"
190
+ - "Claude doesn't check what already exists"
191
+
192
+ 3. **Paradigm preference** (if multi-paradigm language)
193
+ Already gathered for greenfield; confirm for brownfield if multi-paradigm detected.
194
+ - For Python: "OOP with classes" / "Functional/procedural" / "Mix"
195
+ - For TypeScript: "Class-based OOP" / "Functional with types" / "React hooks"
196
+ - For Kotlin/Scala: "OOP with interfaces" / "Functional with sealed classes" / "Mix"
197
+
198
+ 4. **Architecture enforcement**
199
+ "Do you want the standards to enforce architecture patterns?"
200
+ - SOLID principles, Clean Architecture layers, DI requirements
201
+ - Or just code-level rules without architectural mandates
202
+
203
+ 5. **File organization rules**
204
+ "One class/module per file strictly, or are small related types OK together?"
205
+ "Max file length preference?"
206
+
207
+ 6. **Error handling philosophy**
208
+ "How should errors be handled?"
209
+ - Fail fast with exceptions
210
+ - Result/Either types for expected failures
211
+ - Language-specific patterns
212
+
213
+ 7. **Testability requirements**
214
+ "Should the standards mandate testability patterns?"
215
+ - Always code against interfaces/abstractions
216
+ - Pure functions where possible
217
+ - DI for all dependencies
218
+
219
+ 8. **Custom rules**
220
+ "Any specific rules from your experience that you want enforced?"
221
+ Capture these verbatim they are the user's hard-won lessons.
222
+
223
+ If the user provided a context document ($ARGUMENTS), absorb it first and use it
224
+ to skip questions that are already answered. Probe gaps and ambiguities instead.
225
+
226
+ **Decision gate:**
227
+
228
+ When you understand their philosophy, pain points, and specific preferences:
229
+ - header: "Ready?"
230
+ - question: "I understand your coding philosophy. Ready to generate your coding standards?"
231
+ - options:
232
+ - "Generate standards" — Create the document
233
+ - "Keep exploring" I have more to share
234
+
235
+ Loop until "Generate standards" selected.
236
+ </step>
237
+
238
+ <!-- ══════════════════════════════════════════════════════════════════ -->
239
+ <!-- STEP 4: GENERATE -->
240
+ <!-- ══════════════════════════════════════════════════════════════════ -->
241
+
242
+ <step name="generate" order="4">
243
+ **Create directory structure:**
244
+ ```bash
245
+ mkdir -p .docs/wiki/system-wide
246
+ ```
247
+
248
+ **Prepare a context brief (300-500 words) that distills:**
249
+ - Project type: greenfield or brownfield
250
+ - Detection results OR user-stated tech choices (languages, paradigm, frameworks, tooling)
251
+ - User's strictness preference
252
+ - User's pain points (listed explicitly — these become emphatic rules)
253
+ - Paradigm preference and which template modules to include
254
+ - Architecture enforcement preferences
255
+ - File organization rules (construct per file, max length)
256
+ - Error handling philosophy
257
+ - Testability requirements
258
+ - Custom rules (verbatim from user)
259
+ - Constants location, DI config location (from detection or "TBD" for greenfield)
260
+ - If updating existing standards: what to preserve vs. change
261
+
262
+ **Spawn the ace-wiki-mapper agent to write the document:**
263
+
264
+ ```
265
+ Task(
266
+ prompt="You are writing a prescriptive coding standards document for the project wiki.
267
+
268
+ **Context brief from detection + interview:**
269
+ {paste the context brief here}
270
+
271
+ **Instructions:**
272
+ 1. Read the coding standards template:
273
+ ${CLAUDE_SKILL_DIR}/coding-standards-template.xml
274
+ 2. Assemble the document following the template's assembly guidelines:
275
+ - ALWAYS include universal-standards (adapt placeholders to the project's language)
276
+ - Include paradigm modules based on context brief (OOP, functional, systems, or multiple)
277
+ - Generate language-conventions section from detection results or user-stated choices
278
+ - Include project-specific-rules from user's pain points and custom rules
279
+ - For greenfield: use [TBD] markers for project-specific paths (constants dir, DI config)
280
+ that will be filled once the codebase exists
281
+ 3. If brownfield: explore the codebase to cross-reference actual file paths for
282
+ constants directories, DI configuration, shared utilities, etc.
283
+ 4. Tone: DIRECT and EMPHATIC. Bold for emphasis, caps for critical words.
284
+ This is a mandate document, not suggestions.
285
+ 5. Target length: 150-350 lines. Comprehensive but not bloated.
286
+ 6. Write the file to `.docs/wiki/system-wide/coding-standards.md`
287
+
288
+ **Return format ONLY this, nothing else:**
289
+ DONE
290
+ - Paradigm modules included: [list]
291
+ - Total sections: [N]
292
+ - Line count: [N]
293
+ - Top 3 emphatic rules: [list the most critical rules]",
294
+ subagent_type="ace-wiki-mapper",
295
+ model="{MAPPER_MODEL}",
296
+ description="Write coding standards document"
297
+ )
298
+ ```
299
+ </step>
300
+
301
+ <!-- ══════════════════════════════════════════════════════════════════ -->
302
+ <!-- STEP 5: REVIEW AND APPROVE -->
303
+ <!-- ══════════════════════════════════════════════════════════════════ -->
304
+
305
+ <step name="review" order="5">
306
+ Show the agent's returned summary to the user. Then:
307
+
308
+ - header: "Standards"
309
+ - question: "Coding standards written to `.docs/wiki/system-wide/coding-standards.md`. Does this look right? Review the full file in your editor for details."
310
+ - options:
311
+ - "Approve" Looks good, commit it
312
+ - "Adjust" — I want to change some things
313
+ - "Redo interview" — Let's go back and discuss more
314
+
315
+ **If "Adjust":**
316
+ - Ask what they want to change
317
+ - Spawn the ace-wiki-mapper agent to adjust:
318
+ ```
319
+ Task(
320
+ prompt="Read `.docs/wiki/system-wide/coding-standards.md` and make these changes:
321
+ {user's requested changes}.
322
+ If changes reference codebase paths or patterns, explore the codebase to verify.
323
+ Use the Edit tool to modify in place. Return only a confirmation of what changed.",
324
+ subagent_type="ace-wiki-mapper",
325
+ model="{MAPPER_MODEL}",
326
+ description="Adjust coding standards"
327
+ )
328
+ ```
329
+ - Present for review again. Loop until approved.
330
+
331
+ **If "Redo interview":**
332
+ - Return to step 3 (interview), preserve detection results
333
+ - Hold previous answers as context
334
+
335
+ **If "Approve":**
336
+ Continue to commit step.
337
+ </step>
338
+
339
+ <!-- ══════════════════════════════════════════════════════════════════ -->
340
+ <!-- STEP 6: COMMIT -->
341
+ <!-- ══════════════════════════════════════════════════════════════════ -->
342
+
343
+ <step name="commit" order="6">
344
+ Commit the coding standards:
345
+
346
+ ```bash
347
+ git add .docs/wiki/system-wide/coding-standards.md
348
+ git commit -m "docs: initialize coding standards"
349
+ ```
350
+
351
+ Display completion:
352
+
353
+ ```
354
+ ╔══════════════════════════════════════════════════╗
355
+ ║ ACE > Coding Standards Created ║
356
+ ╚══════════════════════════════════════════════════╝
357
+
358
+ + .docs/wiki/system-wide/coding-standards.md committed.
359
+
360
+ i These standards will be used as context by ACE commands
361
+ when planning and executing stories.
362
+
363
+ Next > /ace:map-system
364
+ Map your codebase structure and architecture.
365
+ ```
366
+ </step>
367
+
368
+ </process>
369
+
370
+ <success_criteria>
371
+ - Init function executed (brownfield/greenfield detected, existing standards checked)
372
+ - Brownfield: project technical profile detected via Explore agent
373
+ - Greenfield: language, paradigm, frameworks gathered from user interview
374
+ - User interviewed about coding philosophy and pain points
375
+ - coding-standards.md written with appropriate paradigm modules
376
+ - Document is prescriptive and emphatic, not descriptive
377
+ - User reviewed and approved the document
378
+ - Document committed to .docs/wiki/system-wide/
379
+ </success_criteria>
380
+
381
+ </workflow>