thatgfsj-code 2.2.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/CHANGELOG.md +15 -67
  2. package/dist/app/index.d.ts +28 -5
  3. package/dist/app/index.d.ts.map +1 -1
  4. package/dist/app/index.js +69 -10
  5. package/dist/app/index.js.map +1 -1
  6. package/dist/cache/fingerprint.d.ts +49 -0
  7. package/dist/cache/fingerprint.d.ts.map +1 -0
  8. package/dist/cache/fingerprint.js +100 -0
  9. package/dist/cache/fingerprint.js.map +1 -0
  10. package/dist/cache/index.d.ts +15 -0
  11. package/dist/cache/index.d.ts.map +1 -0
  12. package/dist/cache/index.js +15 -0
  13. package/dist/cache/index.js.map +1 -0
  14. package/dist/cache/smartModel.d.ts +40 -0
  15. package/dist/cache/smartModel.d.ts.map +1 -0
  16. package/dist/cache/smartModel.js +43 -0
  17. package/dist/cache/smartModel.js.map +1 -0
  18. package/dist/cache/stats.d.ts +93 -0
  19. package/dist/cache/stats.d.ts.map +1 -0
  20. package/dist/cache/stats.js +155 -0
  21. package/dist/cache/stats.js.map +1 -0
  22. package/dist/cache/volatile.d.ts +32 -0
  23. package/dist/cache/volatile.d.ts.map +1 -0
  24. package/dist/cache/volatile.js +44 -0
  25. package/dist/cache/volatile.js.map +1 -0
  26. package/dist/cmd/index.js +49 -57
  27. package/dist/cmd/index.js.map +1 -1
  28. package/dist/config/index.d.ts.map +1 -1
  29. package/dist/config/index.js +8 -0
  30. package/dist/config/index.js.map +1 -1
  31. package/dist/config/types.d.ts +14 -0
  32. package/dist/config/types.d.ts.map +1 -1
  33. package/dist/llm/anthropic.d.ts +55 -5
  34. package/dist/llm/anthropic.d.ts.map +1 -1
  35. package/dist/llm/anthropic.js +172 -26
  36. package/dist/llm/anthropic.js.map +1 -1
  37. package/dist/llm/index.d.ts +26 -8
  38. package/dist/llm/index.d.ts.map +1 -1
  39. package/dist/llm/index.js +83 -15
  40. package/dist/llm/index.js.map +1 -1
  41. package/dist/llm/openai.d.ts +28 -8
  42. package/dist/llm/openai.d.ts.map +1 -1
  43. package/dist/llm/openai.js +58 -8
  44. package/dist/llm/openai.js.map +1 -1
  45. package/dist/llm/provider.d.ts +40 -8
  46. package/dist/llm/provider.d.ts.map +1 -1
  47. package/dist/llm/provider.js +8 -1
  48. package/dist/llm/provider.js.map +1 -1
  49. package/dist/prompts/index.d.ts +32 -0
  50. package/dist/prompts/index.d.ts.map +1 -1
  51. package/dist/prompts/index.js +33 -11
  52. package/dist/prompts/index.js.map +1 -1
  53. package/dist/session/index.d.ts +32 -3
  54. package/dist/session/index.d.ts.map +1 -1
  55. package/dist/session/index.js +51 -36
  56. package/dist/session/index.js.map +1 -1
  57. package/dist/skills/brainstorming.js +33 -33
  58. package/dist/skills/code-review.js +35 -35
  59. package/dist/skills/executing-plans.js +18 -18
  60. package/dist/skills/frontend-design.js +25 -25
  61. package/dist/skills/git-workflow.js +26 -26
  62. package/dist/skills/improve-architecture.js +28 -28
  63. package/dist/skills/neuroweave.js +37 -37
  64. package/dist/skills/playwright.js +62 -62
  65. package/dist/skills/prototype.js +20 -20
  66. package/dist/skills/subagent.js +19 -19
  67. package/dist/skills/supabase.js +34 -34
  68. package/dist/skills/systematic-debugging.js +34 -34
  69. package/dist/skills/tdd.js +29 -29
  70. package/dist/skills/triage.js +25 -25
  71. package/dist/skills/verification.js +22 -22
  72. package/dist/skills/writing-plans.js +32 -32
  73. package/dist/tools/nwt.js +16 -16
  74. package/dist/tui/app.d.ts.map +1 -1
  75. package/dist/tui/app.js +9 -2
  76. package/dist/tui/app.js.map +1 -1
  77. package/dist/tui/components/Header.d.ts +8 -0
  78. package/dist/tui/components/Header.d.ts.map +1 -1
  79. package/dist/tui/components/Header.js +17 -4
  80. package/dist/tui/components/Header.js.map +1 -1
  81. package/dist/tui/components/InitWizard.d.ts +12 -1
  82. package/dist/tui/components/InitWizard.d.ts.map +1 -1
  83. package/dist/tui/components/InitWizard.js +58 -3
  84. package/dist/tui/components/InitWizard.js.map +1 -1
  85. package/dist/tui/components/ToolCall.d.ts.map +1 -1
  86. package/dist/tui/components/ToolCall.js +1 -6
  87. package/dist/tui/components/ToolCall.js.map +1 -1
  88. package/dist/tui/hooks/useChat.d.ts +22 -0
  89. package/dist/tui/hooks/useChat.d.ts.map +1 -1
  90. package/dist/tui/hooks/useChat.js +82 -46
  91. package/dist/tui/hooks/useChat.js.map +1 -1
  92. package/dist/tui/hooks/useCommands.d.ts.map +1 -1
  93. package/dist/tui/hooks/useCommands.js +57 -0
  94. package/dist/tui/hooks/useCommands.js.map +1 -1
  95. package/dist/tui/welcome.d.ts.map +1 -1
  96. package/dist/tui/welcome.js +2 -3
  97. package/dist/tui/welcome.js.map +1 -1
  98. package/dist/types.d.ts +79 -6
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/types.js +7 -0
  101. package/dist/types.js.map +1 -1
  102. package/dist/utils/stableStringify.d.ts +21 -0
  103. package/dist/utils/stableStringify.d.ts.map +1 -0
  104. package/dist/utils/stableStringify.js +53 -0
  105. package/dist/utils/stableStringify.js.map +1 -0
  106. package/dist/utils/thinking.d.ts.map +1 -1
  107. package/dist/utils/thinking.js +0 -3
  108. package/dist/utils/thinking.js.map +1 -1
  109. package/package.json +6 -6
  110. package/src/app/index.ts +180 -124
  111. package/src/cache/fingerprint.ts +101 -0
  112. package/src/cache/index.ts +15 -0
  113. package/src/cache/smartModel.ts +52 -0
  114. package/src/cache/stats.ts +199 -0
  115. package/src/cache/volatile.ts +47 -0
  116. package/src/cmd/index.tsx +288 -292
  117. package/src/config/index.ts +156 -148
  118. package/src/config/providers.ts +234 -234
  119. package/src/config/types.ts +67 -53
  120. package/src/hooks/index.ts +111 -111
  121. package/src/llm/anthropic.ts +388 -243
  122. package/src/llm/gemini.ts +169 -169
  123. package/src/llm/index.ts +265 -200
  124. package/src/llm/openai.ts +243 -196
  125. package/src/llm/provider.ts +66 -34
  126. package/src/prompts/index.ts +260 -220
  127. package/src/session/compactor.ts +103 -103
  128. package/src/session/index.ts +181 -168
  129. package/src/session/message.ts +42 -42
  130. package/src/skills/brainstorming.ts +43 -43
  131. package/src/skills/code-review.ts +45 -45
  132. package/src/skills/executing-plans.ts +27 -27
  133. package/src/skills/frontend-design.ts +35 -35
  134. package/src/skills/git-workflow.ts +36 -36
  135. package/src/skills/improve-architecture.ts +38 -38
  136. package/src/skills/index.ts +136 -136
  137. package/src/skills/neuroweave.ts +47 -47
  138. package/src/skills/playwright.ts +72 -72
  139. package/src/skills/prototype.ts +30 -30
  140. package/src/skills/subagent.ts +28 -28
  141. package/src/skills/supabase.ts +44 -44
  142. package/src/skills/systematic-debugging.ts +44 -44
  143. package/src/skills/tdd.ts +39 -39
  144. package/src/skills/triage.ts +35 -35
  145. package/src/skills/verification.ts +31 -31
  146. package/src/skills/writing-plans.ts +42 -42
  147. package/src/tools/nwt.ts +598 -598
  148. package/src/tools/types.ts +122 -122
  149. package/src/tui/app.tsx +199 -186
  150. package/src/tui/components/ChatList.tsx +41 -41
  151. package/src/tui/components/ChatMessage.tsx +54 -54
  152. package/src/tui/components/Header.tsx +56 -29
  153. package/src/tui/components/InitWizard.tsx +217 -132
  154. package/src/tui/components/Markdown.tsx +35 -35
  155. package/src/tui/components/ModelSelector.tsx +87 -87
  156. package/src/tui/components/StatusBar.tsx +30 -30
  157. package/src/tui/components/Thinking.tsx +17 -17
  158. package/src/tui/components/ToolCall.tsx +102 -107
  159. package/src/tui/components/UserInput.tsx +131 -131
  160. package/src/tui/hooks/useChat.ts +287 -238
  161. package/src/tui/hooks/useCommands.ts +234 -176
  162. package/src/tui/index.ts +6 -6
  163. package/src/tui/welcome.ts +177 -178
  164. package/src/types.ts +104 -42
  165. package/src/utils/diff.ts +71 -71
  166. package/src/utils/project.ts +99 -99
  167. package/src/utils/stableStringify.ts +47 -0
  168. package/src/utils/thinking.ts +118 -121
  169. package/tests/cache/fingerprint.test.ts +75 -0
  170. package/tests/cache/stableStringify.test.ts +43 -0
  171. package/tests/cache/stats.test.ts +146 -0
  172. package/tests/cache/volatile.test.ts +75 -0
  173. package/tests/smoke-pollution.mjs +78 -0
  174. package/tests/smoke-thinking.mjs +110 -0
  175. package/tests/smoke-tool-stream.mjs +69 -0
  176. package/tests/smoke-tool.mjs +117 -0
  177. package/.nwt/meta.json +0 -5
  178. package/dist/version.d.ts +0 -16
  179. package/dist/version.d.ts.map +0 -1
  180. package/dist/version.js +0 -16
  181. package/dist/version.js.map +0 -1
  182. package/src/version.ts +0 -16
@@ -1,43 +1,43 @@
1
- import type { Skill } from './index.js';
2
-
3
- export const brainstormingSkill: Skill = {
4
- id: 'brainstorming',
5
- name: 'Brainstorming',
6
- description: 'Explore multiple approaches before committing to a solution',
7
- category: 'planning',
8
- autoActivate: ['怎么', 'how to', '方案', 'approach', '有没有', 'alternatives'],
9
- prompt: `## Brainstorming Mode
10
-
11
- When exploring solutions, don't jump to the first idea. Instead:
12
-
13
- ### 1. Generate Options
14
- List 3-5 different approaches, including at least one unconventional one.
15
-
16
- ### 2. Evaluate Each
17
- For each approach, briefly note:
18
- - **Pros**: What makes it good
19
- - **Cons**: What could go wrong
20
- - **Effort**: How much work (quick/medium/heavy)
21
-
22
- ### 3. Recommend
23
- Pick the best approach and explain WHY it's the best fit for this specific situation.
24
-
25
- ### Format
26
- \`\`\`
27
- ## Approaches
28
-
29
- ### Option A: [Name]
30
- - Pros: ...
31
- - Cons: ...
32
- - Effort: medium
33
-
34
- ### Option B: [Name]
35
- - Pros: ...
36
- - Cons: ...
37
- - Effort: quick
38
-
39
- **Recommendation**: Option B because [specific reason]
40
- \`\`\`
41
-
42
- Don't just list options - give a clear recommendation with reasoning.`,
43
- };
1
+ import type { Skill } from './index.js';
2
+
3
+ export const brainstormingSkill: Skill = {
4
+ id: 'brainstorming',
5
+ name: 'Brainstorming',
6
+ description: 'Explore multiple approaches before committing to a solution',
7
+ category: 'planning',
8
+ autoActivate: ['怎么', 'how to', '方案', 'approach', '有没有', 'alternatives'],
9
+ prompt: `## Brainstorming Mode
10
+
11
+ When exploring solutions, don't jump to the first idea. Instead:
12
+
13
+ ### 1. Generate Options
14
+ List 3-5 different approaches, including at least one unconventional one.
15
+
16
+ ### 2. Evaluate Each
17
+ For each approach, briefly note:
18
+ - **Pros**: What makes it good
19
+ - **Cons**: What could go wrong
20
+ - **Effort**: How much work (quick/medium/heavy)
21
+
22
+ ### 3. Recommend
23
+ Pick the best approach and explain WHY it's the best fit for this specific situation.
24
+
25
+ ### Format
26
+ \`\`\`
27
+ ## Approaches
28
+
29
+ ### Option A: [Name]
30
+ - Pros: ...
31
+ - Cons: ...
32
+ - Effort: medium
33
+
34
+ ### Option B: [Name]
35
+ - Pros: ...
36
+ - Cons: ...
37
+ - Effort: quick
38
+
39
+ **Recommendation**: Option B because [specific reason]
40
+ \`\`\`
41
+
42
+ Don't just list options - give a clear recommendation with reasoning.`,
43
+ };
@@ -1,45 +1,45 @@
1
- import type { Skill } from './index.js';
2
-
3
- export const codeReviewSkill: Skill = {
4
- id: 'code-review',
5
- name: 'Code Review',
6
- description: 'Systematic code review for quality, security, and correctness',
7
- category: 'review',
8
- autoActivate: ['review', '审查', '检查代码', 'code quality'],
9
- prompt: `## Code Review Checklist
10
-
11
- When reviewing code (your own or others):
12
-
13
- ### Correctness
14
- - Does it do what it's supposed to?
15
- - Are edge cases handled?
16
- - Are error cases handled?
17
-
18
- ### Security
19
- - No hardcoded secrets or API keys
20
- - Input validation on user data
21
- - No SQL injection, XSS, or path traversal risks
22
-
23
- ### Performance
24
- - No unnecessary loops or allocations
25
- - Efficient data structures
26
- - No N+1 queries or blocking calls
27
-
28
- ### Readability
29
- - Clear variable/function names
30
- - Appropriate comments (why, not what)
31
- - Consistent style with codebase
32
-
33
- ### Testability
34
- - Can this be easily tested?
35
- - Are dependencies injectable?
36
- - Are side effects isolated?
37
-
38
- ### Output Format
39
- \`\`\`
40
- ## Review Summary
41
- ✅ Good: [what's done well]
42
- ⚠️ Suggestions: [improvements]
43
- 🔴 Issues: [must fix]
44
- \`\`\``,
45
- };
1
+ import type { Skill } from './index.js';
2
+
3
+ export const codeReviewSkill: Skill = {
4
+ id: 'code-review',
5
+ name: 'Code Review',
6
+ description: 'Systematic code review for quality, security, and correctness',
7
+ category: 'review',
8
+ autoActivate: ['review', '审查', '检查代码', 'code quality'],
9
+ prompt: `## Code Review Checklist
10
+
11
+ When reviewing code (your own or others):
12
+
13
+ ### Correctness
14
+ - Does it do what it's supposed to?
15
+ - Are edge cases handled?
16
+ - Are error cases handled?
17
+
18
+ ### Security
19
+ - No hardcoded secrets or API keys
20
+ - Input validation on user data
21
+ - No SQL injection, XSS, or path traversal risks
22
+
23
+ ### Performance
24
+ - No unnecessary loops or allocations
25
+ - Efficient data structures
26
+ - No N+1 queries or blocking calls
27
+
28
+ ### Readability
29
+ - Clear variable/function names
30
+ - Appropriate comments (why, not what)
31
+ - Consistent style with codebase
32
+
33
+ ### Testability
34
+ - Can this be easily tested?
35
+ - Are dependencies injectable?
36
+ - Are side effects isolated?
37
+
38
+ ### Output Format
39
+ \`\`\`
40
+ ## Review Summary
41
+ ✅ Good: [what's done well]
42
+ ⚠️ Suggestions: [improvements]
43
+ 🔴 Issues: [must fix]
44
+ \`\`\``,
45
+ };
@@ -1,27 +1,27 @@
1
- import type { Skill } from './index.js';
2
-
3
- export const executingPlansSkill: Skill = {
4
- id: 'executing-plans',
5
- name: 'Executing Plans',
6
- description: 'Execute multi-step plans methodically with verification',
7
- category: 'planning',
8
- prompt: `## Plan Execution Mode
9
-
10
- When executing a plan or multi-step task:
11
-
12
- 1. **One step at a time** - Complete each step fully before moving to the next
13
- 2. **Verify each step** - After each change, verify it works (read the file, run a test, check syntax)
14
- 3. **Report progress** - Tell the user what you did for each step
15
- 4. **Handle failures** - If a step fails, stop and explain. Don't silently skip.
16
- 5. **Commit checkpoints** - After successful steps, suggest a git commit
17
-
18
- ### Progress Format
19
- \`\`\`
20
- ✅ Step 1: [What was done] - Verified
21
- ✅ Step 2: [What was done] - Verified
22
- ⏳ Step 3: [Currently working on]
23
- ⬜ Step 4: [Pending]
24
- \`\`\`
25
-
26
- If you encounter an unexpected issue, stop and ask the user how to proceed.`,
27
- };
1
+ import type { Skill } from './index.js';
2
+
3
+ export const executingPlansSkill: Skill = {
4
+ id: 'executing-plans',
5
+ name: 'Executing Plans',
6
+ description: 'Execute multi-step plans methodically with verification',
7
+ category: 'planning',
8
+ prompt: `## Plan Execution Mode
9
+
10
+ When executing a plan or multi-step task:
11
+
12
+ 1. **One step at a time** - Complete each step fully before moving to the next
13
+ 2. **Verify each step** - After each change, verify it works (read the file, run a test, check syntax)
14
+ 3. **Report progress** - Tell the user what you did for each step
15
+ 4. **Handle failures** - If a step fails, stop and explain. Don't silently skip.
16
+ 5. **Commit checkpoints** - After successful steps, suggest a git commit
17
+
18
+ ### Progress Format
19
+ \`\`\`
20
+ ✅ Step 1: [What was done] - Verified
21
+ ✅ Step 2: [What was done] - Verified
22
+ ⏳ Step 3: [Currently working on]
23
+ ⬜ Step 4: [Pending]
24
+ \`\`\`
25
+
26
+ If you encounter an unexpected issue, stop and ask the user how to proceed.`,
27
+ };
@@ -1,35 +1,35 @@
1
- import type { Skill } from './index.js';
2
-
3
- export const frontendDesignSkill: Skill = {
4
- id: 'frontend-design',
5
- name: 'Frontend Design',
6
- description: 'UI/UX best practices for web interfaces',
7
- category: 'architecture',
8
- autoActivate: ['ui', 'ux', 'frontend', 'css', 'layout', 'design', '界面', '页面'],
9
- prompt: `## Frontend Design Principles
10
-
11
- ### Layout
12
- - Use CSS Grid for 2D layouts, Flexbox for 1D
13
- - Mobile-first: design for small screens, enhance for larger
14
- - Consistent spacing: use a 4px or 8px grid system
15
-
16
- ### Typography
17
- - Max 2-3 font sizes per page
18
- - Line height: 1.5 for body, 1.2 for headings
19
- - Max line length: 60-80 characters
20
-
21
- ### Color
22
- - Use a limited palette (primary, secondary, accent, neutral)
23
- - Ensure contrast ratio ≥ 4.5:1 for text
24
- - Use color purposefully (not just decoration)
25
-
26
- ### Components
27
- - Keep components small and focused
28
- - Extract reusable patterns early
29
- - Props should be explicit, not spread
30
-
31
- ### Performance
32
- - Lazy load images and heavy components
33
- - Minimize bundle size
34
- - Use skeleton loaders for async content`,
35
- };
1
+ import type { Skill } from './index.js';
2
+
3
+ export const frontendDesignSkill: Skill = {
4
+ id: 'frontend-design',
5
+ name: 'Frontend Design',
6
+ description: 'UI/UX best practices for web interfaces',
7
+ category: 'architecture',
8
+ autoActivate: ['ui', 'ux', 'frontend', 'css', 'layout', 'design', '界面', '页面'],
9
+ prompt: `## Frontend Design Principles
10
+
11
+ ### Layout
12
+ - Use CSS Grid for 2D layouts, Flexbox for 1D
13
+ - Mobile-first: design for small screens, enhance for larger
14
+ - Consistent spacing: use a 4px or 8px grid system
15
+
16
+ ### Typography
17
+ - Max 2-3 font sizes per page
18
+ - Line height: 1.5 for body, 1.2 for headings
19
+ - Max line length: 60-80 characters
20
+
21
+ ### Color
22
+ - Use a limited palette (primary, secondary, accent, neutral)
23
+ - Ensure contrast ratio ≥ 4.5:1 for text
24
+ - Use color purposefully (not just decoration)
25
+
26
+ ### Components
27
+ - Keep components small and focused
28
+ - Extract reusable patterns early
29
+ - Props should be explicit, not spread
30
+
31
+ ### Performance
32
+ - Lazy load images and heavy components
33
+ - Minimize bundle size
34
+ - Use skeleton loaders for async content`,
35
+ };
@@ -1,36 +1,36 @@
1
- import type { Skill } from './index.js';
2
-
3
- export const gitWorkflowSkill: Skill = {
4
- id: 'git-workflow',
5
- name: 'Git Workflow',
6
- description: 'Clean git practices: commits, branches, PRs',
7
- category: 'workflow',
8
- autoActivate: ['git', 'commit', 'branch', 'merge', 'push', 'pull request'],
9
- prompt: `## Git Best Practices
10
-
11
- ### Commits
12
- - **Atomic**: One logical change per commit
13
- - **Message format**: \`type(scope): description\`
14
- - feat: new feature
15
- - fix: bug fix
16
- - refactor: code restructuring
17
- - docs: documentation
18
- - test: adding tests
19
- - chore: maintenance
20
-
21
- ### Before Committing
22
- 1. Review changes: \`git diff --staged\`
23
- 2. Run tests
24
- 3. Check for secrets or debug code
25
-
26
- ### Branch Naming
27
- - \`feature/description\` - New features
28
- - \`fix/description\` - Bug fixes
29
- - \`refactor/description\` - Code improvements
30
-
31
- ### Workflow
32
- 1. Create branch from main
33
- 2. Make changes with atomic commits
34
- 3. Push and create PR
35
- 4. Squash merge to main`,
36
- };
1
+ import type { Skill } from './index.js';
2
+
3
+ export const gitWorkflowSkill: Skill = {
4
+ id: 'git-workflow',
5
+ name: 'Git Workflow',
6
+ description: 'Clean git practices: commits, branches, PRs',
7
+ category: 'workflow',
8
+ autoActivate: ['git', 'commit', 'branch', 'merge', 'push', 'pull request'],
9
+ prompt: `## Git Best Practices
10
+
11
+ ### Commits
12
+ - **Atomic**: One logical change per commit
13
+ - **Message format**: \`type(scope): description\`
14
+ - feat: new feature
15
+ - fix: bug fix
16
+ - refactor: code restructuring
17
+ - docs: documentation
18
+ - test: adding tests
19
+ - chore: maintenance
20
+
21
+ ### Before Committing
22
+ 1. Review changes: \`git diff --staged\`
23
+ 2. Run tests
24
+ 3. Check for secrets or debug code
25
+
26
+ ### Branch Naming
27
+ - \`feature/description\` - New features
28
+ - \`fix/description\` - Bug fixes
29
+ - \`refactor/description\` - Code improvements
30
+
31
+ ### Workflow
32
+ 1. Create branch from main
33
+ 2. Make changes with atomic commits
34
+ 3. Push and create PR
35
+ 4. Squash merge to main`,
36
+ };
@@ -1,38 +1,38 @@
1
- import type { Skill } from './index.js';
2
-
3
- export const improveArchitectureSkill: Skill = {
4
- id: 'improve-architecture',
5
- name: 'Improve Architecture',
6
- description: 'Systematically improve codebase structure and quality',
7
- category: 'architecture',
8
- autoActivate: ['重构', 'refactor', '架构', 'architecture', 'clean', 'improve'],
9
- prompt: `## Architecture Improvement Protocol
10
-
11
- When improving code structure:
12
-
13
- ### 1. Assess Current State
14
- - Read the code and identify pain points
15
- - Look for: god classes, circular dependencies, tight coupling, code duplication
16
-
17
- ### 2. Identify Patterns
18
- - **Single Responsibility**: Does each module/class do ONE thing?
19
- - **Dependency Direction**: Do high-level modules depend on low-level ones?
20
- - **Abstraction Level**: Is each layer at the right abstraction?
21
-
22
- ### 3. Plan Changes
23
- - Start with the highest-impact, lowest-risk change
24
- - Each change should be independently valuable
25
- - Never refactor everything at once
26
-
27
- ### 4. Execute Safely
28
- - Make one change at a time
29
- - Verify after each change
30
- - Commit frequently
31
-
32
- ### Red Flags to Fix
33
- - Files over 300 lines
34
- - Functions over 50 lines
35
- - More than 3 levels of nesting
36
- - Copy-pasted code blocks
37
- - Circular imports`,
38
- };
1
+ import type { Skill } from './index.js';
2
+
3
+ export const improveArchitectureSkill: Skill = {
4
+ id: 'improve-architecture',
5
+ name: 'Improve Architecture',
6
+ description: 'Systematically improve codebase structure and quality',
7
+ category: 'architecture',
8
+ autoActivate: ['重构', 'refactor', '架构', 'architecture', 'clean', 'improve'],
9
+ prompt: `## Architecture Improvement Protocol
10
+
11
+ When improving code structure:
12
+
13
+ ### 1. Assess Current State
14
+ - Read the code and identify pain points
15
+ - Look for: god classes, circular dependencies, tight coupling, code duplication
16
+
17
+ ### 2. Identify Patterns
18
+ - **Single Responsibility**: Does each module/class do ONE thing?
19
+ - **Dependency Direction**: Do high-level modules depend on low-level ones?
20
+ - **Abstraction Level**: Is each layer at the right abstraction?
21
+
22
+ ### 3. Plan Changes
23
+ - Start with the highest-impact, lowest-risk change
24
+ - Each change should be independently valuable
25
+ - Never refactor everything at once
26
+
27
+ ### 4. Execute Safely
28
+ - Make one change at a time
29
+ - Verify after each change
30
+ - Commit frequently
31
+
32
+ ### Red Flags to Fix
33
+ - Files over 300 lines
34
+ - Functions over 50 lines
35
+ - More than 3 levels of nesting
36
+ - Copy-pasted code blocks
37
+ - Circular imports`,
38
+ };