@malamute/ai-rules 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +270 -121
  2. package/bin/cli.js +5 -2
  3. package/configs/_shared/.claude/rules/conventions/documentation.md +324 -0
  4. package/configs/_shared/.claude/rules/conventions/git.md +265 -0
  5. package/configs/_shared/.claude/rules/{performance.md → conventions/performance.md} +1 -1
  6. package/configs/_shared/.claude/rules/conventions/principles.md +334 -0
  7. package/configs/_shared/.claude/rules/devops/ci-cd.md +262 -0
  8. package/configs/_shared/.claude/rules/devops/docker.md +275 -0
  9. package/configs/_shared/.claude/rules/devops/nx.md +194 -0
  10. package/configs/_shared/.claude/rules/domain/backend/api-design.md +203 -0
  11. package/configs/_shared/.claude/rules/lang/csharp/async.md +220 -0
  12. package/configs/_shared/.claude/rules/lang/csharp/csharp.md +314 -0
  13. package/configs/_shared/.claude/rules/lang/csharp/linq.md +210 -0
  14. package/configs/_shared/.claude/rules/lang/python/async.md +337 -0
  15. package/configs/_shared/.claude/rules/lang/python/celery.md +476 -0
  16. package/configs/_shared/.claude/rules/lang/python/config.md +339 -0
  17. package/configs/{python/.claude/rules → _shared/.claude/rules/lang/python}/database/sqlalchemy.md +6 -1
  18. package/configs/_shared/.claude/rules/lang/python/deployment.md +523 -0
  19. package/configs/_shared/.claude/rules/lang/python/error-handling.md +330 -0
  20. package/configs/_shared/.claude/rules/lang/python/migrations.md +421 -0
  21. package/configs/_shared/.claude/rules/lang/python/python.md +172 -0
  22. package/configs/_shared/.claude/rules/lang/python/repository.md +383 -0
  23. package/configs/{python/.claude/rules → _shared/.claude/rules/lang/python}/testing.md +2 -69
  24. package/configs/_shared/.claude/rules/lang/typescript/async.md +447 -0
  25. package/configs/_shared/.claude/rules/lang/typescript/generics.md +356 -0
  26. package/configs/_shared/.claude/rules/lang/typescript/typescript.md +212 -0
  27. package/configs/_shared/.claude/rules/quality/error-handling.md +48 -0
  28. package/configs/_shared/.claude/rules/quality/logging.md +45 -0
  29. package/configs/_shared/.claude/rules/quality/observability.md +240 -0
  30. package/configs/_shared/.claude/rules/quality/testing-patterns.md +65 -0
  31. package/configs/_shared/.claude/rules/security/secrets-management.md +222 -0
  32. package/configs/_shared/.claude/skills/analysis/explore/SKILL.md +257 -0
  33. package/configs/_shared/.claude/skills/analysis/security-audit/SKILL.md +184 -0
  34. package/configs/_shared/.claude/skills/dev/api-endpoint/SKILL.md +126 -0
  35. package/configs/_shared/.claude/{commands/generate-tests.md → skills/dev/generate-tests/SKILL.md} +6 -0
  36. package/configs/_shared/.claude/{commands/fix-issue.md → skills/git/fix-issue/SKILL.md} +6 -0
  37. package/configs/_shared/.claude/{commands/review-pr.md → skills/git/review-pr/SKILL.md} +6 -0
  38. package/configs/_shared/.claude/skills/infra/deploy/SKILL.md +139 -0
  39. package/configs/_shared/.claude/skills/infra/docker/SKILL.md +95 -0
  40. package/configs/_shared/.claude/skills/infra/migration/SKILL.md +158 -0
  41. package/configs/_shared/.claude/skills/nx/nx-affected/SKILL.md +72 -0
  42. package/configs/_shared/.claude/skills/nx/nx-lib/SKILL.md +375 -0
  43. package/configs/_shared/CLAUDE.md +52 -149
  44. package/configs/angular/.claude/rules/{components.md → core/components.md} +69 -15
  45. package/configs/angular/.claude/rules/core/resource.md +285 -0
  46. package/configs/angular/.claude/rules/core/signals.md +323 -0
  47. package/configs/angular/.claude/rules/http.md +338 -0
  48. package/configs/angular/.claude/rules/routing.md +291 -0
  49. package/configs/angular/.claude/rules/ssr.md +312 -0
  50. package/configs/angular/.claude/rules/state/signal-store.md +408 -0
  51. package/configs/angular/.claude/rules/{state.md → state/state.md} +2 -2
  52. package/configs/angular/.claude/rules/testing.md +7 -7
  53. package/configs/angular/.claude/rules/ui/aria.md +422 -0
  54. package/configs/angular/.claude/rules/ui/forms.md +424 -0
  55. package/configs/angular/.claude/rules/ui/pipes-directives.md +335 -0
  56. package/configs/angular/.claude/settings.json +1 -0
  57. package/configs/angular/.claude/skills/ngrx-slice/SKILL.md +362 -0
  58. package/configs/angular/.claude/skills/signal-store/SKILL.md +445 -0
  59. package/configs/angular/CLAUDE.md +24 -216
  60. package/configs/dotnet/.claude/rules/background-services.md +552 -0
  61. package/configs/dotnet/.claude/rules/configuration.md +426 -0
  62. package/configs/dotnet/.claude/rules/ddd.md +447 -0
  63. package/configs/dotnet/.claude/rules/dependency-injection.md +343 -0
  64. package/configs/dotnet/.claude/rules/mediatr.md +320 -0
  65. package/configs/dotnet/.claude/rules/middleware.md +489 -0
  66. package/configs/dotnet/.claude/rules/result-pattern.md +363 -0
  67. package/configs/dotnet/.claude/rules/validation.md +388 -0
  68. package/configs/dotnet/.claude/settings.json +21 -3
  69. package/configs/dotnet/CLAUDE.md +53 -286
  70. package/configs/fastapi/.claude/rules/background-tasks.md +254 -0
  71. package/configs/fastapi/.claude/rules/dependencies.md +170 -0
  72. package/configs/{python → fastapi}/.claude/rules/fastapi.md +61 -1
  73. package/configs/fastapi/.claude/rules/lifespan.md +274 -0
  74. package/configs/fastapi/.claude/rules/middleware.md +229 -0
  75. package/configs/fastapi/.claude/rules/pydantic.md +433 -0
  76. package/configs/fastapi/.claude/rules/responses.md +251 -0
  77. package/configs/fastapi/.claude/rules/routers.md +202 -0
  78. package/configs/fastapi/.claude/rules/security.md +222 -0
  79. package/configs/fastapi/.claude/rules/testing.md +251 -0
  80. package/configs/fastapi/.claude/rules/websockets.md +298 -0
  81. package/configs/fastapi/.claude/settings.json +33 -0
  82. package/configs/fastapi/CLAUDE.md +144 -0
  83. package/configs/flask/.claude/rules/blueprints.md +208 -0
  84. package/configs/flask/.claude/rules/cli.md +285 -0
  85. package/configs/flask/.claude/rules/configuration.md +281 -0
  86. package/configs/flask/.claude/rules/context.md +238 -0
  87. package/configs/flask/.claude/rules/error-handlers.md +278 -0
  88. package/configs/flask/.claude/rules/extensions.md +278 -0
  89. package/configs/flask/.claude/rules/flask.md +171 -0
  90. package/configs/flask/.claude/rules/marshmallow.md +206 -0
  91. package/configs/flask/.claude/rules/security.md +267 -0
  92. package/configs/flask/.claude/rules/testing.md +284 -0
  93. package/configs/flask/.claude/settings.json +33 -0
  94. package/configs/flask/CLAUDE.md +166 -0
  95. package/configs/nestjs/.claude/rules/common-patterns.md +300 -0
  96. package/configs/nestjs/.claude/rules/filters.md +376 -0
  97. package/configs/nestjs/.claude/rules/interceptors.md +317 -0
  98. package/configs/nestjs/.claude/rules/middleware.md +321 -0
  99. package/configs/nestjs/.claude/rules/modules.md +26 -0
  100. package/configs/nestjs/.claude/rules/pipes.md +351 -0
  101. package/configs/nestjs/.claude/rules/websockets.md +451 -0
  102. package/configs/nestjs/.claude/settings.json +16 -2
  103. package/configs/nestjs/CLAUDE.md +57 -215
  104. package/configs/nextjs/.claude/rules/api-routes.md +358 -0
  105. package/configs/nextjs/.claude/rules/authentication.md +355 -0
  106. package/configs/nextjs/.claude/rules/components.md +52 -0
  107. package/configs/nextjs/.claude/rules/data-fetching.md +249 -0
  108. package/configs/nextjs/.claude/rules/database.md +400 -0
  109. package/configs/nextjs/.claude/rules/middleware.md +303 -0
  110. package/configs/nextjs/.claude/rules/routing.md +324 -0
  111. package/configs/nextjs/.claude/rules/seo.md +350 -0
  112. package/configs/nextjs/.claude/rules/server-actions.md +353 -0
  113. package/configs/nextjs/.claude/rules/state/zustand.md +6 -6
  114. package/configs/nextjs/.claude/settings.json +5 -0
  115. package/configs/nextjs/CLAUDE.md +69 -331
  116. package/package.json +23 -9
  117. package/src/cli.js +220 -0
  118. package/src/config.js +29 -0
  119. package/src/index.js +13 -0
  120. package/src/installer.js +361 -0
  121. package/src/merge.js +116 -0
  122. package/src/tech-config.json +29 -0
  123. package/src/utils.js +96 -0
  124. package/configs/python/.claude/rules/flask.md +0 -332
  125. package/configs/python/.claude/settings.json +0 -18
  126. package/configs/python/CLAUDE.md +0 -273
  127. package/src/install.js +0 -315
  128. /package/configs/_shared/.claude/rules/{accessibility.md → domain/frontend/accessibility.md} +0 -0
  129. /package/configs/_shared/.claude/rules/{security.md → security/security.md} +0 -0
  130. /package/configs/_shared/.claude/skills/{debug → dev/debug}/SKILL.md +0 -0
  131. /package/configs/_shared/.claude/skills/{learning → dev/learning}/SKILL.md +0 -0
  132. /package/configs/_shared/.claude/skills/{spec → dev/spec}/SKILL.md +0 -0
  133. /package/configs/_shared/.claude/skills/{review → git/review}/SKILL.md +0 -0
@@ -0,0 +1,324 @@
1
+ ---
2
+ paths:
3
+ - "**/README.md"
4
+ - "**/CHANGELOG.md"
5
+ - "**/docs/**"
6
+ - "**/ADR/**"
7
+ ---
8
+
9
+ # Documentation Standards
10
+
11
+ ## README Structure
12
+
13
+ ```markdown
14
+ # Project Name
15
+
16
+ Brief description (1-2 sentences).
17
+
18
+ ## Quick Start
19
+
20
+ \`\`\`bash
21
+ # Clone and setup
22
+ git clone <repo>
23
+ cd project
24
+ npm install
25
+ npm run dev
26
+ \`\`\`
27
+
28
+ ## Prerequisites
29
+
30
+ - Node.js 20+
31
+ - Docker
32
+ - PostgreSQL 16
33
+
34
+ ## Installation
35
+
36
+ Step-by-step setup instructions.
37
+
38
+ ## Usage
39
+
40
+ Basic usage examples.
41
+
42
+ ## API Reference
43
+
44
+ Link to API docs or brief overview.
45
+
46
+ ## Configuration
47
+
48
+ | Variable | Description | Default |
49
+ |----------|-------------|---------|
50
+ | `PORT` | Server port | `3000` |
51
+ | `DATABASE_URL` | DB connection | required |
52
+
53
+ ## Development
54
+
55
+ \`\`\`bash
56
+ npm run dev # Start dev server
57
+ npm run test # Run tests
58
+ npm run lint # Lint code
59
+ npm run build # Build for production
60
+ \`\`\`
61
+
62
+ ## Deployment
63
+
64
+ How to deploy to production.
65
+
66
+ ## Contributing
67
+
68
+ Link to CONTRIBUTING.md or brief guidelines.
69
+
70
+ ## License
71
+
72
+ MIT / Apache-2.0 / etc.
73
+ ```
74
+
75
+ ## Architecture Decision Records (ADR)
76
+
77
+ ### Template
78
+
79
+ ```markdown
80
+ # ADR-001: Use PostgreSQL as primary database
81
+
82
+ ## Status
83
+
84
+ Accepted | Proposed | Deprecated | Superseded by ADR-XXX
85
+
86
+ ## Date
87
+
88
+ 2024-01-15
89
+
90
+ ## Context
91
+
92
+ What is the issue we're facing? What are the constraints?
93
+
94
+ ## Decision
95
+
96
+ What is the change we're making?
97
+
98
+ ## Consequences
99
+
100
+ ### Positive
101
+ - Benefit 1
102
+ - Benefit 2
103
+
104
+ ### Negative
105
+ - Drawback 1
106
+ - Drawback 2
107
+
108
+ ### Risks
109
+ - Risk 1 and mitigation
110
+
111
+ ## Alternatives Considered
112
+
113
+ 1. **Alternative A**: Why rejected
114
+ 2. **Alternative B**: Why rejected
115
+ ```
116
+
117
+ ### Naming Convention
118
+
119
+ ```
120
+ docs/adr/
121
+ ├── 001-use-postgresql.md
122
+ ├── 002-adopt-microservices.md
123
+ ├── 003-authentication-strategy.md
124
+ └── README.md # Index of all ADRs
125
+ ```
126
+
127
+ ## Changelog
128
+
129
+ ### Format (Keep a Changelog)
130
+
131
+ ```markdown
132
+ # Changelog
133
+
134
+ All notable changes to this project.
135
+
136
+ ## [Unreleased]
137
+
138
+ ### Added
139
+ - New feature X
140
+
141
+ ### Changed
142
+ - Updated dependency Y
143
+
144
+ ## [1.2.0] - 2024-01-15
145
+
146
+ ### Added
147
+ - User authentication (#123)
148
+ - Email notifications (#124)
149
+
150
+ ### Fixed
151
+ - Login redirect issue (#125)
152
+
153
+ ### Security
154
+ - Patched XSS vulnerability (#126)
155
+
156
+ ## [1.1.0] - 2024-01-01
157
+
158
+ ### Added
159
+ - Initial release
160
+ ```
161
+
162
+ ### Categories
163
+
164
+ - **Added**: New features
165
+ - **Changed**: Changes in existing functionality
166
+ - **Deprecated**: Soon-to-be removed features
167
+ - **Removed**: Removed features
168
+ - **Fixed**: Bug fixes
169
+ - **Security**: Vulnerability fixes
170
+
171
+ ## API Documentation
172
+
173
+ ### OpenAPI/Swagger
174
+
175
+ ```yaml
176
+ openapi: 3.0.3
177
+ info:
178
+ title: My API
179
+ version: 1.0.0
180
+ description: API description
181
+
182
+ paths:
183
+ /users:
184
+ get:
185
+ summary: List users
186
+ description: Returns paginated list of users
187
+ parameters:
188
+ - name: page
189
+ in: query
190
+ schema:
191
+ type: integer
192
+ default: 1
193
+ responses:
194
+ '200':
195
+ description: Success
196
+ content:
197
+ application/json:
198
+ schema:
199
+ $ref: '#/components/schemas/UserList'
200
+ ```
201
+
202
+ ### Inline Documentation
203
+
204
+ ```typescript
205
+ /**
206
+ * Creates a new user account.
207
+ *
208
+ * @param data - User registration data
209
+ * @returns Created user object
210
+ * @throws {ValidationError} When email is invalid
211
+ * @throws {ConflictError} When email already exists
212
+ *
213
+ * @example
214
+ * const user = await createUser({
215
+ * email: 'user@example.com',
216
+ * password: 'secure123'
217
+ * });
218
+ */
219
+ async function createUser(data: CreateUserDto): Promise<User> {
220
+ // Implementation
221
+ }
222
+ ```
223
+
224
+ ## Code Comments
225
+
226
+ ### When to Comment
227
+
228
+ ```typescript
229
+ // GOOD: Explains WHY, not WHAT
230
+ // Using retry with exponential backoff because the external API
231
+ // has rate limiting and occasional timeouts
232
+ await retryWithBackoff(() => externalApi.call());
233
+
234
+ // BAD: Explains WHAT (obvious from code)
235
+ // Loop through users
236
+ for (const user of users) { ... }
237
+
238
+ // GOOD: Documents non-obvious behavior
239
+ // Note: Returns null instead of throwing when user not found
240
+ // to support optional user lookups in middleware
241
+ async function findUser(id: string): Promise<User | null>
242
+
243
+ // GOOD: TODO with context
244
+ // TODO(#123): Replace with proper caching once Redis is available
245
+ const cache = new Map();
246
+ ```
247
+
248
+ ### Comment Types
249
+
250
+ ```typescript
251
+ // TODO: Feature to implement
252
+ // FIXME: Known bug to fix
253
+ // HACK: Temporary workaround
254
+ // NOTE: Important information
255
+ // WARN: Potential issue
256
+ // DEPRECATED: Will be removed
257
+ ```
258
+
259
+ ## Project Structure Documentation
260
+
261
+ ```markdown
262
+ # Project Structure
263
+
264
+ \`\`\`
265
+ src/
266
+ ├── modules/ # Feature modules
267
+ │ ├── users/ # User management
268
+ │ │ ├── dto/ # Data transfer objects
269
+ │ │ ├── entities/ # Database entities
270
+ │ │ └── users.service.ts
271
+ │ └── orders/ # Order management
272
+ ├── common/ # Shared utilities
273
+ │ ├── decorators/ # Custom decorators
274
+ │ ├── filters/ # Exception filters
275
+ │ └── guards/ # Auth guards
276
+ ├── config/ # Configuration
277
+ └── main.ts # Entry point
278
+ \`\`\`
279
+ ```
280
+
281
+ ## Runbooks
282
+
283
+ ### Template
284
+
285
+ ```markdown
286
+ # Runbook: Database Connection Issues
287
+
288
+ ## Symptoms
289
+ - API returning 500 errors
290
+ - Logs show "Connection refused"
291
+
292
+ ## Diagnosis
293
+ 1. Check database status: `docker ps | grep postgres`
294
+ 2. Check connections: `SELECT count(*) FROM pg_stat_activity;`
295
+ 3. Check logs: `docker logs postgres`
296
+
297
+ ## Resolution
298
+
299
+ ### If database is down
300
+ \`\`\`bash
301
+ docker-compose restart db
302
+ \`\`\`
303
+
304
+ ### If too many connections
305
+ \`\`\`bash
306
+ # Kill idle connections
307
+ SELECT pg_terminate_backend(pid)
308
+ FROM pg_stat_activity
309
+ WHERE state = 'idle' AND query_start < now() - interval '1 hour';
310
+ \`\`\`
311
+
312
+ ## Escalation
313
+ Contact: @database-team in #incidents
314
+ ```
315
+
316
+ ## Anti-patterns
317
+
318
+ - No README
319
+ - Outdated documentation
320
+ - Documenting WHAT instead of WHY
321
+ - No ADRs for major decisions
322
+ - Missing changelog
323
+ - Undocumented environment variables
324
+ - No setup instructions
@@ -0,0 +1,265 @@
1
+ ---
2
+ paths:
3
+ - "**/*"
4
+ ---
5
+
6
+ # Git Rules
7
+
8
+ ## Commit Messages (Conventional Commits)
9
+
10
+ Format: `type(scope): description`
11
+
12
+ ```bash
13
+ # Types
14
+ feat # New feature
15
+ fix # Bug fix
16
+ docs # Documentation only
17
+ style # Formatting, no code change
18
+ refactor # Code change, no feature/fix
19
+ perf # Performance improvement
20
+ test # Adding/updating tests
21
+ chore # Build, CI, dependencies
22
+ ```
23
+
24
+ ```bash
25
+ # Good examples
26
+ feat(auth): add OAuth2 login with Google
27
+ fix(cart): resolve race condition in checkout
28
+ refactor(api): simplify error handling middleware
29
+ perf(db): add index on users.email column
30
+ test(orders): add integration tests for payment flow
31
+ chore(deps): upgrade typescript to 5.3
32
+
33
+ # Bad examples
34
+ fix: bug fix # Too vague
35
+ updated stuff # No type, unclear
36
+ feat: Add new feature for users # Capitalized, vague
37
+ ```
38
+
39
+ ## Branch Naming
40
+
41
+ ```bash
42
+ # Pattern: type/description or type/TICKET-description
43
+ feat/user-authentication
44
+ feat/JIRA-123-oauth-login
45
+ fix/cart-total-calculation
46
+ fix/BUG-456-null-pointer
47
+ refactor/api-error-handling
48
+ chore/upgrade-dependencies
49
+ ```
50
+
51
+ ## Workflow
52
+
53
+ ```bash
54
+ # Start new feature
55
+ git checkout main
56
+ git pull --rebase
57
+ git checkout -b feat/my-feature
58
+
59
+ # Regular commits during work
60
+ git add -p # Stage interactively
61
+ git commit -m "feat(scope): description"
62
+
63
+ # Before pushing - rebase on main
64
+ git fetch origin
65
+ git rebase origin/main
66
+
67
+ # Push (first time)
68
+ git push -u origin feat/my-feature
69
+
70
+ # Push (subsequent)
71
+ git push
72
+ ```
73
+
74
+ ## Rebase vs Merge
75
+
76
+ ```bash
77
+ # ALWAYS rebase local changes on remote
78
+ git pull --rebase origin main
79
+
80
+ # NEVER merge main into feature branch
81
+ git merge main # Creates ugly merge commits
82
+
83
+ # Interactive rebase to clean up commits before PR
84
+ git rebase -i HEAD~3
85
+ ```
86
+
87
+ ## Interactive Rebase
88
+
89
+ ```bash
90
+ # Clean up last 3 commits
91
+ git rebase -i HEAD~3
92
+
93
+ # In editor:
94
+ pick abc1234 feat(auth): add login endpoint
95
+ squash def5678 fix typo # Squash into previous
96
+ fixup ghi9012 more fixes # Squash, discard message
97
+ reword jkl3456 wip # Edit commit message
98
+ ```
99
+
100
+ ## Stashing
101
+
102
+ ```bash
103
+ # Save work in progress
104
+ git stash push -m "WIP: feature description"
105
+
106
+ # List stashes
107
+ git stash list
108
+
109
+ # Apply and drop
110
+ git stash pop
111
+
112
+ # Apply specific stash
113
+ git stash apply stash@{2}
114
+
115
+ # Drop stash
116
+ git stash drop stash@{0}
117
+ ```
118
+
119
+ ## Undoing Changes
120
+
121
+ ```bash
122
+ # Unstage file (keep changes)
123
+ git restore --staged file.ts
124
+
125
+ # Discard local changes (DESTRUCTIVE)
126
+ git restore file.ts
127
+
128
+ # Undo last commit (keep changes staged)
129
+ git reset --soft HEAD~1
130
+
131
+ # Undo last commit (keep changes unstaged)
132
+ git reset HEAD~1
133
+
134
+ # Completely undo last commit (DESTRUCTIVE)
135
+ git reset --hard HEAD~1
136
+
137
+ # Create new commit that undoes previous
138
+ git revert abc1234
139
+ ```
140
+
141
+ ## Viewing History
142
+
143
+ ```bash
144
+ # Compact log
145
+ git log --oneline -20
146
+
147
+ # With graph
148
+ git log --oneline --graph --all
149
+
150
+ # Changes in commit
151
+ git show abc1234
152
+
153
+ # Who changed this line
154
+ git blame file.ts
155
+
156
+ # Search commits by message
157
+ git log --grep="fix auth"
158
+
159
+ # Search commits by code change
160
+ git log -S "functionName" --oneline
161
+ ```
162
+
163
+ ## Cherry-Pick
164
+
165
+ ```bash
166
+ # Apply specific commit to current branch
167
+ git cherry-pick abc1234
168
+
169
+ # Cherry-pick without committing
170
+ git cherry-pick --no-commit abc1234
171
+
172
+ # Cherry-pick range
173
+ git cherry-pick abc1234..def5678
174
+ ```
175
+
176
+ ## Tags
177
+
178
+ ```bash
179
+ # Create annotated tag
180
+ git tag -a v1.2.0 -m "Release 1.2.0"
181
+
182
+ # Push tags
183
+ git push origin v1.2.0
184
+ git push origin --tags
185
+
186
+ # List tags
187
+ git tag -l "v1.*"
188
+
189
+ # Delete tag
190
+ git tag -d v1.2.0
191
+ git push origin :refs/tags/v1.2.0
192
+ ```
193
+
194
+ ## Hooks (Husky)
195
+
196
+ ```bash
197
+ # .husky/pre-commit
198
+ npm run lint-staged
199
+
200
+ # .husky/commit-msg
201
+ npx commitlint --edit $1
202
+
203
+ # .husky/pre-push
204
+ npm run test
205
+ ```
206
+
207
+ ## .gitignore Essentials
208
+
209
+ ```gitignore
210
+ # Dependencies
211
+ node_modules/
212
+ .venv/
213
+ vendor/
214
+
215
+ # Build
216
+ dist/
217
+ build/
218
+ *.dll
219
+ *.exe
220
+
221
+ # IDE
222
+ .idea/
223
+ .vscode/
224
+ *.swp
225
+
226
+ # Environment
227
+ .env
228
+ .env.local
229
+ *.local
230
+
231
+ # Secrets (NEVER commit)
232
+ *.pem
233
+ *.key
234
+ credentials.json
235
+ secrets.yaml
236
+
237
+ # OS
238
+ .DS_Store
239
+ Thumbs.db
240
+
241
+ # Logs
242
+ *.log
243
+ logs/
244
+
245
+ # Test
246
+ coverage/
247
+ .nyc_output/
248
+ ```
249
+
250
+ ## PR Best Practices
251
+
252
+ ```bash
253
+ # Keep PRs small and focused
254
+ # - One feature/fix per PR
255
+ # - <400 lines changed ideal
256
+ # - Split large changes into stacked PRs
257
+
258
+ # Before creating PR
259
+ git rebase -i origin/main # Clean history
260
+ npm run lint # Pass lint
261
+ npm run test # Pass tests
262
+
263
+ # PR title follows commit convention
264
+ feat(auth): add OAuth2 login with Google
265
+ ```
@@ -79,7 +79,7 @@ await cache.delete(`user:${userId}`);
79
79
  ### Memoization
80
80
  ```typescript
81
81
  // Memoize pure functions
82
- const memoize = <T>(fn: (...args: any[]) => T): ((...args: any[]) => T) => {
82
+ const memoize = <T, Args extends unknown[]>(fn: (...args: Args) => T): ((...args: Args) => T) => {
83
83
  const cache = new Map();
84
84
  return (...args) => {
85
85
  const key = JSON.stringify(args);