create-claude-webapp 1.0.0 → 1.0.1

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 (79) hide show
  1. package/.claude/agents/acceptance-test-generator.md +256 -0
  2. package/.claude/agents/auth-flow-designer.md +93 -0
  3. package/.claude/agents/code-reviewer.md +193 -0
  4. package/.claude/agents/code-verifier.md +194 -0
  5. package/.claude/agents/deployment-executor.md +90 -0
  6. package/.claude/agents/design-sync.md +226 -0
  7. package/.claude/agents/document-reviewer.md +304 -0
  8. package/.claude/agents/environment-validator.md +100 -0
  9. package/.claude/agents/integration-test-reviewer.md +196 -0
  10. package/.claude/agents/investigator.md +162 -0
  11. package/.claude/agents/prd-creator.md +220 -0
  12. package/.claude/agents/quality-fixer-frontend.md +323 -0
  13. package/.claude/agents/quality-fixer.md +280 -0
  14. package/.claude/agents/requirement-analyzer.md +149 -0
  15. package/.claude/agents/rls-policy-designer.md +86 -0
  16. package/.claude/agents/rule-advisor.md +123 -0
  17. package/.claude/agents/scope-discoverer.md +231 -0
  18. package/.claude/agents/solver.md +173 -0
  19. package/.claude/agents/supabase-migration-generator.md +85 -0
  20. package/.claude/agents/task-decomposer.md +246 -0
  21. package/.claude/agents/task-executor-frontend.md +264 -0
  22. package/.claude/agents/task-executor.md +261 -0
  23. package/.claude/agents/technical-designer-frontend.md +444 -0
  24. package/.claude/agents/technical-designer.md +370 -0
  25. package/.claude/agents/verifier.md +193 -0
  26. package/.claude/agents/work-planner.md +211 -0
  27. package/.claude/commands/add-integration-tests.md +116 -0
  28. package/.claude/commands/build.md +77 -0
  29. package/.claude/commands/db-migrate.md +96 -0
  30. package/.claude/commands/deploy.md +95 -0
  31. package/.claude/commands/design.md +75 -0
  32. package/.claude/commands/diagnose.md +202 -0
  33. package/.claude/commands/front-build.md +116 -0
  34. package/.claude/commands/front-design.md +61 -0
  35. package/.claude/commands/front-plan.md +53 -0
  36. package/.claude/commands/front-reverse-design.md +183 -0
  37. package/.claude/commands/front-review.md +89 -0
  38. package/.claude/commands/implement.md +80 -0
  39. package/.claude/commands/local-dev.md +94 -0
  40. package/.claude/commands/plan.md +61 -0
  41. package/.claude/commands/project-inject.md +76 -0
  42. package/.claude/commands/refine-skill.md +207 -0
  43. package/.claude/commands/reverse-engineer.md +301 -0
  44. package/.claude/commands/review.md +88 -0
  45. package/.claude/commands/setup-auth.md +68 -0
  46. package/.claude/commands/setup-supabase.md +66 -0
  47. package/.claude/commands/setup-vercel.md +71 -0
  48. package/.claude/commands/sync-skills.md +116 -0
  49. package/.claude/commands/task.md +13 -0
  50. package/.claude/skills/coding-standards/SKILL.md +246 -0
  51. package/.claude/skills/documentation-criteria/SKILL.md +184 -0
  52. package/.claude/skills/documentation-criteria/references/adr-template.md +64 -0
  53. package/.claude/skills/documentation-criteria/references/design-template.md +263 -0
  54. package/.claude/skills/documentation-criteria/references/plan-template.md +130 -0
  55. package/.claude/skills/documentation-criteria/references/prd-template.md +109 -0
  56. package/.claude/skills/documentation-criteria/references/task-template.md +38 -0
  57. package/.claude/skills/frontend/technical-spec/SKILL.md +147 -0
  58. package/.claude/skills/frontend/typescript-rules/SKILL.md +136 -0
  59. package/.claude/skills/frontend/typescript-testing/SKILL.md +129 -0
  60. package/.claude/skills/fullstack-integration/SKILL.md +466 -0
  61. package/.claude/skills/implementation-approach/SKILL.md +141 -0
  62. package/.claude/skills/integration-e2e-testing/SKILL.md +146 -0
  63. package/.claude/skills/interview/SKILL.md +345 -0
  64. package/.claude/skills/project-context/SKILL.md +53 -0
  65. package/.claude/skills/stack-auth/SKILL.md +519 -0
  66. package/.claude/skills/subagents-orchestration-guide/SKILL.md +218 -0
  67. package/.claude/skills/supabase/SKILL.md +289 -0
  68. package/.claude/skills/supabase-edge-functions/SKILL.md +386 -0
  69. package/.claude/skills/supabase-local/SKILL.md +328 -0
  70. package/.claude/skills/supabase-testing/SKILL.md +513 -0
  71. package/.claude/skills/task-analyzer/SKILL.md +131 -0
  72. package/.claude/skills/task-analyzer/references/skills-index.yaml +375 -0
  73. package/.claude/skills/technical-spec/SKILL.md +86 -0
  74. package/.claude/skills/typescript-rules/SKILL.md +121 -0
  75. package/.claude/skills/typescript-testing/SKILL.md +155 -0
  76. package/.claude/skills/vercel-deployment/SKILL.md +355 -0
  77. package/.claude/skills/vercel-edge/SKILL.md +407 -0
  78. package/README.md +1 -1
  79. package/package.json +1 -1
@@ -0,0 +1,375 @@
1
+ # Skills Metadata Index
2
+ # Used to select appropriate skills based on task analysis
3
+
4
+ skills:
5
+ coding-standards:
6
+ skill: "coding-standards"
7
+ tags: [universal, anti-patterns, refactoring, type-safety, testing, code-deletion, rule-of-three, fail-fast, impact-analysis]
8
+ typical-use: "Universal coding principles applicable across all domains, foundational standards for all developers"
9
+ size: large
10
+ key-references:
11
+ - "Rule of Three - Martin Fowler"
12
+ - "Single Responsibility Principle - Clean Code"
13
+ - "DRY Principle - The Pragmatic Programmer"
14
+ - "YAGNI Principle - Kent Beck"
15
+ - "5 Whys - Toyota Production System"
16
+ - "Red-Green-Refactor - Kent Beck"
17
+ - "AAA Pattern - Arrange-Act-Assert"
18
+ sections:
19
+ - "Technical Anti-patterns (Red Flag Patterns)"
20
+ - "Basic Principles"
21
+ - "Comment Writing Rules"
22
+ - "Error Handling Fundamentals"
23
+ - "Rule of Three - Criteria for Code Duplication"
24
+ - "Common Failure Patterns and Avoidance Methods"
25
+ - "Debugging Techniques"
26
+ - "Type Safety Fundamentals"
27
+ - "Refactoring Techniques"
28
+ - "Situations Requiring Technical Decisions"
29
+ - "Continuous Improvement Mindset"
30
+ - "Implementation Completeness Assurance"
31
+ - "Red-Green-Refactor Process (Test-First Development)"
32
+ - "Test Design Principles"
33
+ - "Test Helper Utilization Rules"
34
+ - "Test Granularity Principles"
35
+ - "Continuity Test Scope"
36
+
37
+ typescript-rules:
38
+ skill: "typescript-rules"
39
+ tags: [implementation, type-safety, async, refactoring, coding-style, functional-programming, dependency-injection, branded-types, backend]
40
+ typical-use: "Backend TypeScript code creation, modification, refactoring, modern type features utilization"
41
+ size: small
42
+ key-references:
43
+ - "YAGNI Principle - Kent Beck"
44
+ - "Clean Code - Robert C. Martin"
45
+ - "DRY Principle - The Pragmatic Programmer"
46
+ - "Refactoring - Martin Fowler"
47
+ - "TypeScript 4.9 satisfies Operator - Microsoft"
48
+ - "Branded Types - TypeScript Community"
49
+ - "Effect-TS / fp-ts - Functional Programming"
50
+ - "Dependency Injection - Martin Fowler"
51
+ - "Avoiding fallback in distributed systems - AWS Builders' Library"
52
+ sections:
53
+ - "Type Safety in Backend Implementation"
54
+ - "Coding Conventions"
55
+ - "Error Handling"
56
+ - "Performance Optimization"
57
+
58
+ typescript-testing:
59
+ skill: "typescript-testing"
60
+ tags: [quality, testing, tdd, coverage, vitest, implementation, debugging, refactoring, backend]
61
+ typical-use: "Backend test creation, quality checks, test quality criteria, development steps for code/bug fixes, refactoring, and new feature implementation"
62
+ size: small
63
+ key-references:
64
+ - "Test-Driven Development - Kent Beck"
65
+ - "Rule of Three - Martin Fowler"
66
+ - "Red-Green-Refactor - Kent Beck"
67
+ - "AAA Pattern - Arrange-Act-Assert"
68
+ sections:
69
+ - "Test Framework"
70
+ - "Basic Testing Policy"
71
+ - "Test Implementation Conventions"
72
+ - "Test Quality Criteria"
73
+ - "Mock Type Safety Enforcement"
74
+ - "Basic Vitest Example"
75
+
76
+ technical-spec:
77
+ skill: "technical-spec"
78
+ tags: [architecture, design, documentation, environment, data-flow, implementation, quality-commands, testing, build]
79
+ typical-use: "Technical design, environment configuration, documentation creation process, implementation policy decisions, quality check commands, build and test execution"
80
+ size: medium
81
+ key-references:
82
+ - "ADR Format - Michael Nygard"
83
+ - "Single Data Source Principle - Single Source of Truth"
84
+ sections:
85
+ - "Basic Technology Stack Policy"
86
+ - "Environment Variable Management and Security"
87
+ - "Architecture Design"
88
+ - "Architecture Patterns"
89
+ - "Unified Data Flow Principles"
90
+ - "Build and Testing"
91
+
92
+ project-context:
93
+ skill: "project-context"
94
+ tags: [context, project-specific, implementation]
95
+ typical-use: "Project-specific information, understanding implementation principles"
96
+ size: small
97
+ key-references:
98
+ - "Project-specific (empirical)"
99
+ sections:
100
+ - "Basic Configuration"
101
+ - "Implementation Principles"
102
+ - "Customization Guide"
103
+
104
+ documentation-criteria:
105
+ skill: "documentation-criteria"
106
+ tags: [documentation, adr, prd, design-doc, work-plan, decision-matrix]
107
+ typical-use: "Implementation start scale assessment, document creation decisions, ADR/PRD/Design Doc/work plan creation criteria"
108
+ size: medium
109
+ key-references:
110
+ - "ADR Methodology - Michael Nygard"
111
+ - "Design Doc Culture - Google Engineering Practices"
112
+ - "Single Source of Truth"
113
+ sections:
114
+ - "Creation Decision Matrix"
115
+ - "ADR Creation Conditions (Required if Any Apply)"
116
+ - "Detailed Document Definitions"
117
+ - "Creation Process"
118
+ - "Storage Locations"
119
+ - "ADR Status"
120
+ - "AI Automation Rules"
121
+ - "Diagram Requirements"
122
+ - "Common ADR Relationships"
123
+
124
+ implementation-approach:
125
+ skill: "implementation-approach"
126
+ tags: [architecture, implementation, task-decomposition, strategy-patterns, strangler-pattern, facade-pattern, design, planning, confirmation-levels]
127
+ typical-use: "Implementation strategy selection, task decomposition, design decisions, large-scale change planning"
128
+ size: medium
129
+ key-references:
130
+ - "Strangler Fig Pattern - Martin Fowler"
131
+ - "Feature Slicing - Martin Fowler"
132
+ - "Walking Skeleton - Alistair Cockburn"
133
+ - "Facade Pattern - Gang of Four"
134
+ sections:
135
+ - "Meta-cognitive Strategy Selection Process"
136
+ - "Verification Level Definitions"
137
+ - "Integration Point Definitions"
138
+ - "Anti-patterns"
139
+ - "Guidelines for Meta-cognitive Execution"
140
+
141
+ integration-e2e-testing:
142
+ skill: "integration-e2e-testing"
143
+ tags: [testing, integration-test, e2e-test, property-based-testing, fast-check, test-skeleton, test-review, quality]
144
+ typical-use: "Integration and E2E test skeleton generation, test implementation, test review, Property-Based Test implementation"
145
+ size: small
146
+ key-references:
147
+ - "fast-check - Property-based testing for TypeScript"
148
+ - "Node.js Testing Best Practices - Yoni Goldberg"
149
+ - "Property-Based Testing - 2025 Practices"
150
+ sections:
151
+ - "Test Types and Limits"
152
+ - "Behavior-First Principle"
153
+ - "Skeleton Specification"
154
+ - "Implementation Rules"
155
+ - "Review Criteria"
156
+
157
+ subagents-orchestration-guide:
158
+ skill: "subagents-orchestration-guide"
159
+ tags: [orchestration, subagents, workflow, scale-determination, document-requirements, autonomous-execution]
160
+ typical-use: "Coordinating subagents through implementation workflows, scale determination, document requirements"
161
+ size: medium
162
+ key-references:
163
+ - "Workflow Orchestration Patterns"
164
+ - "Agent Coordination Patterns"
165
+ sections:
166
+ - "Scale Determination"
167
+ - "Document Requirements"
168
+ - "Stop Points"
169
+ - "Autonomous Execution Mode"
170
+
171
+ # Frontend-specific Skills
172
+ frontend/typescript-rules:
173
+ skill: "frontend/typescript-rules"
174
+ tags: [frontend, react, implementation, type-safety, function-components, props-driven, async, refactoring, coding-style]
175
+ typical-use: "React component creation, Props type definitions, frontend TypeScript development"
176
+ size: small
177
+ key-references:
178
+ - "React Function Components - React Official"
179
+ - "Props-driven Design - React Best Practices"
180
+ - "YAGNI Principle - Kent Beck"
181
+ - "Clean Code - Robert C. Martin"
182
+ - "TypeScript satisfies Operator - Microsoft"
183
+ sections:
184
+ - "Frontend-Specific Anti-patterns"
185
+ - "Type Safety in Frontend Implementation"
186
+ - "Coding Conventions"
187
+ - "Error Handling"
188
+ - "Performance Optimization"
189
+
190
+ frontend/typescript-testing:
191
+ skill: "frontend/typescript-testing"
192
+ tags: [frontend, react, quality, testing, tdd, coverage, vitest, react-testing-library, msw, implementation]
193
+ typical-use: "React component testing, React Testing Library tests, MSW API mocking, frontend test creation"
194
+ size: small
195
+ key-references:
196
+ - "React Testing Library - Kent C. Dodds"
197
+ - "MSW (Mock Service Worker) - MSW Team"
198
+ - "Test-Driven Development - Kent Beck"
199
+ - "Red-Green-Refactor - Kent Beck"
200
+ - "User-Observable Behavior Testing - Testing Library"
201
+ sections:
202
+ - "Test Framework"
203
+ - "Basic Testing Policy"
204
+ - "Test Implementation Conventions"
205
+ - "Mock Type Safety Enforcement"
206
+ - "Basic React Testing Library Example"
207
+
208
+ frontend/technical-spec:
209
+ skill: "frontend/technical-spec"
210
+ tags: [frontend, react, vite, architecture, design, environment, data-flow, implementation, performance]
211
+ typical-use: "React technical design, Vite configuration, frontend environment setup, component architecture decisions"
212
+ size: medium
213
+ key-references:
214
+ - "React Official Documentation"
215
+ - "Build Tool Best Practices"
216
+ - "Single Source of Truth"
217
+ sections:
218
+ - "Basic Technology Stack Policy"
219
+ - "Environment Variable Management and Security"
220
+ - "Architecture Design"
221
+ - "Unified Data Flow Principles"
222
+ - "Build and Testing"
223
+ - "Quality Check Requirements"
224
+ - "Coverage Requirements"
225
+ - "Non-functional Requirements"
226
+
227
+ # Supabase Skills
228
+ supabase:
229
+ skill: "supabase"
230
+ tags: [database, backend, supabase, rls, type-generation, postgresql, security, realtime]
231
+ typical-use: "Supabase database design, RLS policies, type generation, client usage, realtime subscriptions"
232
+ size: medium
233
+ key-references:
234
+ - "Supabase Documentation"
235
+ - "PostgreSQL Best Practices"
236
+ - "Row Level Security - Supabase"
237
+ sections:
238
+ - "Database Design Principles"
239
+ - "Type Generation"
240
+ - "Row Level Security (RLS)"
241
+ - "Client Usage Patterns"
242
+ - "Common Anti-Patterns"
243
+ - "Environment Variables"
244
+ - "Realtime Subscriptions"
245
+ - "Migration Naming Convention"
246
+
247
+ supabase-local:
248
+ skill: "supabase-local"
249
+ tags: [database, supabase, local-dev, cli, docker, migrations, troubleshooting]
250
+ typical-use: "Local Supabase development, CLI commands, migrations, seeding, troubleshooting"
251
+ size: small
252
+ key-references:
253
+ - "Supabase CLI Documentation"
254
+ - "Local Development Guide"
255
+ sections:
256
+ - "CLI Commands Reference"
257
+ - "Local Configuration"
258
+ - "Migration Workflow"
259
+ - "Seeding Data"
260
+ - "Local vs Production Parity"
261
+ - "Common Local Development Tasks"
262
+ - "Troubleshooting"
263
+
264
+ supabase-edge-functions:
265
+ skill: "supabase-edge-functions"
266
+ tags: [serverless, supabase, deno, edge, functions, webhooks, deployment]
267
+ typical-use: "Supabase Edge Functions with Deno, webhooks, authentication"
268
+ size: medium
269
+ key-references:
270
+ - "Deno Documentation"
271
+ - "Supabase Edge Functions Guide"
272
+ sections:
273
+ - "Function Structure"
274
+ - "Type Safety in Deno"
275
+ - "Authentication in Edge Functions"
276
+ - "CORS Handling"
277
+ - "Local Development"
278
+ - "Deployment"
279
+ - "Webhooks Pattern"
280
+ - "Environment Variables"
281
+ - "Error Handling Best Practices"
282
+
283
+ supabase-testing:
284
+ skill: "supabase-testing"
285
+ tags: [testing, supabase, vitest, integration-test, rls, factories]
286
+ typical-use: "Testing Supabase, RLS policy testing, test factories"
287
+ size: small
288
+ key-references:
289
+ - "Vitest Documentation"
290
+ - "Testing Best Practices"
291
+ sections:
292
+ - "Test Database Setup"
293
+ - "Mocking Strategies"
294
+ - "RLS Testing"
295
+ - "Integration Test Patterns"
296
+ - "CI/CD Integration"
297
+ - "Test Utilities"
298
+
299
+ # Vercel Skills
300
+ vercel-deployment:
301
+ skill: "vercel-deployment"
302
+ tags: [deployment, vercel, ci-cd, hosting, environment, domains, monitoring]
303
+ typical-use: "Vercel deployment, environment variables, builds, monitoring, troubleshooting"
304
+ size: medium
305
+ key-references:
306
+ - "Vercel Documentation"
307
+ - "Next.js Deployment Guide"
308
+ sections:
309
+ - "Configuration"
310
+ - "Environment Variables"
311
+ - "Build Configuration"
312
+ - "Deployment Types"
313
+ - "Build Optimization"
314
+ - "Function Configuration"
315
+ - "Domain Configuration"
316
+ - "Deployment Protection"
317
+ - "Monitoring and Logs"
318
+ - "CI/CD Integration"
319
+ - "Troubleshooting"
320
+ - "Best Practices"
321
+
322
+ vercel-edge:
323
+ skill: "vercel-edge"
324
+ tags: [edge, vercel, middleware, serverless, caching, geo-routing]
325
+ typical-use: "Vercel Edge Functions, middleware, caching, geo-routing"
326
+ size: small
327
+ key-references:
328
+ - "Vercel Edge Runtime"
329
+ - "Next.js Middleware"
330
+ sections:
331
+ - "Edge Runtime Constraints"
332
+ - "Middleware Patterns"
333
+ - "Edge Functions"
334
+ - "Edge Config"
335
+ - "Caching at the Edge"
336
+ - "Best Practices"
337
+
338
+ # Authentication Skills
339
+ stack-auth:
340
+ skill: "stack-auth"
341
+ tags: [authentication, stack-auth, mcp, oauth, security, magic-link, error-handling]
342
+ typical-use: "Stack-auth integration, MCP server, auth flows, OAuth, magic links"
343
+ size: medium
344
+ key-references:
345
+ - "Stack-auth Documentation"
346
+ - "MCP Server: https://mcp.stack-auth.com/"
347
+ sections:
348
+ - "Overview"
349
+ - "Setup"
350
+ - "Authentication Flows"
351
+ - "User Management"
352
+ - "Security Best Practices"
353
+ - "Integration with Supabase"
354
+ - "MCP Server Usage"
355
+ - "Sign Out"
356
+ - "Error Handling"
357
+
358
+ # Integration Skills
359
+ fullstack-integration:
360
+ skill: "fullstack-integration"
361
+ tags: [architecture, integration, supabase, vercel, stack-auth, fullstack, deployment, schema]
362
+ typical-use: "Cross-service integration patterns, deployment checklists, database schema patterns"
363
+ size: medium
364
+ key-references:
365
+ - "Fullstack Architecture Patterns"
366
+ - "Service Integration Best Practices"
367
+ sections:
368
+ - "Architecture Overview"
369
+ - "Authentication Flow Integration"
370
+ - "Environment Configuration"
371
+ - "Error Handling Patterns"
372
+ - "Performance Patterns"
373
+ - "Database Schema Pattern"
374
+ - "Deployment Checklist"
375
+ - "Common Integration Issues"
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: technical-spec
3
+ description: Defines environment variables, architecture design, and build/test commands. Use when configuring environment or designing architecture.
4
+ ---
5
+
6
+ # Technical Design Rules
7
+
8
+ ## Basic Technology Stack Policy
9
+ TypeScript-based application implementation. Architecture patterns should be selected according to project requirements and scale.
10
+
11
+ ## Environment Variable Management and Security
12
+
13
+ ### Environment Variable Management
14
+ - Centrally manage environment variables and build mechanisms to ensure type safety
15
+ - Avoid direct references to `process.env`, obtain through configuration management layer
16
+ - Properly implement default value settings and mandatory checks
17
+
18
+ ### Security
19
+ - Do not include `.env` files in Git
20
+ - Always manage API keys and secrets as environment variables
21
+ - Prohibit logging of sensitive information
22
+ - Do not include sensitive information in error messages
23
+
24
+ ## Architecture Design
25
+
26
+ ### Architecture Design Principles
27
+ Select appropriate architecture for each project and define clearly:
28
+
29
+ - **Separation of Responsibilities**: Clearly define responsibilities for each layer and module, and maintain boundaries
30
+
31
+ ## Unified Data Flow Principles
32
+
33
+ #### Basic Principles
34
+ 1. **Single Data Source**: Store the same information in only one place
35
+ 2. **Structured Data Priority**: Use parsed objects rather than JSON strings
36
+ 3. **Clear Responsibility Separation**: Clearly define responsibilities for each layer
37
+
38
+ #### Data Flow Best Practices
39
+ - **Validation at Input**: Validate data at input layer and pass internally in type-safe form
40
+ - **Centralized Transformation**: Consolidate data transformation logic in dedicated utilities
41
+ - **Structured Logging**: Output structured logs at each stage of data flow
42
+
43
+ ## Build and Testing
44
+ Use the appropriate run command based on the `packageManager` field in package.json.
45
+
46
+ ### Build Commands
47
+ - `build` - TypeScript build
48
+ - `type-check` - Type check (no emit)
49
+
50
+ ### Testing Commands
51
+ - `test` - Run tests
52
+ - `test:coverage` - Run tests with coverage
53
+ - `test:coverage:fresh` - Run tests with coverage (fresh cache)
54
+ - `test:safe` - Safe test execution (with auto cleanup)
55
+ - `cleanup:processes` - Cleanup Vitest processes
56
+
57
+ ### Quality Check Requirements
58
+
59
+ Quality checks are mandatory upon implementation completion:
60
+
61
+ **Phase 1-3: Code Quality Checks**
62
+ - `check` - Biome (lint + format)
63
+ - `check:unused` - Detect unused exports
64
+ - `check:deps` - Detect circular dependencies
65
+ - `build` - TypeScript build
66
+
67
+ **Phase 4: Tests**
68
+ - `test` - Test execution
69
+
70
+ **Phase 5: Code Quality Re-verification**
71
+ - `check:code` - Re-verify code quality (clean up side effects from test fixes in Phase 4)
72
+
73
+ ### Auxiliary Commands
74
+ - `check:all` - Overall integrated check (check:code + test) *for manual batch verification
75
+ - `open coverage/index.html` - Check coverage report
76
+ - `format` - Format fixes
77
+ - `lint:fix` - Lint fixes
78
+
79
+ ### Troubleshooting
80
+ - **Port in use error**: Run the `cleanup:processes` script
81
+ - **Cache issues**: Run the `test:coverage:fresh` script
82
+ - **Dependency errors**: Clean reinstall dependencies
83
+
84
+ ### Coverage Requirements
85
+ - **MANDATORY**: Unit test coverage MUST be 70% or higher
86
+ - **Metrics**: Statements, Branches, Functions, Lines
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: typescript-rules
3
+ description: Applies type safety and error handling rules. Enforces no-any policy and type guards. Use when implementing TypeScript or reviewing types.
4
+ ---
5
+
6
+ # TypeScript Development Rules
7
+
8
+ ## Type Safety in Backend Implementation
9
+
10
+ **Type Safety in Data Flow**
11
+ Input Layer (`unknown`) -> Type Guard -> Business Layer (Type Guaranteed) -> Output Layer (Serialization)
12
+
13
+ **Backend-Specific Type Scenarios**:
14
+ - **API Communication**: Always receive responses as `unknown`, validate with type guards
15
+ - **Form Input**: External input as `unknown`, type determined after validation
16
+ - **Legacy Integration**: Stepwise assertion like `window as unknown as LegacyWindow`
17
+ - **Test Code**: Always define types for mocks, utilize `Partial<T>` and `vi.fn<[Args], Return>()`
18
+
19
+ ## Coding Conventions
20
+
21
+ **Class Usage Criteria**
22
+ - **Recommended: Implementation with Functions and Interfaces**
23
+ - Rationale: Improves testability and flexibility of function composition
24
+ - **Classes Allowed**:
25
+ - Framework requirements (NestJS Controller/Service, TypeORM Entity, etc.)
26
+ - Custom error class definitions
27
+ - When state and business logic are tightly coupled (e.g., ShoppingCart, Session, StateMachine)
28
+ - **Decision Criterion**: If "Does this data have behavior?" is Yes, consider using a class
29
+ ```typescript
30
+ // Functions and interfaces
31
+ interface UserService { create(data: UserData): User }
32
+ const userService: UserService = { create: (data) => {...} }
33
+ ```
34
+
35
+ **Function Design**
36
+ - **0-2 parameters maximum**: Use object for 3+ parameters
37
+ ```typescript
38
+ // Object parameter
39
+ function createUser({ name, email, role }: CreateUserParams) {}
40
+ ```
41
+
42
+ **Dependency Injection**
43
+ - **Inject external dependencies as parameters**: Ensure testability and modularity
44
+ ```typescript
45
+ // Receive dependency as parameter
46
+ function createService(repository: Repository) { return {...} }
47
+ ```
48
+
49
+ **Asynchronous Processing**
50
+ - Promise Handling: Always use `async/await`
51
+ - Error Handling: Always handle with `try-catch`
52
+ - Type Definition: Explicitly define return value types (e.g., `Promise<Result>`)
53
+
54
+ **Format Rules**
55
+ - Semicolon omission (follow Biome settings)
56
+ - Types in `PascalCase`, variables/functions in `camelCase`
57
+ - Imports use absolute paths (`src/`)
58
+
59
+ **Clean Code Principles**
60
+ - Delete unused code immediately
61
+ - Delete debug `console.log()`
62
+ - No commented-out code (manage history with version control)
63
+ - Comments explain "why" (not "what")
64
+
65
+ ## Error Handling
66
+
67
+ **Absolute Rule**: Error suppression prohibited. All errors must have log output and appropriate handling.
68
+
69
+ **Fail-Fast Principle**: Fail quickly on errors to prevent continued processing in invalid states
70
+ ```typescript
71
+ // Prohibited: Unconditional fallback
72
+ catch (error) {
73
+ return defaultValue // Hides error
74
+ }
75
+
76
+ // Required: Explicit failure
77
+ catch (error) {
78
+ logger.error('Processing failed', error)
79
+ throw error // Handle appropriately at higher layer
80
+ }
81
+ ```
82
+
83
+ **Result Type Pattern**: Express errors with types for explicit handling
84
+ ```typescript
85
+ type Result<T, E> = { ok: true; value: T } | { ok: false; error: E }
86
+
87
+ // Example: Express error possibility with types
88
+ function parseUser(data: unknown): Result<User, ValidationError> {
89
+ if (!isValid(data)) return { ok: false, error: new ValidationError() }
90
+ return { ok: true, value: data as User }
91
+ }
92
+ ```
93
+
94
+ **Custom Error Classes**
95
+ ```typescript
96
+ export class AppError extends Error {
97
+ constructor(message: string, public readonly code: string, public readonly statusCode = 500) {
98
+ super(message)
99
+ this.name = this.constructor.name
100
+ }
101
+ }
102
+ // Purpose-specific: ValidationError(400), BusinessRuleError(400), DatabaseError(500), ExternalServiceError(502)
103
+ ```
104
+
105
+ **Layer-Specific Error Handling (Backend)**
106
+ - API Layer: Convert to HTTP response, log output excluding sensitive information
107
+ - Service Layer: Detect business rule violations, propagate AppError as-is
108
+ - Repository Layer: Convert technical errors to domain errors
109
+
110
+ **Structured Logging and Sensitive Information Protection**
111
+ Never include sensitive information (password, token, apiKey, secret, creditCard) in logs
112
+
113
+ **Asynchronous Error Handling**
114
+ - Global handler setup mandatory: `unhandledRejection`, `uncaughtException`
115
+ - Use try-catch with all async/await
116
+ - Always log and re-throw errors
117
+
118
+ ## Performance Optimization
119
+
120
+ - Streaming Processing: Process large datasets with streams
121
+ - Memory Leak Prevention: Explicitly release unnecessary objects