agents-templated 2.2.6 → 2.2.7

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/README.md CHANGED
@@ -28,12 +28,14 @@ Agents Templated scaffolds your project with:
28
28
  - Deterministic slash-command standard in `AGENTS.MD` and modular contracts in `agents/commands/`
29
29
  - Implicit natural-language routing support (`slash-command-auto`) for non-technical prompts
30
30
  - New workflow/routing/hardening rule set:
31
- - `.github/instructions/rules/intent-routing.mdc`
32
- - `.github/instructions/rules/system-workflow.mdc`
33
- - `.github/instructions/rules/hardening.mdc`
31
+ - `.claude/rules/intent-routing.md`
32
+ - `.claude/rules/system-workflow.md`
33
+ - `.claude/rules/hardening.md`
34
+ - `.claude/rules/lessons-learned.md`
34
35
  - New baseline skills:
35
36
  - `.github/skills/feature-delivery/`
36
37
  - `.github/skills/bug-triage/`
38
+ - `.github/skills/error-patterns/`
37
39
  - `.github/skills/app-hardening/`
38
40
  - Release and audit contracts now require hardening evidence when risk profile requires it
39
41
 
@@ -143,29 +145,33 @@ your-project/
143
145
  │ └── README.md # Human-readable setup guide
144
146
 
145
147
  ├── .github/
146
- │ ├── instructions/ # Generated compatibility wrappers + rules
147
- │ │ ├── AGENTS.md
148
- │ │ └── rules/
149
- │ │ ├── core.mdc # Core development principles
150
- │ │ ├── security.mdc # Security patterns (CRITICAL)
151
- │ │ ├── testing.mdc # Testing strategy
152
- │ │ ├── frontend.mdc # Frontend patterns
153
- │ │ ├── database.mdc # Database patterns
154
- │ │ ├── style.mdc # Code style guidelines
155
- │ │ ├── workflows.mdc # Workflow and quality gates
156
- │ │ ├── intent-routing.mdc # Intent-to-command routing policy
157
- │ │ ├── system-workflow.mdc # End-to-end delivery lifecycle gates
158
- │ │ └── hardening.mdc # Hardening and obfuscation guidance
148
+ │ ├── instructions/ # Compatibility pointer directory
159
149
  │ ├── skills/
160
150
  │ │ ├── find-skills/ # Skill discovery helper
161
151
  │ │ ├── feature-delivery/ # Scoped feature delivery workflow
162
152
  │ │ ├── bug-triage/ # Reproduction-first defect workflow
153
+ │ │ ├── error-patterns/ # Persistent error-debugging memory workflow
163
154
  │ │ ├── app-hardening/ # Hardening and release-evidence workflow
164
155
  │ │ ├── ui-ux-pro-max/ # Advanced UI/UX design implementation skill
165
156
  │ │ ├── README.md # Guide for creating custom skills
166
157
  │ │ └── [your-custom-skills]/ # Your project-specific skills
167
158
  │ └── copilot-instructions.md # Compatibility shim for Copilot
168
159
 
160
+ ├── .claude/
161
+ │ ├── rules/ # Canonical rules source
162
+ │ │ ├── core.md
163
+ │ │ ├── security.md
164
+ │ │ ├── testing.md
165
+ │ │ ├── frontend.md
166
+ │ │ ├── database.md
167
+ │ │ ├── style.md
168
+ │ │ ├── workflows.md
169
+ │ │ ├── intent-routing.md
170
+ │ │ ├── system-workflow.md
171
+ │ │ ├── hardening.md
172
+ │ │ └── lessons-learned.md
173
+ │ └── agents/ # Optional subagents
174
+
169
175
  ├── agents/ # 🤖 Deterministic command contracts
170
176
  │ └── commands/
171
177
  │ │ ├── SCHEMA.md # Global slash-command response schema
@@ -299,8 +305,8 @@ Skills define *how to execute specific tasks*, complementing rules that define *
299
305
  - **[AGENTS.MD](AGENTS.MD)** – AI assistant guide
300
306
  - **[agent-docs/ARCHITECTURE.md](agent-docs/ARCHITECTURE.md)** – Project architecture & tech stack guidance
301
307
  - **[.github/skills/README.md](.github/skills/README.md)** – Custom skills guide
302
- - **[.github/instructions/rules/security.mdc](.github/instructions/rules/security.mdc)** – Security patterns (CRITICAL)
303
- - **[.github/instructions/rules/testing.mdc](.github/instructions/rules/testing.mdc)** – Testing strategy
308
+ - **[.claude/rules/security.md](.claude/rules/security.md)** – Security patterns (CRITICAL)
309
+ - **[.claude/rules/testing.md](.claude/rules/testing.md)** – Testing strategy
304
310
 
305
311
  ### 5. Start Building
306
312
 
@@ -326,7 +332,7 @@ Your AI will follow the enterprise patterns automatically!
326
332
  ✅ Sanitize outputs to prevent injection attacks
327
333
  ✅ Never expose sensitive data in error messages or logs
328
334
 
329
- **Reference**: [.github/instructions/rules/security.mdc](.github/instructions/rules/security.mdc)
335
+ **Reference**: [.claude/rules/security.md](.claude/rules/security.md)
330
336
 
331
337
  ### Testing Strategy
332
338
 
@@ -334,7 +340,7 @@ Your AI will follow the enterprise patterns automatically!
334
340
  - **15% Integration Tests** – API endpoints, database operations
335
341
  - **5% E2E Tests** – Critical user journeys
336
342
 
337
- **Reference**: [.github/instructions/rules/testing.mdc](.github/instructions/rules/testing.mdc)
343
+ **Reference**: [.claude/rules/testing.md](.claude/rules/testing.md)
338
344
 
339
345
  ### Agent-Based Architecture
340
346
 
@@ -421,7 +427,7 @@ await agentsTemplated.install('./my-project', {
421
427
 
422
428
  When contributing to this template:
423
429
  1. Maintain technology-agnostic patterns
424
- 2. Update relevant rule files in `.github/instructions/rules/`
430
+ 2. Update relevant rule files in `.claude/rules/`
425
431
  3. Keep documentation synchronized with code changes
426
432
  4. Follow security and testing patterns
427
433
  5. Ensure AI assistant configurations remain compatible
package/bin/cli.js CHANGED
@@ -455,7 +455,7 @@ program
455
455
  }
456
456
 
457
457
  // Check agent rules
458
- const ruleFiles = ['core.md', 'security.md', 'testing.md', 'frontend.md', 'database.md', 'style.md'];
458
+ const ruleFiles = ['core.md', 'security.md', 'testing.md', 'lessons-learned.md', 'frontend.md', 'database.md', 'style.md'];
459
459
  const canonicalRulesDir = path.join(targetDir, LAYOUT.canonical.rulesDir);
460
460
  const legacyRulesDir = path.join(targetDir, LAYOUT.legacy.rulesDirs[0]);
461
461
  const rulesDir = path.join(targetDir, resolveRulesDir(targetDir));
@@ -831,9 +831,11 @@ program
831
831
  { targetFile: 'agent-docs/ARCHITECTURE.md', templateFile: 'agent-docs/ARCHITECTURE.md', component: 'docs' },
832
832
  { targetFile: `${LAYOUT.canonical.rulesDir}/security.md`, templateFile: 'agents/rules/security.md', component: 'rules' },
833
833
  { targetFile: `${LAYOUT.canonical.rulesDir}/testing.md`, templateFile: 'agents/rules/testing.md', component: 'rules' },
834
+ { targetFile: `${LAYOUT.canonical.rulesDir}/lessons-learned.md`, templateFile: 'agents/rules/lessons-learned.md', component: 'rules' },
834
835
  { targetFile: `${LAYOUT.canonical.rulesDir}/core.md`, templateFile: 'agents/rules/core.md', component: 'rules' },
835
836
  { targetFile: `${LAYOUT.canonical.skillsDir}/README.md`, templateFile: 'agents/skills/README.md', component: 'skills' },
836
837
  { targetFile: `${LAYOUT.canonical.skillsDir}/find-skills/SKILL.md`, templateFile: 'agents/skills/find-skills/SKILL.md', component: 'skills' },
838
+ { targetFile: `${LAYOUT.canonical.skillsDir}/error-patterns/SKILL.md`, templateFile: 'agents/skills/error-patterns/SKILL.md', component: 'skills' },
837
839
  { targetFile: `${LAYOUT.canonical.skillsDir}/ui-ux-pro-max/SKILL.md`, templateFile: 'agents/skills/ui-ux-pro-max/SKILL.md', component: 'skills' }
838
840
  ];
839
841
 
package/lib/layout.js CHANGED
@@ -9,11 +9,11 @@ const LAYOUT = {
9
9
  subagentsDir: '.claude/agents'
10
10
  },
11
11
  legacy: {
12
- rulesDirs: ['agents/rules', '.github/instructions/rules'],
12
+ rulesDirs: ['agents/rules'],
13
13
  skillsDirs: ['agents/skills']
14
14
  },
15
15
  compatible: {
16
- rulesDirs: ['.github/instructions'],
16
+ rulesDirs: [],
17
17
  skillsDirs: ['.claude/skills', '.agents/skills']
18
18
  }
19
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-templated",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Technology-agnostic development template with multi-AI agent support (Cursor, Copilot, VSCode, Gemini), security-first patterns, and comprehensive testing guidelines",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,44 @@
1
+ ---
2
+ alwaysApply: true
3
+ title: "Lessons Learned"
4
+ description: "Apply before debugging: check known error patterns first, then record every new resolved fix"
5
+ version: "1.0.0"
6
+ tags: ["debugging", "memory", "lessons", "error-patterns"]
7
+ ---
8
+
9
+ # Lessons Learned - Persistent Error Memory
10
+
11
+ ## Purpose
12
+
13
+ This rule is the agent's long-term memory for recurring errors and fixes.
14
+ Always check this rule before debugging. If a matching error exists, apply that known fix first.
15
+
16
+ ## Required Workflow
17
+
18
+ 1. Before debugging, check this file for matching symptoms.
19
+ 2. If a match is found, apply the known fix immediately.
20
+ 3. If no match is found, debug using the `error-patterns` skill checklist.
21
+ 4. After every successful fix, append a new lesson entry.
22
+
23
+ ## Lesson Entry Format
24
+
25
+ ```markdown
26
+ ### [CATEGORY] Short title of the error
27
+ - **Symptom**: What the error looked like (message, behavior)
28
+ - **Root Cause**: Why it happened
29
+ - **Fix**: Exact steps or code that resolved it
30
+ - **Avoid**: What NOT to do next time
31
+ - **Date**: YYYY-MM-DD
32
+ ```
33
+
34
+ Allowed categories: `[BUILD]` `[DB]` `[API/AUTH]` `[UI]` `[TYPE]` `[CONFIG]` `[OTHER]`
35
+
36
+ ## Enforcement
37
+
38
+ - This rule is non-overrideable.
39
+ - Lesson recording is mandatory after each resolved error.
40
+ - Do not remove existing lessons unless explicitly requested.
41
+
42
+ ## Known Lessons
43
+
44
+ <!-- New lessons are appended below this line. Do not remove this comment. -->
@@ -13,6 +13,7 @@ All policy, routing, and skill governance lives here — edit this file directly
13
13
  |--------|------|---------------|
14
14
  | Security | `.claude/rules/security.md` | Implementing authentication, validating inputs, protecting against injection attacks |
15
15
  | Testing | `.claude/rules/testing.md` | Adding tests, verifying coverage, validating quality before deployment |
16
+ | Lessons Learned | `.claude/rules/lessons-learned.md` | Debugging recurring errors and applying previously resolved fixes first |
16
17
  | Core | `.claude/rules/core.md` | Designing architecture, setting up projects, defining type systems |
17
18
  | Database | `.claude/rules/database.md` | Designing schema, building data access layers, optimizing queries |
18
19
  | Frontend | `.claude/rules/frontend.md` | Building UI components, designing pages, creating forms, implementing accessibility |
@@ -31,6 +32,7 @@ All policy, routing, and skill governance lives here — edit this file directly
31
32
  |-------|------|------------------|
32
33
  | app-hardening | `.github/skills/app-hardening/SKILL.md` | Hardening, anti-tamper, integrity controls |
33
34
  | bug-triage | `.github/skills/bug-triage/SKILL.md` | Something is broken, failing, or crashing |
35
+ | error-patterns | `.github/skills/error-patterns/SKILL.md` | Debugging with persistent lessons memory and automatic fix recording |
34
36
  | feature-delivery | `.github/skills/feature-delivery/SKILL.md` | Build/add/implement feature work |
35
37
  | find-skills | `.github/skills/find-skills/SKILL.md` | User asks to discover a skill |
36
38
  | ui-ux-pro-max | `.github/skills/ui-ux-pro-max/SKILL.md` | UI, layout, design, visual work |
@@ -70,29 +72,34 @@ Subagents are bounded agents with limited tool access. They inherit all policy f
70
72
  - Business logic must have tests; critical flows need integration coverage.
71
73
  - Never disable/remove tests to pass builds.
72
74
 
73
- 3. **Type safety and runtime boundaries** — `.claude/rules/core.md`
75
+ 3. **Lessons Learned (non-overrideable)** — `.claude/rules/lessons-learned.md`
76
+ - On any error, read lessons first; if matched, apply the known fix immediately.
77
+ - If new, debug via the `error-patterns` skill checklist and record the resolved fix.
78
+ - Keep lessons structured and persistent so future sessions reuse known solutions.
79
+
80
+ 4. **Type safety and runtime boundaries** — `.claude/rules/core.md`
74
81
  - Strong internal typing, runtime validation at boundaries, explicit error models.
75
82
 
76
- 4. **Database integrity** — `.claude/rules/database.md`
83
+ 5. **Database integrity** — `.claude/rules/database.md`
77
84
  - Prefer ORM/ODM, justify raw queries, enforce DB constraints, prevent N+1, reversible migrations.
78
85
 
79
- 5. **Frontend standards** — `.claude/rules/frontend.md`
86
+ 6. **Frontend standards** — `.claude/rules/frontend.md`
80
87
  - WCAG 2.1 AA, responsive defaults, clear loading/error states, no unsafe client trust.
81
88
 
82
- 6. **Style and consistency** — `.claude/rules/style.md`
89
+ 7. **Style and consistency** — `.claude/rules/style.md`
83
90
  - Consistent naming, small composable modules, explicit contracts, no magic values.
84
91
 
85
- 7. **Workflow discipline** — `.claude/rules/system-workflow.md`, `.claude/rules/workflows.md`
92
+ 8. **Workflow discipline** — `.claude/rules/system-workflow.md`, `.claude/rules/workflows.md`
86
93
  - Feature branches only, no direct main edits, deterministic PR structure, review gates.
87
94
 
88
- 8. **Hardening mode** — `.claude/rules/hardening.md`
95
+ 9. **Hardening mode** — `.claude/rules/hardening.md`
89
96
  - In hardening/audit contexts: assume hostile input, threat-model, validate config safety, strict rate limits, dependency audit.
90
97
 
91
- 9. **Planning discipline** — `.claude/rules/planning.md`
98
+ 10. **Planning discipline** — `.claude/rules/planning.md`
92
99
  - Every feature discussion or implementation produces a `.github/prompts/` plan file.
93
100
  - Plans are updated as work progresses, not discarded.
94
101
 
95
- 10. **Guardrails (non-overrideable)** — `.claude/rules/guardrails.md`
102
+ 11. **Guardrails (non-overrideable)** — `.claude/rules/guardrails.md`
96
103
  - Require `CONFIRM-DESTRUCTIVE:<target>` token before any destructive/irreversible action.
97
104
  - Work only within the defined task scope; no silent expansion.
98
105
  - Classify every action by reversibility before executing.
@@ -115,6 +122,7 @@ Use `.claude/rules/intent-routing.md` and route each task to one primary module:
115
122
  - Refactor/Cleanup → Style
116
123
  - Audit/Production readiness → Hardening
117
124
  - Feature planning → Planning
125
+ - Debugging / recurring failures → Lessons Learned + error-patterns skill
118
126
  - LLM/AI work → AI Integration
119
127
  - Scope creep / dangerous action / agent behavioral safety → Guardrails
120
128
  - Multi-step orchestration / planning / code review → Subagents
@@ -124,22 +124,25 @@ your-project/
124
124
  │ └── README.md # Human-readable setup guide
125
125
 
126
126
  ├── .github/
127
- │ ├── instructions/ # Generated compatibility wrappers + rules
128
- │ │ ├── AGENTS.md
129
- │ │ └── rules/
130
- │ │ ├── core.mdc # Core development principles
131
- │ │ ├── security.mdc # Security patterns (CRITICAL)
132
- │ │ ├── testing.mdc # Testing strategy
133
- │ │ ├── frontend.mdc # Frontend patterns
134
- │ │ ├── database.mdc # Database patterns
135
- │ │ └── style.mdc # Code style guidelines
127
+ │ ├── instructions/ # Compatibility pointer directory
136
128
  │ ├── skills/
137
129
  │ │ ├── find-skills/ # Skill discovery helper
130
+ │ │ ├── error-patterns/ # Persistent error-debugging memory workflow
138
131
  │ │ ├── ui-ux-pro-max/ # Advanced UI/UX design implementation skill
139
132
  │ │ ├── README.md # Guide for creating custom skills
140
133
  │ │ └── [your-custom-skills]/ # Your project-specific skills
141
134
  │ └── copilot-instructions.md # Compatibility shim for Copilot
142
135
 
136
+ ├── .claude/
137
+ │ ├── rules/ # Canonical rules source
138
+ │ │ ├── core.md
139
+ │ │ ├── security.md
140
+ │ │ ├── testing.md
141
+ │ │ ├── frontend.md
142
+ │ │ ├── database.md
143
+ │ │ ├── style.md
144
+ │ │ └── lessons-learned.md
145
+
143
146
  ├── agents/ # 🤖 Deterministic command contracts
144
147
  │ └── commands/
145
148
  │ │ ├── SCHEMA.md # Global slash-command response schema
@@ -273,8 +276,8 @@ Skills define *how to execute specific tasks*, complementing rules that define *
273
276
  - **[AGENTS.MD](AGENTS.MD)** – AI assistant guide
274
277
  - **[agent-docs/ARCHITECTURE.md](agent-docs/ARCHITECTURE.md)** – Project architecture & tech stack guidance
275
278
  - **[.github/skills/README.md](.github/skills/README.md)** – Custom skills guide
276
- - **[.github/instructions/rules/security.mdc](.github/instructions/rules/security.mdc)** – Security patterns (CRITICAL)
277
- - **[.github/instructions/rules/testing.mdc](.github/instructions/rules/testing.mdc)** – Testing strategy
279
+ - **[.claude/rules/security.md](.claude/rules/security.md)** – Security patterns (CRITICAL)
280
+ - **[.claude/rules/testing.md](.claude/rules/testing.md)** – Testing strategy
278
281
 
279
282
  ### 5. Start Building
280
283
 
@@ -300,7 +303,7 @@ Your AI will follow the enterprise patterns automatically!
300
303
  ✅ Sanitize outputs to prevent injection attacks
301
304
  ✅ Never expose sensitive data in error messages or logs
302
305
 
303
- **Reference**: [.github/instructions/rules/security.mdc](.github/instructions/rules/security.mdc)
306
+ **Reference**: [.claude/rules/security.md](.claude/rules/security.md)
304
307
 
305
308
  ### Testing Strategy
306
309
 
@@ -308,7 +311,7 @@ Your AI will follow the enterprise patterns automatically!
308
311
  - **15% Integration Tests** – API endpoints, database operations
309
312
  - **5% E2E Tests** – Critical user journeys
310
313
 
311
- **Reference**: [.github/instructions/rules/testing.mdc](.github/instructions/rules/testing.mdc)
314
+ **Reference**: [.claude/rules/testing.md](.claude/rules/testing.md)
312
315
 
313
316
  ### Agent-Based Architecture
314
317
 
@@ -395,7 +398,7 @@ await agentsTemplated.install('./my-project', {
395
398
 
396
399
  When contributing to this template:
397
400
  1. Maintain technology-agnostic patterns
398
- 2. Update relevant rule files in `.github/instructions/rules/`
401
+ 2. Update relevant rule files in `.claude/rules/`
399
402
  3. Keep documentation synchronized with code changes
400
403
  4. Follow security and testing patterns
401
404
  5. Ensure AI assistant configurations remain compatible
@@ -5,7 +5,7 @@ These guidelines are for both humans and AI assistants working with any technolo
5
5
 
6
6
  - Canonical AI policy source lives in `CLAUDE.md`.
7
7
  - **Agent responsibilities** and MCP integration are documented in `AGENTS.MD`.
8
- - **Detailed implementation rules** live in `.github/instructions/rules/*.mdc` files.
8
+ - **Detailed implementation rules** live in `.claude/rules/*.md` files.
9
9
  - **Custom skills** for domain-specific tasks are organized in `.github/skills/` (see [Skills Guide](../.github/skills/README.md)).
10
10
 
11
11
  Read this file first to understand the architecture, then consult `AGENTS.MD` for agent delegation.
@@ -223,7 +223,7 @@ Review the options above and select technologies that fit your:
223
223
  - **Timeline** and development velocity requirements
224
224
 
225
225
  ### 2. Adapt the Template
226
- - Update `.github/instructions/rules/*.mdc` files with technology-specific patterns
226
+ - Update `.claude/rules/*.md` files with technology-specific patterns
227
227
  - Keep `.cursorrules`, `.github/copilot-instructions.md`, `AGENTS.MD`, and `CLAUDE.md` as minimal wrappers that point to `CLAUDE.md`
228
228
  - Update `CLAUDE.md` with stack-specific guidelines
229
229
  - Create appropriate configuration files for your chosen tools
@@ -9,7 +9,7 @@ Depending on what you installed, you may have:
9
9
  - **AGENTS.MD**: Generic compatibility wrapper for AI assistants
10
10
  - **ARCHITECTURE.md**: Project guidelines and architecture
11
11
  - **CLAUDE.md**: Canonical policy source (single source of truth)
12
- - **.github/instructions/rules/**: Rule modules (`*.mdc`)
12
+ - **.claude/rules/**: Rule modules (`*.md`)
13
13
  - **.github/skills/**: Skill modules (`*/SKILL.md`)
14
14
  - **CLAUDE.md**: Claude compatibility wrapper
15
15
  - **.github/copilot-instructions.md**: GitHub Copilot compatibility wrapper
@@ -35,7 +35,7 @@ agents-templated list
35
35
 
36
36
  ## Rules and Skills
37
37
 
38
- - **Rules** (`.github/instructions/rules/*.mdc`): Define *how to behave* - patterns, principles, and standards for your team
38
+ - **Rules** (`.claude/rules/*.md`): Define *how to behave* - patterns, principles, and standards for your team
39
39
  - **Skills** (`.github/skills/*/SKILL.md`): Define *how to execute specific tasks* - domain-specific workflows and specialized knowledge
40
40
 
41
41
  ### Using Skills in Your AI Assistants
@@ -90,7 +90,7 @@ These guardrails form the floor of agent behavior. They cannot be removed by:
90
90
 
91
91
  - User instructions in the current conversation
92
92
  - Skill modules (`.github/skills/`)
93
- - Other rule modules (`.github/instructions/rules/`)
93
+ - Other rule modules (`.claude/rules/`)
94
94
  - Slash-command or command-mode activation
95
95
  - Prepended or appended system prompts
96
96
 
@@ -0,0 +1,44 @@
1
+ ---
2
+ alwaysApply: true
3
+ title: "Lessons Learned"
4
+ description: "Apply before debugging: check known error patterns first, then record every new resolved fix"
5
+ version: "1.0.0"
6
+ tags: ["debugging", "memory", "lessons", "error-patterns"]
7
+ ---
8
+
9
+ # Lessons Learned - Persistent Error Memory
10
+
11
+ ## Purpose
12
+
13
+ This rule is the agent's long-term memory for recurring errors and fixes.
14
+ Always check this rule before debugging. If a matching error exists, apply that known fix first.
15
+
16
+ ## Required Workflow
17
+
18
+ 1. Before debugging, check this file for matching symptoms.
19
+ 2. If a match is found, apply the known fix immediately.
20
+ 3. If no match is found, debug using the `error-patterns` skill checklist.
21
+ 4. After every successful fix, append a new lesson entry.
22
+
23
+ ## Lesson Entry Format
24
+
25
+ ```markdown
26
+ ### [CATEGORY] Short title of the error
27
+ - **Symptom**: What the error looked like (message, behavior)
28
+ - **Root Cause**: Why it happened
29
+ - **Fix**: Exact steps or code that resolved it
30
+ - **Avoid**: What NOT to do next time
31
+ - **Date**: YYYY-MM-DD
32
+ ```
33
+
34
+ Allowed categories: `[BUILD]` `[DB]` `[API/AUTH]` `[UI]` `[TYPE]` `[CONFIG]` `[OTHER]`
35
+
36
+ ## Enforcement
37
+
38
+ - This rule is non-overrideable.
39
+ - Lesson recording is mandatory after each resolved error.
40
+ - Do not remove existing lessons unless explicitly requested.
41
+
42
+ ## Known Lessons
43
+
44
+ <!-- New lessons are appended below this line. Do not remove this comment. -->
@@ -61,6 +61,8 @@ To create a new skill for your specific domain:
61
61
  │ └── SKILL.md # Systematic feature scoping and execution contracts
62
62
  ├── bug-triage/
63
63
  │ └── SKILL.md # Reproduction-first debugging and regression workflows
64
+ ├── error-patterns/
65
+ │ └── SKILL.md # Persistent debugging memory and known-fix application
64
66
  ├── app-hardening/
65
67
  │ └── SKILL.md # Risk-based hardening and obfuscation guidance
66
68
  ├── ui-ux-pro-max/
@@ -96,6 +98,7 @@ Consider creating skills for:
96
98
 
97
99
  - `feature-delivery`: Use when user asks are broad and you need objective, scope, acceptance criteria, and validation plan.
98
100
  - `bug-triage`: Use for defects and regressions requiring reproducible evidence, root-cause isolation, and minimal safe patches.
101
+ - `error-patterns`: Use when errors repeat to apply known fixes from lessons-learned and automatically record new resolutions.
99
102
  - `app-hardening`: Use for high-risk/distributed runtimes to enforce hardening profile, obfuscation decisions, and release evidence.
100
103
 
101
104
  ## Using Skills in Your Project
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: error-patterns
3
+ description: >
4
+ Activate this skill whenever something is broken, failing, erroring, or crashing, especially
5
+ for build errors, type errors, database/migration failures, API/auth issues, and UI bugs.
6
+ Also activate when the user says "fix this", "it's broken", "I'm getting an error", or
7
+ "this keeps happening".
8
+ ---
9
+
10
+ # Error Patterns
11
+
12
+ You are debugging with persistent memory. Every fix should be recorded so it does not need to be solved twice.
13
+
14
+ ## Step 1 - Check Lessons First (Always)
15
+
16
+ Before writing any fix, read `.claude/rules/lessons-learned.md`.
17
+
18
+ - Search for symptoms that match the current error.
19
+ - If a match is found, apply the known fix directly and state that the known fix was used.
20
+ - If no match is found, continue to Step 2.
21
+
22
+ ## Step 2 - Diagnose by Category
23
+
24
+ ### [BUILD] Build / Type Errors
25
+ - Read the full error trace, not just the first line.
26
+ - Check for version mismatches, missing imports, circular dependencies, and config issues.
27
+ - Verify lock file and dependency sync.
28
+
29
+ ### [DB] Database / Migration Errors
30
+ - Check whether the migration already ran.
31
+ - Verify DB URL and environment target.
32
+ - Check for schema drift between model and database.
33
+ - Avoid destructive migrations without a backup.
34
+
35
+ ### [API/AUTH] API / Auth Errors
36
+ - Check token expiry, missing headers, and wrong scopes.
37
+ - Verify environment variables for keys/secrets.
38
+ - Check CORS and middleware order.
39
+ - Log request/response safely (no secrets).
40
+
41
+ ### [UI] Frontend / UI Bugs
42
+ - Check hydration mismatches.
43
+ - Verify null/undefined guards and prop contracts.
44
+ - Check list keys and class conflicts.
45
+ - Confirm loading and error states are handled.
46
+
47
+ ## Step 3 - Apply the Fix
48
+
49
+ - Make the minimum safe change needed.
50
+ - Do not expand scope beyond the reported error.
51
+
52
+ ## Step 4 - Record the Lesson (Mandatory)
53
+
54
+ After every successful fix, append to `.claude/rules/lessons-learned.md` using:
55
+
56
+ ```markdown
57
+ ### [CATEGORY] Short title of the error
58
+ - **Symptom**: What the error looked like (message, behavior)
59
+ - **Root Cause**: Why it happened
60
+ - **Fix**: Exact steps or code that resolved it
61
+ - **Avoid**: What NOT to do next time
62
+ - **Date**: YYYY-MM-DD
63
+ ```
64
+
65
+ ## Step 5 - User Confirmation Message
66
+
67
+ After fixing and recording, respond with one of:
68
+
69
+ - `Fixed. I've saved this to lessons-learned so we won't have to solve it again.`
70
+ - `Found this in lessons-learned and applied the known fix.`