create-ai-project 1.11.2 → 1.12.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.
- package/.claude/agents-en/acceptance-test-generator.md +13 -13
- package/.claude/agents-en/code-reviewer.md +8 -10
- package/.claude/agents-en/design-sync.md +6 -5
- package/.claude/agents-en/document-reviewer.md +8 -7
- package/.claude/agents-en/integration-test-reviewer.md +5 -4
- package/.claude/agents-en/prd-creator.md +7 -6
- package/.claude/agents-en/quality-fixer-frontend.md +3 -14
- package/.claude/agents-en/quality-fixer.md +9 -20
- package/.claude/agents-en/requirement-analyzer.md +8 -7
- package/.claude/agents-en/rule-advisor.md +57 -128
- package/.claude/agents-en/task-decomposer.md +4 -10
- package/.claude/agents-en/task-executor-frontend.md +4 -16
- package/.claude/agents-en/task-executor.md +5 -16
- package/.claude/agents-en/technical-designer-frontend.md +17 -15
- package/.claude/agents-en/technical-designer.md +13 -15
- package/.claude/agents-en/work-planner.md +9 -14
- package/.claude/agents-ja/acceptance-test-generator.md +9 -15
- package/.claude/agents-ja/code-reviewer.md +3 -11
- package/.claude/agents-ja/design-sync.md +2 -6
- package/.claude/agents-ja/document-reviewer.md +4 -9
- package/.claude/agents-ja/integration-test-reviewer.md +2 -5
- package/.claude/agents-ja/prd-creator.md +3 -7
- package/.claude/agents-ja/quality-fixer-frontend.md +2 -13
- package/.claude/agents-ja/quality-fixer.md +7 -18
- package/.claude/agents-ja/requirement-analyzer.md +5 -8
- package/.claude/agents-ja/rule-advisor.md +57 -128
- package/.claude/agents-ja/task-decomposer.md +4 -10
- package/.claude/agents-ja/task-executor-frontend.md +3 -15
- package/.claude/agents-ja/task-executor.md +3 -17
- package/.claude/agents-ja/technical-designer-frontend.md +17 -15
- package/.claude/agents-ja/technical-designer.md +13 -15
- package/.claude/agents-ja/work-planner.md +9 -14
- package/.claude/commands-en/build.md +2 -2
- package/.claude/commands-en/design.md +1 -1
- package/.claude/commands-en/implement.md +8 -8
- package/.claude/commands-en/plan.md +3 -3
- package/.claude/commands-en/project-inject.md +4 -4
- package/.claude/commands-en/{refine-rule.md → refine-skill.md} +47 -48
- package/.claude/commands-en/{sync-rules.md → sync-skills.md} +29 -29
- package/.claude/commands-ja/build.md +2 -2
- package/.claude/commands-ja/design.md +1 -1
- package/.claude/commands-ja/implement.md +8 -8
- package/.claude/commands-ja/plan.md +3 -3
- package/.claude/commands-ja/project-inject.md +4 -4
- package/.claude/{commands/refine-rule.md → commands-ja/refine-skill.md} +25 -25
- package/.claude/{commands/sync-rules.md → commands-ja/sync-skills.md} +28 -28
- package/{docs/rules-en/coding-standards.md → .claude/skills-en/coding-standards/SKILL.md} +21 -108
- package/{docs/rules-en/documentation-criteria.md → .claude/skills-en/documentation-criteria/SKILL.md} +40 -42
- package/{docs/adr/template-en.md → .claude/skills-en/documentation-criteria/references/adr-template.md} +1 -1
- package/{docs/design/template-en.md → .claude/skills-en/documentation-criteria/references/design-template.md} +11 -31
- package/{docs/plans/template-en.md → .claude/skills-en/documentation-criteria/references/plan-template.md} +4 -4
- package/{docs/prd/template-en.md → .claude/skills-en/documentation-criteria/references/prd-template.md} +1 -1
- package/{docs/rules-en/frontend/technical-spec.md → .claude/skills-en/frontend/technical-spec/SKILL.md} +17 -13
- package/{docs/rules-en/frontend/typescript.md → .claude/skills-en/frontend/typescript-rules/SKILL.md} +17 -12
- package/{docs/rules-en/frontend/typescript-testing.md → .claude/skills-en/frontend/typescript-testing/SKILL.md} +11 -6
- package/{docs/rules-en/architecture/implementation-approach.md → .claude/skills-en/implementation-approach/SKILL.md} +7 -2
- package/{docs/rules-en/integration-e2e-testing.md → .claude/skills-en/integration-e2e-testing/SKILL.md} +15 -18
- package/{docs/rules-en/project-context.md → .claude/skills-en/project-context/SKILL.md} +7 -3
- package/.claude/skills-en/subagents-orchestration-guide/SKILL.md +224 -0
- package/.claude/skills-en/task-analyzer/SKILL.md +131 -0
- package/{docs/rules-en/rules-index.yaml → .claude/skills-en/task-analyzer/references/skills-index.yaml} +34 -20
- package/{docs/rules-en/technical-spec.md → .claude/skills-en/technical-spec/SKILL.md} +6 -6
- package/{docs/rules-en/typescript.md → .claude/skills-en/typescript-rules/SKILL.md} +15 -10
- package/{docs/rules-en/typescript-testing.md → .claude/skills-en/typescript-testing/SKILL.md} +10 -4
- package/{docs/rules-ja/coding-standards.md → .claude/skills-ja/coding-standards/SKILL.md} +12 -99
- package/{docs/rules-ja/documentation-criteria.md → .claude/skills-ja/documentation-criteria/SKILL.md} +18 -5
- package/.claude/skills-ja/documentation-criteria/references/adr-template.md +64 -0
- package/.claude/skills-ja/documentation-criteria/references/design-template.md +261 -0
- package/{docs/plans/template-ja.md → .claude/skills-ja/documentation-criteria/references/plan-template.md} +38 -38
- package/{docs/prd/template-ja.md → .claude/skills-ja/documentation-criteria/references/prd-template.md} +33 -33
- package/{docs/rules-ja/frontend/technical-spec.md → .claude/skills-ja/frontend/technical-spec/SKILL.md} +13 -9
- package/.claude/skills-ja/frontend/typescript-rules/SKILL.md +315 -0
- package/{docs/rules-ja/frontend/typescript-testing.md → .claude/skills-ja/frontend/typescript-testing/SKILL.md} +93 -5
- package/{docs/rules/architecture/implementation-approach.md → .claude/skills-ja/implementation-approach/SKILL.md} +10 -5
- package/{docs/rules-ja/integration-e2e-testing.md → .claude/skills-ja/integration-e2e-testing/SKILL.md} +5 -8
- package/{docs/rules-ja/project-context.md → .claude/skills-ja/project-context/SKILL.md} +7 -3
- package/.claude/skills-ja/subagents-orchestration-guide/SKILL.md +212 -0
- package/.claude/skills-ja/task-analyzer/SKILL.md +131 -0
- package/{docs/rules-ja/rules-index.yaml → .claude/skills-ja/task-analyzer/references/skills-index.yaml} +34 -19
- package/{docs/rules-ja/technical-spec.md → .claude/skills-ja/technical-spec/SKILL.md} +6 -6
- package/{docs/rules-ja/typescript.md → .claude/skills-ja/typescript-rules/SKILL.md} +16 -11
- package/{docs/rules-ja/typescript-testing.md → .claude/skills-ja/typescript-testing/SKILL.md} +11 -5
- package/CLAUDE.en.md +6 -6
- package/CLAUDE.ja.md +6 -6
- package/CLAUDE.md +19 -28
- package/README.ja.md +39 -10
- package/README.md +39 -10
- package/package.json +1 -1
- package/scripts/set-language.js +35 -53
- package/scripts/setup-project.js +4 -1
- package/.claude/agents/acceptance-test-generator.md +0 -316
- package/.claude/agents/code-reviewer.md +0 -193
- package/.claude/agents/document-reviewer.md +0 -182
- package/.claude/agents/prd-creator.md +0 -186
- package/.claude/agents/quality-fixer.md +0 -295
- package/.claude/agents/requirement-analyzer.md +0 -161
- package/.claude/agents/rule-advisor.md +0 -194
- package/.claude/agents/task-decomposer.md +0 -291
- package/.claude/agents/task-executor.md +0 -270
- package/.claude/agents/technical-designer.md +0 -343
- package/.claude/agents/work-planner.md +0 -181
- package/.claude/commands/build.md +0 -78
- package/.claude/commands/design.md +0 -27
- package/.claude/commands/implement.md +0 -79
- package/.claude/commands/plan.md +0 -43
- package/.claude/commands/project-inject.md +0 -76
- package/.claude/commands/review.md +0 -78
- package/.claude/commands/task.md +0 -13
- package/.claude/commands-ja/refine-rule.md +0 -206
- package/.claude/commands-ja/sync-rules.md +0 -116
- package/.claude/settings.local.json +0 -74
- package/docs/adr/template-ja.md +0 -64
- package/docs/design/template-ja.md +0 -285
- package/docs/guides/en/sub-agents.md +0 -343
- package/docs/guides/ja/sub-agents.md +0 -343
- package/docs/guides/sub-agents.md +0 -306
- package/docs/plans/20250123-integration-test-improvement.md +0 -993
- package/docs/rules/ai-development-guide.md +0 -260
- package/docs/rules/documentation-criteria.md +0 -180
- package/docs/rules/project-context.md +0 -38
- package/docs/rules/rules-index.yaml +0 -137
- package/docs/rules/technical-spec.md +0 -47
- package/docs/rules/typescript-testing.md +0 -188
- package/docs/rules/typescript.md +0 -166
- package/docs/rules-ja/architecture/implementation-approach.md +0 -136
- package/docs/rules-ja/frontend/typescript.md +0 -131
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task-analyzer
|
|
3
|
+
description: Metacognitive task analysis and skill selection. Analyzes task essence, estimates scale, and returns appropriate skills with metadata.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Task Analyzer
|
|
7
|
+
|
|
8
|
+
Provides metacognitive task analysis and skill selection guidance.
|
|
9
|
+
|
|
10
|
+
## Skills Index
|
|
11
|
+
|
|
12
|
+
See **[skills-index.yaml](references/skills-index.yaml)** for available skills metadata.
|
|
13
|
+
|
|
14
|
+
## Task Analysis Process
|
|
15
|
+
|
|
16
|
+
### 1. Understand Task Essence
|
|
17
|
+
|
|
18
|
+
Identify the fundamental purpose beyond surface-level work:
|
|
19
|
+
|
|
20
|
+
| Surface Work | Fundamental Purpose |
|
|
21
|
+
|--------------|---------------------|
|
|
22
|
+
| "Fix this bug" | Problem solving, root cause analysis |
|
|
23
|
+
| "Implement this feature" | Feature addition, value delivery |
|
|
24
|
+
| "Refactor this code" | Quality improvement, maintainability |
|
|
25
|
+
| "Update this file" | Change management, consistency |
|
|
26
|
+
|
|
27
|
+
**Key Questions:**
|
|
28
|
+
- What problem are we really solving?
|
|
29
|
+
- What is the expected outcome?
|
|
30
|
+
- What could go wrong if we approach this superficially?
|
|
31
|
+
|
|
32
|
+
### 2. Estimate Task Scale
|
|
33
|
+
|
|
34
|
+
| Scale | File Count | Indicators |
|
|
35
|
+
|-------|------------|------------|
|
|
36
|
+
| Small | 1-2 | Single function/component change |
|
|
37
|
+
| Medium | 3-5 | Multiple related components |
|
|
38
|
+
| Large | 6+ | Cross-cutting concerns, architecture impact |
|
|
39
|
+
|
|
40
|
+
**Scale affects skill priority:**
|
|
41
|
+
- Larger scale → process/documentation skills more important
|
|
42
|
+
- Smaller scale → implementation skills more focused
|
|
43
|
+
|
|
44
|
+
### 3. Identify Task Type
|
|
45
|
+
|
|
46
|
+
| Type | Characteristics | Key Skills |
|
|
47
|
+
|------|-----------------|------------|
|
|
48
|
+
| Implementation | New code, features | coding-standards, typescript-testing |
|
|
49
|
+
| Fix | Bug resolution | coding-standards, typescript-testing |
|
|
50
|
+
| Refactoring | Structure improvement | coding-standards, implementation-approach |
|
|
51
|
+
| Design | Architecture decisions | documentation-criteria, implementation-approach |
|
|
52
|
+
| Quality | Testing, review | typescript-testing, integration-e2e-testing |
|
|
53
|
+
|
|
54
|
+
### 4. Tag-Based Skill Matching
|
|
55
|
+
|
|
56
|
+
Extract relevant tags from task description and match against skills-index.yaml:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
Task: "Implement user authentication with tests"
|
|
60
|
+
Extracted tags: [implementation, testing, security]
|
|
61
|
+
Matched skills:
|
|
62
|
+
- coding-standards (implementation, security)
|
|
63
|
+
- typescript-testing (testing)
|
|
64
|
+
- typescript-rules (implementation)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 5. Implicit Relationships
|
|
68
|
+
|
|
69
|
+
Consider hidden dependencies:
|
|
70
|
+
|
|
71
|
+
| Task Involves | Also Include |
|
|
72
|
+
|---------------|--------------|
|
|
73
|
+
| Error handling | debugging, testing |
|
|
74
|
+
| New features | design, implementation, documentation |
|
|
75
|
+
| Performance | profiling, optimization, testing |
|
|
76
|
+
| Frontend | typescript-rules, typescript-testing |
|
|
77
|
+
| API/Integration | integration-e2e-testing |
|
|
78
|
+
|
|
79
|
+
## Output Format
|
|
80
|
+
|
|
81
|
+
Return structured analysis with skill metadata from skills-index.yaml:
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
taskAnalysis:
|
|
85
|
+
essence: <string> # Fundamental purpose identified
|
|
86
|
+
type: <implementation|fix|refactoring|design|quality>
|
|
87
|
+
scale: <small|medium|large>
|
|
88
|
+
estimatedFiles: <number>
|
|
89
|
+
tags: [<string>, ...] # Extracted from task description
|
|
90
|
+
|
|
91
|
+
selectedSkills:
|
|
92
|
+
- skill: <skill-name> # From skills-index.yaml
|
|
93
|
+
priority: <high|medium|low>
|
|
94
|
+
reason: <string> # Why this skill was selected
|
|
95
|
+
# Pass through metadata from skills-index.yaml
|
|
96
|
+
tags: [...]
|
|
97
|
+
typical-use: <string>
|
|
98
|
+
size: <small|medium|large>
|
|
99
|
+
sections: [...] # All sections from yaml, unfiltered
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Note**: Section selection (choosing which sections are relevant) is done separately after reading the actual SKILL.md files.
|
|
103
|
+
|
|
104
|
+
## Skill Selection Priority
|
|
105
|
+
|
|
106
|
+
1. **Essential** - Directly related to task type
|
|
107
|
+
2. **Quality** - Testing and quality assurance
|
|
108
|
+
3. **Process** - Workflow and documentation
|
|
109
|
+
4. **Supplementary** - Reference and best practices
|
|
110
|
+
|
|
111
|
+
## Metacognitive Question Design
|
|
112
|
+
|
|
113
|
+
Generate 3-5 questions according to task nature:
|
|
114
|
+
|
|
115
|
+
| Task Type | Question Focus |
|
|
116
|
+
|-----------|----------------|
|
|
117
|
+
| Implementation | Design validity, edge cases, performance |
|
|
118
|
+
| Fix | Root cause (5 Whys), impact scope, regression testing |
|
|
119
|
+
| Refactoring | Current problems, target state, phased plan |
|
|
120
|
+
| Design | Requirement clarity, future extensibility, trade-offs |
|
|
121
|
+
|
|
122
|
+
## Warning Patterns
|
|
123
|
+
|
|
124
|
+
Detect and flag these patterns:
|
|
125
|
+
|
|
126
|
+
| Pattern | Warning | Mitigation |
|
|
127
|
+
|---------|---------|------------|
|
|
128
|
+
| Large change at once | High risk | Split into phases |
|
|
129
|
+
| Implementation without tests | Quality risk | Follow TDD |
|
|
130
|
+
| Immediate fix on error | Root cause missed | Pause, analyze |
|
|
131
|
+
| Coding without plan | Scope creep | Plan first |
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Metadata
|
|
2
|
-
#
|
|
1
|
+
# Skills Metadata Index
|
|
2
|
+
# Used to select appropriate skills based on task analysis
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
skills:
|
|
5
5
|
coding-standards:
|
|
6
|
-
|
|
6
|
+
skill: "coding-standards"
|
|
7
7
|
tags: [universal, anti-patterns, refactoring, type-safety, testing, code-deletion, rule-of-three, fail-fast, impact-analysis]
|
|
8
8
|
typical-use: "Universal coding principles applicable across all domains, foundational standards for all developers"
|
|
9
9
|
size: large
|
|
@@ -34,8 +34,8 @@ rules:
|
|
|
34
34
|
- "Test Granularity Principles"
|
|
35
35
|
- "Continuity Test Scope"
|
|
36
36
|
|
|
37
|
-
typescript:
|
|
38
|
-
|
|
37
|
+
typescript-rules:
|
|
38
|
+
skill: "typescript-rules"
|
|
39
39
|
tags: [implementation, type-safety, async, refactoring, coding-style, functional-programming, dependency-injection, branded-types, backend]
|
|
40
40
|
typical-use: "Backend TypeScript code creation, modification, refactoring, modern type features utilization"
|
|
41
41
|
size: small
|
|
@@ -56,7 +56,7 @@ rules:
|
|
|
56
56
|
- "Performance Optimization"
|
|
57
57
|
|
|
58
58
|
typescript-testing:
|
|
59
|
-
|
|
59
|
+
skill: "typescript-testing"
|
|
60
60
|
tags: [quality, testing, tdd, coverage, vitest, implementation, debugging, refactoring, backend]
|
|
61
61
|
typical-use: "Backend test creation, quality checks, test quality criteria, development steps for code/bug fixes, refactoring, and new feature implementation"
|
|
62
62
|
size: small
|
|
@@ -74,7 +74,7 @@ rules:
|
|
|
74
74
|
- "Basic Vitest Example"
|
|
75
75
|
|
|
76
76
|
technical-spec:
|
|
77
|
-
|
|
77
|
+
skill: "technical-spec"
|
|
78
78
|
tags: [architecture, design, documentation, environment, data-flow, implementation, quality-commands, testing, build]
|
|
79
79
|
typical-use: "Technical design, environment configuration, documentation creation process, implementation policy decisions, quality check commands, build and test execution"
|
|
80
80
|
size: medium
|
|
@@ -90,7 +90,7 @@ rules:
|
|
|
90
90
|
- "Build and Testing"
|
|
91
91
|
|
|
92
92
|
project-context:
|
|
93
|
-
|
|
93
|
+
skill: "project-context"
|
|
94
94
|
tags: [context, project-specific, implementation]
|
|
95
95
|
typical-use: "Project-specific information, understanding implementation principles"
|
|
96
96
|
size: small
|
|
@@ -102,7 +102,7 @@ rules:
|
|
|
102
102
|
- "Customization Guide"
|
|
103
103
|
|
|
104
104
|
documentation-criteria:
|
|
105
|
-
|
|
105
|
+
skill: "documentation-criteria"
|
|
106
106
|
tags: [documentation, adr, prd, design-doc, work-plan, decision-matrix]
|
|
107
107
|
typical-use: "Implementation start scale assessment, document creation decisions, ADR/PRD/Design Doc/work plan creation criteria"
|
|
108
108
|
size: medium
|
|
@@ -122,7 +122,7 @@ rules:
|
|
|
122
122
|
- "Common ADR Relationships"
|
|
123
123
|
|
|
124
124
|
implementation-approach:
|
|
125
|
-
|
|
125
|
+
skill: "implementation-approach"
|
|
126
126
|
tags: [architecture, implementation, task-decomposition, strategy-patterns, strangler-pattern, facade-pattern, design, planning, confirmation-levels]
|
|
127
127
|
typical-use: "Implementation strategy selection, task decomposition, design decisions, large-scale change planning"
|
|
128
128
|
size: medium
|
|
@@ -139,7 +139,7 @@ rules:
|
|
|
139
139
|
- "Guidelines for Meta-cognitive Execution"
|
|
140
140
|
|
|
141
141
|
integration-e2e-testing:
|
|
142
|
-
|
|
142
|
+
skill: "integration-e2e-testing"
|
|
143
143
|
tags: [testing, integration-test, e2e-test, property-based-testing, fast-check, test-skeleton, test-review, quality]
|
|
144
144
|
typical-use: "Integration and E2E test skeleton generation, test implementation, test review, Property-Based Test implementation"
|
|
145
145
|
size: small
|
|
@@ -154,9 +154,23 @@ rules:
|
|
|
154
154
|
- "Implementation Rules"
|
|
155
155
|
- "Review Criteria"
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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"
|
|
160
174
|
tags: [frontend, react, implementation, type-safety, function-components, props-driven, async, refactoring, coding-style]
|
|
161
175
|
typical-use: "React component creation, Props type definitions, frontend TypeScript development"
|
|
162
176
|
size: small
|
|
@@ -173,8 +187,8 @@ rules:
|
|
|
173
187
|
- "Error Handling"
|
|
174
188
|
- "Performance Optimization"
|
|
175
189
|
|
|
176
|
-
frontend
|
|
177
|
-
|
|
190
|
+
frontend/typescript-testing:
|
|
191
|
+
skill: "frontend/typescript-testing"
|
|
178
192
|
tags: [frontend, react, quality, testing, tdd, coverage, vitest, react-testing-library, msw, implementation]
|
|
179
193
|
typical-use: "React component testing, React Testing Library tests, MSW API mocking, frontend test creation"
|
|
180
194
|
size: small
|
|
@@ -191,8 +205,8 @@ rules:
|
|
|
191
205
|
- "Mock Type Safety Enforcement"
|
|
192
206
|
- "Basic React Testing Library Example"
|
|
193
207
|
|
|
194
|
-
frontend
|
|
195
|
-
|
|
208
|
+
frontend/technical-spec:
|
|
209
|
+
skill: "frontend/technical-spec"
|
|
196
210
|
tags: [frontend, react, vite, architecture, design, environment, data-flow, implementation, performance]
|
|
197
211
|
typical-use: "React technical design, Vite configuration, frontend environment setup, component architecture decisions"
|
|
198
212
|
size: medium
|
|
@@ -208,4 +222,4 @@ rules:
|
|
|
208
222
|
- "Build and Testing"
|
|
209
223
|
- "Quality Check Requirements"
|
|
210
224
|
- "Coverage Requirements"
|
|
211
|
-
- "Non-functional Requirements"
|
|
225
|
+
- "Non-functional Requirements"
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: technical-spec
|
|
3
|
+
description: Technical design rules including environment variable management, architecture design, and build/testing commands.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# Technical Design Rules
|
|
2
7
|
|
|
3
8
|
## Basic Technology Stack Policy
|
|
@@ -21,13 +26,8 @@ TypeScript-based application implementation. Architecture patterns should be sel
|
|
|
21
26
|
### Architecture Design Principles
|
|
22
27
|
Select appropriate architecture for each project and define clearly:
|
|
23
28
|
|
|
24
|
-
- **Clear Definition**: Project architecture is defined in dedicated files under `docs/rules/architecture/`
|
|
25
29
|
- **Separation of Responsibilities**: Clearly define responsibilities for each layer and module, and maintain boundaries
|
|
26
30
|
|
|
27
|
-
## Pattern Application Consistency
|
|
28
|
-
|
|
29
|
-
Strictly follow selected architecture patterns. See `docs/rules/architecture/` for project-specific details.
|
|
30
|
-
|
|
31
31
|
## Unified Data Flow Principles
|
|
32
32
|
|
|
33
33
|
#### Basic Principles
|
|
@@ -83,4 +83,4 @@ Quality checks are mandatory upon implementation completion:
|
|
|
83
83
|
|
|
84
84
|
### Coverage Requirements
|
|
85
85
|
- **MANDATORY**: Unit test coverage MUST be 70% or higher
|
|
86
|
-
- **Metrics**: Statements, Branches, Functions, Lines
|
|
86
|
+
- **Metrics**: Statements, Branches, Functions, Lines
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-rules
|
|
3
|
+
description: TypeScript development rules for type safety and error handling. Use when implementing TypeScript code or reviewing type definitions.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# TypeScript Development Rules
|
|
2
7
|
|
|
3
8
|
## Type Safety in Backend Implementation
|
|
4
9
|
|
|
5
10
|
**Type Safety in Data Flow**
|
|
6
|
-
Input Layer (`unknown`)
|
|
11
|
+
Input Layer (`unknown`) -> Type Guard -> Business Layer (Type Guaranteed) -> Output Layer (Serialization)
|
|
7
12
|
|
|
8
13
|
**Backend-Specific Type Scenarios**:
|
|
9
14
|
- **API Communication**: Always receive responses as `unknown`, validate with type guards
|
|
@@ -22,7 +27,7 @@ Input Layer (`unknown`) → Type Guard → Business Layer (Type Guaranteed) →
|
|
|
22
27
|
- When state and business logic are tightly coupled (e.g., ShoppingCart, Session, StateMachine)
|
|
23
28
|
- **Decision Criterion**: If "Does this data have behavior?" is Yes, consider using a class
|
|
24
29
|
```typescript
|
|
25
|
-
//
|
|
30
|
+
// Functions and interfaces
|
|
26
31
|
interface UserService { create(data: UserData): User }
|
|
27
32
|
const userService: UserService = { create: (data) => {...} }
|
|
28
33
|
```
|
|
@@ -30,14 +35,14 @@ Input Layer (`unknown`) → Type Guard → Business Layer (Type Guaranteed) →
|
|
|
30
35
|
**Function Design**
|
|
31
36
|
- **0-2 parameters maximum**: Use object for 3+ parameters
|
|
32
37
|
```typescript
|
|
33
|
-
//
|
|
38
|
+
// Object parameter
|
|
34
39
|
function createUser({ name, email, role }: CreateUserParams) {}
|
|
35
40
|
```
|
|
36
41
|
|
|
37
42
|
**Dependency Injection**
|
|
38
43
|
- **Inject external dependencies as parameters**: Ensure testability and modularity
|
|
39
44
|
```typescript
|
|
40
|
-
//
|
|
45
|
+
// Receive dependency as parameter
|
|
41
46
|
function createService(repository: Repository) { return {...} }
|
|
42
47
|
```
|
|
43
48
|
|
|
@@ -52,10 +57,10 @@ Input Layer (`unknown`) → Type Guard → Business Layer (Type Guaranteed) →
|
|
|
52
57
|
- Imports use absolute paths (`src/`)
|
|
53
58
|
|
|
54
59
|
**Clean Code Principles**
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
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")
|
|
59
64
|
|
|
60
65
|
## Error Handling
|
|
61
66
|
|
|
@@ -63,12 +68,12 @@ Input Layer (`unknown`) → Type Guard → Business Layer (Type Guaranteed) →
|
|
|
63
68
|
|
|
64
69
|
**Fail-Fast Principle**: Fail quickly on errors to prevent continued processing in invalid states
|
|
65
70
|
```typescript
|
|
66
|
-
//
|
|
71
|
+
// Prohibited: Unconditional fallback
|
|
67
72
|
catch (error) {
|
|
68
73
|
return defaultValue // Hides error
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
//
|
|
76
|
+
// Required: Explicit failure
|
|
72
77
|
catch (error) {
|
|
73
78
|
logger.error('Processing failed', error)
|
|
74
79
|
throw error // Handle appropriately at higher layer
|
package/{docs/rules-en/typescript-testing.md → .claude/skills-en/typescript-testing/SKILL.md}
RENAMED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-testing
|
|
3
|
+
description: TypeScript testing rules with Vitest. Includes coverage requirements, test design principles, and quality criteria.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# TypeScript Testing Rules
|
|
2
7
|
|
|
3
8
|
## Test Framework
|
|
@@ -32,7 +37,7 @@
|
|
|
32
37
|
3. **Cross-functional Verification in E2E Tests**
|
|
33
38
|
- Mandatory verification of impact on existing features when adding new features
|
|
34
39
|
- Cover integration points with "High" and "Medium" impact levels from Design Doc's "Integration Point Map"
|
|
35
|
-
- Verification pattern: Existing feature operation
|
|
40
|
+
- Verification pattern: Existing feature operation -> Enable new feature -> Verify continuity of existing features
|
|
36
41
|
- Success criteria: No change in response content, processing time within 5 seconds
|
|
37
42
|
- Designed for automatic execution in CI/CD pipelines
|
|
38
43
|
|
|
@@ -57,11 +62,11 @@ src/
|
|
|
57
62
|
|
|
58
63
|
### Test Code Quality Rules
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
**Recommended: Keep all tests always active**
|
|
61
66
|
- Merit: Guarantees test suite completeness
|
|
62
67
|
- Practice: Fix problematic tests and activate them
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
**Avoid: test.skip() or commenting out**
|
|
65
70
|
- Reason: Creates test gaps and incomplete quality checks
|
|
66
71
|
- Solution: Completely delete unnecessary tests
|
|
67
72
|
|
|
@@ -76,6 +81,7 @@ it('throws on negative price', () => expect(() => calc([{price: -1}])).toThrow()
|
|
|
76
81
|
|
|
77
82
|
### Literal Expected Values
|
|
78
83
|
Use literal values for assertions. Do not replicate implementation logic.
|
|
84
|
+
**Valid test**: Expected value != Mock return value (implementation transforms/processes data)
|
|
79
85
|
```typescript
|
|
80
86
|
expect(calcTax(100)).toBe(10) // not: 100 * TAX_RATE
|
|
81
87
|
```
|
|
@@ -119,7 +125,7 @@ it('reverses twice equals original', () => {
|
|
|
119
125
|
|
|
120
126
|
### Minimal Type Definition Requirements
|
|
121
127
|
```typescript
|
|
122
|
-
//
|
|
128
|
+
// Only required parts
|
|
123
129
|
type TestRepo = Pick<Repository, 'find' | 'save'>
|
|
124
130
|
const mock: TestRepo = { find: vi.fn(), save: vi.fn() }
|
|
125
131
|
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coding-standards
|
|
3
|
+
description: 保守性、可読性、品質のための言語非依存コーディング原則。機能実装、リファクタリング、コードレビュー時に使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# 普遍的コーディング規約
|
|
2
7
|
|
|
3
8
|
## 技術的アンチパターン(赤信号パターン)
|
|
@@ -22,10 +27,11 @@
|
|
|
22
27
|
|
|
23
28
|
## 基本原則
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
- **積極的なリファクタリング** - 技術的負債を防ぎ、健全性を維持
|
|
31
|
+
- **使われない「念のため」のコード禁止** - YAGNI原則(Kent Beck)に反する
|
|
27
32
|
|
|
28
33
|
## コメント記述ルール
|
|
34
|
+
|
|
29
35
|
- **機能説明重視**: コードが「何をするか」を記述
|
|
30
36
|
- **履歴情報禁止**: 開発履歴は記載しない
|
|
31
37
|
- **タイムレス**: いつ読んでも有効な内容のみ記述
|
|
@@ -62,16 +68,6 @@ Martin Fowler「Refactoring」に基づく重複コードの扱い方:
|
|
|
62
68
|
- 共通化により可読性が著しく低下
|
|
63
69
|
- テストコード内の簡単なヘルパー
|
|
64
70
|
|
|
65
|
-
### 実装例
|
|
66
|
-
```typescript
|
|
67
|
-
// ❌ 1回目の重複で即共通化
|
|
68
|
-
function validateUserEmail(email: string) { /* ... */ }
|
|
69
|
-
function validateContactEmail(email: string) { /* ... */ }
|
|
70
|
-
|
|
71
|
-
// ✅ 3回目で共通化
|
|
72
|
-
function validateEmail(email: string, context: 'user' | 'contact' | 'admin') { /* ... */ }
|
|
73
|
-
```
|
|
74
|
-
|
|
75
71
|
## よくある失敗パターンと回避方法
|
|
76
72
|
|
|
77
73
|
### パターン1: エラー修正の連鎖
|
|
@@ -92,20 +88,14 @@ function validateEmail(email: string, context: 'user' | 'contact' | 'admin') { /
|
|
|
92
88
|
### パターン4: 技術的不確実性の無視
|
|
93
89
|
**症状**: 新技術導入時の想定外エラー多発
|
|
94
90
|
**原因**: 事前調査なしで「公式ドキュメント通りなら動くはず」
|
|
95
|
-
**回避方法**:
|
|
91
|
+
**回避方法**:
|
|
96
92
|
- タスクファイル冒頭に確実性評価を記載
|
|
97
|
-
```
|
|
98
|
-
確実性: low(理由: MCP接続の実例がない)
|
|
99
|
-
探索的実装: true
|
|
100
|
-
フォールバック: 従来APIを使用
|
|
101
|
-
```
|
|
102
93
|
- 確実性lowの場合、最初に最小限の動作確認コードを作成
|
|
103
|
-
- 動作確認できたら本実装、できなければフォールバック実行
|
|
104
94
|
|
|
105
95
|
### パターン5: 既存コード調査不足
|
|
106
96
|
**症状**: 重複実装、アーキテクチャ不整合、結合時の障害
|
|
107
97
|
**原因**: 実装前の既存コード理解不足
|
|
108
|
-
**回避方法**:
|
|
98
|
+
**回避方法**:
|
|
109
99
|
- 実装前に類似機能の存在を必ず検索(同じドメイン、責務、設定パターンをキーワードに)
|
|
110
100
|
- 類似機能を発見 → その実装を使用する(新規実装は行わない)
|
|
111
101
|
- 類似機能が技術的負債 → ADRで改善提案を作成してから実装
|
|
@@ -134,16 +124,6 @@ Why5: 破壊的変更を含むメジャーバージョンアップ
|
|
|
134
124
|
- モックで外部依存を置き換え
|
|
135
125
|
- 問題が再現する最小構成を作成
|
|
136
126
|
|
|
137
|
-
### 4. デバッグログ出力
|
|
138
|
-
```typescript
|
|
139
|
-
console.log('DEBUG:', {
|
|
140
|
-
context: 'user-creation',
|
|
141
|
-
input: { email, name },
|
|
142
|
-
state: currentState,
|
|
143
|
-
timestamp: new Date().toISOString()
|
|
144
|
-
})
|
|
145
|
-
```
|
|
146
|
-
|
|
147
127
|
## 型安全性の基礎
|
|
148
128
|
|
|
149
129
|
**型安全の原則**: `unknown`型と型ガードを使用する。`any`型は型チェックを無効化し、実行時エラーの原因となる。
|
|
@@ -161,12 +141,6 @@ function isUser(value: unknown): value is User {
|
|
|
161
141
|
}
|
|
162
142
|
```
|
|
163
143
|
|
|
164
|
-
**モダンな型機能の活用**
|
|
165
|
-
- **satisfies演算子**: `const config = { port: 3000 } satisfies Config` - 型推論維持
|
|
166
|
-
- **const assertion**: `const ROUTES = { HOME: '/' } as const satisfies Routes` - 不変かつ型安全
|
|
167
|
-
- **ブランド型**: `type UserId = string & { __brand: 'UserId' }` - 意味を区別
|
|
168
|
-
- **テンプレートリテラル型**: `type Endpoint = \`\${HttpMethod} \${Route}\`` - 文字列パターンを型で表現
|
|
169
|
-
|
|
170
144
|
**型の複雑性管理**
|
|
171
145
|
- フィールド数: 20個まで(超えたら責務で分割、外部API型は例外)
|
|
172
146
|
- オプショナル率: 30%まで(超えたら必須/任意で分離)
|
|
@@ -185,29 +159,6 @@ function isUser(value: unknown): value is User {
|
|
|
185
159
|
|
|
186
160
|
**優先順位**: 重複コード削除 > 長大な関数分割 > 複雑な条件分岐簡素化 > 型安全性向上
|
|
187
161
|
|
|
188
|
-
## 技術的判断が必要な場面
|
|
189
|
-
|
|
190
|
-
### 抽象化のタイミング
|
|
191
|
-
- 具体的な実装を3回書いてからパターンを抽出
|
|
192
|
-
- YAGNIを意識し、現在必要な機能のみ実装
|
|
193
|
-
- 将来の拡張性より現在のシンプルさを優先
|
|
194
|
-
|
|
195
|
-
### パフォーマンス vs 可読性
|
|
196
|
-
- 明確なボトルネックがない限り可読性を優先
|
|
197
|
-
- 計測してから最適化(推測するな、計測せよ)
|
|
198
|
-
- 最適化する場合はコメントで理由を明記
|
|
199
|
-
|
|
200
|
-
### 型定義の粒度
|
|
201
|
-
- 過度に細かい型は保守性を低下させる
|
|
202
|
-
- ドメインを適切に表現する型を設計
|
|
203
|
-
- ユーティリティ型を活用して重複を削減
|
|
204
|
-
|
|
205
|
-
## 継続的改善のマインドセット
|
|
206
|
-
|
|
207
|
-
- **謙虚**: 完璧なコードは存在しない、フィードバック歓迎
|
|
208
|
-
- **勇気**: 必要なリファクタリングは大胆に実行
|
|
209
|
-
- **透明性**: 技術的な判断理由を明確に記録
|
|
210
|
-
|
|
211
162
|
## 実装作業の完全性担保
|
|
212
163
|
|
|
213
164
|
### 影響範囲調査の必須手順
|
|
@@ -246,23 +197,10 @@ Grep -n "targetData\|SetData\|UpdateData" -o content
|
|
|
246
197
|
|
|
247
198
|
対象: コード・ドキュメント・設定ファイル
|
|
248
199
|
|
|
249
|
-
### 既存コード削除判断フロー
|
|
250
|
-
|
|
251
|
-
```
|
|
252
|
-
使用中? No → 即削除(Git履歴に残る)
|
|
253
|
-
Yes → 動作? No → 削除+再実装
|
|
254
|
-
Yes → 修正
|
|
255
|
-
```
|
|
256
|
-
|
|
257
200
|
## Red-Green-Refactorプロセス(テストファースト開発)
|
|
258
201
|
|
|
259
202
|
**推奨原則**: コード変更は必ずテストから始める
|
|
260
203
|
|
|
261
|
-
**背景**:
|
|
262
|
-
- 変更前の動作を保証し、リグレッションを防止
|
|
263
|
-
- 期待する動作を明確化してから実装
|
|
264
|
-
- リファクタリング時の安全性を確保
|
|
265
|
-
|
|
266
204
|
**開発ステップ**:
|
|
267
205
|
1. **Red**: 期待する動作のテストを書く(失敗する)
|
|
268
206
|
2. **Green**: 最小限の実装でテストを通す
|
|
@@ -288,11 +226,11 @@ Grep -n "targetData\|SetData\|UpdateData" -o content
|
|
|
288
226
|
|
|
289
227
|
### モックとスタブの使用方針
|
|
290
228
|
|
|
291
|
-
|
|
229
|
+
**推奨: 単体テストでの外部依存モック化**
|
|
292
230
|
- メリット: テストの独立性と再現性を確保
|
|
293
231
|
- 実践: DB、API、ファイルシステム等の外部依存をモック化
|
|
294
232
|
|
|
295
|
-
|
|
233
|
+
**避けるべき: 単体テストでの実際の外部接続**
|
|
296
234
|
- 理由: テスト速度が遅くなり、環境依存の問題が発生するため
|
|
297
235
|
|
|
298
236
|
### テスト失敗時の対応判断基準
|
|
@@ -301,33 +239,8 @@ Grep -n "targetData\|SetData\|UpdateData" -o content
|
|
|
301
239
|
**実装を修正**: 妥当な仕様、ビジネスロジック、重要なエッジケース
|
|
302
240
|
**判断に迷ったら**: ユーザーに確認
|
|
303
241
|
|
|
304
|
-
## テストヘルパーの活用ルール
|
|
305
|
-
|
|
306
|
-
### 基本原則
|
|
307
|
-
テストヘルパーは、テストコードの重複を減らし、保守性を高めるために活用します。
|
|
308
|
-
|
|
309
|
-
### 判断基準
|
|
310
|
-
| モックの特性 | 対応方針 |
|
|
311
|
-
|-------------|---------|
|
|
312
|
-
| **単純で安定** | 共通ヘルパーに集約 |
|
|
313
|
-
| **複雑または変更頻度高** | 個別実装 |
|
|
314
|
-
| **3箇所以上で重複** | 共通化を検討 |
|
|
315
|
-
| **テスト固有ロジック** | 個別実装 |
|
|
316
|
-
|
|
317
242
|
## テストの粒度原則
|
|
318
243
|
|
|
319
244
|
### 原則:観測可能な振る舞いのみ
|
|
320
245
|
**テスト対象**:公開API、戻り値、例外、外部呼び出し、永続化された状態
|
|
321
246
|
**テスト対象外**:privateメソッド、内部状態、アルゴリズム詳細
|
|
322
|
-
|
|
323
|
-
```typescript
|
|
324
|
-
// ✅ 振る舞いをテスト
|
|
325
|
-
expect(calculatePrice(100, 0.1)).toBe(110)
|
|
326
|
-
|
|
327
|
-
// ❌ 実装詳細をテスト
|
|
328
|
-
expect((calculator as any).taxRate).toBe(0.1)
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
## 継続性テストの範囲
|
|
332
|
-
|
|
333
|
-
新機能追加時の既存機能への影響確認に限定。長時間運用・負荷テストはインフラ層の責務のため対象外。
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-criteria
|
|
3
|
+
description: PRD、ADR、Design Doc、作業計画書を含むドキュメント作成基準とテンプレート。
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# ドキュメント作成基準
|
|
2
7
|
|
|
3
8
|
## 作成判定マトリクス
|
|
@@ -147,10 +152,10 @@
|
|
|
147
152
|
|
|
148
153
|
| ドキュメント | パス | 命名規則 | テンプレート |
|
|
149
154
|
|------------|-----|---------|------------|
|
|
150
|
-
| PRD | `docs/prd/` | `[機能名]-prd.md` | `template
|
|
151
|
-
| ADR | `docs/adr/` | `ADR-[4桁]-[タイトル].md` | `template
|
|
152
|
-
| Design Doc | `docs/design/` | `[機能名]-design.md` | `template
|
|
153
|
-
| 作業計画書 | `docs/plans/` | `YYYYMMDD-{type}-{description}.md` | `template
|
|
155
|
+
| PRD | `docs/prd/` | `[機能名]-prd.md` | `prd-template.md` |
|
|
156
|
+
| ADR | `docs/adr/` | `ADR-[4桁]-[タイトル].md` | `adr-template.md` |
|
|
157
|
+
| Design Doc | `docs/design/` | `[機能名]-design.md` | `design-template.md` |
|
|
158
|
+
| 作業計画書 | `docs/plans/` | `YYYYMMDD-{type}-{description}.md` | `plan-template.md` |
|
|
154
159
|
|
|
155
160
|
※作業計画書は`.gitignore`で除外
|
|
156
161
|
|
|
@@ -177,4 +182,12 @@
|
|
|
177
182
|
1. **作成時**: 共通技術領域(ログ、エラーハンドリング、非同期処理等)を特定し、既存共通ADRを参照
|
|
178
183
|
2. **不足時**: 必要な共通ADRが存在しない場合は作成を検討
|
|
179
184
|
3. **Design Doc**: 「前提となるADR」セクションで共通ADRを明記
|
|
180
|
-
4. **準拠確認**: 設計が共通ADRの決定事項と整合しているかを検証
|
|
185
|
+
4. **準拠確認**: 設計が共通ADRの決定事項と整合しているかを検証
|
|
186
|
+
|
|
187
|
+
## テンプレート
|
|
188
|
+
|
|
189
|
+
テンプレートは`references/`ディレクトリにあります:
|
|
190
|
+
- [Design Documentテンプレート](references/design-template.md)
|
|
191
|
+
- [PRDテンプレート](references/prd-template.md)
|
|
192
|
+
- [作業計画書テンプレート](references/plan-template.md)
|
|
193
|
+
- [ADRテンプレート](references/adr-template.md)
|