@qazuor/claude-code-config 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.
- package/LICENSE +21 -0
- package/README.md +1248 -0
- package/dist/bin.cjs +11886 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +11869 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.cjs +3887 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1325 -0
- package/dist/index.d.ts +1325 -0
- package/dist/index.js +3835 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -0
- package/templates/.log/notifications.log +1775 -0
- package/templates/agents/README.md +164 -0
- package/templates/agents/_registry.json +443 -0
- package/templates/agents/design/content-writer.md +353 -0
- package/templates/agents/design/ux-ui-designer.md +382 -0
- package/templates/agents/engineering/astro-engineer.md +293 -0
- package/templates/agents/engineering/db-drizzle-engineer.md +360 -0
- package/templates/agents/engineering/express-engineer.md +316 -0
- package/templates/agents/engineering/fastify-engineer.md +399 -0
- package/templates/agents/engineering/hono-engineer.md +263 -0
- package/templates/agents/engineering/mongoose-engineer.md +473 -0
- package/templates/agents/engineering/nestjs-engineer.md +429 -0
- package/templates/agents/engineering/nextjs-engineer.md +451 -0
- package/templates/agents/engineering/node-typescript-engineer.md +347 -0
- package/templates/agents/engineering/prisma-engineer.md +432 -0
- package/templates/agents/engineering/react-senior-dev.md +394 -0
- package/templates/agents/engineering/tanstack-start-engineer.md +447 -0
- package/templates/agents/engineering/tech-lead.md +269 -0
- package/templates/agents/product/product-functional.md +329 -0
- package/templates/agents/product/product-technical.md +578 -0
- package/templates/agents/quality/debugger.md +514 -0
- package/templates/agents/quality/qa-engineer.md +390 -0
- package/templates/agents/specialized/enrichment-agent.md +277 -0
- package/templates/agents/specialized/i18n-specialist.md +322 -0
- package/templates/agents/specialized/seo-ai-specialist.md +387 -0
- package/templates/agents/specialized/tech-writer.md +300 -0
- package/templates/code-style/.editorconfig +27 -0
- package/templates/code-style/.prettierignore +25 -0
- package/templates/code-style/.prettierrc +12 -0
- package/templates/code-style/biome.json +78 -0
- package/templates/code-style/commitlint.config.js +44 -0
- package/templates/commands/README.md +175 -0
- package/templates/commands/_registry.json +420 -0
- package/templates/commands/add-new-entity.md +211 -0
- package/templates/commands/audit/accessibility-audit.md +360 -0
- package/templates/commands/audit/performance-audit.md +290 -0
- package/templates/commands/audit/security-audit.md +231 -0
- package/templates/commands/code-check.md +127 -0
- package/templates/commands/five-why.md +225 -0
- package/templates/commands/formatting/format-markdown.md +197 -0
- package/templates/commands/git/commit.md +247 -0
- package/templates/commands/meta/create-agent.md +257 -0
- package/templates/commands/meta/create-command.md +312 -0
- package/templates/commands/meta/create-skill.md +321 -0
- package/templates/commands/meta/help.md +318 -0
- package/templates/commands/planning/check-completed-tasks.md +224 -0
- package/templates/commands/planning/cleanup-issues.md +248 -0
- package/templates/commands/planning/planning-cleanup.md +251 -0
- package/templates/commands/planning/sync-planning-github.md +133 -0
- package/templates/commands/planning/sync-todos-github.md +203 -0
- package/templates/commands/quality-check.md +211 -0
- package/templates/commands/run-tests.md +159 -0
- package/templates/commands/start-feature-plan.md +232 -0
- package/templates/commands/start-refactor-plan.md +244 -0
- package/templates/commands/sync-planning.md +176 -0
- package/templates/commands/update-docs.md +242 -0
- package/templates/docs/CHECKPOINT-SYSTEM.md +504 -0
- package/templates/docs/INDEX.md +677 -0
- package/templates/docs/RECOMMENDED-HOOKS.md +415 -0
- package/templates/docs/_registry.json +329 -0
- package/templates/docs/diagrams/README.md +220 -0
- package/templates/docs/diagrams/agent-hierarchy.mmd +55 -0
- package/templates/docs/diagrams/documentation-map.mmd +61 -0
- package/templates/docs/diagrams/tools-relationship.mmd +55 -0
- package/templates/docs/diagrams/workflow-decision-tree.mmd +38 -0
- package/templates/docs/doc-sync.md +533 -0
- package/templates/docs/examples/end-to-end-workflow.md +1505 -0
- package/templates/docs/glossary.md +495 -0
- package/templates/docs/guides/mockup-prompt-engineering.md +644 -0
- package/templates/docs/guides/mockup-setup.md +737 -0
- package/templates/docs/learnings/README.md +250 -0
- package/templates/docs/learnings/common-architectural-patterns.md +123 -0
- package/templates/docs/learnings/common-mistakes-to-avoid.md +149 -0
- package/templates/docs/learnings/markdown-formatting-standards.md +104 -0
- package/templates/docs/learnings/monorepo-command-execution.md +64 -0
- package/templates/docs/learnings/optimization-tips.md +146 -0
- package/templates/docs/learnings/planning-linear-sync-workflow.md +70 -0
- package/templates/docs/learnings/shell-compatibility-fish.md +46 -0
- package/templates/docs/learnings/test-organization-structure.md +68 -0
- package/templates/docs/mcp-installation.md +613 -0
- package/templates/docs/mcp-servers.md +989 -0
- package/templates/docs/notification-installation.md +570 -0
- package/templates/docs/quick-start.md +354 -0
- package/templates/docs/standards/architecture-patterns.md +1064 -0
- package/templates/docs/standards/atomic-commits.md +513 -0
- package/templates/docs/standards/code-standards.md +993 -0
- package/templates/docs/standards/design-standards.md +656 -0
- package/templates/docs/standards/documentation-standards.md +1160 -0
- package/templates/docs/standards/testing-standards.md +969 -0
- package/templates/docs/system-maintenance.md +604 -0
- package/templates/docs/templates/PDR-template.md +561 -0
- package/templates/docs/templates/TODOs-template.md +534 -0
- package/templates/docs/templates/tech-analysis-template.md +800 -0
- package/templates/docs/workflows/README.md +519 -0
- package/templates/docs/workflows/atomic-task-protocol.md +955 -0
- package/templates/docs/workflows/decision-tree.md +482 -0
- package/templates/docs/workflows/edge-cases.md +856 -0
- package/templates/docs/workflows/phase-1-planning.md +957 -0
- package/templates/docs/workflows/phase-2-implementation.md +896 -0
- package/templates/docs/workflows/phase-3-validation.md +792 -0
- package/templates/docs/workflows/phase-4-finalization.md +927 -0
- package/templates/docs/workflows/quick-fix-protocol.md +505 -0
- package/templates/docs/workflows/task-atomization.md +537 -0
- package/templates/docs/workflows/task-completion-protocol.md +448 -0
- package/templates/hooks/on-notification.sh +28 -0
- package/templates/schemas/checkpoint.schema.json +97 -0
- package/templates/schemas/code-registry.schema.json +84 -0
- package/templates/schemas/pdr.schema.json +314 -0
- package/templates/schemas/problems.schema.json +55 -0
- package/templates/schemas/tech-analysis.schema.json +404 -0
- package/templates/schemas/telemetry.schema.json +298 -0
- package/templates/schemas/todos.schema.json +234 -0
- package/templates/schemas/workflows.schema.json +69 -0
- package/templates/scripts/add-changelogs.sh +105 -0
- package/templates/scripts/generate-code-registry.ts +270 -0
- package/templates/scripts/health-check.sh +343 -0
- package/templates/scripts/sync-registry.sh +40 -0
- package/templates/scripts/telemetry-report.ts +36 -0
- package/templates/scripts/validate-docs.sh +224 -0
- package/templates/scripts/validate-registry.sh +225 -0
- package/templates/scripts/validate-schemas.ts +283 -0
- package/templates/scripts/validate-structure.sh +165 -0
- package/templates/scripts/worktree-cleanup.sh +81 -0
- package/templates/scripts/worktree-create.sh +63 -0
- package/templates/sessions/planning/.gitkeep +0 -0
- package/templates/sessions/planning/archived/.gitkeep +0 -0
- package/templates/settings.json +202 -0
- package/templates/settings.local.json +138 -0
- package/templates/skills/README.md +197 -0
- package/templates/skills/_registry.json +473 -0
- package/templates/skills/audit/accessibility-audit.md +309 -0
- package/templates/skills/audit/performance-audit.md +257 -0
- package/templates/skills/audit/security-audit.md +217 -0
- package/templates/skills/auth/nextauth-patterns.md +308 -0
- package/templates/skills/brand-guidelines.md +240 -0
- package/templates/skills/documentation/markdown-formatter.md +302 -0
- package/templates/skills/git/git-commit-helper.md +321 -0
- package/templates/skills/i18n/i18n-patterns.md +251 -0
- package/templates/skills/patterns/error-handling-patterns.md +242 -0
- package/templates/skills/patterns/tdd-methodology.md +342 -0
- package/templates/skills/qa/qa-criteria-validator.md +383 -0
- package/templates/skills/qa/web-app-testing.md +398 -0
- package/templates/skills/react/react-hook-form-patterns.md +359 -0
- package/templates/skills/state/redux-toolkit-patterns.md +272 -0
- package/templates/skills/state/tanstack-query-patterns.md +299 -0
- package/templates/skills/state/zustand-patterns.md +301 -0
- package/templates/skills/tech/mermaid-diagram-specialist.md +195 -0
- package/templates/skills/tech/shadcn-specialist.md +252 -0
- package/templates/skills/tech/vercel-specialist.md +297 -0
- package/templates/skills/testing/api-app-testing.md +254 -0
- package/templates/skills/testing/performance-testing.md +275 -0
- package/templates/skills/testing/security-testing.md +348 -0
- package/templates/skills/utils/add-memory.md +295 -0
- package/templates/skills/utils/json-data-auditor.md +283 -0
- package/templates/skills/utils/pdf-creator-editor.md +342 -0
- package/templates/tools/format-markdown.sh +185 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Learnings Archive
|
|
2
|
+
|
|
3
|
+
Documented learnings and best practices discovered during development.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
This directory contains individual learning files extracted from CLAUDE.md's "Recent Learnings" section. Each learning is documented with:
|
|
10
|
+
|
|
11
|
+
- **Title**: Clear, descriptive name
|
|
12
|
+
- **Date**: When the learning was discovered/documented
|
|
13
|
+
- **Category**: Classification (e.g., Testing, Architecture, DevOps)
|
|
14
|
+
- **Problem**: What issue prompted this learning
|
|
15
|
+
- **Solution**: How to handle/solve the problem
|
|
16
|
+
- **Impact**: Severity, frequency, scope, prevention
|
|
17
|
+
- **Related**: Links to documentation and related learnings
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Structure
|
|
22
|
+
|
|
23
|
+
Each learning is a standalone markdown file with kebab-case naming:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
learnings/
|
|
27
|
+
├── README.md (this file)
|
|
28
|
+
├── shell-compatibility-fish.md
|
|
29
|
+
├── monorepo-command-execution.md
|
|
30
|
+
├── test-organization-structure.md
|
|
31
|
+
├── markdown-formatting-standards.md
|
|
32
|
+
├── planning-linear-sync-workflow.md
|
|
33
|
+
├── common-architectural-patterns.md
|
|
34
|
+
├── common-mistakes-to-avoid.md
|
|
35
|
+
└── optimization-tips.md
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Available Learnings
|
|
41
|
+
|
|
42
|
+
### Shell & Terminal (1)
|
|
43
|
+
|
|
44
|
+
**[shell-compatibility-fish.md](shell-compatibility-fish.md)**
|
|
45
|
+
|
|
46
|
+
- **Category:** Shell / Terminal / DevOps
|
|
47
|
+
- **Problem:** `for` loops hang Fish shell
|
|
48
|
+
- **Solution:** Use `find -exec` or `xargs` alternatives
|
|
49
|
+
- **Impact:** High severity, blocks workflow
|
|
50
|
+
- **Date:** 2024-10-28
|
|
51
|
+
|
|
52
|
+
### Monorepo & Build (1)
|
|
53
|
+
|
|
54
|
+
**[monorepo-command-execution.md](monorepo-command-execution.md)**
|
|
55
|
+
|
|
56
|
+
- **Category:** Monorepo / PNPM / Development
|
|
57
|
+
- **Problem:** Incorrect command execution in monorepo packages
|
|
58
|
+
- **Solution:** Always use `cd packageName && pnpm run <command>`
|
|
59
|
+
- **Impact:** High severity, causes build failures
|
|
60
|
+
- **Date:** 2024-10-28
|
|
61
|
+
|
|
62
|
+
### Testing (1)
|
|
63
|
+
|
|
64
|
+
**[test-organization-structure.md](test-organization-structure.md)**
|
|
65
|
+
|
|
66
|
+
- **Category:** Testing / Project Structure
|
|
67
|
+
- **Problem:** Tests in wrong locations cause import/build issues
|
|
68
|
+
- **Solution:** Use `test/` folder, mirror `src/` structure
|
|
69
|
+
- **Impact:** Medium severity, affects reliability
|
|
70
|
+
- **Date:** 2024-10-28
|
|
71
|
+
|
|
72
|
+
### Documentation (1)
|
|
73
|
+
|
|
74
|
+
**[markdown-formatting-standards.md](markdown-formatting-standards.md)**
|
|
75
|
+
|
|
76
|
+
- **Category:** Documentation / Formatting
|
|
77
|
+
- **Problem:** Inconsistent markdown fails CI/CD checks
|
|
78
|
+
- **Solution:** Run `pnpm format:md` before commits
|
|
79
|
+
- **Impact:** Medium severity, blocks CI/CD
|
|
80
|
+
- **Date:** 2024-10-28
|
|
81
|
+
|
|
82
|
+
### Planning & Workflow (1)
|
|
83
|
+
|
|
84
|
+
**[planning-linear-sync-workflow.md](planning-linear-sync-workflow.md)**
|
|
85
|
+
|
|
86
|
+
- **Category:** Planning / GitHub / Linear / Workflow
|
|
87
|
+
- **Problem:** Manual planning sync loses context
|
|
88
|
+
- **Solution:** Sync after approval, commit before completion
|
|
89
|
+
- **Impact:** High severity, affects tracking
|
|
90
|
+
- **Date:** 2024-10-28
|
|
91
|
+
|
|
92
|
+
### Architecture & Patterns (2)
|
|
93
|
+
|
|
94
|
+
**[common-architectural-patterns.md](common-architectural-patterns.md)**
|
|
95
|
+
|
|
96
|
+
- **Category:** Architecture / Best Practices
|
|
97
|
+
- **Problem:** Inconsistent patterns across codebase
|
|
98
|
+
- **Solution:** Always use factories, base classes, RO-RO pattern
|
|
99
|
+
- **Impact:** High severity, affects maintainability
|
|
100
|
+
- **Date:** 2024-10-28
|
|
101
|
+
|
|
102
|
+
**[common-mistakes-to-avoid.md](common-mistakes-to-avoid.md)**
|
|
103
|
+
|
|
104
|
+
- **Category:** Best Practices / Code Quality
|
|
105
|
+
- **Problem:** Repeated mistakes slow development
|
|
106
|
+
- **Solution:** Never use `any`, default exports, skip tests, etc.
|
|
107
|
+
- **Impact:** High severity, compounds over time
|
|
108
|
+
- **Date:** 2024-10-28
|
|
109
|
+
|
|
110
|
+
### Optimization (1)
|
|
111
|
+
|
|
112
|
+
**[optimization-tips.md](optimization-tips.md)**
|
|
113
|
+
|
|
114
|
+
- **Category:** Performance / Best Practices
|
|
115
|
+
- **Problem:** Inefficient development practices
|
|
116
|
+
- **Solution:** Use Context7, dependency mapper, batch changes
|
|
117
|
+
- **Impact:** Medium severity, improves efficiency
|
|
118
|
+
- **Date:** 2024-10-28
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Usage
|
|
123
|
+
|
|
124
|
+
### For Claude
|
|
125
|
+
|
|
126
|
+
**Latest 10 learnings stay inline in CLAUDE.md** for quick reference.
|
|
127
|
+
|
|
128
|
+
When adding new learnings:
|
|
129
|
+
|
|
130
|
+
1. Add to CLAUDE.md "Recent Learnings" section (inline)
|
|
131
|
+
2. Create individual file in `.claude/docs/learnings/`
|
|
132
|
+
3. If > 10 learnings in CLAUDE.md, move oldest to "Archived Learnings" section (keep file)
|
|
133
|
+
|
|
134
|
+
**Finding learnings:**
|
|
135
|
+
|
|
136
|
+
- Check CLAUDE.md for latest 10 (quick reference)
|
|
137
|
+
- Check this directory for full archive (detailed information)
|
|
138
|
+
|
|
139
|
+
### For Developers
|
|
140
|
+
|
|
141
|
+
**When encountering errors or discovering patterns:**
|
|
142
|
+
|
|
143
|
+
1. Document immediately in CLAUDE.md "Recent Learnings"
|
|
144
|
+
2. Create detailed file in this directory
|
|
145
|
+
3. Include problem, solution, impact, related links
|
|
146
|
+
|
|
147
|
+
**When looking for solutions:**
|
|
148
|
+
|
|
149
|
+
1. Check CLAUDE.md first (latest 10 learnings)
|
|
150
|
+
2. Search this directory by category
|
|
151
|
+
3. Review related learnings for context
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Categories
|
|
156
|
+
|
|
157
|
+
Learnings are organized into these categories:
|
|
158
|
+
|
|
159
|
+
- **Shell / Terminal** - Shell compatibility, command usage
|
|
160
|
+
- **Monorepo / Build** - Build system, package management
|
|
161
|
+
- **Testing** - Test organization, TDD practices
|
|
162
|
+
- **Documentation** - Docs formatting, standards
|
|
163
|
+
- **Planning / Workflow** - Project planning, task tracking
|
|
164
|
+
- **Architecture / Patterns** - Code architecture, design patterns
|
|
165
|
+
- **Best Practices** - General development practices
|
|
166
|
+
- **Performance / Optimization** - Development efficiency
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Adding New Learnings
|
|
171
|
+
|
|
172
|
+
### Template
|
|
173
|
+
|
|
174
|
+
```markdown
|
|
175
|
+
# Learning Title
|
|
176
|
+
|
|
177
|
+
**Date:** YYYY-MM-DD
|
|
178
|
+
|
|
179
|
+
**Category:** Category / Subcategory
|
|
180
|
+
|
|
181
|
+
## Problem
|
|
182
|
+
|
|
183
|
+
[Describe what issue prompted this learning]
|
|
184
|
+
|
|
185
|
+
## Solution
|
|
186
|
+
|
|
187
|
+
[Describe how to handle/solve the problem with examples]
|
|
188
|
+
|
|
189
|
+
## Impact
|
|
190
|
+
|
|
191
|
+
- **Severity:** High/Medium/Low
|
|
192
|
+
- **Frequency:** How often this occurs
|
|
193
|
+
- **Scope:** Who is affected
|
|
194
|
+
- **Prevention:** How to avoid in future
|
|
195
|
+
|
|
196
|
+
## Related
|
|
197
|
+
|
|
198
|
+
- **Documentation:** [Link to relevant docs]
|
|
199
|
+
- **Related Learnings:** [Link to related learning files]
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
*Last updated: YYYY-MM-DD*
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Naming Convention
|
|
207
|
+
|
|
208
|
+
Use kebab-case with descriptive names:
|
|
209
|
+
|
|
210
|
+
- ✅ `shell-compatibility-fish.md`
|
|
211
|
+
- ✅ `monorepo-command-execution.md`
|
|
212
|
+
- ✅ `test-organization-structure.md`
|
|
213
|
+
- ❌ `learning-1.md`
|
|
214
|
+
- ❌ `2024-10-shell.md`
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Maintenance
|
|
219
|
+
|
|
220
|
+
### When to Archive
|
|
221
|
+
|
|
222
|
+
When CLAUDE.md "Recent Learnings" exceeds 10 items:
|
|
223
|
+
|
|
224
|
+
1. Move oldest learning from inline to "Archived Learnings" section
|
|
225
|
+
2. Add link to the individual file in "Archived Learnings"
|
|
226
|
+
3. Keep the individual file in this directory (don't delete)
|
|
227
|
+
|
|
228
|
+
### When to Update
|
|
229
|
+
|
|
230
|
+
Update learning files when:
|
|
231
|
+
|
|
232
|
+
- New information discovered about the problem
|
|
233
|
+
- Better solutions found
|
|
234
|
+
- Impact changes (severity/frequency)
|
|
235
|
+
- Related learnings added
|
|
236
|
+
|
|
237
|
+
**Always update the "Last updated" date at bottom of file.**
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Statistics
|
|
242
|
+
|
|
243
|
+
- **Total Learnings:** 8
|
|
244
|
+
- **Categories:** 8
|
|
245
|
+
- **Latest Addition:** 2024-10-28
|
|
246
|
+
- **Most Critical:** Shell Compatibility, Monorepo Execution, Planning Sync (High severity)
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
Last updated: 2024-10-31
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Common Architectural Patterns
|
|
2
|
+
|
|
3
|
+
**Date:** 2024-10-28
|
|
4
|
+
|
|
5
|
+
**Category:** Architecture / Best Practices
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
Inconsistent code patterns across the codebase cause:
|
|
10
|
+
|
|
11
|
+
- Difficult code reviews
|
|
12
|
+
- Higher cognitive load for developers
|
|
13
|
+
- Harder to onboard new team members
|
|
14
|
+
- Bugs from inconsistent implementations
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
**Always Follow These Patterns:**
|
|
19
|
+
|
|
20
|
+
### 1. Factory Patterns for Routes
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// ✅ CORRECT - Use createCRUDRoute factory
|
|
24
|
+
import { createCRUDRoute } from '@repo/api-factories';
|
|
25
|
+
|
|
26
|
+
const userRoutes = createCRUDRoute({
|
|
27
|
+
path: '/users',
|
|
28
|
+
service: userService,
|
|
29
|
+
schema: userSchema,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// ❌ WRONG - Manual route creation
|
|
33
|
+
app.get('/users', async (c) => { /* ... */ });
|
|
34
|
+
app.post('/users', async (c) => { /* ... */ });
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Extend Base Classes
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// ✅ CORRECT - Extend BaseModel
|
|
41
|
+
export class UserModel extends BaseModel<User> {
|
|
42
|
+
constructor() {
|
|
43
|
+
super('users');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ✅ CORRECT - Extend BaseCrudService
|
|
48
|
+
export class UserService extends BaseCrudService<User> {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(userModel);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ❌ WRONG - Custom implementations
|
|
55
|
+
export class UserModel { /* manual CRUD */ }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. RO-RO Pattern (Receive Object / Return Object)
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
// ✅ CORRECT - RO-RO pattern
|
|
62
|
+
export async function createUser({ data, context }: CreateUserParams): Promise<CreateUserResult> {
|
|
63
|
+
return { user, status: 'created' };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ❌ WRONG - Multiple parameters
|
|
67
|
+
export async function createUser(email: string, name: string, age: number) {
|
|
68
|
+
return user;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 4. Barrel Files (index.ts)
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// ✅ CORRECT - models/index.ts
|
|
76
|
+
export { UserModel } from './user.model.js';
|
|
77
|
+
export { BookingModel } from './booking.model.js';
|
|
78
|
+
|
|
79
|
+
// Import usage
|
|
80
|
+
import { UserModel, BookingModel } from '@repo/db/models';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 5. Named Exports Only
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// ✅ CORRECT - Named export
|
|
87
|
+
export const userService = new UserService();
|
|
88
|
+
export function validateUser() { /* ... */ }
|
|
89
|
+
|
|
90
|
+
// ❌ WRONG - Default export
|
|
91
|
+
export default userService;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 6. Types from Zod Schemas
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// ✅ CORRECT - Infer from schema
|
|
98
|
+
import { userSchema } from '@repo/schemas';
|
|
99
|
+
export type User = z.infer<typeof userSchema>;
|
|
100
|
+
|
|
101
|
+
// ❌ WRONG - Separate type file
|
|
102
|
+
export interface User {
|
|
103
|
+
id: string;
|
|
104
|
+
email: string;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Impact
|
|
109
|
+
|
|
110
|
+
- **Severity:** High - Affects codebase maintainability
|
|
111
|
+
- **Frequency:** Every new feature/component
|
|
112
|
+
- **Scope:** All developers
|
|
113
|
+
- **Prevention:** Follow patterns exactly, use factories and base classes
|
|
114
|
+
|
|
115
|
+
## Related
|
|
116
|
+
|
|
117
|
+
- **Full Patterns:** [.claude/docs/standards/architecture-patterns.md](../standards/architecture-patterns.md)
|
|
118
|
+
- **Code Standards:** [.claude/docs/standards/code-standards.md](../standards/code-standards.md)
|
|
119
|
+
- **Related Learnings:** `common-mistakes-to-avoid.md`
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
Last updated: 2024-10-28
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Common Mistakes to Avoid
|
|
2
|
+
|
|
3
|
+
**Date:** 2024-10-28
|
|
4
|
+
|
|
5
|
+
**Category:** Best Practices / Code Quality
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
Repeated mistakes slow down development and introduce bugs:
|
|
10
|
+
|
|
11
|
+
- Type safety violations
|
|
12
|
+
- Skipped tests leading to bugs
|
|
13
|
+
- Pattern violations causing inconsistency
|
|
14
|
+
- Quality issues from skipped checks
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
**Never Do These Things:**
|
|
19
|
+
|
|
20
|
+
### 1. Using `any` Type
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// ❌ WRONG - Loses all type safety
|
|
24
|
+
function processData(data: any) {
|
|
25
|
+
return data.value; // No autocomplete, no errors
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ✅ CORRECT - Use unknown with type guards
|
|
29
|
+
function processData(data: unknown) {
|
|
30
|
+
if (typeof data === 'object' && data !== null && 'value' in data) {
|
|
31
|
+
return (data as { value: string }).value;
|
|
32
|
+
}
|
|
33
|
+
throw new Error('Invalid data');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ✅ BETTER - Proper typing
|
|
37
|
+
interface DataWithValue {
|
|
38
|
+
value: string;
|
|
39
|
+
}
|
|
40
|
+
function processData(data: DataWithValue) {
|
|
41
|
+
return data.value;
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Using Default Exports
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// ❌ WRONG - Default export
|
|
49
|
+
export default class UserService { }
|
|
50
|
+
|
|
51
|
+
// Import becomes inconsistent
|
|
52
|
+
import UserService from './user.service'; // Could be named anything
|
|
53
|
+
import MyService from './user.service'; // No consistency
|
|
54
|
+
|
|
55
|
+
// ✅ CORRECT - Named export
|
|
56
|
+
export class UserService { }
|
|
57
|
+
|
|
58
|
+
// Import is consistent
|
|
59
|
+
import { UserService } from './user.service';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Skipping Tests in TDD
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// ❌ WRONG - Implement first
|
|
66
|
+
export function calculateTotal(items: Item[]) {
|
|
67
|
+
return items.reduce((sum, item) => sum + item.price, 0);
|
|
68
|
+
}
|
|
69
|
+
// Then write tests later (often forgotten)
|
|
70
|
+
|
|
71
|
+
// ✅ CORRECT - Test first (RED)
|
|
72
|
+
it('should calculate total of items', () => {
|
|
73
|
+
const items = [{ price: 10 }, { price: 20 }];
|
|
74
|
+
expect(calculateTotal(items)).toBe(30);
|
|
75
|
+
});
|
|
76
|
+
// Result: FAIL - calculateTotal is not defined
|
|
77
|
+
|
|
78
|
+
// Then implement (GREEN)
|
|
79
|
+
export function calculateTotal(items: Item[]) {
|
|
80
|
+
return items.reduce((sum, item) => sum + item.price, 0);
|
|
81
|
+
}
|
|
82
|
+
// Result: PASS ✓
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Not Running Quality Checks
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# ❌ WRONG - Skip directly to commit
|
|
89
|
+
git add .
|
|
90
|
+
git commit -m "Add feature"
|
|
91
|
+
|
|
92
|
+
# ✅ CORRECT - Always run quality checks
|
|
93
|
+
pnpm typecheck
|
|
94
|
+
pnpm lint
|
|
95
|
+
pnpm test
|
|
96
|
+
# Then commit if all pass
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 5. Making Autonomous Decisions
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
// ❌ WRONG - Choose approach without consulting
|
|
103
|
+
// "I'll use Redis for caching"
|
|
104
|
+
await redis.set(key, value);
|
|
105
|
+
|
|
106
|
+
// ✅ CORRECT - Present options
|
|
107
|
+
// "I have 3 caching options:
|
|
108
|
+
// 1. In-memory (fast, simple, limited)
|
|
109
|
+
// 2. Redis (scalable, complex)
|
|
110
|
+
// 3. Database (simple, slower)
|
|
111
|
+
// Which do you prefer?"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 6. Creating Separate Type Files
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// ❌ WRONG - Separate type file
|
|
118
|
+
// types/user.ts
|
|
119
|
+
export interface User {
|
|
120
|
+
id: string;
|
|
121
|
+
email: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ✅ CORRECT - Infer from Zod schema
|
|
125
|
+
// schemas/user.schema.ts
|
|
126
|
+
export const userSchema = z.object({
|
|
127
|
+
id: z.string(),
|
|
128
|
+
email: z.string().email(),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export type User = z.infer<typeof userSchema>;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Impact
|
|
135
|
+
|
|
136
|
+
- **Severity:** High - Each mistake compounds over time
|
|
137
|
+
- **Frequency:** Common for new developers or under time pressure
|
|
138
|
+
- **Scope:** All codebase contributors
|
|
139
|
+
- **Prevention:** Code reviews, automated checks, following standards
|
|
140
|
+
|
|
141
|
+
## Related
|
|
142
|
+
|
|
143
|
+
- **Standards:** [.claude/docs/standards/code-standards.md](../standards/code-standards.md)
|
|
144
|
+
- **TDD Guide:** [.claude/skills/patterns/tdd-methodology.md](../../skills/patterns/tdd-methodology.md)
|
|
145
|
+
- **Related Learnings:** `common-architectural-patterns.md`
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
Last updated: 2024-10-28
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Markdown Formatting Standards
|
|
2
|
+
|
|
3
|
+
**Date:** 2024-10-28
|
|
4
|
+
|
|
5
|
+
**Category:** Documentation / Formatting
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
Inconsistent markdown formatting causes:
|
|
10
|
+
|
|
11
|
+
- Failed CI/CD checks (markdownlint errors)
|
|
12
|
+
- Difficult-to-read documentation
|
|
13
|
+
- Merge conflicts in documentation files
|
|
14
|
+
- Unprofessional appearance
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
**Always format markdown before committing:**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Format all markdown files
|
|
22
|
+
pnpm format:md
|
|
23
|
+
|
|
24
|
+
# Format only .claude docs
|
|
25
|
+
pnpm format:md:claude
|
|
26
|
+
|
|
27
|
+
# Check without fixing
|
|
28
|
+
pnpm lint:md
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Key Rules:**
|
|
32
|
+
|
|
33
|
+
1. **Add language to code blocks** - Never leave code blocks without language specification
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
✅ CORRECT
|
|
37
|
+
```javascript
|
|
38
|
+
const foo = 'bar';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
❌ WRONG
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
const foo = 'bar';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. **Use 2-space indentation for lists** - Consistent nested list formatting
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
✅ CORRECT
|
|
53
|
+
- Item 1
|
|
54
|
+
- Nested item
|
|
55
|
+
- Double nested
|
|
56
|
+
|
|
57
|
+
❌ WRONG
|
|
58
|
+
- Item 1
|
|
59
|
+
- Nested (4 spaces)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. **Add blank lines around blocks** - Headings, code blocks, lists, tables need spacing
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
✅ CORRECT
|
|
66
|
+
Some text.
|
|
67
|
+
|
|
68
|
+
## Heading
|
|
69
|
+
|
|
70
|
+
More text.
|
|
71
|
+
|
|
72
|
+
❌ WRONG
|
|
73
|
+
Some text.
|
|
74
|
+
## Heading
|
|
75
|
+
More text.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
4. **No trailing punctuation in headings**
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
✅ CORRECT
|
|
82
|
+
## My Heading
|
|
83
|
+
|
|
84
|
+
❌ WRONG
|
|
85
|
+
## My Heading:
|
|
86
|
+
## My Heading.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Impact
|
|
90
|
+
|
|
91
|
+
- **Severity:** Medium - Blocks CI/CD, affects readability
|
|
92
|
+
- **Frequency:** Common when writing documentation
|
|
93
|
+
- **Scope:** All documentation contributors
|
|
94
|
+
- **Prevention:** Run `pnpm format:md` before every commit
|
|
95
|
+
|
|
96
|
+
## Related
|
|
97
|
+
|
|
98
|
+
- **Full Documentation:** `docs/development/markdown-formatting.md`
|
|
99
|
+
- **CI/CD Hooks:** `.claude/hooks/` configuration
|
|
100
|
+
- **Related Learnings:** None yet
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
Last updated: 2024-10-28
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Monorepo Command Execution
|
|
2
|
+
|
|
3
|
+
**Date:** 2024-10-28
|
|
4
|
+
|
|
5
|
+
**Category:** Monorepo / PNPM / Development
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
Running package-specific commands (lint, typecheck, test) incorrectly leads to:
|
|
10
|
+
|
|
11
|
+
- Commands not finding workspace dependencies
|
|
12
|
+
- Inconsistent environment setup
|
|
13
|
+
- Path resolution errors
|
|
14
|
+
- Build failures
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
**ALWAYS run package/app commands from project root** using `cd packageName && pnpm run <command>`
|
|
19
|
+
|
|
20
|
+
**Examples:**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# ✅ CORRECT - Lint individual package
|
|
24
|
+
cd packages/db && pnpm run lint
|
|
25
|
+
|
|
26
|
+
# ✅ CORRECT - Test individual app
|
|
27
|
+
cd apps/api && pnpm run test
|
|
28
|
+
|
|
29
|
+
# ✅ CORRECT - TypeCheck individual package
|
|
30
|
+
cd packages/db && pnpm run typecheck
|
|
31
|
+
|
|
32
|
+
# ❌ WRONG - Don't use filters for individual checks
|
|
33
|
+
pnpm --filter @repo/db run lint # Doesn't work as expected
|
|
34
|
+
|
|
35
|
+
# ❌ WRONG - Don't run from package directory
|
|
36
|
+
cd packages/db
|
|
37
|
+
pnpm run lint # May fail due to workspace context
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**When to use from root:**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# For entire monorepo checks only
|
|
44
|
+
pnpm run lint # All packages/apps
|
|
45
|
+
pnpm run typecheck # All packages/apps
|
|
46
|
+
pnpm run test # All packages/apps
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Impact
|
|
50
|
+
|
|
51
|
+
- **Severity:** High - Causes build/test failures
|
|
52
|
+
- **Frequency:** Very common in monorepo development
|
|
53
|
+
- **Scope:** All developers
|
|
54
|
+
- **Prevention:** Always use `cd packageName && pnpm run <command>` pattern
|
|
55
|
+
|
|
56
|
+
## Related
|
|
57
|
+
|
|
58
|
+
- **Documentation:** [CLAUDE.md](../../../CLAUDE.md#quick-command-reference)
|
|
59
|
+
- **Monorepo Structure:** [CLAUDE.md](../../../CLAUDE.md#monorepo-structure-full)
|
|
60
|
+
- **Related Learnings:** None yet
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
Last updated: 2024-10-28
|