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,263 @@
1
+ # [Feature Name] Design Document
2
+
3
+ ## Overview
4
+
5
+ [Explain the purpose and overview of this feature in 2-3 sentences]
6
+
7
+ ## Design Summary (Meta)
8
+
9
+ ```yaml
10
+ design_type: "new_feature|extension|refactoring"
11
+ risk_level: "low|medium|high"
12
+ complexity_level: "low|medium|high"
13
+ complexity_rationale: "[Required if medium/high: (1) which requirements/ACs necessitate this complexity, (2) which constraints/risks it addresses]"
14
+ main_constraints:
15
+ - "[constraint 1]"
16
+ - "[constraint 2]"
17
+ biggest_risks:
18
+ - "[risk 1]"
19
+ - "[risk 2]"
20
+ unknowns:
21
+ - "[uncertainty 1]"
22
+ - "[uncertainty 2]"
23
+ ```
24
+
25
+ ## Background and Context
26
+
27
+ ### Prerequisite ADRs
28
+
29
+ - [ADR File Name]: [Related decision items]
30
+ - Reference common technical ADRs when applicable
31
+
32
+ ### Agreement Checklist
33
+
34
+ #### Scope
35
+ - [ ] [Features/components to change]
36
+ - [ ] [Features to add]
37
+
38
+ #### Non-Scope (Explicitly not changing)
39
+ - [ ] [Features/components not to change]
40
+ - [ ] [Existing logic to preserve]
41
+
42
+ #### Constraints
43
+ - [ ] Parallel operation: [Yes/No]
44
+ - [ ] Backward compatibility: [Required/Not required]
45
+ - [ ] Performance measurement: [Required/Not required]
46
+
47
+ ### Problem to Solve
48
+
49
+ [Specific problems or challenges this feature aims to address]
50
+
51
+ ### Current Challenges
52
+
53
+ [Current system issues or limitations]
54
+
55
+ ### Requirements
56
+
57
+ #### Functional Requirements
58
+
59
+ - [List mandatory functional requirements]
60
+
61
+ #### Non-Functional Requirements
62
+
63
+ - **Performance**: [Response time, throughput requirements]
64
+ - **Scalability**: [Requirements for handling increased load]
65
+ - **Reliability**: [Error rate, availability requirements]
66
+ - **Maintainability**: [Code readability and changeability]
67
+
68
+ ## Acceptance Criteria (AC) - EARS Format
69
+
70
+ Each AC is written in EARS format. Keywords determine test type.
71
+
72
+ ### [Functional Requirement 1]
73
+
74
+ - [ ] **When** user clicks login button with valid credentials, the system shall authenticate and redirect to dashboard
75
+ - [ ] **If** credentials are invalid, **then** the system shall display error message "Invalid credentials"
76
+ - [ ] **While** user is logged in, the system shall maintain the session for 60 minutes
77
+
78
+ ### [Functional Requirement 2]
79
+
80
+ - [ ] The system shall display data list with pagination of 10 items per page
81
+ - [ ] **When** input is entered in search field, the system shall apply real-time filtering
82
+ - **Property**: `filtered.every(item => item.name.includes(query))`
83
+
84
+ ## Existing Codebase Analysis
85
+
86
+ ### Implementation Path Mapping
87
+ | Type | Path | Description |
88
+ |------|------|-------------|
89
+ | Existing | src/[actual-path] | [Current implementation] |
90
+ | New | src/[planned-path] | [Planned new creation] |
91
+
92
+ ### Integration Points (Include even for new implementations)
93
+ - **Integration Target**: [What to connect with]
94
+ - **Invocation Method**: [How it will be invoked]
95
+
96
+ ## Design
97
+
98
+ ### Change Impact Map
99
+
100
+ ```yaml
101
+ Change Target: [Component/feature to change]
102
+ Direct Impact:
103
+ - [Files/functions requiring direct changes]
104
+ - [Interface change points]
105
+ Indirect Impact:
106
+ - [Data format changes]
107
+ - [Processing time changes]
108
+ No Ripple Effect:
109
+ - [Explicitly specify unaffected features]
110
+ ```
111
+
112
+ ### Architecture Overview
113
+
114
+ [How this feature is positioned within the overall system]
115
+
116
+ ### Data Flow
117
+
118
+ ```
119
+ [Express data flow using diagrams or pseudo-code]
120
+ ```
121
+
122
+ ### Integration Points List
123
+
124
+ | Integration Point | Location | Old Implementation | New Implementation | Switching Method |
125
+ |-------------------|----------|-------------------|-------------------|------------------|
126
+ | Integration Point 1 | [Class/Function] | [Existing Process] | [New Process] | [DI/Factory etc.] |
127
+ | Integration Point 2 | [Another Location] | [Existing] | [New] | [Method] |
128
+
129
+ ### Main Components
130
+
131
+ #### Component 1
132
+
133
+ - **Responsibility**: [Scope of responsibility for this component]
134
+ - **Interface**: [APIs and type definitions provided]
135
+ - **Dependencies**: [Relationships with other components]
136
+
137
+ #### Component 2
138
+
139
+ - **Responsibility**: [Scope of responsibility for this component]
140
+ - **Interface**: [APIs and type definitions provided]
141
+ - **Dependencies**: [Relationships with other components]
142
+
143
+ ### Type Definitions
144
+
145
+ ```typescript
146
+ // Record major type definitions here
147
+ ```
148
+
149
+ ### Data Contract
150
+
151
+ #### Component 1
152
+
153
+ ```yaml
154
+ Input:
155
+ Type: [TypeScript type definition]
156
+ Preconditions: [Required items, format constraints]
157
+ Validation: [Validation method]
158
+
159
+ Output:
160
+ Type: [TypeScript type definition]
161
+ Guarantees: [Conditions that must always be met]
162
+ On Error: [Exception/null/default value]
163
+
164
+ Invariants:
165
+ - [Conditions that remain unchanged before and after processing]
166
+ ```
167
+
168
+ ### State Transitions and Invariants
169
+
170
+ [If the feature involves state management, describe state transitions and invariants here]
171
+
172
+ ```
173
+ [State A] ---(event 1)---> [State B]
174
+ [State B] ---(event 2)---> [State C]
175
+ ```
176
+
177
+ **Invariants**:
178
+ - [Condition that must always hold true]
179
+ - [Constraints on valid state transitions]
180
+
181
+ ### Error Handling
182
+
183
+ [Types of errors and how to handle them]
184
+
185
+ ### Logging and Monitoring
186
+
187
+ [What to record in logs and how to monitor]
188
+
189
+ ## Implementation Plan
190
+
191
+ ### Implementation Approach
192
+
193
+ **Selected Approach**: [Approach name or combination]
194
+ **Selection Reason**: [Reason considering project constraints and technical dependencies]
195
+
196
+ ### Technical Dependencies and Implementation Order
197
+
198
+ #### Required Implementation Order
199
+ 1. **[Component/Feature A]**
200
+ - Technical Reason: [Why this needs to be implemented first]
201
+ - Dependent Elements: [Other components that depend on this]
202
+
203
+ 2. **[Component/Feature B]**
204
+ - Technical Reason: [Technical necessity to implement after A]
205
+ - Prerequisites: [Required pre-implementations]
206
+
207
+ ### Integration Points
208
+ Each integration point requires E2E verification:
209
+
210
+ **Integration Point 1: [Name]**
211
+ - Components: [Component A] -> [Component B]
212
+ - Verification: [How to verify integration works]
213
+
214
+ ### Migration Strategy
215
+
216
+ [Technical migration approach, ensuring backward compatibility]
217
+
218
+ ## Test Strategy
219
+
220
+ ### Unit Tests
221
+
222
+ [Unit testing policy and coverage goals]
223
+ - Verify individual elements of functional acceptance criteria
224
+
225
+ ### Integration Tests
226
+
227
+ [Integration testing policy and important test cases]
228
+ - Verify combined operations of functional acceptance criteria
229
+
230
+ ### E2E Tests
231
+
232
+ [E2E testing policy]
233
+ - Verify entire scenarios of acceptance criteria
234
+ - Confirm functional operation from user perspective
235
+
236
+ ## Security Considerations
237
+
238
+ [Security concerns and countermeasures]
239
+
240
+ ## Alternative Solutions
241
+
242
+ ### Alternative 1
243
+
244
+ - **Overview**: [Description of alternative solution]
245
+ - **Advantages**: [Advantages]
246
+ - **Disadvantages**: [Disadvantages]
247
+ - **Reason for Rejection**: [Why it wasn't adopted]
248
+
249
+ ## Risks and Mitigation
250
+
251
+ | Risk | Impact | Probability | Mitigation |
252
+ |------|--------|-------------|------------|
253
+ | [Risk 1] | High/Medium/Low | High/Medium/Low | [Countermeasure] |
254
+
255
+ ## References
256
+
257
+ - [Related documentation and links]
258
+
259
+ ## Update History
260
+
261
+ | Date | Version | Changes | Author |
262
+ |------|---------|---------|--------|
263
+ | YYYY-MM-DD | 1.0 | Initial version | [Name] |
@@ -0,0 +1,130 @@
1
+ # Work Plan: [Title]
2
+
3
+ Created Date: YYYY-MM-DD
4
+ Type: feature|fix|refactor
5
+ Estimated Impact: X files
6
+ Related Issue/PR: #XXX (if any)
7
+
8
+ ## Related Documents
9
+ - Design Doc: [docs/design/XXX.md]
10
+ - ADR: [docs/adr/ADR-XXXX.md] (if any)
11
+ - PRD: [docs/prd/XXX.md] (if any)
12
+
13
+ ## Objective
14
+ [Why this change is necessary, what problem it solves]
15
+
16
+ ## Impact Scope
17
+ ### Target Files
18
+ - [ ] src/domain/xxx
19
+ - [ ] src/application/xxx
20
+ - [ ] src/infrastructure/xxx
21
+ - [ ] src/presentation/xxx
22
+
23
+ ### Test Files
24
+ - [ ] __tests__/xxx.test.ts
25
+ - [ ] __tests__/xxx.test.ts
26
+
27
+ ### Documentation
28
+ - [ ] ADR creation needed (for architecture changes)
29
+ - [ ] Design Doc update needed
30
+ - [ ] README update needed
31
+
32
+ ## Implementation Plan
33
+
34
+ (Note: Phase structure is determined based on Design Doc technical dependencies and implementation approach)
35
+
36
+ ### Phase 1: [Phase Name] (Estimated commits: X)
37
+ **Purpose**: [What this phase aims to achieve]
38
+
39
+ #### Tasks
40
+ - [ ] Task 1: Specific work content
41
+ - [ ] Task 2: Specific work content
42
+ - [ ] Quality check: Implement staged quality checks (refer to technical-spec skill)
43
+ - [ ] Unit tests: All related tests pass
44
+
45
+ #### Phase Completion Criteria
46
+ - [ ] [Functional completion criteria]
47
+ - [ ] [Quality completion criteria]
48
+
49
+ #### Operational Verification Procedures
50
+ 1. [Operation verification steps]
51
+ 2. [Expected result verification]
52
+ 3. [Performance verification (when applicable)]
53
+
54
+ ### Phase 2: [Phase Name] (Estimated commits: X)
55
+ **Purpose**: [What this phase aims to achieve]
56
+
57
+ #### Tasks
58
+ - [ ] Task 1: Specific work content
59
+ - [ ] Task 2: Specific work content
60
+ - [ ] Quality check: Implement staged quality checks (refer to technical-spec skill)
61
+ - [ ] Integration tests: Verify overall feature functionality
62
+
63
+ #### Phase Completion Criteria
64
+ - [ ] [Functional completion criteria]
65
+ - [ ] [Quality completion criteria]
66
+
67
+ #### Operational Verification Procedures
68
+ 1. [Operation verification steps]
69
+ 2. [Expected result verification]
70
+ 3. [Performance verification (when applicable)]
71
+
72
+ ### Phase 3: [Phase Name] (Estimated commits: X)
73
+ **Purpose**: [What this phase aims to achieve]
74
+
75
+ #### Tasks
76
+ - [ ] Task 1: Specific work content
77
+ - [ ] Task 2: Specific work content
78
+ - [ ] Quality check: Implement staged quality checks (refer to technical-spec skill)
79
+ - [ ] Integration tests: Verify component coordination
80
+
81
+ #### Phase Completion Criteria
82
+ - [ ] [Functional completion criteria]
83
+ - [ ] [Quality completion criteria]
84
+
85
+ #### Operational Verification Procedures
86
+ [Copy relevant integration point E2E verification from Design Doc]
87
+
88
+ ### Final Phase: Quality Assurance (Required) (Estimated commits: 1)
89
+ **Purpose**: Overall quality assurance and Design Doc consistency verification
90
+
91
+ #### Tasks
92
+ - [ ] Verify all Design Doc acceptance criteria achieved
93
+ - [ ] Quality checks (types, lint, format)
94
+ - [ ] Execute all tests
95
+ - [ ] Coverage 70%+
96
+ - [ ] Document updates
97
+
98
+ #### Operational Verification Procedures
99
+ [Copy E2E verification procedures from Design Doc]
100
+
101
+ ### Quality Assurance
102
+ - [ ] Implement staged quality checks (details: refer to technical-spec skill)
103
+
104
+ ## Risks and Countermeasures
105
+ | Risk | Countermeasure |
106
+ |------|----------------|
107
+ | [Expected risk] | [How to address it] |
108
+
109
+ ## Completion Criteria
110
+ - [ ] All phases completed
111
+ - [ ] Each phase's operational verification procedures executed
112
+ - [ ] Design Doc acceptance criteria satisfied
113
+ - [ ] Staged quality checks completed (zero errors)
114
+ - [ ] All tests pass
115
+ - [ ] Necessary documentation updated
116
+ - [ ] User review approval obtained
117
+
118
+ ## Progress Tracking
119
+ ### Phase 1
120
+ - Start: YYYY-MM-DD HH:MM
121
+ - Complete: YYYY-MM-DD HH:MM
122
+ - Notes: [Any special remarks]
123
+
124
+ ### Phase 2
125
+ - Start: YYYY-MM-DD HH:MM
126
+ - Complete: YYYY-MM-DD HH:MM
127
+ - Notes: [Any special remarks]
128
+
129
+ ## Notes
130
+ [Special notes, reference information, important points, etc.]
@@ -0,0 +1,109 @@
1
+ # PRD: [Feature Name]
2
+
3
+ ## Overview
4
+
5
+ ### One-line Summary
6
+ [Describe this feature in one line]
7
+
8
+ ### Background
9
+ [Why is this feature needed? What problem does it solve?]
10
+
11
+ ## User Stories
12
+
13
+ ### Primary Users
14
+ [Define the main target users]
15
+
16
+ ### User Stories
17
+ ```
18
+ As a [user type]
19
+ I want to [goal/desire]
20
+ So that [expected value/benefit]
21
+ ```
22
+
23
+ ### Use Cases
24
+ 1. [Specific usage scenario 1]
25
+ 2. [Specific usage scenario 2]
26
+ 3. [Specific usage scenario 3]
27
+
28
+ ## Functional Requirements
29
+
30
+ ### Must Have (MVP)
31
+ - [ ] Requirement 1: [Detailed description]
32
+ - AC: [Acceptance criteria - Given/When/Then format or measurable standard]
33
+ - [ ] Requirement 2: [Detailed description]
34
+ - AC: [Acceptance criteria]
35
+ - [ ] Requirement 3: [Detailed description]
36
+ - AC: [Acceptance criteria]
37
+
38
+ ### Nice to Have
39
+ - [ ] Requirement 1: [Detailed description]
40
+ - [ ] Requirement 2: [Detailed description]
41
+
42
+ ### Out of Scope
43
+ - Item 1: [Description and reason]
44
+ - Item 2: [Description and reason]
45
+
46
+ ## Non-Functional Requirements
47
+
48
+ ### Performance
49
+ - Response Time: [Target value]
50
+ - Throughput: [Target value]
51
+ - Concurrency: [Target value]
52
+
53
+ ### Reliability
54
+ - Availability: [Target value]
55
+ - Error Rate: [Target value]
56
+
57
+ ### Security
58
+ - [Security requirements details]
59
+
60
+ ### Scalability
61
+ - [Considerations for future scaling]
62
+
63
+ ## Success Criteria
64
+
65
+ ### Quantitative Metrics
66
+ 1. [Measurable success metric 1]
67
+ 2. [Measurable success metric 2]
68
+ 3. [Measurable success metric 3]
69
+
70
+ ### Qualitative Metrics
71
+ 1. [User experience metric 1]
72
+ 2. [User experience metric 2]
73
+
74
+ ## Technical Considerations
75
+
76
+ ### Dependencies
77
+ - [Dependencies on existing systems]
78
+ - [Dependencies on external services]
79
+
80
+ ### Constraints
81
+ - [Technical constraints]
82
+ - [Resource constraints]
83
+
84
+ ### Assumptions
85
+ - [Prerequisite requiring validation 1]
86
+ - [Prerequisite requiring validation 2]
87
+
88
+ ### Risks and Mitigation
89
+ | Risk | Impact | Probability | Mitigation |
90
+ |------|--------|-------------|------------|
91
+ | [Risk 1] | High/Medium/Low | High/Medium/Low | [Countermeasure] |
92
+ | [Risk 2] | High/Medium/Low | High/Medium/Low | [Countermeasure] |
93
+
94
+ ## Undetermined Items
95
+
96
+ - [ ] [Question 1]: [Description of options or impacts]
97
+ - [ ] [Question 2]: [Description of options or impacts]
98
+
99
+ *Discuss with user until this section is empty, then delete after confirmation*
100
+
101
+ ## Appendix
102
+
103
+ ### References
104
+ - [Related document 1]
105
+ - [Related document 2]
106
+
107
+ ### Glossary
108
+ - **Term 1**: [Definition]
109
+ - **Term 2**: [Definition]
@@ -0,0 +1,38 @@
1
+ # Task: [Task Name]
2
+
3
+ Metadata:
4
+ - Dependencies: task-01 -> Deliverable: docs/plans/analysis/research-results.md
5
+ - Provides: docs/plans/analysis/api-spec.md (for research/design tasks)
6
+ - Size: Small (1-2 files)
7
+
8
+ ## Implementation Content
9
+ [What this task will achieve]
10
+ *Reference dependency deliverables if applicable
11
+
12
+ ## Target Files
13
+ - [ ] [Implementation file path]
14
+ - [ ] [Test file path]
15
+
16
+ ## Implementation Steps (TDD: Red-Green-Refactor)
17
+ ### 1. Red Phase
18
+ - [ ] Review dependency deliverables (if any)
19
+ - [ ] Verify/create contract definitions
20
+ - [ ] Write failing tests
21
+ - [ ] Run tests and confirm failure
22
+
23
+ ### 2. Green Phase
24
+ - [ ] Add minimal implementation to pass tests
25
+ - [ ] Run only added tests and confirm they pass
26
+
27
+ ### 3. Refactor Phase
28
+ - [ ] Improve code (maintain passing tests)
29
+ - [ ] Confirm added tests still pass
30
+
31
+ ## Completion Criteria
32
+ - [ ] All added tests pass
33
+ - [ ] Operation verified (select L1/L2/L3, per implementation-approach skill)
34
+ - [ ] Deliverables created (for research/design tasks)
35
+
36
+ ## Notes
37
+ - Impact scope: [Areas where changes may propagate]
38
+ - Constraints: [Areas not to be modified]
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: frontend/technical-spec
3
+ description: Defines frontend environment variables, component design, and data flow patterns. Use when configuring React environment.
4
+ ---
5
+
6
+ # Technical Design Rules (Frontend)
7
+
8
+ ## Basic Technology Stack Policy
9
+ TypeScript-based React 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
+ - **Use build tool's environment variable system**: `process.env` does not work in browser environments
15
+ - Centrally manage environment variables through configuration layer
16
+ - Implement proper type safety with TypeScript
17
+ - Properly implement default value settings and mandatory checks
18
+
19
+ ```typescript
20
+ // Build tool environment variables (public values only)
21
+ const config = {
22
+ apiUrl: import.meta.env.API_URL || 'http://localhost:3000',
23
+ appName: import.meta.env.APP_NAME || 'My App'
24
+ }
25
+
26
+ // Does not work in frontend
27
+ const apiUrl = process.env.API_URL
28
+ ```
29
+
30
+ ### Security (Client-side Constraints)
31
+ - **CRITICAL**: All frontend code is public and visible in browser
32
+ - **Never store secrets client-side**: No API keys, tokens, or secrets in environment variables
33
+ - Do not include `.env` files in Git (same as backend)
34
+ - Prohibit logging of sensitive information (passwords, tokens, personal data)
35
+ - Do not include sensitive information in error messages
36
+
37
+ **Correct Approach for Secrets**:
38
+ ```typescript
39
+ // Security risk: API key exposed in browser
40
+ const apiKey = import.meta.env.API_KEY
41
+ const response = await fetch(`https://api.example.com/data?key=${apiKey}`)
42
+
43
+ // Correct: Backend manages secrets, frontend accesses via proxy
44
+ const response = await fetch('/api/data') // Backend handles API key authentication
45
+ ```
46
+
47
+ ## Architecture Design
48
+
49
+ ### Frontend Architecture Patterns
50
+
51
+ **React Component Architecture**:
52
+ - **Function Components**: Mandatory, class components deprecated
53
+ - **Custom Hooks**: For logic reuse and dependency injection
54
+ - **Component Hierarchy**: Atoms -> Molecules -> Organisms -> Templates -> Pages
55
+ - **Props-driven**: Components receive all necessary data via props
56
+ - **Co-location**: Place tests, styles, and related files alongside components
57
+
58
+ **State Management Patterns**:
59
+ - **Local State**: `useState` for component-specific state
60
+ - **Context API**: For sharing state across component tree (theme, auth, etc.)
61
+ - **Custom Hooks**: Encapsulate state logic and side effects
62
+ - **Server State**: React Query or SWR for API data caching
63
+
64
+ ## Unified Data Flow Principles
65
+
66
+ ### Client-side Data Flow
67
+ Maintain consistent data flow throughout the React application:
68
+
69
+ - **Single Source of Truth**: Each piece of state has one authoritative source
70
+ - UI state: Component state or Context
71
+ - Server data: API responses cached in React Query/SWR
72
+ - Form data: Controlled components with React Hook Form
73
+
74
+ - **Unidirectional Flow**: Data flows top-down via props
75
+ ```
76
+ API Response -> State -> Props -> Render -> UI
77
+ User Input -> Event Handler -> State Update -> Re-render
78
+ ```
79
+
80
+ - **Immutable Updates**: Use immutable patterns for state updates
81
+ ```typescript
82
+ // Immutable state update
83
+ setUsers(prev => [...prev, newUser])
84
+
85
+ // Mutable state update (avoid)
86
+ users.push(newUser)
87
+ setUsers(users)
88
+ ```
89
+
90
+ ### Type Safety in Data Flow
91
+ - **Frontend -> Backend**: Props/State (Type Guaranteed) -> API Request (Serialization)
92
+ - **Backend -> Frontend**: API Response (`unknown`) -> Type Guard -> State (Type Guaranteed)
93
+
94
+ ```typescript
95
+ // Type-safe data flow
96
+ async function fetchUser(id: string): Promise<User> {
97
+ const response = await fetch(`/api/users/${id}`)
98
+ const data: unknown = await response.json()
99
+
100
+ if (!isUser(data)) {
101
+ throw new Error('Invalid user data')
102
+ }
103
+
104
+ return data // Type guaranteed as User
105
+ }
106
+ ```
107
+
108
+ ## Build and Testing
109
+ Use the appropriate run command based on the `packageManager` field in package.json.
110
+
111
+ ### Build Commands
112
+ - `dev` - Development server
113
+ - `build` - Production build
114
+ - `preview` - Preview production build
115
+ - `type-check` - Type check (no emit)
116
+
117
+ ### Testing Commands
118
+ - `test` - Run tests
119
+ - `test:coverage` - Run tests with coverage
120
+ - `test:coverage:fresh` - Run tests with coverage (fresh cache)
121
+ - `test:safe` - Safe test execution (with auto cleanup)
122
+ - `cleanup:processes` - Cleanup Vitest processes
123
+
124
+ ### Quality Check Requirements
125
+ Quality checks are mandatory upon implementation completion:
126
+
127
+ **Phase 1-3: Basic Checks**
128
+ - `check` - Biome (lint + format)
129
+ - `build` - TypeScript build
130
+
131
+ **Phase 4-5: Tests and Final Confirmation**
132
+ - `test` - Test execution
133
+ - `test:coverage:fresh` - Coverage measurement
134
+ - `check:all` - Overall integrated check
135
+
136
+ ### Coverage Requirements
137
+ - **Mandatory**: Unit test coverage must be 60% or higher
138
+ - **Component-specific targets**:
139
+ - Atoms: 70% or higher
140
+ - Molecules: 65% or higher
141
+ - Organisms: 60% or higher
142
+ - Custom Hooks: 65% or higher
143
+ - Utils: 70% or higher
144
+
145
+ ### Non-functional Requirements
146
+ - **Browser Compatibility**: Chrome/Firefox/Safari/Edge (latest 2 versions)
147
+ - **Rendering Time**: Within 5 seconds for major pages