@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,513 @@
|
|
|
1
|
+
# Atomic Commits Policy
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
**Atomic commits** are focused, single-purpose commits that contain **only the changes related to one specific task**. This is a **CRITICAL** policy in the project that ensures clean git history, easier code review, and better debugging capabilities.
|
|
6
|
+
|
|
7
|
+
## Why Atomic Commits Matter
|
|
8
|
+
|
|
9
|
+
### Benefits
|
|
10
|
+
|
|
11
|
+
1. **Clear History**: Each commit represents one logical change
|
|
12
|
+
2. **Easy Revert**: Roll back specific features without affecting others
|
|
13
|
+
3. **Better Reviews**: Reviewers can understand changes in isolation
|
|
14
|
+
4. **Improved Debugging**: `git bisect` works more effectively
|
|
15
|
+
5. **Cleaner PRs**: Pull requests are focused and easier to understand
|
|
16
|
+
6. **Audit Trail**: Clear documentation of what changed and when
|
|
17
|
+
|
|
18
|
+
### Problems with Non-Atomic Commits
|
|
19
|
+
|
|
20
|
+
- **Mixed Changes**: Unrelated modifications in same commit make history confusing
|
|
21
|
+
- **Hard to Revert**: Can't undo one change without affecting others
|
|
22
|
+
- **Review Complexity**: Reviewers must parse multiple unrelated changes
|
|
23
|
+
- **Lost Context**: Why changes were made becomes unclear
|
|
24
|
+
- **Merge Conflicts**: More likely when commits contain unrelated changes
|
|
25
|
+
|
|
26
|
+
## 🔥 CRITICAL: Project Policy
|
|
27
|
+
|
|
28
|
+
When committing code after completing a task:
|
|
29
|
+
|
|
30
|
+
### Rules
|
|
31
|
+
|
|
32
|
+
1. **ONLY** commit files modified during THAT specific task
|
|
33
|
+
2. **NEVER** use `git add .` or `git add -A`
|
|
34
|
+
3. **ALWAYS** use `git add <specific-file>` for task-related files
|
|
35
|
+
4. **WARN** user if unrelated modified files are detected
|
|
36
|
+
|
|
37
|
+
### Example Scenario
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Task: "Create User model"
|
|
41
|
+
# git status shows:
|
|
42
|
+
M packages/db/src/models/user.model.ts ← Task file ✅
|
|
43
|
+
M packages/db/test/models/user.model.test.ts ← Task file ✅
|
|
44
|
+
M packages/api/routes/booking.ts ← NOT related ❌
|
|
45
|
+
M .env.local ← NOT related ❌
|
|
46
|
+
|
|
47
|
+
# ✅ CORRECT:
|
|
48
|
+
git add packages/db/src/models/user.model.ts
|
|
49
|
+
git add packages/db/test/models/user.model.test.ts
|
|
50
|
+
# Only task-related files
|
|
51
|
+
|
|
52
|
+
# ❌ WRONG:
|
|
53
|
+
git add . # Would include unrelated files!
|
|
54
|
+
git add -A # Would include unrelated files!
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### If Unrelated Files Exist
|
|
58
|
+
|
|
59
|
+
When `git status` shows modified files NOT part of current task:
|
|
60
|
+
|
|
61
|
+
1. **Inform** user about unrelated files
|
|
62
|
+
2. **Confirm** proceeding with ONLY task files
|
|
63
|
+
3. **Allow override** if user explicitly requests including other files
|
|
64
|
+
|
|
65
|
+
#### Warning Template
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
⚠️ Warning: I see modified files that are NOT part of this task:
|
|
69
|
+
- packages/api/routes/booking.ts
|
|
70
|
+
- .env.local
|
|
71
|
+
|
|
72
|
+
I will ONLY commit the files related to the current task:
|
|
73
|
+
- packages/db/src/models/user.model.ts
|
|
74
|
+
- packages/db/test/models/user.model.test.ts
|
|
75
|
+
|
|
76
|
+
The unrelated files will remain uncommitted. You can commit them separately
|
|
77
|
+
when their respective tasks are complete.
|
|
78
|
+
|
|
79
|
+
Do you want to proceed with committing only the task-related files? (yes/no)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Exception
|
|
83
|
+
|
|
84
|
+
User can explicitly request including other files:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# User says: "Include the booking.ts file too"
|
|
88
|
+
# Then you can:
|
|
89
|
+
git add packages/db/src/models/user.model.ts
|
|
90
|
+
git add packages/db/test/models/user.model.test.ts
|
|
91
|
+
git add packages/api/routes/booking.ts
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Workflow by Level
|
|
95
|
+
|
|
96
|
+
### Level 1: Quick Fix Protocol
|
|
97
|
+
|
|
98
|
+
**Commits:** Single atomic commit
|
|
99
|
+
|
|
100
|
+
- All changes for the fix
|
|
101
|
+
- Documentation updates
|
|
102
|
+
- Test additions/modifications
|
|
103
|
+
|
|
104
|
+
**Example:**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Fix typo in entity schema
|
|
108
|
+
git add packages/db/schemas/entity.schema.ts
|
|
109
|
+
git commit -m "fix(db): correct typo in entity description field"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Level 2: Atomic Task Protocol
|
|
113
|
+
|
|
114
|
+
**Commits:** 1-3 logical commits
|
|
115
|
+
|
|
116
|
+
Organize files into logical groups:
|
|
117
|
+
|
|
118
|
+
1. **Schemas & Validation**
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git add packages/schemas/src/entity.schema.ts
|
|
122
|
+
git commit -m "feat(schemas): add entity validation schema"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
2. **Models & Tests**
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
git add packages/db/src/models/entity.model.ts
|
|
129
|
+
git add packages/db/test/models/entity.model.test.ts
|
|
130
|
+
git commit -m "feat(db): implement entity model with tests"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
3. **Services**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
git add packages/service-core/src/entity.service.ts
|
|
137
|
+
git add packages/service-core/test/entity.service.test.ts
|
|
138
|
+
git commit -m "feat(service): add entity CRUD service"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
4. **API Routes**
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
git add apps/api/src/routes/entitys.ts
|
|
145
|
+
git add apps/api/test/routes/entitys.test.ts
|
|
146
|
+
git commit -m "feat(api): expose entity endpoints"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Bad Example:**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# ❌ Don't do this - mixing unrelated changes
|
|
153
|
+
git add packages/schemas/src/entity.schema.ts
|
|
154
|
+
git add packages/schemas/src/booking.schema.ts # Different feature!
|
|
155
|
+
git add packages/db/src/models/entity.model.ts
|
|
156
|
+
git add .env.local # Config file!
|
|
157
|
+
git commit -m "Add stuff"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Level 3: Feature Planning (4 Phases)
|
|
161
|
+
|
|
162
|
+
**Phase 2 - Implementation:**
|
|
163
|
+
|
|
164
|
+
Multiple atomic commits, each for a specific subtask (PB-XXX):
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# PB-001: Database Schema
|
|
168
|
+
git add packages/db/schemas/entitys.ts
|
|
169
|
+
git commit -m "feat(db): add entitys table schema [PB-001]"
|
|
170
|
+
|
|
171
|
+
# PB-002: Model Layer
|
|
172
|
+
git add packages/db/src/models/entity.model.ts
|
|
173
|
+
git add packages/db/test/models/entity.model.test.ts
|
|
174
|
+
git commit -m "feat(db): implement entity model [PB-002]"
|
|
175
|
+
|
|
176
|
+
# PB-003: Service Layer
|
|
177
|
+
git add packages/service-core/src/entity.service.ts
|
|
178
|
+
git add packages/service-core/test/entity.service.test.ts
|
|
179
|
+
git commit -m "feat(service): add entity CRUD service [PB-003]"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Phase 4 - Finalization:**
|
|
183
|
+
|
|
184
|
+
Separate commits for documentation:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Update documentation
|
|
188
|
+
git add docs/api/entitys.md
|
|
189
|
+
git commit -m "docs: add entity API documentation"
|
|
190
|
+
|
|
191
|
+
# Update changelog
|
|
192
|
+
git add CHANGELOG.md
|
|
193
|
+
git commit -m "docs: update changelog for entity feature"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Common Patterns
|
|
197
|
+
|
|
198
|
+
### Pattern 1: Schema + Model + Test
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Zod schema
|
|
202
|
+
git add packages/schemas/src/user.schema.ts
|
|
203
|
+
git commit -m "feat(schemas): add user validation schema"
|
|
204
|
+
|
|
205
|
+
# Drizzle model + tests together
|
|
206
|
+
git add packages/db/src/models/user.model.ts
|
|
207
|
+
git add packages/db/test/models/user.model.test.ts
|
|
208
|
+
git commit -m "feat(db): implement user model with tests"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Pattern 2: Service + API
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# Service layer with tests
|
|
215
|
+
git add packages/service-core/src/booking.service.ts
|
|
216
|
+
git add packages/service-core/test/booking.service.test.ts
|
|
217
|
+
git commit -m "feat(service): implement booking service"
|
|
218
|
+
|
|
219
|
+
# API routes with tests
|
|
220
|
+
git add apps/api/src/routes/bookings.ts
|
|
221
|
+
git add apps/api/test/routes/bookings.test.ts
|
|
222
|
+
git commit -m "feat(api): add booking endpoints"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Pattern 3: Refactoring
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Extract utility function
|
|
229
|
+
git add packages/utils/src/date-helpers.ts
|
|
230
|
+
git add packages/utils/test/date-helpers.test.ts
|
|
231
|
+
git commit -m "refactor(utils): extract date calculation utilities"
|
|
232
|
+
|
|
233
|
+
# Update services to use new utilities
|
|
234
|
+
git add packages/service-core/src/booking.service.ts
|
|
235
|
+
git add packages/service-core/test/booking.service.test.ts
|
|
236
|
+
git commit -m "refactor(service): use shared date utilities"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Pattern 4: Bug Fix
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Fix + regression test
|
|
243
|
+
git add packages/db/src/models/entity.model.ts
|
|
244
|
+
git add packages/db/test/models/entity.model.test.ts
|
|
245
|
+
git commit -m "fix(db): correct price calculation for seasonal rates"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Anti-Patterns to Avoid
|
|
249
|
+
|
|
250
|
+
### ❌ The "Everything" Commit
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# DON'T do this
|
|
254
|
+
git add .
|
|
255
|
+
git commit -m "Updates"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Why it's bad:**
|
|
259
|
+
|
|
260
|
+
- Includes unrelated changes
|
|
261
|
+
- No clear purpose
|
|
262
|
+
- Hard to review
|
|
263
|
+
- Impossible to revert selectively
|
|
264
|
+
|
|
265
|
+
### ❌ The "Mixed Concerns" Commit
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# DON'T do this
|
|
269
|
+
git add packages/db/src/models/user.model.ts
|
|
270
|
+
git add packages/api/routes/bookings.ts
|
|
271
|
+
git add apps/web/pages/contact.tsx
|
|
272
|
+
git commit -m "Various updates"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Why it's bad:**
|
|
276
|
+
|
|
277
|
+
- Three unrelated features
|
|
278
|
+
- Can't track individual changes
|
|
279
|
+
- Review is confusing
|
|
280
|
+
|
|
281
|
+
### ❌ The "Config Leak" Commit
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
# DON'T do this
|
|
285
|
+
git add packages/db/src/models/entity.model.ts
|
|
286
|
+
git add .env.local
|
|
287
|
+
git add .vscode/settings.json
|
|
288
|
+
git commit -m "Add entity model"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Why it's bad:**
|
|
292
|
+
|
|
293
|
+
- Personal config files mixed with feature
|
|
294
|
+
- May leak sensitive data
|
|
295
|
+
- Pollutes shared history
|
|
296
|
+
|
|
297
|
+
### ❌ The "WIP" Commit
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# DON'T do this
|
|
301
|
+
git add .
|
|
302
|
+
git commit -m "WIP"
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Why it's bad:**
|
|
306
|
+
|
|
307
|
+
- No context for changes
|
|
308
|
+
- Likely includes unrelated files
|
|
309
|
+
- Creates noise in history
|
|
310
|
+
|
|
311
|
+
## Tools and Commands
|
|
312
|
+
|
|
313
|
+
### Checking Status
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# See what files are modified
|
|
317
|
+
git status
|
|
318
|
+
|
|
319
|
+
# See detailed changes
|
|
320
|
+
git diff
|
|
321
|
+
|
|
322
|
+
# See staged changes
|
|
323
|
+
git diff --cached
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Staging Selectively
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# Stage specific file
|
|
330
|
+
git add path/to/file.ts
|
|
331
|
+
|
|
332
|
+
# Stage multiple specific files
|
|
333
|
+
git add path/to/file1.ts path/to/file2.ts
|
|
334
|
+
|
|
335
|
+
# Stage parts of a file (interactive)
|
|
336
|
+
git add -p path/to/file.ts
|
|
337
|
+
|
|
338
|
+
# Unstage file
|
|
339
|
+
git restore --staged path/to/file.ts
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Reviewing Before Commit
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Review what's staged
|
|
346
|
+
git diff --cached
|
|
347
|
+
|
|
348
|
+
# Review specific file changes
|
|
349
|
+
git diff --cached path/to/file.ts
|
|
350
|
+
|
|
351
|
+
# See summary of staged changes
|
|
352
|
+
git status
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Amending Commits
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# Amend last commit (add forgotten file)
|
|
359
|
+
git add path/to/forgotten/file.ts
|
|
360
|
+
git commit --amend --no-edit
|
|
361
|
+
|
|
362
|
+
# Amend last commit (change message)
|
|
363
|
+
git commit --amend -m "Better commit message"
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**⚠️ Warning:** Only amend commits that haven't been pushed!
|
|
367
|
+
|
|
368
|
+
## Commit Message Guidelines
|
|
369
|
+
|
|
370
|
+
Follow **Conventional Commits** format:
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
<type>(<scope>): <description>
|
|
374
|
+
|
|
375
|
+
[optional body]
|
|
376
|
+
|
|
377
|
+
[optional footer]
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Types
|
|
381
|
+
|
|
382
|
+
- `feat`: New feature
|
|
383
|
+
- `fix`: Bug fix
|
|
384
|
+
- `refactor`: Code change that neither fixes bug nor adds feature
|
|
385
|
+
- `docs`: Documentation only
|
|
386
|
+
- `test`: Adding or updating tests
|
|
387
|
+
- `chore`: Maintenance tasks
|
|
388
|
+
- `perf`: Performance improvement
|
|
389
|
+
- `style`: Code style changes (formatting, no logic change)
|
|
390
|
+
|
|
391
|
+
### Scope
|
|
392
|
+
|
|
393
|
+
Package or area affected:
|
|
394
|
+
|
|
395
|
+
- `db`, `api`, `web`, `admin`
|
|
396
|
+
- `schemas`, `service`, `utils`
|
|
397
|
+
- `auth`, `payments`, `i18n`
|
|
398
|
+
|
|
399
|
+
### Examples
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
feat(db): add entity availability tracking
|
|
403
|
+
fix(api): correct booking date validation logic
|
|
404
|
+
refactor(service): extract price calculation utilities
|
|
405
|
+
docs(api): update entity endpoint documentation
|
|
406
|
+
test(db): add edge cases for booking model
|
|
407
|
+
chore(deps): update Drizzle to v0.29.0
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## Integration with Workflows
|
|
411
|
+
|
|
412
|
+
### Quick Fix Protocol (Level 1)
|
|
413
|
+
|
|
414
|
+
1. Make the fix
|
|
415
|
+
2. Add tests
|
|
416
|
+
3. **Single atomic commit** with all changes
|
|
417
|
+
4. Run quality checks
|
|
418
|
+
5. Commit
|
|
419
|
+
|
|
420
|
+
### Atomic Task Protocol (Level 2)
|
|
421
|
+
|
|
422
|
+
1. Complete subtask (TDD)
|
|
423
|
+
2. **Commit only files for that subtask**
|
|
424
|
+
3. Move to next subtask
|
|
425
|
+
4. Repeat until task complete
|
|
426
|
+
5. Create PR with 1-3 focused commits
|
|
427
|
+
|
|
428
|
+
### Feature Planning (Level 3)
|
|
429
|
+
|
|
430
|
+
1. Phase 2: **One commit per PB-XXX subtask**
|
|
431
|
+
2. Each commit is atomic to its subtask
|
|
432
|
+
3. Task codes in commit messages
|
|
433
|
+
4. Phase 4: Separate commits for docs
|
|
434
|
+
5. Create PR with clear commit history
|
|
435
|
+
|
|
436
|
+
## Pre-commit Checklist
|
|
437
|
+
|
|
438
|
+
Before committing, verify:
|
|
439
|
+
|
|
440
|
+
- [ ] Only task-related files are staged
|
|
441
|
+
- [ ] No unrelated changes included
|
|
442
|
+
- [ ] No sensitive data (`.env`, credentials)
|
|
443
|
+
- [ ] No personal config files (`.vscode/*`)
|
|
444
|
+
- [ ] Tests pass
|
|
445
|
+
- [ ] Linting passes
|
|
446
|
+
- [ ] Commit message follows conventions
|
|
447
|
+
- [ ] Changes can stand alone (atomic)
|
|
448
|
+
|
|
449
|
+
## When Things Go Wrong
|
|
450
|
+
|
|
451
|
+
### Committed Wrong Files
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
# Remove file from last commit (keep changes)
|
|
455
|
+
git restore --staged unwanted-file.ts
|
|
456
|
+
git commit --amend --no-edit
|
|
457
|
+
|
|
458
|
+
# OR: Reset last commit entirely (keep changes)
|
|
459
|
+
git reset HEAD~1
|
|
460
|
+
# Then stage correct files and commit again
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Mixed Changes in Working Directory
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
# Stash unrelated changes
|
|
467
|
+
git stash push -m "Booking feature WIP" packages/api/routes/booking.ts
|
|
468
|
+
|
|
469
|
+
# Commit task-related files
|
|
470
|
+
git add packages/db/src/models/user.model.ts
|
|
471
|
+
git commit -m "feat(db): add user model"
|
|
472
|
+
|
|
473
|
+
# Restore unrelated changes
|
|
474
|
+
git stash pop
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Need to Split Changes
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
# Interactive staging
|
|
481
|
+
git add -p packages/db/src/models/user.model.ts
|
|
482
|
+
# Select only related hunks
|
|
483
|
+
|
|
484
|
+
# Or: Stash everything, restore selectively
|
|
485
|
+
git stash
|
|
486
|
+
git stash show -p | git apply
|
|
487
|
+
git restore <files-to-exclude>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## References
|
|
491
|
+
|
|
492
|
+
- **Main Documentation**: [CLAUDE.md](../../../CLAUDE.md#git--commit-rules)
|
|
493
|
+
- **Task Completion**: [task-completion-protocol.md](../workflows/task-completion-protocol.md)
|
|
494
|
+
- **Quick Fix**: [quick-fix-protocol.md](../workflows/quick-fix-protocol.md)
|
|
495
|
+
- **Atomic Task**: [atomic-task-protocol.md](../workflows/atomic-task-protocol.md)
|
|
496
|
+
|
|
497
|
+
## Summary
|
|
498
|
+
|
|
499
|
+
**Key Takeaway:** Commits should be **atomic** - one logical change per commit, including only files modified for that specific task.
|
|
500
|
+
|
|
501
|
+
**Golden Rules:**
|
|
502
|
+
|
|
503
|
+
1. ✅ Stage files individually with `git add <file>`
|
|
504
|
+
2. ❌ Never use `git add .` or `git add -A`
|
|
505
|
+
3. ⚠️ Warn user about unrelated changes
|
|
506
|
+
4. 🎯 One task = One focused commit (or logical group)
|
|
507
|
+
5. 📝 Clear, conventional commit messages
|
|
508
|
+
|
|
509
|
+
Following atomic commits makes code review easier, debugging simpler, and git history clearer for the entire team.
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
*Last updated: 2025-11-03*
|