ag-cortex 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 (162) hide show
  1. package/.agent/commands/test-browser.md +339 -0
  2. package/.agent/rules/00-constitution.md +46 -0
  3. package/.agent/rules/project-rules.md +49 -0
  4. package/.agent/skills/agent-browser/SKILL.md +223 -0
  5. package/.agent/skills/agent-native-architecture/SKILL.md +435 -0
  6. package/.agent/skills/agent-native-architecture/references/action-parity-discipline.md +409 -0
  7. package/.agent/skills/agent-native-architecture/references/agent-execution-patterns.md +467 -0
  8. package/.agent/skills/agent-native-architecture/references/agent-native-testing.md +582 -0
  9. package/.agent/skills/agent-native-architecture/references/architecture-patterns.md +478 -0
  10. package/.agent/skills/agent-native-architecture/references/dynamic-context-injection.md +338 -0
  11. package/.agent/skills/agent-native-architecture/references/files-universal-interface.md +301 -0
  12. package/.agent/skills/agent-native-architecture/references/from-primitives-to-domain-tools.md +359 -0
  13. package/.agent/skills/agent-native-architecture/references/mcp-tool-design.md +506 -0
  14. package/.agent/skills/agent-native-architecture/references/mobile-patterns.md +871 -0
  15. package/.agent/skills/agent-native-architecture/references/product-implications.md +443 -0
  16. package/.agent/skills/agent-native-architecture/references/refactoring-to-prompt-native.md +317 -0
  17. package/.agent/skills/agent-native-architecture/references/self-modification.md +269 -0
  18. package/.agent/skills/agent-native-architecture/references/shared-workspace-architecture.md +680 -0
  19. package/.agent/skills/agent-native-architecture/references/system-prompt-design.md +250 -0
  20. package/.agent/skills/agent-native-reviewer/SKILL.md +246 -0
  21. package/.agent/skills/andrew-kane-gem-writer/SKILL.md +184 -0
  22. package/.agent/skills/andrew-kane-gem-writer/references/database-adapters.md +231 -0
  23. package/.agent/skills/andrew-kane-gem-writer/references/module-organization.md +121 -0
  24. package/.agent/skills/andrew-kane-gem-writer/references/rails-integration.md +183 -0
  25. package/.agent/skills/andrew-kane-gem-writer/references/resources.md +119 -0
  26. package/.agent/skills/andrew-kane-gem-writer/references/testing-patterns.md +261 -0
  27. package/.agent/skills/ankane-readme-writer/SKILL.md +50 -0
  28. package/.agent/skills/architecture-strategist/SKILL.md +52 -0
  29. package/.agent/skills/best-practices-researcher/SKILL.md +100 -0
  30. package/.agent/skills/bug-reproduction-validator/SKILL.md +67 -0
  31. package/.agent/skills/code-simplicity-reviewer/SKILL.md +85 -0
  32. package/.agent/skills/coding-tutor/.claude-plugin/plugin.json +9 -0
  33. package/.agent/skills/coding-tutor/README.md +37 -0
  34. package/.agent/skills/coding-tutor/commands/quiz-me.md +1 -0
  35. package/.agent/skills/coding-tutor/commands/sync-tutorials.md +25 -0
  36. package/.agent/skills/coding-tutor/commands/teach-me.md +1 -0
  37. package/.agent/skills/coding-tutor/skills/coding-tutor/SKILL.md +214 -0
  38. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/create_tutorial.py +202 -0
  39. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/index_tutorials.py +203 -0
  40. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/quiz_priority.py +190 -0
  41. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/setup_tutorials.py +132 -0
  42. package/.agent/skills/compound-docs/SKILL.md +510 -0
  43. package/.agent/skills/compound-docs/assets/critical-pattern-template.md +34 -0
  44. package/.agent/skills/compound-docs/assets/resolution-template.md +93 -0
  45. package/.agent/skills/compound-docs/references/yaml-schema.md +65 -0
  46. package/.agent/skills/compound-docs/schema.yaml +176 -0
  47. package/.agent/skills/create-agent-skills/SKILL.md +299 -0
  48. package/.agent/skills/create-agent-skills/references/api-security.md +226 -0
  49. package/.agent/skills/create-agent-skills/references/be-clear-and-direct.md +531 -0
  50. package/.agent/skills/create-agent-skills/references/best-practices.md +404 -0
  51. package/.agent/skills/create-agent-skills/references/common-patterns.md +595 -0
  52. package/.agent/skills/create-agent-skills/references/core-principles.md +437 -0
  53. package/.agent/skills/create-agent-skills/references/executable-code.md +175 -0
  54. package/.agent/skills/create-agent-skills/references/iteration-and-testing.md +474 -0
  55. package/.agent/skills/create-agent-skills/references/official-spec.md +185 -0
  56. package/.agent/skills/create-agent-skills/references/recommended-structure.md +168 -0
  57. package/.agent/skills/create-agent-skills/references/skill-structure.md +372 -0
  58. package/.agent/skills/create-agent-skills/references/using-scripts.md +113 -0
  59. package/.agent/skills/create-agent-skills/references/using-templates.md +112 -0
  60. package/.agent/skills/create-agent-skills/references/workflows-and-validation.md +510 -0
  61. package/.agent/skills/create-agent-skills/templates/router-skill.md +73 -0
  62. package/.agent/skills/create-agent-skills/templates/simple-skill.md +33 -0
  63. package/.agent/skills/create-agent-skills/workflows/add-reference.md +96 -0
  64. package/.agent/skills/create-agent-skills/workflows/add-script.md +93 -0
  65. package/.agent/skills/create-agent-skills/workflows/add-template.md +74 -0
  66. package/.agent/skills/create-agent-skills/workflows/add-workflow.md +120 -0
  67. package/.agent/skills/create-agent-skills/workflows/audit-skill.md +138 -0
  68. package/.agent/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +605 -0
  69. package/.agent/skills/create-agent-skills/workflows/create-new-skill.md +191 -0
  70. package/.agent/skills/create-agent-skills/workflows/get-guidance.md +121 -0
  71. package/.agent/skills/create-agent-skills/workflows/upgrade-to-router.md +161 -0
  72. package/.agent/skills/create-agent-skills/workflows/verify-skill.md +204 -0
  73. package/.agent/skills/data-integrity-guardian/SKILL.md +70 -0
  74. package/.agent/skills/data-migration-expert/SKILL.md +97 -0
  75. package/.agent/skills/deployment-verification-agent/SKILL.md +159 -0
  76. package/.agent/skills/design-implementation-reviewer/SKILL.md +85 -0
  77. package/.agent/skills/design-iterator/SKILL.md +197 -0
  78. package/.agent/skills/dhh-rails-reviewer/SKILL.md +45 -0
  79. package/.agent/skills/dhh-rails-style/SKILL.md +184 -0
  80. package/.agent/skills/dhh-rails-style/references/architecture.md +653 -0
  81. package/.agent/skills/dhh-rails-style/references/controllers.md +303 -0
  82. package/.agent/skills/dhh-rails-style/references/frontend.md +510 -0
  83. package/.agent/skills/dhh-rails-style/references/gems.md +266 -0
  84. package/.agent/skills/dhh-rails-style/references/models.md +359 -0
  85. package/.agent/skills/dhh-rails-style/references/testing.md +338 -0
  86. package/.agent/skills/dspy-ruby/SKILL.md +594 -0
  87. package/.agent/skills/dspy-ruby/assets/config-template.rb +359 -0
  88. package/.agent/skills/dspy-ruby/assets/module-template.rb +326 -0
  89. package/.agent/skills/dspy-ruby/assets/signature-template.rb +143 -0
  90. package/.agent/skills/dspy-ruby/references/core-concepts.md +265 -0
  91. package/.agent/skills/dspy-ruby/references/optimization.md +623 -0
  92. package/.agent/skills/dspy-ruby/references/providers.md +305 -0
  93. package/.agent/skills/every-style-editor/SKILL.md +134 -0
  94. package/.agent/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +529 -0
  95. package/.agent/skills/figma-design-sync/SKILL.md +166 -0
  96. package/.agent/skills/file-todos/SKILL.md +251 -0
  97. package/.agent/skills/file-todos/assets/todo-template.md +155 -0
  98. package/.agent/skills/framework-docs-researcher/SKILL.md +83 -0
  99. package/.agent/skills/frontend-design/SKILL.md +42 -0
  100. package/.agent/skills/gemini-imagegen/SKILL.md +237 -0
  101. package/.agent/skills/gemini-imagegen/requirements.txt +2 -0
  102. package/.agent/skills/gemini-imagegen/scripts/compose_images.py +168 -0
  103. package/.agent/skills/gemini-imagegen/scripts/edit_image.py +157 -0
  104. package/.agent/skills/gemini-imagegen/scripts/gemini_images.py +265 -0
  105. package/.agent/skills/gemini-imagegen/scripts/generate_image.py +147 -0
  106. package/.agent/skills/gemini-imagegen/scripts/multi_turn_chat.py +215 -0
  107. package/.agent/skills/git-history-analyzer/SKILL.md +42 -0
  108. package/.agent/skills/git-worktree/SKILL.md +302 -0
  109. package/.agent/skills/git-worktree/scripts/worktree-manager.sh +345 -0
  110. package/.agent/skills/julik-frontend-races-reviewer/SKILL.md +222 -0
  111. package/.agent/skills/kieran-python-reviewer/SKILL.md +104 -0
  112. package/.agent/skills/kieran-rails-reviewer/SKILL.md +86 -0
  113. package/.agent/skills/kieran-typescript-reviewer/SKILL.md +95 -0
  114. package/.agent/skills/lint/SKILL.md +16 -0
  115. package/.agent/skills/pattern-recognition-specialist/SKILL.md +57 -0
  116. package/.agent/skills/performance-oracle/SKILL.md +110 -0
  117. package/.agent/skills/pr-comment-resolver/SKILL.md +69 -0
  118. package/.agent/skills/rclone/SKILL.md +150 -0
  119. package/.agent/skills/rclone/scripts/check_setup.sh +60 -0
  120. package/.agent/skills/repo-research-analyst/SKILL.md +113 -0
  121. package/.agent/skills/security-sentinel/SKILL.md +93 -0
  122. package/.agent/skills/skill-creator/SKILL.md +209 -0
  123. package/.agent/skills/skill-creator/scripts/init_skill.py +304 -0
  124. package/.agent/skills/skill-creator/scripts/package_skill.py +112 -0
  125. package/.agent/skills/skill-creator/scripts/quick_validate.py +72 -0
  126. package/.agent/skills/spec-flow-analyzer/SKILL.md +113 -0
  127. package/.agent/skills/test-agent/SKILL.md +4 -0
  128. package/.agent/workflows/agent-native-audit.md +277 -0
  129. package/.agent/workflows/ask-user-question.md +21 -0
  130. package/.agent/workflows/changelog.md +137 -0
  131. package/.agent/workflows/compound.md +202 -0
  132. package/.agent/workflows/create-agent-skill.md +8 -0
  133. package/.agent/workflows/deepen-plan-research.md +334 -0
  134. package/.agent/workflows/deepen-plan-synthesis.md +182 -0
  135. package/.agent/workflows/deepen-plan.md +79 -0
  136. package/.agent/workflows/feature-video.md +342 -0
  137. package/.agent/workflows/generate-command.md +162 -0
  138. package/.agent/workflows/heal-skill.md +142 -0
  139. package/.agent/workflows/lfg.md +20 -0
  140. package/.agent/workflows/plan-analysis.md +67 -0
  141. package/.agent/workflows/plan-next-steps.md +63 -0
  142. package/.agent/workflows/plan-review.md +33 -0
  143. package/.agent/workflows/plan-synthesis.md +106 -0
  144. package/.agent/workflows/plan.md +49 -0
  145. package/.agent/workflows/report-bug.md +150 -0
  146. package/.agent/workflows/reproduce-bug.md +99 -0
  147. package/.agent/workflows/resolve-parallel.md +34 -0
  148. package/.agent/workflows/resolve-pr-parallel.md +49 -0
  149. package/.agent/workflows/resolve-todo-parallel.md +35 -0
  150. package/.agent/workflows/review-analysis.md +145 -0
  151. package/.agent/workflows/review-synthesis.md +262 -0
  152. package/.agent/workflows/review.md +64 -0
  153. package/.agent/workflows/ship.md +90 -0
  154. package/.agent/workflows/test-command.md +3 -0
  155. package/.agent/workflows/triage.md +310 -0
  156. package/.agent/workflows/work.md +157 -0
  157. package/.agent/workflows/xcode-test.md +332 -0
  158. package/LICENSE +22 -0
  159. package/README.md +49 -0
  160. package/bin/ag-cortex.js +54 -0
  161. package/lib/core.js +165 -0
  162. package/package.json +31 -0
@@ -0,0 +1,510 @@
1
+ ---
2
+ name: compound-docs
3
+ description: Capture solved problems as categorized documentation with YAML frontmatter for fast lookup
4
+ allowed-tools:
5
+ - Read # Parse conversation context
6
+ - Write # Create resolution docs
7
+ - Bash # Create directories
8
+ - Grep # Search existing docs
9
+ preconditions:
10
+ - Problem has been solved (not in-progress)
11
+ - Solution has been verified working
12
+ ---
13
+
14
+ # compound-docs Skill
15
+
16
+ **Purpose:** Automatically document solved problems to build searchable institutional knowledge with category-based organization (enum-validated problem types).
17
+
18
+ ## Overview
19
+
20
+ This skill captures problem solutions immediately after confirmation, creating structured documentation that serves as a searchable knowledge base for future sessions.
21
+
22
+ **Organization:** Single-file architecture - each problem documented as one markdown file in its symptom category directory (e.g., `docs/solutions/performance-issues/n-plus-one-briefs.md`). Files use YAML frontmatter for metadata and searchability.
23
+
24
+ ---
25
+
26
+ <critical_sequence name="documentation-capture" enforce_order="strict">
27
+
28
+ ## 7-Step Process
29
+
30
+ <step number="1" required="true">
31
+ ### Step 1: Detect Confirmation
32
+
33
+ **Auto-invoke after phrases:**
34
+
35
+ - "that worked"
36
+ - "it's fixed"
37
+ - "working now"
38
+ - "problem solved"
39
+ - "that did it"
40
+
41
+ **OR manual:** `/doc-fix` command
42
+
43
+ **Non-trivial problems only:**
44
+
45
+ - Multiple investigation attempts needed
46
+ - Tricky debugging that took time
47
+ - Non-obvious solution
48
+ - Future sessions would benefit
49
+
50
+ **Skip documentation for:**
51
+
52
+ - Simple typos
53
+ - Obvious syntax errors
54
+ - Trivial fixes immediately corrected
55
+ </step>
56
+
57
+ <step number="2" required="true" depends_on="1">
58
+ ### Step 2: Gather Context
59
+
60
+ Extract from conversation history:
61
+
62
+ **Required information:**
63
+
64
+ - **Module name**: Which CORA module had the problem
65
+ - **Symptom**: Observable error/behavior (exact error messages)
66
+ - **Investigation attempts**: What didn't work and why
67
+ - **Root cause**: Technical explanation of actual problem
68
+ - **Solution**: What fixed it (code/config changes)
69
+ - **Prevention**: How to avoid in future
70
+
71
+ **Environment details:**
72
+
73
+ - Rails version
74
+ - Stage (0-6 or post-implementation)
75
+ - OS version
76
+ - File/line references
77
+
78
+ **BLOCKING REQUIREMENT:** If critical context is missing (module name, exact error, stage, or resolution steps), ask user and WAIT for response before proceeding to Step 3:
79
+
80
+ ```
81
+ I need a few details to document this properly:
82
+
83
+ 1. Which module had this issue? [ModuleName]
84
+ 2. What was the exact error message or symptom?
85
+ 3. What stage were you in? (0-6 or post-implementation)
86
+
87
+ [Continue after user provides details]
88
+ ```
89
+ </step>
90
+
91
+ <step number="3" required="false" depends_on="2">
92
+ ### Step 3: Check Existing Docs
93
+
94
+ Search docs/solutions/ for similar issues:
95
+
96
+ ```bash
97
+ # Search by error message keywords
98
+ grep -r "exact error phrase" docs/solutions/
99
+
100
+ # Search by symptom category
101
+ ls docs/solutions/[category]/
102
+ ```
103
+
104
+ **IF similar issue found:**
105
+
106
+ THEN present decision options:
107
+
108
+ ```
109
+ Found similar issue: docs/solutions/[path]
110
+
111
+ What's next?
112
+ 1. Create new doc with cross-reference (recommended)
113
+ 2. Update existing doc (only if same root cause)
114
+ 3. Other
115
+
116
+ Choose (1-3): _
117
+ ```
118
+
119
+ WAIT for user response, then execute chosen action.
120
+
121
+ **ELSE** (no similar issue found):
122
+
123
+ Proceed directly to Step 4 (no user interaction needed).
124
+ </step>
125
+
126
+ <step number="4" required="true" depends_on="2">
127
+ ### Step 4: Generate Filename
128
+
129
+ Format: `[sanitized-symptom]-[module]-[YYYYMMDD].md`
130
+
131
+ **Sanitization rules:**
132
+
133
+ - Lowercase
134
+ - Replace spaces with hyphens
135
+ - Remove special characters except hyphens
136
+ - Truncate to reasonable length (< 80 chars)
137
+
138
+ **Examples:**
139
+
140
+ - `missing-include-BriefSystem-20251110.md`
141
+ - `parameter-not-saving-state-EmailProcessing-20251110.md`
142
+ - `webview-crash-on-resize-Assistant-20251110.md`
143
+ </step>
144
+
145
+ <step number="5" required="true" depends_on="4" blocking="true">
146
+ ### Step 5: Validate YAML Schema
147
+
148
+ **CRITICAL:** All docs require validated YAML frontmatter with enum validation.
149
+
150
+ <validation_gate name="yaml-schema" blocking="true">
151
+
152
+ **Validate against schema:**
153
+ Load `schema.yaml` and classify the problem against the enum values defined in [yaml-schema.md](./references/yaml-schema.md). Ensure all required fields are present and match allowed values exactly.
154
+
155
+ **BLOCK if validation fails:**
156
+
157
+ ```
158
+ ❌ YAML validation failed
159
+
160
+ Errors:
161
+ - problem_type: must be one of schema enums, got "compilation_error"
162
+ - severity: must be one of [critical, moderate, minor], got "high"
163
+ - symptoms: must be array with 1-5 items, got string
164
+
165
+ Please provide corrected values.
166
+ ```
167
+
168
+ **GATE ENFORCEMENT:** Do NOT proceed to Step 6 (Create Documentation) until YAML frontmatter passes all validation rules defined in `schema.yaml`.
169
+
170
+ </validation_gate>
171
+ </step>
172
+
173
+ <step number="6" required="true" depends_on="5">
174
+ ### Step 6: Create Documentation
175
+
176
+ **Determine category from problem_type:** Use the category mapping defined in [yaml-schema.md](./references/yaml-schema.md) (lines 49-61).
177
+
178
+ **Create documentation file:**
179
+
180
+ ```bash
181
+ PROBLEM_TYPE="[from validated YAML]"
182
+ CATEGORY="[mapped from problem_type]"
183
+ FILENAME="[generated-filename].md"
184
+ DOC_PATH="docs/solutions/${CATEGORY}/${FILENAME}"
185
+
186
+ # Create directory if needed
187
+ mkdir -p "docs/solutions/${CATEGORY}"
188
+
189
+ # Write documentation using template from assets/resolution-template.md
190
+ # (Content populated with Step 2 context and validated YAML frontmatter)
191
+ ```
192
+
193
+ **Result:**
194
+ - Single file in category directory
195
+ - Enum validation ensures consistent categorization
196
+
197
+ **Create documentation:** Populate the structure from `assets/resolution-template.md` with context gathered in Step 2 and validated YAML frontmatter from Step 5.
198
+ </step>
199
+
200
+ <step number="7" required="false" depends_on="6">
201
+ ### Step 7: Cross-Reference & Critical Pattern Detection
202
+
203
+ If similar issues found in Step 3:
204
+
205
+ **Update existing doc:**
206
+
207
+ ```bash
208
+ # Add Related Issues link to similar doc
209
+ echo "- See also: [$FILENAME]($REAL_FILE)" >> [similar-doc.md]
210
+ ```
211
+
212
+ **Update new doc:**
213
+ Already includes cross-reference from Step 6.
214
+
215
+ **Update patterns if applicable:**
216
+
217
+ If this represents a common pattern (3+ similar issues):
218
+
219
+ ```bash
220
+ # Add to docs/solutions/patterns/common-solutions.md
221
+ cat >> docs/solutions/patterns/common-solutions.md << 'EOF'
222
+
223
+ ## [Pattern Name]
224
+
225
+ **Common symptom:** [Description]
226
+ **Root cause:** [Technical explanation]
227
+ **Solution pattern:** [General approach]
228
+
229
+ **Examples:**
230
+ - [Link to doc 1]
231
+ - [Link to doc 2]
232
+ - [Link to doc 3]
233
+ EOF
234
+ ```
235
+
236
+ **Critical Pattern Detection (Optional Proactive Suggestion):**
237
+
238
+ If this issue has automatic indicators suggesting it might be critical:
239
+ - Severity: `critical` in YAML
240
+ - Affects multiple modules OR foundational stage (Stage 2 or 3)
241
+ - Non-obvious solution
242
+
243
+ Then in the decision menu (Step 8), add a note:
244
+ ```
245
+ 💡 This might be worth adding to Required Reading (Option 2)
246
+ ```
247
+
248
+ But **NEVER auto-promote**. User decides via decision menu (Option 2).
249
+
250
+ **Template for critical pattern addition:**
251
+
252
+ When user selects Option 2 (Add to Required Reading), use the template from `assets/critical-pattern-template.md` to structure the pattern entry. Number it sequentially based on existing patterns in `docs/solutions/patterns/cora-critical-patterns.md`.
253
+ </step>
254
+
255
+ </critical_sequence>
256
+
257
+ ---
258
+
259
+ <decision_gate name="post-documentation" wait_for_user="true">
260
+
261
+ ## Decision Menu After Capture
262
+
263
+ After successful documentation, present options and WAIT for user response:
264
+
265
+ ```
266
+ ✓ Solution documented
267
+
268
+ File created:
269
+ - docs/solutions/[category]/[filename].md
270
+
271
+ What's next?
272
+ 1. Continue workflow (recommended)
273
+ 2. Add to Required Reading - Promote to critical patterns (cora-critical-patterns.md)
274
+ 3. Link related issues - Connect to similar problems
275
+ 4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
276
+ 5. Create new skill - Extract into new learning skill
277
+ 6. View documentation - See what was captured
278
+ 7. Other
279
+ ```
280
+
281
+ **Handle responses:**
282
+
283
+ **Option 1: Continue workflow**
284
+
285
+ - Return to calling skill/workflow
286
+ - Documentation is complete
287
+
288
+ **Option 2: Add to Required Reading** ⭐ PRIMARY PATH FOR CRITICAL PATTERNS
289
+
290
+ User selects this when:
291
+ - System made this mistake multiple times across different modules
292
+ - Solution is non-obvious but must be followed every time
293
+ - Foundational requirement (Rails, Rails API, threading, etc.)
294
+
295
+ Action:
296
+ 1. Extract pattern from the documentation
297
+ 2. Format as ❌ WRONG vs ✅ CORRECT with code examples
298
+ 3. Add to `docs/solutions/patterns/cora-critical-patterns.md`
299
+ 4. Add cross-reference back to this doc
300
+ 5. Confirm: "✓ Added to Required Reading. All subagents will see this pattern before code generation."
301
+
302
+ **Option 3: Link related issues**
303
+
304
+ - Prompt: "Which doc to link? (provide filename or describe)"
305
+ - Search docs/solutions/ for the doc
306
+ - Add cross-reference to both docs
307
+ - Confirm: "✓ Cross-reference added"
308
+
309
+ **Option 4: Add to existing skill**
310
+
311
+ User selects this when the documented solution relates to an existing learning skill:
312
+
313
+ Action:
314
+ 1. Prompt: "Which skill? (hotwire-native, etc.)"
315
+ 2. Determine which reference file to update (resources.md, patterns.md, or examples.md)
316
+ 3. Add link and brief description to appropriate section
317
+ 4. Confirm: "✓ Added to [skill-name] skill in [file]"
318
+
319
+ Example: For Hotwire Native Tailwind variants solution:
320
+ - Add to `hotwire-native/references/resources.md` under "CORA-Specific Resources"
321
+ - Add to `hotwire-native/references/examples.md` with link to solution doc
322
+
323
+ **Option 5: Create new skill**
324
+
325
+ User selects this when the solution represents the start of a new learning domain:
326
+
327
+ Action:
328
+ 1. Prompt: "What should the new skill be called? (e.g., stripe-billing, email-processing)"
329
+ 2. Run `python3 .antigravity/skills/skill-creator/scripts/init_skill.py [skill-name]`
330
+ 3. Create initial reference files with this solution as first example
331
+ 4. Confirm: "✓ Created new [skill-name] skill with this solution as first example"
332
+
333
+ **Option 6: View documentation**
334
+
335
+ - Display the created documentation
336
+ - Present decision menu again
337
+
338
+ **Option 7: Other**
339
+
340
+ - Ask what they'd like to do
341
+
342
+ </decision_gate>
343
+
344
+ ---
345
+
346
+ <integration_protocol>
347
+
348
+ ## Integration Points
349
+
350
+ **Invoked by:**
351
+ - /compound command (primary interface)
352
+ - Manual invocation in conversation after solution confirmed
353
+ - Can be triggered by detecting confirmation phrases like "that worked", "it's fixed", etc.
354
+
355
+ **Invokes:**
356
+ - None (terminal skill - does not delegate to other skills)
357
+
358
+ **Handoff expectations:**
359
+ All context needed for documentation should be present in conversation history before invocation.
360
+
361
+ </integration_protocol>
362
+
363
+ ---
364
+
365
+ <success_criteria>
366
+
367
+ ## Success Criteria
368
+
369
+ Documentation is successful when ALL of the following are true:
370
+
371
+ - ✅ YAML frontmatter validated (all required fields, correct formats)
372
+ - ✅ File created in docs/solutions/[category]/[filename].md
373
+ - ✅ Enum values match schema.yaml exactly
374
+ - ✅ Code examples included in solution section
375
+ - ✅ Cross-references added if related issues found
376
+ - ✅ User presented with decision menu and action confirmed
377
+
378
+ </success_criteria>
379
+
380
+ ---
381
+
382
+ ## Error Handling
383
+
384
+ **Missing context:**
385
+
386
+ - Ask user for missing details
387
+ - Don't proceed until critical info provided
388
+
389
+ **YAML validation failure:**
390
+
391
+ - Show specific errors
392
+ - Present retry with corrected values
393
+ - BLOCK until valid
394
+
395
+ **Similar issue ambiguity:**
396
+
397
+ - Present multiple matches
398
+ - Let user choose: new doc, update existing, or link as duplicate
399
+
400
+ **Module not in CORA-MODULES.md:**
401
+
402
+ - Warn but don't block
403
+ - Proceed with documentation
404
+ - Suggest: "Add [Module] to CORA-MODULES.md if not there"
405
+
406
+ ---
407
+
408
+ ## Execution Guidelines
409
+
410
+ **MUST do:**
411
+ - Validate YAML frontmatter (BLOCK if invalid per Step 5 validation gate)
412
+ - Extract exact error messages from conversation
413
+ - Include code examples in solution section
414
+ - Create directories before writing files (`mkdir -p`)
415
+ - Ask user and WAIT if critical context missing
416
+
417
+ **MUST NOT do:**
418
+ - Skip YAML validation (validation gate is blocking)
419
+ - Use vague descriptions (not searchable)
420
+ - Omit code examples or cross-references
421
+
422
+ ---
423
+
424
+ ## Quality Guidelines
425
+
426
+ **Good documentation has:**
427
+
428
+ - ✅ Exact error messages (copy-paste from output)
429
+ - ✅ Specific file:line references
430
+ - ✅ Observable symptoms (what you saw, not interpretations)
431
+ - ✅ Failed attempts documented (helps avoid wrong paths)
432
+ - ✅ Technical explanation (not just "what" but "why")
433
+ - ✅ Code examples (before/after if applicable)
434
+ - ✅ Prevention guidance (how to catch early)
435
+ - ✅ Cross-references (related issues)
436
+
437
+ **Avoid:**
438
+
439
+ - ❌ Vague descriptions ("something was wrong")
440
+ - ❌ Missing technical details ("fixed the code")
441
+ - ❌ No context (which version? which file?)
442
+ - ❌ Just code dumps (explain why it works)
443
+ - ❌ No prevention guidance
444
+ - ❌ No cross-references
445
+
446
+ ---
447
+
448
+ ## Example Scenario
449
+
450
+ **User:** "That worked! The N+1 query is fixed."
451
+
452
+ **Skill activates:**
453
+
454
+ 1. **Detect confirmation:** "That worked!" triggers auto-invoke
455
+ 2. **Gather context:**
456
+ - Module: Brief System
457
+ - Symptom: Brief generation taking >5 seconds, N+1 query when loading email threads
458
+ - Failed attempts: Added pagination (didn't help), checked background job performance
459
+ - Solution: Added eager loading with `includes(:emails)` on Brief model
460
+ - Root cause: Missing eager loading causing separate database query per email thread
461
+ 3. **Check existing:** No similar issue found
462
+ 4. **Generate filename:** `n-plus-one-brief-generation-BriefSystem-20251110.md`
463
+ 5. **Validate YAML:**
464
+ ```yaml
465
+ module: Brief System
466
+ date: 2025-11-10
467
+ problem_type: performance_issue
468
+ component: rails_model
469
+ symptoms:
470
+ - "N+1 query when loading email threads"
471
+ - "Brief generation taking >5 seconds"
472
+ root_cause: missing_include
473
+ severity: high
474
+ tags: [n-plus-one, eager-loading, performance]
475
+ ```
476
+ ✅ Valid
477
+ 6. **Create documentation:**
478
+ - `docs/solutions/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md`
479
+ 7. **Cross-reference:** None needed (no similar issues)
480
+
481
+ **Output:**
482
+
483
+ ```
484
+ ✓ Solution documented
485
+
486
+ File created:
487
+ - docs/solutions/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md
488
+
489
+ What's next?
490
+ 1. Continue workflow (recommended)
491
+ 2. Add to Required Reading - Promote to critical patterns (cora-critical-patterns.md)
492
+ 3. Link related issues - Connect to similar problems
493
+ 4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
494
+ 5. Create new skill - Extract into new learning skill
495
+ 6. View documentation - See what was captured
496
+ 7. Other
497
+ ```
498
+
499
+ ---
500
+
501
+ ## Future Enhancements
502
+
503
+ **Not in Phase 7 scope, but potential:**
504
+
505
+ - Search by date range
506
+ - Filter by severity
507
+ - Tag-based search interface
508
+ - Metrics (most common issues, resolution time)
509
+ - Export to shareable format (community knowledge sharing)
510
+ - Import community solutions
@@ -0,0 +1,34 @@
1
+ # Critical Pattern Template
2
+
3
+ Use this template when adding a pattern to `docs/solutions/patterns/cora-critical-patterns.md`:
4
+
5
+ ---
6
+
7
+ ## N. [Pattern Name] (ALWAYS REQUIRED)
8
+
9
+ ### ❌ WRONG ([Will cause X error])
10
+ ```[language]
11
+ [code showing wrong approach]
12
+ ```
13
+
14
+ ### ✅ CORRECT
15
+ ```[language]
16
+ [code showing correct approach]
17
+ ```
18
+
19
+ **Why:** [Technical explanation of why this is required]
20
+
21
+ **Placement/Context:** [When this applies]
22
+
23
+ **Documented in:** `docs/solutions/[category]/[filename].md`
24
+
25
+ ---
26
+
27
+ **Instructions:**
28
+ 1. Replace N with the next pattern number
29
+ 2. Replace [Pattern Name] with descriptive title
30
+ 3. Fill in WRONG example with code that causes the problem
31
+ 4. Fill in CORRECT example with the solution
32
+ 5. Explain the technical reason in "Why"
33
+ 6. Clarify when this pattern applies in "Placement/Context"
34
+ 7. Link to the full troubleshooting doc where this was originally solved
@@ -0,0 +1,93 @@
1
+ ---
2
+ module: [Module name or "CORA" for system-wide]
3
+ date: [YYYY-MM-DD]
4
+ problem_type: [build_error|test_failure|runtime_error|performance_issue|database_issue|security_issue|ui_bug|integration_issue|logic_error]
5
+ component: [rails_model|rails_controller|rails_view|service_object|background_job|database|frontend_stimulus|hotwire_turbo|email_processing|brief_system|assistant|authentication|payments]
6
+ symptoms:
7
+ - [Observable symptom 1 - specific error message or behavior]
8
+ - [Observable symptom 2 - what user actually saw/experienced]
9
+ root_cause: [missing_association|missing_include|missing_index|wrong_api|scope_issue|thread_violation|async_timing|memory_leak|config_error|logic_error|test_isolation|missing_validation|missing_permission]
10
+ rails_version: [7.1.2 - optional]
11
+ resolution_type: [code_fix|migration|config_change|test_fix|dependency_update|environment_setup]
12
+ severity: [critical|high|medium|low]
13
+ tags: [keyword1, keyword2, keyword3]
14
+ ---
15
+
16
+ # Troubleshooting: [Clear Problem Title]
17
+
18
+ ## Problem
19
+ [1-2 sentence clear description of the issue and what the user experienced]
20
+
21
+ ## Environment
22
+ - Module: [Name or "CORA system"]
23
+ - Rails Version: [e.g., 7.1.2]
24
+ - Affected Component: [e.g., "Email Processing model", "Brief System service", "Authentication controller"]
25
+ - Date: [YYYY-MM-DD when this was solved]
26
+
27
+ ## Symptoms
28
+ - [Observable symptom 1 - what the user saw/experienced]
29
+ - [Observable symptom 2 - error messages, visual issues, unexpected behavior]
30
+ - [Continue as needed - be specific]
31
+
32
+ ## What Didn't Work
33
+
34
+ **Attempted Solution 1:** [Description of what was tried]
35
+ - **Why it failed:** [Technical reason this didn't solve the problem]
36
+
37
+ **Attempted Solution 2:** [Description of second attempt]
38
+ - **Why it failed:** [Technical reason]
39
+
40
+ [Continue for all significant attempts that DIDN'T work]
41
+
42
+ [If nothing else was attempted first, write:]
43
+ **Direct solution:** The problem was identified and fixed on the first attempt.
44
+
45
+ ## Solution
46
+
47
+ [The actual fix that worked - provide specific details]
48
+
49
+ **Code changes** (if applicable):
50
+ ```ruby
51
+ # Before (broken):
52
+ [Show the problematic code]
53
+
54
+ # After (fixed):
55
+ [Show the corrected code with explanation]
56
+ ```
57
+
58
+ **Database migration** (if applicable):
59
+ ```ruby
60
+ # Migration change:
61
+ [Show what was changed in the migration]
62
+ ```
63
+
64
+ **Commands run** (if applicable):
65
+ ```bash
66
+ # Steps taken to fix:
67
+ [Commands or actions]
68
+ ```
69
+
70
+ ## Why This Works
71
+
72
+ [Technical explanation of:]
73
+ 1. What was the ROOT CAUSE of the problem?
74
+ 2. Why does the solution address this root cause?
75
+ 3. What was the underlying issue (API misuse, configuration error, Rails version issue, etc.)?
76
+
77
+ [Be detailed enough that future developers understand the "why", not just the "what"]
78
+
79
+ ## Prevention
80
+
81
+ [How to avoid this problem in future CORA development:]
82
+ - [Specific coding practice, check, or pattern to follow]
83
+ - [What to watch out for]
84
+ - [How to catch this early]
85
+
86
+ ## Related Issues
87
+
88
+ [If any similar problems exist in docs/solutions/, link to them:]
89
+ - See also: [another-related-issue.md](../category/another-related-issue.md)
90
+ - Similar to: [related-problem.md](../category/related-problem.md)
91
+
92
+ [If no related issues, write:]
93
+ No related issues documented yet.
@@ -0,0 +1,65 @@
1
+ # YAML Frontmatter Schema
2
+
3
+ **See `.antigravity/skills/codify-docs/schema.yaml` for the complete schema specification.**
4
+
5
+ ## Required Fields
6
+
7
+ - **module** (string): Module name (e.g., "EmailProcessing") or "CORA" for system-wide issues
8
+ - **date** (string): ISO 8601 date (YYYY-MM-DD)
9
+ - **problem_type** (enum): One of [build_error, test_failure, runtime_error, performance_issue, database_issue, security_issue, ui_bug, integration_issue, logic_error, developer_experience, workflow_issue, best_practice, documentation_gap]
10
+ - **component** (enum): One of [rails_model, rails_controller, rails_view, service_object, background_job, database, frontend_stimulus, hotwire_turbo, email_processing, brief_system, assistant, authentication, payments, development_workflow, testing_framework, documentation, tooling]
11
+ - **symptoms** (array): 1-5 specific observable symptoms
12
+ - **root_cause** (enum): One of [missing_association, missing_include, missing_index, wrong_api, scope_issue, thread_violation, async_timing, memory_leak, config_error, logic_error, test_isolation, missing_validation, missing_permission, missing_workflow_step, inadequate_documentation, missing_tooling, incomplete_setup]
13
+ - **resolution_type** (enum): One of [code_fix, migration, config_change, test_fix, dependency_update, environment_setup, workflow_improvement, documentation_update, tooling_addition, seed_data_update]
14
+ - **severity** (enum): One of [critical, high, medium, low]
15
+
16
+ ## Optional Fields
17
+
18
+ - **rails_version** (string): Rails version in X.Y.Z format
19
+ - **tags** (array): Searchable keywords (lowercase, hyphen-separated)
20
+
21
+ ## Validation Rules
22
+
23
+ 1. All required fields must be present
24
+ 2. Enum fields must match allowed values exactly (case-sensitive)
25
+ 3. symptoms must be YAML array with 1-5 items
26
+ 4. date must match YYYY-MM-DD format
27
+ 5. rails_version (if provided) must match X.Y.Z format
28
+ 6. tags should be lowercase, hyphen-separated
29
+
30
+ ## Example
31
+
32
+ ```yaml
33
+ ---
34
+ module: Email Processing
35
+ date: 2025-11-12
36
+ problem_type: performance_issue
37
+ component: rails_model
38
+ symptoms:
39
+ - "N+1 query when loading email threads"
40
+ - "Brief generation taking >5 seconds"
41
+ root_cause: missing_include
42
+ rails_version: 7.1.2
43
+ resolution_type: code_fix
44
+ severity: high
45
+ tags: [n-plus-one, eager-loading, performance]
46
+ ---
47
+ ```
48
+
49
+ ## Category Mapping
50
+
51
+ Based on `problem_type`, documentation is filed in:
52
+
53
+ - **build_error** → `docs/solutions/build-errors/`
54
+ - **test_failure** → `docs/solutions/test-failures/`
55
+ - **runtime_error** → `docs/solutions/runtime-errors/`
56
+ - **performance_issue** → `docs/solutions/performance-issues/`
57
+ - **database_issue** → `docs/solutions/database-issues/`
58
+ - **security_issue** → `docs/solutions/security-issues/`
59
+ - **ui_bug** → `docs/solutions/ui-bugs/`
60
+ - **integration_issue** → `docs/solutions/integration-issues/`
61
+ - **logic_error** → `docs/solutions/logic-errors/`
62
+ - **developer_experience** → `docs/solutions/developer-experience/`
63
+ - **workflow_issue** → `docs/solutions/workflow-issues/`
64
+ - **best_practice** → `docs/solutions/best-practices/`
65
+ - **documentation_gap** → `docs/solutions/documentation-gaps/`