cp-toolkit 2.2.3 → 2.2.4

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 (71) hide show
  1. package/package.json +1 -1
  2. package/src/commands/add.js +23 -16
  3. package/src/commands/doctor.js +15 -10
  4. package/src/commands/init.js +55 -16
  5. package/templates/AGENTS.md +47 -0
  6. package/templates/ARCHITECTURE.md +42 -0
  7. package/templates/agents/backend-specialist.md +1 -0
  8. package/templates/agents/code-archaeologist.md +116 -106
  9. package/templates/agents/database-architect.md +1 -0
  10. package/templates/agents/debugger.md +1 -0
  11. package/templates/agents/devops-engineer.md +1 -0
  12. package/templates/agents/documentation-writer.md +1 -0
  13. package/templates/agents/explorer-agent.md +83 -73
  14. package/templates/agents/frontend-specialist.md +1 -0
  15. package/templates/agents/game-developer.md +1 -0
  16. package/templates/agents/mobile-developer.md +1 -0
  17. package/templates/agents/orchestrator.md +426 -416
  18. package/templates/agents/penetration-tester.md +1 -0
  19. package/templates/agents/performance-optimizer.md +1 -0
  20. package/templates/agents/product-manager.md +122 -112
  21. package/templates/agents/product-owner.md +105 -95
  22. package/templates/agents/project-planner.md +416 -406
  23. package/templates/agents/qa-automation-engineer.md +113 -103
  24. package/templates/agents/security-auditor.md +1 -0
  25. package/templates/agents/seo-specialist.md +1 -0
  26. package/templates/agents/test-engineer.md +1 -0
  27. package/templates/skills/core/behavioral-modes/SKILL.md +244 -242
  28. package/templates/skills/core/brainstorming/SKILL.md +166 -163
  29. package/templates/skills/core/mcp-builder/SKILL.md +178 -176
  30. package/templates/skills/core/parallel-agents/SKILL.md +187 -175
  31. package/templates/skills/core/plan-writing/SKILL.md +154 -152
  32. package/templates/skills/optional/api-patterns/SKILL.md +83 -81
  33. package/templates/skills/optional/app-builder/SKILL.md +78 -75
  34. package/templates/skills/optional/app-builder/templates/SKILL.md +41 -39
  35. package/templates/skills/optional/architecture/SKILL.md +58 -55
  36. package/templates/skills/optional/bash-linux/SKILL.md +201 -199
  37. package/templates/skills/optional/code-review-checklist/SKILL.md +110 -109
  38. package/templates/skills/optional/database-design/SKILL.md +54 -52
  39. package/templates/skills/optional/deployment-procedures/SKILL.md +243 -241
  40. package/templates/skills/optional/documentation-templates/SKILL.md +196 -194
  41. package/templates/skills/optional/frontend-design/SKILL.md +421 -418
  42. package/templates/skills/optional/game-development/2d-games/SKILL.md +120 -119
  43. package/templates/skills/optional/game-development/3d-games/SKILL.md +136 -135
  44. package/templates/skills/optional/game-development/SKILL.md +169 -167
  45. package/templates/skills/optional/game-development/game-art/SKILL.md +187 -185
  46. package/templates/skills/optional/game-development/game-audio/SKILL.md +192 -190
  47. package/templates/skills/optional/game-development/game-design/SKILL.md +131 -129
  48. package/templates/skills/optional/game-development/mobile-games/SKILL.md +110 -108
  49. package/templates/skills/optional/game-development/multiplayer/SKILL.md +133 -132
  50. package/templates/skills/optional/game-development/pc-games/SKILL.md +146 -144
  51. package/templates/skills/optional/game-development/vr-ar/SKILL.md +124 -123
  52. package/templates/skills/optional/game-development/web-games/SKILL.md +152 -150
  53. package/templates/skills/optional/geo-fundamentals/SKILL.md +158 -156
  54. package/templates/skills/optional/i18n-localization/SKILL.md +156 -154
  55. package/templates/skills/optional/lint-and-validate/SKILL.md +48 -45
  56. package/templates/skills/optional/mobile-design/SKILL.md +397 -394
  57. package/templates/skills/optional/nextjs-react-expert/SKILL.md +271 -267
  58. package/templates/skills/optional/nodejs-best-practices/SKILL.md +335 -333
  59. package/templates/skills/optional/performance-profiling/SKILL.md +145 -143
  60. package/templates/skills/optional/powershell-windows/SKILL.md +169 -167
  61. package/templates/skills/optional/python-patterns/SKILL.md +443 -441
  62. package/templates/skills/optional/red-team-tactics/SKILL.md +201 -199
  63. package/templates/skills/optional/seo-fundamentals/SKILL.md +130 -129
  64. package/templates/skills/optional/server-management/SKILL.md +163 -161
  65. package/templates/skills/optional/systematic-debugging/SKILL.md +111 -109
  66. package/templates/skills/optional/tailwind-patterns/SKILL.md +271 -269
  67. package/templates/skills/optional/tdd-workflow/SKILL.md +150 -149
  68. package/templates/skills/optional/testing-patterns/SKILL.md +179 -178
  69. package/templates/skills/optional/vulnerability-scanner/SKILL.md +278 -276
  70. package/templates/skills/optional/web-design-guidelines/SKILL.md +60 -57
  71. package/templates/skills/optional/webapp-testing/SKILL.md +188 -187
@@ -1,149 +1,150 @@
1
- ---
2
- name: tdd-workflow
3
- description: Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash
5
- ---
6
-
7
- # TDD Workflow
8
-
9
- > Write tests first, code second.
10
-
11
- ---
12
-
13
- ## 1. The TDD Cycle
14
-
15
- ```
16
- 🔴 RED → Write failing test
17
-
18
- 🟢 GREEN → Write minimal code to pass
19
-
20
- 🔵 REFACTOR → Improve code quality
21
-
22
- Repeat...
23
- ```
24
-
25
- ---
26
-
27
- ## 2. The Three Laws of TDD
28
-
29
- 1. Write production code only to make a failing test pass
30
- 2. Write only enough test to demonstrate failure
31
- 3. Write only enough code to make the test pass
32
-
33
- ---
34
-
35
- ## 3. RED Phase Principles
36
-
37
- ### What to Write
38
-
39
- | Focus | Example |
40
- |-------|---------|
41
- | Behavior | "should add two numbers" |
42
- | Edge cases | "should handle empty input" |
43
- | Error states | "should throw for invalid data" |
44
-
45
- ### RED Phase Rules
46
-
47
- - Test must fail first
48
- - Test name describes expected behavior
49
- - One assertion per test (ideally)
50
-
51
- ---
52
-
53
- ## 4. GREEN Phase Principles
54
-
55
- ### Minimum Code
56
-
57
- | Principle | Meaning |
58
- |-----------|---------|
59
- | **YAGNI** | You Aren't Gonna Need It |
60
- | **Simplest thing** | Write the minimum to pass |
61
- | **No optimization** | Just make it work |
62
-
63
- ### GREEN Phase Rules
64
-
65
- - Don't write unneeded code
66
- - Don't optimize yet
67
- - Pass the test, nothing more
68
-
69
- ---
70
-
71
- ## 5. REFACTOR Phase Principles
72
-
73
- ### What to Improve
74
-
75
- | Area | Action |
76
- |------|--------|
77
- | Duplication | Extract common code |
78
- | Naming | Make intent clear |
79
- | Structure | Improve organization |
80
- | Complexity | Simplify logic |
81
-
82
- ### REFACTOR Rules
83
-
84
- - All tests must stay green
85
- - Small incremental changes
86
- - Commit after each refactor
87
-
88
- ---
89
-
90
- ## 6. AAA Pattern
91
-
92
- Every test follows:
93
-
94
- | Step | Purpose |
95
- |------|---------|
96
- | **Arrange** | Set up test data |
97
- | **Act** | Execute code under test |
98
- | **Assert** | Verify expected outcome |
99
-
100
- ---
101
-
102
- ## 7. When to Use TDD
103
-
104
- | Scenario | TDD Value |
105
- |----------|-----------|
106
- | New feature | High |
107
- | Bug fix | High (write test first) |
108
- | Complex logic | High |
109
- | Exploratory | Low (spike, then TDD) |
110
- | UI layout | Low |
111
-
112
- ---
113
-
114
- ## 8. Test Prioritization
115
-
116
- | Priority | Test Type |
117
- |----------|-----------|
118
- | 1 | Happy path |
119
- | 2 | Error cases |
120
- | 3 | Edge cases |
121
- | 4 | Performance |
122
-
123
- ---
124
-
125
- ## 9. Anti-Patterns
126
-
127
- | ❌ Don't | ✅ Do |
128
- |----------|-------|
129
- | Skip the RED phase | Watch test fail first |
130
- | Write tests after | Write tests before |
131
- | Over-engineer initial | Keep it simple |
132
- | Multiple asserts | One behavior per test |
133
- | Test implementation | Test behavior |
134
-
135
- ---
136
-
137
- ## 10. AI-Augmented TDD
138
-
139
- ### Multi-Agent Pattern
140
-
141
- | Agent | Role |
142
- |-------|------|
143
- | Agent A | Write failing tests (RED) |
144
- | Agent B | Implement to pass (GREEN) |
145
- | Agent C | Optimize (REFACTOR) |
146
-
147
- ---
148
-
149
- > **Remember:** The test is the specification. If you can't write a test, you don't understand the requirement.
1
+ ---
2
+ name: tdd-workflow
3
+ description: Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
5
+ version: '1.0'
6
+ ---
7
+
8
+ # TDD Workflow
9
+
10
+ > Write tests first, code second.
11
+
12
+ ---
13
+
14
+ ## 1. The TDD Cycle
15
+
16
+ ```
17
+ 🔴 RED → Write failing test
18
+
19
+ 🟢 GREEN → Write minimal code to pass
20
+
21
+ 🔵 REFACTOR → Improve code quality
22
+
23
+ Repeat...
24
+ ```
25
+
26
+ ---
27
+
28
+ ## 2. The Three Laws of TDD
29
+
30
+ 1. Write production code only to make a failing test pass
31
+ 2. Write only enough test to demonstrate failure
32
+ 3. Write only enough code to make the test pass
33
+
34
+ ---
35
+
36
+ ## 3. RED Phase Principles
37
+
38
+ ### What to Write
39
+
40
+ | Focus | Example |
41
+ |-------|---------|
42
+ | Behavior | "should add two numbers" |
43
+ | Edge cases | "should handle empty input" |
44
+ | Error states | "should throw for invalid data" |
45
+
46
+ ### RED Phase Rules
47
+
48
+ - Test must fail first
49
+ - Test name describes expected behavior
50
+ - One assertion per test (ideally)
51
+
52
+ ---
53
+
54
+ ## 4. GREEN Phase Principles
55
+
56
+ ### Minimum Code
57
+
58
+ | Principle | Meaning |
59
+ |-----------|---------|
60
+ | **YAGNI** | You Aren't Gonna Need It |
61
+ | **Simplest thing** | Write the minimum to pass |
62
+ | **No optimization** | Just make it work |
63
+
64
+ ### GREEN Phase Rules
65
+
66
+ - Don't write unneeded code
67
+ - Don't optimize yet
68
+ - Pass the test, nothing more
69
+
70
+ ---
71
+
72
+ ## 5. REFACTOR Phase Principles
73
+
74
+ ### What to Improve
75
+
76
+ | Area | Action |
77
+ |------|--------|
78
+ | Duplication | Extract common code |
79
+ | Naming | Make intent clear |
80
+ | Structure | Improve organization |
81
+ | Complexity | Simplify logic |
82
+
83
+ ### REFACTOR Rules
84
+
85
+ - All tests must stay green
86
+ - Small incremental changes
87
+ - Commit after each refactor
88
+
89
+ ---
90
+
91
+ ## 6. AAA Pattern
92
+
93
+ Every test follows:
94
+
95
+ | Step | Purpose |
96
+ |------|---------|
97
+ | **Arrange** | Set up test data |
98
+ | **Act** | Execute code under test |
99
+ | **Assert** | Verify expected outcome |
100
+
101
+ ---
102
+
103
+ ## 7. When to Use TDD
104
+
105
+ | Scenario | TDD Value |
106
+ |----------|-----------|
107
+ | New feature | High |
108
+ | Bug fix | High (write test first) |
109
+ | Complex logic | High |
110
+ | Exploratory | Low (spike, then TDD) |
111
+ | UI layout | Low |
112
+
113
+ ---
114
+
115
+ ## 8. Test Prioritization
116
+
117
+ | Priority | Test Type |
118
+ |----------|-----------|
119
+ | 1 | Happy path |
120
+ | 2 | Error cases |
121
+ | 3 | Edge cases |
122
+ | 4 | Performance |
123
+
124
+ ---
125
+
126
+ ## 9. Anti-Patterns
127
+
128
+ | ❌ Don't | ✅ Do |
129
+ |----------|-------|
130
+ | Skip the RED phase | Watch test fail first |
131
+ | Write tests after | Write tests before |
132
+ | Over-engineer initial | Keep it simple |
133
+ | Multiple asserts | One behavior per test |
134
+ | Test implementation | Test behavior |
135
+
136
+ ---
137
+
138
+ ## 10. AI-Augmented TDD
139
+
140
+ ### Multi-Agent Pattern
141
+
142
+ | Agent | Role |
143
+ |-------|------|
144
+ | Agent A | Write failing tests (RED) |
145
+ | Agent B | Implement to pass (GREEN) |
146
+ | Agent C | Optimize (REFACTOR) |
147
+
148
+ ---
149
+
150
+ > **Remember:** The test is the specification. If you can't write a test, you don't understand the requirement.
@@ -1,178 +1,179 @@
1
- ---
2
- name: testing-patterns
3
- description: Testing patterns and principles. Unit, integration, mocking strategies.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash
5
- ---
6
-
7
- # Testing Patterns
8
-
9
- > Principles for reliable test suites.
10
-
11
- ---
12
-
13
- ## 1. Testing Pyramid
14
-
15
- ```
16
- /\ E2E (Few)
17
- / \ Critical flows
18
- /----\
19
- / \ Integration (Some)
20
- /--------\ API, DB queries
21
- / \
22
- /------------\ Unit (Many)
23
- Functions, classes
24
- ```
25
-
26
- ---
27
-
28
- ## 2. AAA Pattern
29
-
30
- | Step | Purpose |
31
- |------|---------|
32
- | **Arrange** | Set up test data |
33
- | **Act** | Execute code under test |
34
- | **Assert** | Verify outcome |
35
-
36
- ---
37
-
38
- ## 3. Test Type Selection
39
-
40
- ### When to Use Each
41
-
42
- | Type | Best For | Speed |
43
- |------|----------|-------|
44
- | **Unit** | Pure functions, logic | Fast (<50ms) |
45
- | **Integration** | API, DB, services | Medium |
46
- | **E2E** | Critical user flows | Slow |
47
-
48
- ---
49
-
50
- ## 4. Unit Test Principles
51
-
52
- ### Good Unit Tests
53
-
54
- | Principle | Meaning |
55
- |-----------|---------|
56
- | Fast | < 100ms each |
57
- | Isolated | No external deps |
58
- | Repeatable | Same result always |
59
- | Self-checking | No manual verification |
60
- | Timely | Written with code |
61
-
62
- ### What to Unit Test
63
-
64
- | Test | Don't Test |
65
- |------|------------|
66
- | Business logic | Framework code |
67
- | Edge cases | Third-party libs |
68
- | Error handling | Simple getters |
69
-
70
- ---
71
-
72
- ## 5. Integration Test Principles
73
-
74
- ### What to Test
75
-
76
- | Area | Focus |
77
- |------|-------|
78
- | API endpoints | Request/response |
79
- | Database | Queries, transactions |
80
- | External services | Contracts |
81
-
82
- ### Setup/Teardown
83
-
84
- | Phase | Action |
85
- |-------|--------|
86
- | Before All | Connect resources |
87
- | Before Each | Reset state |
88
- | After Each | Clean up |
89
- | After All | Disconnect |
90
-
91
- ---
92
-
93
- ## 6. Mocking Principles
94
-
95
- ### When to Mock
96
-
97
- | Mock | Don't Mock |
98
- |------|------------|
99
- | External APIs | The code under test |
100
- | Database (unit) | Simple dependencies |
101
- | Time/random | Pure functions |
102
- | Network | In-memory stores |
103
-
104
- ### Mock Types
105
-
106
- | Type | Use |
107
- |------|-----|
108
- | Stub | Return fixed values |
109
- | Spy | Track calls |
110
- | Mock | Set expectations |
111
- | Fake | Simplified implementation |
112
-
113
- ---
114
-
115
- ## 7. Test Organization
116
-
117
- ### Naming
118
-
119
- | Pattern | Example |
120
- |---------|---------|
121
- | Should behavior | "should return error when..." |
122
- | When condition | "when user not found..." |
123
- | Given-when-then | "given X, when Y, then Z" |
124
-
125
- ### Grouping
126
-
127
- | Level | Use |
128
- |-------|-----|
129
- | describe | Group related tests |
130
- | it/test | Individual case |
131
- | beforeEach | Common setup |
132
-
133
- ---
134
-
135
- ## 8. Test Data
136
-
137
- ### Strategies
138
-
139
- | Approach | Use |
140
- |----------|-----|
141
- | Factories | Generate test data |
142
- | Fixtures | Predefined datasets |
143
- | Builders | Fluent object creation |
144
-
145
- ### Principles
146
-
147
- - Use realistic data
148
- - Randomize non-essential values (faker)
149
- - Share common fixtures
150
- - Keep data minimal
151
-
152
- ---
153
-
154
- ## 9. Best Practices
155
-
156
- | Practice | Why |
157
- |----------|-----|
158
- | One assert per test | Clear failure reason |
159
- | Independent tests | No order dependency |
160
- | Fast tests | Run frequently |
161
- | Descriptive names | Self-documenting |
162
- | Clean up | Avoid side effects |
163
-
164
- ---
165
-
166
- ## 10. Anti-Patterns
167
-
168
- | ❌ Don't | ✅ Do |
169
- |----------|-------|
170
- | Test implementation | Test behavior |
171
- | Duplicate test code | Use factories |
172
- | Complex test setup | Simplify or split |
173
- | Ignore flaky tests | Fix root cause |
174
- | Skip cleanup | Reset state |
175
-
176
- ---
177
-
178
- > **Remember:** Tests are documentation. If someone can't understand what the code does from the tests, rewrite them.
1
+ ---
2
+ name: testing-patterns
3
+ description: Testing patterns and principles. Unit, integration, mocking strategies.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
5
+ version: '1.0'
6
+ ---
7
+
8
+ # Testing Patterns
9
+
10
+ > Principles for reliable test suites.
11
+
12
+ ---
13
+
14
+ ## 1. Testing Pyramid
15
+
16
+ ```
17
+ /\ E2E (Few)
18
+ / \ Critical flows
19
+ /----\
20
+ / \ Integration (Some)
21
+ /--------\ API, DB queries
22
+ / \
23
+ /------------\ Unit (Many)
24
+ Functions, classes
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 2. AAA Pattern
30
+
31
+ | Step | Purpose |
32
+ |------|---------|
33
+ | **Arrange** | Set up test data |
34
+ | **Act** | Execute code under test |
35
+ | **Assert** | Verify outcome |
36
+
37
+ ---
38
+
39
+ ## 3. Test Type Selection
40
+
41
+ ### When to Use Each
42
+
43
+ | Type | Best For | Speed |
44
+ |------|----------|-------|
45
+ | **Unit** | Pure functions, logic | Fast (<50ms) |
46
+ | **Integration** | API, DB, services | Medium |
47
+ | **E2E** | Critical user flows | Slow |
48
+
49
+ ---
50
+
51
+ ## 4. Unit Test Principles
52
+
53
+ ### Good Unit Tests
54
+
55
+ | Principle | Meaning |
56
+ |-----------|---------|
57
+ | Fast | < 100ms each |
58
+ | Isolated | No external deps |
59
+ | Repeatable | Same result always |
60
+ | Self-checking | No manual verification |
61
+ | Timely | Written with code |
62
+
63
+ ### What to Unit Test
64
+
65
+ | Test | Don't Test |
66
+ |------|------------|
67
+ | Business logic | Framework code |
68
+ | Edge cases | Third-party libs |
69
+ | Error handling | Simple getters |
70
+
71
+ ---
72
+
73
+ ## 5. Integration Test Principles
74
+
75
+ ### What to Test
76
+
77
+ | Area | Focus |
78
+ |------|-------|
79
+ | API endpoints | Request/response |
80
+ | Database | Queries, transactions |
81
+ | External services | Contracts |
82
+
83
+ ### Setup/Teardown
84
+
85
+ | Phase | Action |
86
+ |-------|--------|
87
+ | Before All | Connect resources |
88
+ | Before Each | Reset state |
89
+ | After Each | Clean up |
90
+ | After All | Disconnect |
91
+
92
+ ---
93
+
94
+ ## 6. Mocking Principles
95
+
96
+ ### When to Mock
97
+
98
+ | Mock | Don't Mock |
99
+ |------|------------|
100
+ | External APIs | The code under test |
101
+ | Database (unit) | Simple dependencies |
102
+ | Time/random | Pure functions |
103
+ | Network | In-memory stores |
104
+
105
+ ### Mock Types
106
+
107
+ | Type | Use |
108
+ |------|-----|
109
+ | Stub | Return fixed values |
110
+ | Spy | Track calls |
111
+ | Mock | Set expectations |
112
+ | Fake | Simplified implementation |
113
+
114
+ ---
115
+
116
+ ## 7. Test Organization
117
+
118
+ ### Naming
119
+
120
+ | Pattern | Example |
121
+ |---------|---------|
122
+ | Should behavior | "should return error when..." |
123
+ | When condition | "when user not found..." |
124
+ | Given-when-then | "given X, when Y, then Z" |
125
+
126
+ ### Grouping
127
+
128
+ | Level | Use |
129
+ |-------|-----|
130
+ | describe | Group related tests |
131
+ | it/test | Individual case |
132
+ | beforeEach | Common setup |
133
+
134
+ ---
135
+
136
+ ## 8. Test Data
137
+
138
+ ### Strategies
139
+
140
+ | Approach | Use |
141
+ |----------|-----|
142
+ | Factories | Generate test data |
143
+ | Fixtures | Predefined datasets |
144
+ | Builders | Fluent object creation |
145
+
146
+ ### Principles
147
+
148
+ - Use realistic data
149
+ - Randomize non-essential values (faker)
150
+ - Share common fixtures
151
+ - Keep data minimal
152
+
153
+ ---
154
+
155
+ ## 9. Best Practices
156
+
157
+ | Practice | Why |
158
+ |----------|-----|
159
+ | One assert per test | Clear failure reason |
160
+ | Independent tests | No order dependency |
161
+ | Fast tests | Run frequently |
162
+ | Descriptive names | Self-documenting |
163
+ | Clean up | Avoid side effects |
164
+
165
+ ---
166
+
167
+ ## 10. Anti-Patterns
168
+
169
+ | ❌ Don't | ✅ Do |
170
+ |----------|-------|
171
+ | Test implementation | Test behavior |
172
+ | Duplicate test code | Use factories |
173
+ | Complex test setup | Simplify or split |
174
+ | Ignore flaky tests | Fix root cause |
175
+ | Skip cleanup | Reset state |
176
+
177
+ ---
178
+
179
+ > **Remember:** Tests are documentation. If someone can't understand what the code does from the tests, rewrite them.