@howlil/ez-agents 2.0.0 → 3.0.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 -21
- package/README.md +157 -110
- package/README.zh-CN.md +84 -84
- package/agents/ez-plan-checker.md +2 -2
- package/agents/ez-research-synthesizer.md +1 -1
- package/agents/ez-ui-auditor.md +0 -2
- package/agents/ez-ui-checker.md +2 -4
- package/agents/ez-ui-researcher.md +0 -2
- package/agents/ez-verifier.md +1 -1
- package/bin/install.js +211 -211
- package/commands/ez/debug.md +1 -1
- package/commands/ez/map-codebase.md +1 -1
- package/commands/ez/reapply-patches.md +3 -3
- package/commands/ez/research-phase.md +1 -1
- package/{get-shit-done → ez-agents}/bin/ez-tools.cjs +1 -1
- package/{get-shit-done → ez-agents}/bin/lib/assistant-adapter.cjs +205 -205
- package/{get-shit-done → ez-agents}/bin/lib/audit-exec.cjs +150 -150
- package/{get-shit-done → ez-agents}/bin/lib/auth.cjs +175 -175
- package/{get-shit-done → ez-agents}/bin/lib/circuit-breaker.cjs +118 -118
- package/{get-shit-done → ez-agents}/bin/lib/commands.cjs +666 -666
- package/{get-shit-done → ez-agents}/bin/lib/config.cjs +183 -183
- package/{get-shit-done → ez-agents}/bin/lib/core.cjs +495 -495
- package/{get-shit-done → ez-agents}/bin/lib/file-lock.cjs +236 -236
- package/{get-shit-done → ez-agents}/bin/lib/frontmatter.cjs +299 -299
- package/{get-shit-done → ez-agents}/bin/lib/fs-utils.cjs +153 -153
- package/{get-shit-done → ez-agents}/bin/lib/git-utils.cjs +203 -203
- package/{get-shit-done → ez-agents}/bin/lib/health-check.cjs +163 -163
- package/{get-shit-done → ez-agents}/bin/lib/index.cjs +113 -113
- package/{get-shit-done → ez-agents}/bin/lib/init.cjs +710 -710
- package/{get-shit-done → ez-agents}/bin/lib/logger.cjs +117 -117
- package/{get-shit-done → ez-agents}/bin/lib/milestone.cjs +241 -241
- package/{get-shit-done → ez-agents}/bin/lib/model-provider.cjs +146 -146
- package/{get-shit-done → ez-agents}/bin/lib/phase.cjs +908 -908
- package/{get-shit-done → ez-agents}/bin/lib/retry.cjs +119 -119
- package/{get-shit-done → ez-agents}/bin/lib/roadmap.cjs +305 -305
- package/{get-shit-done → ez-agents}/bin/lib/safe-exec.cjs +128 -128
- package/{get-shit-done → ez-agents}/bin/lib/safe-path.cjs +130 -130
- package/{get-shit-done → ez-agents}/bin/lib/state.cjs +721 -721
- package/{get-shit-done → ez-agents}/bin/lib/temp-file.cjs +239 -239
- package/{get-shit-done → ez-agents}/bin/lib/template.cjs +222 -222
- package/{get-shit-done → ez-agents}/bin/lib/test-file-lock.cjs +112 -112
- package/{get-shit-done → ez-agents}/bin/lib/test-graceful.cjs +93 -93
- package/{get-shit-done → ez-agents}/bin/lib/test-logger.cjs +60 -60
- package/{get-shit-done → ez-agents}/bin/lib/test-safe-exec.cjs +38 -38
- package/{get-shit-done → ez-agents}/bin/lib/test-safe-path.cjs +33 -33
- package/{get-shit-done → ez-agents}/bin/lib/test-temp-file.cjs +125 -125
- package/{get-shit-done → ez-agents}/bin/lib/timeout-exec.cjs +62 -62
- package/{get-shit-done → ez-agents}/bin/lib/verify.cjs +820 -820
- package/{get-shit-done → ez-agents}/references/checkpoints.md +776 -776
- package/{get-shit-done → ez-agents}/references/questioning.md +162 -162
- package/{get-shit-done → ez-agents}/references/tdd.md +263 -263
- package/{get-shit-done → ez-agents}/templates/codebase/concerns.md +310 -310
- package/{get-shit-done → ez-agents}/templates/codebase/conventions.md +307 -307
- package/{get-shit-done → ez-agents}/templates/codebase/integrations.md +280 -280
- package/{get-shit-done → ez-agents}/templates/codebase/stack.md +186 -186
- package/{get-shit-done → ez-agents}/templates/codebase/testing.md +480 -480
- package/{get-shit-done → ez-agents}/templates/config.json +37 -37
- package/{get-shit-done → ez-agents}/templates/continue-here.md +78 -78
- package/{get-shit-done → ez-agents}/templates/milestone-archive.md +123 -123
- package/{get-shit-done → ez-agents}/templates/milestone.md +115 -115
- package/{get-shit-done → ez-agents}/templates/requirements.md +231 -231
- package/{get-shit-done → ez-agents}/templates/research-project/ARCHITECTURE.md +204 -204
- package/{get-shit-done → ez-agents}/templates/research-project/FEATURES.md +147 -147
- package/{get-shit-done → ez-agents}/templates/research-project/PITFALLS.md +200 -200
- package/{get-shit-done → ez-agents}/templates/research-project/STACK.md +120 -120
- package/{get-shit-done → ez-agents}/templates/research-project/SUMMARY.md +170 -170
- package/{get-shit-done → ez-agents}/templates/retrospective.md +54 -54
- package/{get-shit-done → ez-agents}/templates/roadmap.md +202 -202
- package/{get-shit-done → ez-agents}/templates/summary-minimal.md +41 -41
- package/{get-shit-done → ez-agents}/templates/summary-standard.md +48 -48
- package/{get-shit-done → ez-agents}/templates/summary.md +248 -248
- package/{get-shit-done → ez-agents}/templates/user-setup.md +311 -311
- package/{get-shit-done → ez-agents}/templates/verification-report.md +322 -322
- package/{get-shit-done → ez-agents}/workflows/add-phase.md +112 -112
- package/{get-shit-done → ez-agents}/workflows/add-tests.md +351 -351
- package/{get-shit-done → ez-agents}/workflows/add-todo.md +158 -158
- package/{get-shit-done → ez-agents}/workflows/audit-milestone.md +332 -332
- package/{get-shit-done → ez-agents}/workflows/autonomous.md +743 -743
- package/{get-shit-done → ez-agents}/workflows/check-todos.md +177 -177
- package/{get-shit-done → ez-agents}/workflows/cleanup.md +152 -152
- package/{get-shit-done → ez-agents}/workflows/complete-milestone.md +766 -766
- package/ez-agents/workflows/debug.md +0 -0
- package/{get-shit-done → ez-agents}/workflows/diagnose-issues.md +219 -219
- package/{get-shit-done → ez-agents}/workflows/discovery-phase.md +289 -289
- package/{get-shit-done → ez-agents}/workflows/discuss-phase.md +762 -762
- package/{get-shit-done → ez-agents}/workflows/execute-phase.md +468 -468
- package/{get-shit-done → ez-agents}/workflows/execute-plan.md +483 -483
- package/{get-shit-done → ez-agents}/workflows/health.md +159 -159
- package/{get-shit-done → ez-agents}/workflows/help.md +492 -492
- package/{get-shit-done → ez-agents}/workflows/insert-phase.md +130 -130
- package/{get-shit-done → ez-agents}/workflows/list-phase-assumptions.md +178 -178
- package/{get-shit-done → ez-agents}/workflows/map-codebase.md +316 -316
- package/{get-shit-done → ez-agents}/workflows/new-milestone.md +384 -384
- package/{get-shit-done → ez-agents}/workflows/new-project.md +1111 -1111
- package/{get-shit-done → ez-agents}/workflows/node-repair.md +92 -92
- package/{get-shit-done → ez-agents}/workflows/pause-work.md +122 -122
- package/{get-shit-done → ez-agents}/workflows/plan-milestone-gaps.md +274 -274
- package/{get-shit-done → ez-agents}/workflows/plan-phase.md +651 -651
- package/{get-shit-done → ez-agents}/workflows/progress.md +382 -382
- package/{get-shit-done → ez-agents}/workflows/quick.md +610 -610
- package/{get-shit-done → ez-agents}/workflows/remove-phase.md +155 -155
- package/{get-shit-done → ez-agents}/workflows/research-phase.md +74 -74
- package/{get-shit-done → ez-agents}/workflows/resume-project.md +307 -307
- package/{get-shit-done → ez-agents}/workflows/set-profile.md +81 -81
- package/{get-shit-done → ez-agents}/workflows/settings.md +242 -242
- package/{get-shit-done → ez-agents}/workflows/stats.md +57 -57
- package/{get-shit-done → ez-agents}/workflows/transition.md +544 -544
- package/{get-shit-done → ez-agents}/workflows/ui-phase.md +290 -290
- package/{get-shit-done → ez-agents}/workflows/ui-review.md +157 -157
- package/{get-shit-done → ez-agents}/workflows/update.md +320 -320
- package/{get-shit-done → ez-agents}/workflows/validate-phase.md +167 -167
- package/{get-shit-done → ez-agents}/workflows/verify-phase.md +243 -243
- package/{get-shit-done → ez-agents}/workflows/verify-work.md +5 -5
- package/hooks/dist/ez-check-update.js +81 -0
- package/hooks/dist/ez-context-monitor.js +141 -0
- package/hooks/dist/ez-statusline.js +115 -0
- package/package.json +13 -3
- package/scripts/build-hooks.js +43 -43
- package/scripts/run-tests.cjs +29 -29
- /package/{get-shit-done → ez-agents}/references/continuation-format.md +0 -0
- /package/{get-shit-done → ez-agents}/references/decimal-phase-calculation.md +0 -0
- /package/{get-shit-done → ez-agents}/references/git-integration.md +0 -0
- /package/{get-shit-done → ez-agents}/references/git-planning-commit.md +0 -0
- /package/{get-shit-done → ez-agents}/references/model-profile-resolution.md +0 -0
- /package/{get-shit-done → ez-agents}/references/model-profiles.md +0 -0
- /package/{get-shit-done → ez-agents}/references/phase-argument-parsing.md +0 -0
- /package/{get-shit-done → ez-agents}/references/planning-config.md +0 -0
- /package/{get-shit-done → ez-agents}/references/ui-brand.md +0 -0
- /package/{get-shit-done → ez-agents}/references/verification-patterns.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/DEBUG.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/UAT.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/UI-SPEC.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/VALIDATION.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/codebase/architecture.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/codebase/structure.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/context.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/copilot-instructions.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/debug-subagent-prompt.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/discovery.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/phase-prompt.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/planner-subagent-prompt.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/project.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/research.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/state.md +0 -0
- /package/{get-shit-done → ez-agents}/templates/summary-complex.md +0 -0
|
@@ -1,307 +1,307 @@
|
|
|
1
|
-
# Coding Conventions Template
|
|
2
|
-
|
|
3
|
-
Template for `.planning/codebase/CONVENTIONS.md` - captures coding style and patterns.
|
|
4
|
-
|
|
5
|
-
**Purpose:** Document how code is written in this codebase. Prescriptive guide for Claude to match existing style.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## File Template
|
|
10
|
-
|
|
11
|
-
```markdown
|
|
12
|
-
# Coding Conventions
|
|
13
|
-
|
|
14
|
-
**Analysis Date:** [YYYY-MM-DD]
|
|
15
|
-
|
|
16
|
-
## Naming Patterns
|
|
17
|
-
|
|
18
|
-
**Files:**
|
|
19
|
-
- [Pattern: e.g., "kebab-case for all files"]
|
|
20
|
-
- [Test files: e.g., "*.test.ts alongside source"]
|
|
21
|
-
- [Components: e.g., "PascalCase.tsx for React components"]
|
|
22
|
-
|
|
23
|
-
**Functions:**
|
|
24
|
-
- [Pattern: e.g., "camelCase for all functions"]
|
|
25
|
-
- [Async: e.g., "no special prefix for async functions"]
|
|
26
|
-
- [Handlers: e.g., "handleEventName for event handlers"]
|
|
27
|
-
|
|
28
|
-
**Variables:**
|
|
29
|
-
- [Pattern: e.g., "camelCase for variables"]
|
|
30
|
-
- [Constants: e.g., "UPPER_SNAKE_CASE for constants"]
|
|
31
|
-
- [Private: e.g., "_prefix for private members" or "no prefix"]
|
|
32
|
-
|
|
33
|
-
**Types:**
|
|
34
|
-
- [Interfaces: e.g., "PascalCase, no I prefix"]
|
|
35
|
-
- [Types: e.g., "PascalCase for type aliases"]
|
|
36
|
-
- [Enums: e.g., "PascalCase for enum name, UPPER_CASE for values"]
|
|
37
|
-
|
|
38
|
-
## Code Style
|
|
39
|
-
|
|
40
|
-
**Formatting:**
|
|
41
|
-
- [Tool: e.g., "Prettier with config in .prettierrc"]
|
|
42
|
-
- [Line length: e.g., "100 characters max"]
|
|
43
|
-
- [Quotes: e.g., "single quotes for strings"]
|
|
44
|
-
- [Semicolons: e.g., "required" or "omitted"]
|
|
45
|
-
|
|
46
|
-
**Linting:**
|
|
47
|
-
- [Tool: e.g., "ESLint with eslint.config.js"]
|
|
48
|
-
- [Rules: e.g., "extends airbnb-base, no console in production"]
|
|
49
|
-
- [Run: e.g., "npm run lint"]
|
|
50
|
-
|
|
51
|
-
## Import Organization
|
|
52
|
-
|
|
53
|
-
**Order:**
|
|
54
|
-
1. [e.g., "External packages (react, express, etc.)"]
|
|
55
|
-
2. [e.g., "Internal modules (@/lib, @/components)"]
|
|
56
|
-
3. [e.g., "Relative imports (., ..)"]
|
|
57
|
-
4. [e.g., "Type imports (import type {})"]
|
|
58
|
-
|
|
59
|
-
**Grouping:**
|
|
60
|
-
- [Blank lines: e.g., "blank line between groups"]
|
|
61
|
-
- [Sorting: e.g., "alphabetical within each group"]
|
|
62
|
-
|
|
63
|
-
**Path Aliases:**
|
|
64
|
-
- [Aliases used: e.g., "@/ for src/, @components/ for src/components/"]
|
|
65
|
-
|
|
66
|
-
## Error Handling
|
|
67
|
-
|
|
68
|
-
**Patterns:**
|
|
69
|
-
- [Strategy: e.g., "throw errors, catch at boundaries"]
|
|
70
|
-
- [Custom errors: e.g., "extend Error class, named *Error"]
|
|
71
|
-
- [Async: e.g., "use try/catch, no .catch() chains"]
|
|
72
|
-
|
|
73
|
-
**Error Types:**
|
|
74
|
-
- [When to throw: e.g., "invalid input, missing dependencies"]
|
|
75
|
-
- [When to return: e.g., "expected failures return Result<T, E>"]
|
|
76
|
-
- [Logging: e.g., "log error with context before throwing"]
|
|
77
|
-
|
|
78
|
-
## Logging
|
|
79
|
-
|
|
80
|
-
**Framework:**
|
|
81
|
-
- [Tool: e.g., "console.log, pino, winston"]
|
|
82
|
-
- [Levels: e.g., "debug, info, warn, error"]
|
|
83
|
-
|
|
84
|
-
**Patterns:**
|
|
85
|
-
- [Format: e.g., "structured logging with context object"]
|
|
86
|
-
- [When: e.g., "log state transitions, external calls"]
|
|
87
|
-
- [Where: e.g., "log at service boundaries, not in utils"]
|
|
88
|
-
|
|
89
|
-
## Comments
|
|
90
|
-
|
|
91
|
-
**When to Comment:**
|
|
92
|
-
- [e.g., "explain why, not what"]
|
|
93
|
-
- [e.g., "document business logic, algorithms, edge cases"]
|
|
94
|
-
- [e.g., "avoid obvious comments like // increment counter"]
|
|
95
|
-
|
|
96
|
-
**JSDoc/TSDoc:**
|
|
97
|
-
- [Usage: e.g., "required for public APIs, optional for internal"]
|
|
98
|
-
- [Format: e.g., "use @param, @returns, @throws tags"]
|
|
99
|
-
|
|
100
|
-
**TODO Comments:**
|
|
101
|
-
- [Pattern: e.g., "// TODO(username): description"]
|
|
102
|
-
- [Tracking: e.g., "link to issue number if available"]
|
|
103
|
-
|
|
104
|
-
## Function Design
|
|
105
|
-
|
|
106
|
-
**Size:**
|
|
107
|
-
- [e.g., "keep under 50 lines, extract helpers"]
|
|
108
|
-
|
|
109
|
-
**Parameters:**
|
|
110
|
-
- [e.g., "max 3 parameters, use object for more"]
|
|
111
|
-
- [e.g., "destructure objects in parameter list"]
|
|
112
|
-
|
|
113
|
-
**Return Values:**
|
|
114
|
-
- [e.g., "explicit returns, no implicit undefined"]
|
|
115
|
-
- [e.g., "return early for guard clauses"]
|
|
116
|
-
|
|
117
|
-
## Module Design
|
|
118
|
-
|
|
119
|
-
**Exports:**
|
|
120
|
-
- [e.g., "named exports preferred, default exports for React components"]
|
|
121
|
-
- [e.g., "export from index.ts for public API"]
|
|
122
|
-
|
|
123
|
-
**Barrel Files:**
|
|
124
|
-
- [e.g., "use index.ts to re-export public API"]
|
|
125
|
-
- [e.g., "avoid circular dependencies"]
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
*Convention analysis: [date]*
|
|
130
|
-
*Update when patterns change*
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
<good_examples>
|
|
134
|
-
```markdown
|
|
135
|
-
# Coding Conventions
|
|
136
|
-
|
|
137
|
-
**Analysis Date:** 2025-01-20
|
|
138
|
-
|
|
139
|
-
## Naming Patterns
|
|
140
|
-
|
|
141
|
-
**Files:**
|
|
142
|
-
- kebab-case for all files (command-handler.ts, user-service.ts)
|
|
143
|
-
- *.test.ts alongside source files
|
|
144
|
-
- index.ts for barrel exports
|
|
145
|
-
|
|
146
|
-
**Functions:**
|
|
147
|
-
- camelCase for all functions
|
|
148
|
-
- No special prefix for async functions
|
|
149
|
-
- handleEventName for event handlers (handleClick, handleSubmit)
|
|
150
|
-
|
|
151
|
-
**Variables:**
|
|
152
|
-
- camelCase for variables
|
|
153
|
-
- UPPER_SNAKE_CASE for constants (MAX_RETRIES, API_BASE_URL)
|
|
154
|
-
- No underscore prefix (no private marker in TS)
|
|
155
|
-
|
|
156
|
-
**Types:**
|
|
157
|
-
- PascalCase for interfaces, no I prefix (User, not IUser)
|
|
158
|
-
- PascalCase for type aliases (UserConfig, ResponseData)
|
|
159
|
-
- PascalCase for enum names, UPPER_CASE for values (Status.PENDING)
|
|
160
|
-
|
|
161
|
-
## Code Style
|
|
162
|
-
|
|
163
|
-
**Formatting:**
|
|
164
|
-
- Prettier with .prettierrc
|
|
165
|
-
- 100 character line length
|
|
166
|
-
- Single quotes for strings
|
|
167
|
-
- Semicolons required
|
|
168
|
-
- 2 space indentation
|
|
169
|
-
|
|
170
|
-
**Linting:**
|
|
171
|
-
- ESLint with eslint.config.js
|
|
172
|
-
- Extends @typescript-eslint/recommended
|
|
173
|
-
- No console.log in production code (use logger)
|
|
174
|
-
- Run: npm run lint
|
|
175
|
-
|
|
176
|
-
## Import Organization
|
|
177
|
-
|
|
178
|
-
**Order:**
|
|
179
|
-
1. External packages (react, express, commander)
|
|
180
|
-
2. Internal modules (@/lib, @/services)
|
|
181
|
-
3. Relative imports (./utils, ../types)
|
|
182
|
-
4. Type imports (import type { User })
|
|
183
|
-
|
|
184
|
-
**Grouping:**
|
|
185
|
-
- Blank line between groups
|
|
186
|
-
- Alphabetical within each group
|
|
187
|
-
- Type imports last within each group
|
|
188
|
-
|
|
189
|
-
**Path Aliases:**
|
|
190
|
-
- @/ maps to src/
|
|
191
|
-
- No other aliases defined
|
|
192
|
-
|
|
193
|
-
## Error Handling
|
|
194
|
-
|
|
195
|
-
**Patterns:**
|
|
196
|
-
- Throw errors, catch at boundaries (route handlers, main functions)
|
|
197
|
-
- Extend Error class for custom errors (ValidationError, NotFoundError)
|
|
198
|
-
- Async functions use try/catch, no .catch() chains
|
|
199
|
-
|
|
200
|
-
**Error Types:**
|
|
201
|
-
- Throw on invalid input, missing dependencies, invariant violations
|
|
202
|
-
- Log error with context before throwing: logger.error({ err, userId }, 'Failed to process')
|
|
203
|
-
- Include cause in error message: new Error('Failed to X', { cause: originalError })
|
|
204
|
-
|
|
205
|
-
## Logging
|
|
206
|
-
|
|
207
|
-
**Framework:**
|
|
208
|
-
- pino logger instance exported from lib/logger.ts
|
|
209
|
-
- Levels: debug, info, warn, error (no trace)
|
|
210
|
-
|
|
211
|
-
**Patterns:**
|
|
212
|
-
- Structured logging with context: logger.info({ userId, action }, 'User action')
|
|
213
|
-
- Log at service boundaries, not in utility functions
|
|
214
|
-
- Log state transitions, external API calls, errors
|
|
215
|
-
- No console.log in committed code
|
|
216
|
-
|
|
217
|
-
## Comments
|
|
218
|
-
|
|
219
|
-
**When to Comment:**
|
|
220
|
-
- Explain why, not what: // Retry 3 times because API has transient failures
|
|
221
|
-
- Document business rules: // Users must verify email within 24 hours
|
|
222
|
-
- Explain non-obvious algorithms or workarounds
|
|
223
|
-
- Avoid obvious comments: // set count to 0
|
|
224
|
-
|
|
225
|
-
**JSDoc/TSDoc:**
|
|
226
|
-
- Required for public API functions
|
|
227
|
-
- Optional for internal functions if signature is self-explanatory
|
|
228
|
-
- Use @param, @returns, @throws tags
|
|
229
|
-
|
|
230
|
-
**TODO Comments:**
|
|
231
|
-
- Format: // TODO: description (no username, using git blame)
|
|
232
|
-
- Link to issue if exists: // TODO: Fix race condition (issue #123)
|
|
233
|
-
|
|
234
|
-
## Function Design
|
|
235
|
-
|
|
236
|
-
**Size:**
|
|
237
|
-
- Keep under 50 lines
|
|
238
|
-
- Extract helpers for complex logic
|
|
239
|
-
- One level of abstraction per function
|
|
240
|
-
|
|
241
|
-
**Parameters:**
|
|
242
|
-
- Max 3 parameters
|
|
243
|
-
- Use options object for 4+ parameters: function create(options: CreateOptions)
|
|
244
|
-
- Destructure in parameter list: function process({ id, name }: ProcessParams)
|
|
245
|
-
|
|
246
|
-
**Return Values:**
|
|
247
|
-
- Explicit return statements
|
|
248
|
-
- Return early for guard clauses
|
|
249
|
-
- Use Result<T, E> type for expected failures
|
|
250
|
-
|
|
251
|
-
## Module Design
|
|
252
|
-
|
|
253
|
-
**Exports:**
|
|
254
|
-
- Named exports preferred
|
|
255
|
-
- Default exports only for React components
|
|
256
|
-
- Export public API from index.ts barrel files
|
|
257
|
-
|
|
258
|
-
**Barrel Files:**
|
|
259
|
-
- index.ts re-exports public API
|
|
260
|
-
- Keep internal helpers private (don't export from index)
|
|
261
|
-
- Avoid circular dependencies (import from specific files if needed)
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
*Convention analysis: 2025-01-20*
|
|
266
|
-
*Update when patterns change*
|
|
267
|
-
```
|
|
268
|
-
</good_examples>
|
|
269
|
-
|
|
270
|
-
<guidelines>
|
|
271
|
-
**What belongs in CONVENTIONS.md:**
|
|
272
|
-
- Naming patterns observed in the codebase
|
|
273
|
-
- Formatting rules (Prettier config, linting rules)
|
|
274
|
-
- Import organization patterns
|
|
275
|
-
- Error handling strategy
|
|
276
|
-
- Logging approach
|
|
277
|
-
- Comment conventions
|
|
278
|
-
- Function and module design patterns
|
|
279
|
-
|
|
280
|
-
**What does NOT belong here:**
|
|
281
|
-
- Architecture decisions (that's ARCHITECTURE.md)
|
|
282
|
-
- Technology choices (that's STACK.md)
|
|
283
|
-
- Test patterns (that's TESTING.md)
|
|
284
|
-
- File organization (that's STRUCTURE.md)
|
|
285
|
-
|
|
286
|
-
**When filling this template:**
|
|
287
|
-
- Check .prettierrc, .eslintrc, or similar config files
|
|
288
|
-
- Examine 5-10 representative source files for patterns
|
|
289
|
-
- Look for consistency: if 80%+ follows a pattern, document it
|
|
290
|
-
- Be prescriptive: "Use X" not "Sometimes Y is used"
|
|
291
|
-
- Note deviations: "Legacy code uses Y, new code should use X"
|
|
292
|
-
- Keep under ~150 lines total
|
|
293
|
-
|
|
294
|
-
**Useful for phase planning when:**
|
|
295
|
-
- Writing new code (match existing style)
|
|
296
|
-
- Adding features (follow naming patterns)
|
|
297
|
-
- Refactoring (apply consistent conventions)
|
|
298
|
-
- Code review (check against documented patterns)
|
|
299
|
-
- Onboarding (understand style expectations)
|
|
300
|
-
|
|
301
|
-
**Analysis approach:**
|
|
302
|
-
- Scan src/ directory for file naming patterns
|
|
303
|
-
- Check package.json scripts for lint/format commands
|
|
304
|
-
- Read 5-10 files to identify function naming, error handling
|
|
305
|
-
- Look for config files (.prettierrc, eslint.config.js)
|
|
306
|
-
- Note patterns in imports, comments, function signatures
|
|
307
|
-
</guidelines>
|
|
1
|
+
# Coding Conventions Template
|
|
2
|
+
|
|
3
|
+
Template for `.planning/codebase/CONVENTIONS.md` - captures coding style and patterns.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Document how code is written in this codebase. Prescriptive guide for Claude to match existing style.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## File Template
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# Coding Conventions
|
|
13
|
+
|
|
14
|
+
**Analysis Date:** [YYYY-MM-DD]
|
|
15
|
+
|
|
16
|
+
## Naming Patterns
|
|
17
|
+
|
|
18
|
+
**Files:**
|
|
19
|
+
- [Pattern: e.g., "kebab-case for all files"]
|
|
20
|
+
- [Test files: e.g., "*.test.ts alongside source"]
|
|
21
|
+
- [Components: e.g., "PascalCase.tsx for React components"]
|
|
22
|
+
|
|
23
|
+
**Functions:**
|
|
24
|
+
- [Pattern: e.g., "camelCase for all functions"]
|
|
25
|
+
- [Async: e.g., "no special prefix for async functions"]
|
|
26
|
+
- [Handlers: e.g., "handleEventName for event handlers"]
|
|
27
|
+
|
|
28
|
+
**Variables:**
|
|
29
|
+
- [Pattern: e.g., "camelCase for variables"]
|
|
30
|
+
- [Constants: e.g., "UPPER_SNAKE_CASE for constants"]
|
|
31
|
+
- [Private: e.g., "_prefix for private members" or "no prefix"]
|
|
32
|
+
|
|
33
|
+
**Types:**
|
|
34
|
+
- [Interfaces: e.g., "PascalCase, no I prefix"]
|
|
35
|
+
- [Types: e.g., "PascalCase for type aliases"]
|
|
36
|
+
- [Enums: e.g., "PascalCase for enum name, UPPER_CASE for values"]
|
|
37
|
+
|
|
38
|
+
## Code Style
|
|
39
|
+
|
|
40
|
+
**Formatting:**
|
|
41
|
+
- [Tool: e.g., "Prettier with config in .prettierrc"]
|
|
42
|
+
- [Line length: e.g., "100 characters max"]
|
|
43
|
+
- [Quotes: e.g., "single quotes for strings"]
|
|
44
|
+
- [Semicolons: e.g., "required" or "omitted"]
|
|
45
|
+
|
|
46
|
+
**Linting:**
|
|
47
|
+
- [Tool: e.g., "ESLint with eslint.config.js"]
|
|
48
|
+
- [Rules: e.g., "extends airbnb-base, no console in production"]
|
|
49
|
+
- [Run: e.g., "npm run lint"]
|
|
50
|
+
|
|
51
|
+
## Import Organization
|
|
52
|
+
|
|
53
|
+
**Order:**
|
|
54
|
+
1. [e.g., "External packages (react, express, etc.)"]
|
|
55
|
+
2. [e.g., "Internal modules (@/lib, @/components)"]
|
|
56
|
+
3. [e.g., "Relative imports (., ..)"]
|
|
57
|
+
4. [e.g., "Type imports (import type {})"]
|
|
58
|
+
|
|
59
|
+
**Grouping:**
|
|
60
|
+
- [Blank lines: e.g., "blank line between groups"]
|
|
61
|
+
- [Sorting: e.g., "alphabetical within each group"]
|
|
62
|
+
|
|
63
|
+
**Path Aliases:**
|
|
64
|
+
- [Aliases used: e.g., "@/ for src/, @components/ for src/components/"]
|
|
65
|
+
|
|
66
|
+
## Error Handling
|
|
67
|
+
|
|
68
|
+
**Patterns:**
|
|
69
|
+
- [Strategy: e.g., "throw errors, catch at boundaries"]
|
|
70
|
+
- [Custom errors: e.g., "extend Error class, named *Error"]
|
|
71
|
+
- [Async: e.g., "use try/catch, no .catch() chains"]
|
|
72
|
+
|
|
73
|
+
**Error Types:**
|
|
74
|
+
- [When to throw: e.g., "invalid input, missing dependencies"]
|
|
75
|
+
- [When to return: e.g., "expected failures return Result<T, E>"]
|
|
76
|
+
- [Logging: e.g., "log error with context before throwing"]
|
|
77
|
+
|
|
78
|
+
## Logging
|
|
79
|
+
|
|
80
|
+
**Framework:**
|
|
81
|
+
- [Tool: e.g., "console.log, pino, winston"]
|
|
82
|
+
- [Levels: e.g., "debug, info, warn, error"]
|
|
83
|
+
|
|
84
|
+
**Patterns:**
|
|
85
|
+
- [Format: e.g., "structured logging with context object"]
|
|
86
|
+
- [When: e.g., "log state transitions, external calls"]
|
|
87
|
+
- [Where: e.g., "log at service boundaries, not in utils"]
|
|
88
|
+
|
|
89
|
+
## Comments
|
|
90
|
+
|
|
91
|
+
**When to Comment:**
|
|
92
|
+
- [e.g., "explain why, not what"]
|
|
93
|
+
- [e.g., "document business logic, algorithms, edge cases"]
|
|
94
|
+
- [e.g., "avoid obvious comments like // increment counter"]
|
|
95
|
+
|
|
96
|
+
**JSDoc/TSDoc:**
|
|
97
|
+
- [Usage: e.g., "required for public APIs, optional for internal"]
|
|
98
|
+
- [Format: e.g., "use @param, @returns, @throws tags"]
|
|
99
|
+
|
|
100
|
+
**TODO Comments:**
|
|
101
|
+
- [Pattern: e.g., "// TODO(username): description"]
|
|
102
|
+
- [Tracking: e.g., "link to issue number if available"]
|
|
103
|
+
|
|
104
|
+
## Function Design
|
|
105
|
+
|
|
106
|
+
**Size:**
|
|
107
|
+
- [e.g., "keep under 50 lines, extract helpers"]
|
|
108
|
+
|
|
109
|
+
**Parameters:**
|
|
110
|
+
- [e.g., "max 3 parameters, use object for more"]
|
|
111
|
+
- [e.g., "destructure objects in parameter list"]
|
|
112
|
+
|
|
113
|
+
**Return Values:**
|
|
114
|
+
- [e.g., "explicit returns, no implicit undefined"]
|
|
115
|
+
- [e.g., "return early for guard clauses"]
|
|
116
|
+
|
|
117
|
+
## Module Design
|
|
118
|
+
|
|
119
|
+
**Exports:**
|
|
120
|
+
- [e.g., "named exports preferred, default exports for React components"]
|
|
121
|
+
- [e.g., "export from index.ts for public API"]
|
|
122
|
+
|
|
123
|
+
**Barrel Files:**
|
|
124
|
+
- [e.g., "use index.ts to re-export public API"]
|
|
125
|
+
- [e.g., "avoid circular dependencies"]
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
*Convention analysis: [date]*
|
|
130
|
+
*Update when patterns change*
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
<good_examples>
|
|
134
|
+
```markdown
|
|
135
|
+
# Coding Conventions
|
|
136
|
+
|
|
137
|
+
**Analysis Date:** 2025-01-20
|
|
138
|
+
|
|
139
|
+
## Naming Patterns
|
|
140
|
+
|
|
141
|
+
**Files:**
|
|
142
|
+
- kebab-case for all files (command-handler.ts, user-service.ts)
|
|
143
|
+
- *.test.ts alongside source files
|
|
144
|
+
- index.ts for barrel exports
|
|
145
|
+
|
|
146
|
+
**Functions:**
|
|
147
|
+
- camelCase for all functions
|
|
148
|
+
- No special prefix for async functions
|
|
149
|
+
- handleEventName for event handlers (handleClick, handleSubmit)
|
|
150
|
+
|
|
151
|
+
**Variables:**
|
|
152
|
+
- camelCase for variables
|
|
153
|
+
- UPPER_SNAKE_CASE for constants (MAX_RETRIES, API_BASE_URL)
|
|
154
|
+
- No underscore prefix (no private marker in TS)
|
|
155
|
+
|
|
156
|
+
**Types:**
|
|
157
|
+
- PascalCase for interfaces, no I prefix (User, not IUser)
|
|
158
|
+
- PascalCase for type aliases (UserConfig, ResponseData)
|
|
159
|
+
- PascalCase for enum names, UPPER_CASE for values (Status.PENDING)
|
|
160
|
+
|
|
161
|
+
## Code Style
|
|
162
|
+
|
|
163
|
+
**Formatting:**
|
|
164
|
+
- Prettier with .prettierrc
|
|
165
|
+
- 100 character line length
|
|
166
|
+
- Single quotes for strings
|
|
167
|
+
- Semicolons required
|
|
168
|
+
- 2 space indentation
|
|
169
|
+
|
|
170
|
+
**Linting:**
|
|
171
|
+
- ESLint with eslint.config.js
|
|
172
|
+
- Extends @typescript-eslint/recommended
|
|
173
|
+
- No console.log in production code (use logger)
|
|
174
|
+
- Run: npm run lint
|
|
175
|
+
|
|
176
|
+
## Import Organization
|
|
177
|
+
|
|
178
|
+
**Order:**
|
|
179
|
+
1. External packages (react, express, commander)
|
|
180
|
+
2. Internal modules (@/lib, @/services)
|
|
181
|
+
3. Relative imports (./utils, ../types)
|
|
182
|
+
4. Type imports (import type { User })
|
|
183
|
+
|
|
184
|
+
**Grouping:**
|
|
185
|
+
- Blank line between groups
|
|
186
|
+
- Alphabetical within each group
|
|
187
|
+
- Type imports last within each group
|
|
188
|
+
|
|
189
|
+
**Path Aliases:**
|
|
190
|
+
- @/ maps to src/
|
|
191
|
+
- No other aliases defined
|
|
192
|
+
|
|
193
|
+
## Error Handling
|
|
194
|
+
|
|
195
|
+
**Patterns:**
|
|
196
|
+
- Throw errors, catch at boundaries (route handlers, main functions)
|
|
197
|
+
- Extend Error class for custom errors (ValidationError, NotFoundError)
|
|
198
|
+
- Async functions use try/catch, no .catch() chains
|
|
199
|
+
|
|
200
|
+
**Error Types:**
|
|
201
|
+
- Throw on invalid input, missing dependencies, invariant violations
|
|
202
|
+
- Log error with context before throwing: logger.error({ err, userId }, 'Failed to process')
|
|
203
|
+
- Include cause in error message: new Error('Failed to X', { cause: originalError })
|
|
204
|
+
|
|
205
|
+
## Logging
|
|
206
|
+
|
|
207
|
+
**Framework:**
|
|
208
|
+
- pino logger instance exported from lib/logger.ts
|
|
209
|
+
- Levels: debug, info, warn, error (no trace)
|
|
210
|
+
|
|
211
|
+
**Patterns:**
|
|
212
|
+
- Structured logging with context: logger.info({ userId, action }, 'User action')
|
|
213
|
+
- Log at service boundaries, not in utility functions
|
|
214
|
+
- Log state transitions, external API calls, errors
|
|
215
|
+
- No console.log in committed code
|
|
216
|
+
|
|
217
|
+
## Comments
|
|
218
|
+
|
|
219
|
+
**When to Comment:**
|
|
220
|
+
- Explain why, not what: // Retry 3 times because API has transient failures
|
|
221
|
+
- Document business rules: // Users must verify email within 24 hours
|
|
222
|
+
- Explain non-obvious algorithms or workarounds
|
|
223
|
+
- Avoid obvious comments: // set count to 0
|
|
224
|
+
|
|
225
|
+
**JSDoc/TSDoc:**
|
|
226
|
+
- Required for public API functions
|
|
227
|
+
- Optional for internal functions if signature is self-explanatory
|
|
228
|
+
- Use @param, @returns, @throws tags
|
|
229
|
+
|
|
230
|
+
**TODO Comments:**
|
|
231
|
+
- Format: // TODO: description (no username, using git blame)
|
|
232
|
+
- Link to issue if exists: // TODO: Fix race condition (issue #123)
|
|
233
|
+
|
|
234
|
+
## Function Design
|
|
235
|
+
|
|
236
|
+
**Size:**
|
|
237
|
+
- Keep under 50 lines
|
|
238
|
+
- Extract helpers for complex logic
|
|
239
|
+
- One level of abstraction per function
|
|
240
|
+
|
|
241
|
+
**Parameters:**
|
|
242
|
+
- Max 3 parameters
|
|
243
|
+
- Use options object for 4+ parameters: function create(options: CreateOptions)
|
|
244
|
+
- Destructure in parameter list: function process({ id, name }: ProcessParams)
|
|
245
|
+
|
|
246
|
+
**Return Values:**
|
|
247
|
+
- Explicit return statements
|
|
248
|
+
- Return early for guard clauses
|
|
249
|
+
- Use Result<T, E> type for expected failures
|
|
250
|
+
|
|
251
|
+
## Module Design
|
|
252
|
+
|
|
253
|
+
**Exports:**
|
|
254
|
+
- Named exports preferred
|
|
255
|
+
- Default exports only for React components
|
|
256
|
+
- Export public API from index.ts barrel files
|
|
257
|
+
|
|
258
|
+
**Barrel Files:**
|
|
259
|
+
- index.ts re-exports public API
|
|
260
|
+
- Keep internal helpers private (don't export from index)
|
|
261
|
+
- Avoid circular dependencies (import from specific files if needed)
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
*Convention analysis: 2025-01-20*
|
|
266
|
+
*Update when patterns change*
|
|
267
|
+
```
|
|
268
|
+
</good_examples>
|
|
269
|
+
|
|
270
|
+
<guidelines>
|
|
271
|
+
**What belongs in CONVENTIONS.md:**
|
|
272
|
+
- Naming patterns observed in the codebase
|
|
273
|
+
- Formatting rules (Prettier config, linting rules)
|
|
274
|
+
- Import organization patterns
|
|
275
|
+
- Error handling strategy
|
|
276
|
+
- Logging approach
|
|
277
|
+
- Comment conventions
|
|
278
|
+
- Function and module design patterns
|
|
279
|
+
|
|
280
|
+
**What does NOT belong here:**
|
|
281
|
+
- Architecture decisions (that's ARCHITECTURE.md)
|
|
282
|
+
- Technology choices (that's STACK.md)
|
|
283
|
+
- Test patterns (that's TESTING.md)
|
|
284
|
+
- File organization (that's STRUCTURE.md)
|
|
285
|
+
|
|
286
|
+
**When filling this template:**
|
|
287
|
+
- Check .prettierrc, .eslintrc, or similar config files
|
|
288
|
+
- Examine 5-10 representative source files for patterns
|
|
289
|
+
- Look for consistency: if 80%+ follows a pattern, document it
|
|
290
|
+
- Be prescriptive: "Use X" not "Sometimes Y is used"
|
|
291
|
+
- Note deviations: "Legacy code uses Y, new code should use X"
|
|
292
|
+
- Keep under ~150 lines total
|
|
293
|
+
|
|
294
|
+
**Useful for phase planning when:**
|
|
295
|
+
- Writing new code (match existing style)
|
|
296
|
+
- Adding features (follow naming patterns)
|
|
297
|
+
- Refactoring (apply consistent conventions)
|
|
298
|
+
- Code review (check against documented patterns)
|
|
299
|
+
- Onboarding (understand style expectations)
|
|
300
|
+
|
|
301
|
+
**Analysis approach:**
|
|
302
|
+
- Scan src/ directory for file naming patterns
|
|
303
|
+
- Check package.json scripts for lint/format commands
|
|
304
|
+
- Read 5-10 files to identify function naming, error handling
|
|
305
|
+
- Look for config files (.prettierrc, eslint.config.js)
|
|
306
|
+
- Note patterns in imports, comments, function signatures
|
|
307
|
+
</guidelines>
|