@bovinphang/frontend-craft 2.8.0 → 2.9.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.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +378 -339
- package/CHANGELOG.zh-CN.md +377 -338
- package/CONTRIBUTING.md +371 -361
- package/CONTRIBUTING.zh-CN.md +371 -361
- package/README.md +545 -493
- package/README.openclaw.md +359 -320
- package/README.openclaw.zh-CN.md +359 -320
- package/README.zh-CN.md +545 -493
- package/agents/fec-code-reviewer.md +24 -3
- package/agents/fec-debugger.md +1 -1
- package/agents/fec-doc-updater.md +1 -1
- package/agents/fec-e2e-runner.md +1 -1
- package/agents/fec-figma-implementer.md +1 -1
- package/agents/fec-performance-optimizer.md +1 -1
- package/agents/fec-refactor-cleaner.md +4 -1
- package/agents/fec-refactoring-expert.md +81 -0
- package/agents/fec-security-reviewer.md +17 -1
- package/agents/fec-test-planner.md +1 -1
- package/agents/fec-typescript-reviewer.md +24 -8
- package/agents/fec-ui-checker.md +11 -11
- package/commands/fec-debug.md +1 -1
- package/commands/fec-refactor-plan.md +17 -0
- package/commands/fec-refactor.md +18 -0
- package/commands/fec-review.md +40 -10
- package/commands/fec-scaffold.md +1 -1
- package/commands/fec-smell.md +17 -0
- package/commands/fec-tdd.md +6 -2
- package/dist/bin/frontend-craft.js +190 -38
- package/dist/hooks/fec-run-tests.js +5 -1
- package/dist/hooks/fec-session-start.js +1 -1
- package/docs/example-prompts.md +157 -140
- package/docs/ja-JP/README.md +534 -493
- package/docs/ko-KR/README.md +534 -493
- package/docs/project-structure.md +151 -131
- package/docs/refactoring/README.md +50 -0
- package/docs/refactoring/catalog.md +105 -0
- package/docs/refactoring/smell-refactoring-matrix.md +41 -0
- package/docs/review-and-diagram-workflows.md +39 -0
- package/docs/runtimes/antigravity.md +18 -10
- package/docs/runtimes/augment.md +18 -10
- package/docs/runtimes/claude.md +191 -177
- package/docs/runtimes/claude.zh-CN.md +189 -175
- package/docs/runtimes/cline.md +18 -10
- package/docs/runtimes/codebuddy.md +18 -10
- package/docs/runtimes/codex.md +18 -10
- package/docs/runtimes/compatibility.md +27 -0
- package/docs/runtimes/copilot.md +18 -10
- package/docs/runtimes/cursor.md +18 -10
- package/docs/runtimes/gemini.md +18 -10
- package/docs/runtimes/kilo.md +18 -10
- package/docs/runtimes/openclaw.md +18 -10
- package/docs/runtimes/opencode.md +18 -10
- package/docs/runtimes/qoder.md +18 -19
- package/docs/runtimes/trae.md +18 -10
- package/docs/runtimes/windsurf.md +18 -10
- package/docs/superpowers/plans/2026-09-26-content-integrity.md +145 -0
- package/docs/superpowers/plans/2026-09-26-diagram-quality.md +170 -0
- package/docs/superpowers/specs/2026-09-26-diagram-quality-design.md +77 -0
- package/docs/superpowers/specs/2026-09-26-project-optimization-design.md +95 -0
- package/docs/zh-CN/example-prompts.md +157 -140
- package/docs/zh-CN/project-structure.md +148 -128
- package/docs/zh-CN/review-and-diagram-workflows.md +39 -0
- package/docs/zh-TW/README.md +534 -493
- package/localized/zh-CN/agents/fec-code-reviewer.md +22 -3
- package/localized/zh-CN/agents/fec-refactor-cleaner.md +3 -0
- package/localized/zh-CN/agents/fec-refactoring-expert.md +53 -0
- package/localized/zh-CN/agents/fec-security-reviewer.md +16 -0
- package/localized/zh-CN/agents/fec-typescript-reviewer.md +23 -7
- package/localized/zh-CN/commands/fec-refactor-plan.md +15 -0
- package/localized/zh-CN/commands/fec-refactor.md +14 -0
- package/localized/zh-CN/commands/fec-review.md +40 -9
- package/localized/zh-CN/commands/fec-smell.md +13 -0
- package/localized/zh-CN/commands/fec-tdd.md +4 -0
- package/localized/zh-CN/skills/eval_queries.json +244 -0
- package/localized/zh-CN/skills/fec-code-review/SKILL.md +20 -1
- package/localized/zh-CN/skills/fec-code-review/references/report-template.md +11 -1
- package/localized/zh-CN/skills/fec-code-smells/SKILL.md +33 -0
- package/localized/zh-CN/skills/fec-code-smells/references/detection-guide.md +25 -0
- package/localized/zh-CN/skills/fec-code-smells/references/smell-catalog.md +817 -0
- package/localized/zh-CN/skills/fec-code-smells/references/smell-to-refactoring-map.md +265 -0
- package/localized/zh-CN/skills/fec-image-generation/SKILL.md +31 -1
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/README.md +14 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/architecture.json +121 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/invalid-explicit.json +41 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/sequence.json +53 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/sequence.mmd +21 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/workflow.json +98 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/workflow.mmd +7 -0
- package/localized/zh-CN/skills/fec-image-generation/references/diagram-workflows.md +10 -3
- package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +8 -1
- package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +9 -2
- package/localized/zh-CN/skills/fec-image-generation/scripts/diagram-browser.mjs +90 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/diagram-layout.mjs +176 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +48 -80
- package/localized/zh-CN/skills/fec-image-generation/scripts/mermaid-render.mjs +64 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/png-qa.mjs +35 -4
- package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +193 -53
- package/localized/zh-CN/skills/fec-refactor-clean/SKILL.md +3 -0
- package/localized/zh-CN/skills/fec-refactoring/SKILL.md +83 -0
- package/localized/zh-CN/skills/fec-refactoring/references/principles.md +43 -0
- package/localized/zh-CN/skills/fec-refactoring/references/refactoring-vs-feature-change.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring/references/when-to-refactor.md +17 -0
- package/localized/zh-CN/skills/fec-refactoring/references/workflow.md +59 -0
- package/localized/zh-CN/skills/fec-refactoring-api/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md +496 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/SKILL.md +21 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/references/catalog-index.md +99 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/references/composition-guide.md +49 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/references/selection-guide.md +41 -0
- package/localized/zh-CN/skills/fec-refactoring-control/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md +299 -0
- package/localized/zh-CN/skills/fec-refactoring-data/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md +248 -0
- package/localized/zh-CN/skills/fec-refactoring-encapsulation/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md +452 -0
- package/localized/zh-CN/skills/fec-refactoring-functions/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md +567 -0
- package/localized/zh-CN/skills/fec-refactoring-inheritance/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md +550 -0
- package/localized/zh-CN/skills/fec-refactoring-move-features/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md +453 -0
- package/localized/zh-CN/skills/fec-refactoring-validation/SKILL.md +52 -0
- package/localized/zh-CN/skills/fec-refactoring-validation/references/behavior-preservation.md +15 -0
- package/localized/zh-CN/skills/fec-refactoring-validation/references/refactoring-test-checklist.md +25 -0
- package/localized/zh-CN/skills/fec-security-review/SKILL.md +16 -0
- package/localized/zh-CN/skills/fec-security-review/references/report-template.md +10 -0
- package/localized/zh-CN/skills/fec-tdd-workflow/SKILL.md +3 -0
- package/localized/zh-CN/skills/metadata.json +408 -50
- package/localized/zh-CN/skills/relations.json +271 -3
- package/localized/zh-CN/templates/shared/rules/fec-agent-workflow.md +1 -0
- package/openclaw.plugin.json +2 -3
- package/package.json +27 -17
- package/skills/eval_queries.json +244 -0
- package/skills/fec-code-review/SKILL.md +20 -1
- package/skills/fec-code-review/references/report-template.md +11 -1
- package/skills/fec-code-smells/SKILL.md +33 -0
- package/skills/fec-code-smells/references/detection-guide.md +25 -0
- package/skills/fec-code-smells/references/smell-catalog.md +861 -0
- package/skills/fec-code-smells/references/smell-to-refactoring-map.md +265 -0
- package/skills/fec-data-fetching/SKILL.md +1 -1
- package/skills/fec-image-generation/SKILL.md +31 -1
- package/skills/fec-image-generation/assets/quality-examples/README.md +14 -0
- package/skills/fec-image-generation/assets/quality-examples/architecture.json +121 -0
- package/skills/fec-image-generation/assets/quality-examples/invalid-explicit.json +41 -0
- package/skills/fec-image-generation/assets/quality-examples/sequence.json +53 -0
- package/skills/fec-image-generation/assets/quality-examples/sequence.mmd +21 -0
- package/skills/fec-image-generation/assets/quality-examples/workflow.json +98 -0
- package/skills/fec-image-generation/assets/quality-examples/workflow.mmd +7 -0
- package/skills/fec-image-generation/references/diagram-workflows.md +10 -3
- package/skills/fec-image-generation/references/html-technical-diagrams.md +8 -1
- package/skills/fec-image-generation/references/png-qa-autofix.md +9 -2
- package/skills/fec-image-generation/scripts/diagram-browser.mjs +90 -0
- package/skills/fec-image-generation/scripts/diagram-layout.mjs +176 -0
- package/skills/fec-image-generation/scripts/export-diagram.mjs +48 -80
- package/skills/fec-image-generation/scripts/mermaid-render.mjs +64 -0
- package/skills/fec-image-generation/scripts/png-qa.mjs +35 -4
- package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +193 -53
- package/skills/fec-legacy-web-standard/SKILL.md +1 -1
- package/skills/fec-refactor-clean/SKILL.md +3 -0
- package/skills/fec-refactoring/SKILL.md +83 -0
- package/skills/fec-refactoring/references/principles.md +60 -0
- package/skills/fec-refactoring/references/refactoring-vs-feature-change.md +27 -0
- package/skills/fec-refactoring/references/when-to-refactor.md +31 -0
- package/skills/fec-refactoring/references/workflow.md +90 -0
- package/skills/fec-refactoring-api/SKILL.md +25 -0
- package/skills/fec-refactoring-api/references/api-refactorings.md +496 -0
- package/skills/fec-refactoring-catalog/SKILL.md +28 -0
- package/skills/fec-refactoring-catalog/references/catalog-index.md +99 -0
- package/skills/fec-refactoring-catalog/references/composition-guide.md +49 -0
- package/skills/fec-refactoring-catalog/references/selection-guide.md +47 -0
- package/skills/fec-refactoring-control/SKILL.md +25 -0
- package/skills/fec-refactoring-control/references/conditional-refactorings.md +299 -0
- package/skills/fec-refactoring-data/SKILL.md +25 -0
- package/skills/fec-refactoring-data/references/data-refactorings.md +248 -0
- package/skills/fec-refactoring-encapsulation/SKILL.md +25 -0
- package/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md +452 -0
- package/skills/fec-refactoring-functions/SKILL.md +25 -0
- package/skills/fec-refactoring-functions/references/function-refactorings.md +567 -0
- package/skills/fec-refactoring-inheritance/SKILL.md +25 -0
- package/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md +550 -0
- package/skills/fec-refactoring-move-features/SKILL.md +25 -0
- package/skills/fec-refactoring-move-features/references/moving-refactorings.md +453 -0
- package/skills/fec-refactoring-validation/SKILL.md +59 -0
- package/skills/fec-refactoring-validation/references/behavior-preservation.md +53 -0
- package/skills/fec-refactoring-validation/references/refactoring-test-checklist.md +42 -0
- package/skills/fec-security-review/SKILL.md +16 -0
- package/skills/fec-security-review/references/report-template.md +10 -0
- package/skills/fec-tdd-workflow/SKILL.md +5 -1
- package/skills/metadata.json +434 -71
- package/skills/relations.json +264 -0
- package/templates/shared/rules/fec-agent-workflow.md +1 -0
- package/docs/superpowers/plans/2026-05-29-fec-debug.md +0 -491
- package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +0 -340
|
@@ -1,131 +1,151 @@
|
|
|
1
|
-
# Project Structure
|
|
2
|
-
|
|
3
|
-
Detailed directory layout for `frontend-craft`.
|
|
4
|
-
|
|
5
|
-
## Repository Layout
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
frontend-craft/
|
|
9
|
-
|-- .claude-plugin/ # Claude Code plugin + marketplace manifests
|
|
10
|
-
| |-- plugin.json # Plugin metadata
|
|
11
|
-
| |-- marketplace.json # Marketplace directory metadata
|
|
12
|
-
|
|
|
13
|
-
|-- agents/ # Specialized sub-agents for delegation
|
|
14
|
-
| |-- fec-architect.md # Page splitting, component architecture, state flow
|
|
15
|
-
| |-- fec-code-reviewer.md # Frontend-focused code review (quality, security, a11y)
|
|
16
|
-
| |-- fec-security-reviewer.md # Frontend attack surface: XSS, secrets, CSP, deps
|
|
17
|
-
| |-- fec-test-planner.md # Testing strategy, risk matrix, coverage planning
|
|
18
|
-
| |-- fec-debugger.md # Complex build/runtime/UI/API diagnostics
|
|
19
|
-
| |-- fec-refactor-cleaner.md # Dead-code and unused dependency cleanup
|
|
20
|
-
| |-- fec-
|
|
21
|
-
| |-- fec-
|
|
22
|
-
| |-- fec-
|
|
23
|
-
| |-- fec-
|
|
24
|
-
| |-- fec-
|
|
25
|
-
| |-- fec-
|
|
26
|
-
| |-- fec-
|
|
27
|
-
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
| |-- fec-
|
|
31
|
-
| |-- fec-
|
|
32
|
-
| |-- fec-
|
|
33
|
-
| |-- fec-
|
|
34
|
-
| |-- fec-
|
|
35
|
-
| |-- fec-
|
|
36
|
-
| |-- fec-
|
|
37
|
-
| |-- fec-
|
|
38
|
-
| |-- fec-
|
|
39
|
-
| |-- fec-
|
|
40
|
-
| |-- fec-
|
|
41
|
-
| |-- fec-
|
|
42
|
-
| |-- fec-
|
|
43
|
-
| |-- fec-
|
|
44
|
-
| |-- fec-
|
|
45
|
-
| |-- fec-
|
|
46
|
-
| |-- fec-
|
|
47
|
-
| |-- fec-
|
|
48
|
-
| |-- fec-
|
|
49
|
-
| |-- fec-
|
|
50
|
-
| |-- fec-
|
|
51
|
-
| |-- fec-
|
|
52
|
-
| |-- fec-
|
|
53
|
-
| |-- fec-
|
|
54
|
-
| |-- fec-
|
|
55
|
-
| |-- fec-
|
|
56
|
-
| |-- fec-
|
|
57
|
-
| |-- fec-
|
|
58
|
-
| |-- fec-
|
|
59
|
-
| |-- fec-
|
|
60
|
-
| |-- fec-
|
|
61
|
-
| |-- fec-
|
|
62
|
-
| |-- fec-
|
|
63
|
-
| |-- fec-
|
|
64
|
-
| |-- fec-
|
|
65
|
-
| |-- fec-
|
|
66
|
-
| |-- fec-
|
|
67
|
-
| |-- fec-
|
|
68
|
-
| |-- fec-
|
|
69
|
-
| |-- fec-
|
|
70
|
-
| |-- fec-
|
|
71
|
-
| |-- fec-
|
|
72
|
-
| |-- fec-
|
|
73
|
-
| |-- fec-
|
|
74
|
-
| |-- fec-
|
|
75
|
-
| |-- fec-
|
|
76
|
-
| |-- fec-
|
|
77
|
-
|
|
|
78
|
-
|--
|
|
79
|
-
| |-- fec-
|
|
80
|
-
| |-- fec-
|
|
81
|
-
| |-- fec-
|
|
82
|
-
| |-- fec-
|
|
83
|
-
| |-- fec-
|
|
84
|
-
| |-- fec-
|
|
85
|
-
| |-- fec-
|
|
86
|
-
| |-- fec-
|
|
87
|
-
|
|
|
88
|
-
|--
|
|
89
|
-
|
|
|
90
|
-
|
|
91
|
-
|--
|
|
92
|
-
| |--
|
|
93
|
-
| |--
|
|
94
|
-
| |--
|
|
95
|
-
| |--
|
|
96
|
-
| |--
|
|
97
|
-
| |--
|
|
98
|
-
| |--
|
|
99
|
-
| |--
|
|
100
|
-
|
|
|
101
|
-
|--
|
|
102
|
-
|
|
|
103
|
-
|--
|
|
104
|
-
| |--
|
|
105
|
-
|
|
|
106
|
-
|
|
107
|
-
| |--
|
|
108
|
-
| |--
|
|
109
|
-
| |--
|
|
110
|
-
| |--
|
|
111
|
-
|
|
|
112
|
-
|-- .
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
1
|
+
# Project Structure
|
|
2
|
+
|
|
3
|
+
Detailed directory layout for `frontend-craft`.
|
|
4
|
+
|
|
5
|
+
## Repository Layout
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
frontend-craft/
|
|
9
|
+
|-- .claude-plugin/ # Claude Code plugin + marketplace manifests
|
|
10
|
+
| |-- plugin.json # Plugin metadata
|
|
11
|
+
| |-- marketplace.json # Marketplace directory metadata
|
|
12
|
+
|
|
|
13
|
+
|-- agents/ # Specialized sub-agents for delegation
|
|
14
|
+
| |-- fec-architect.md # Page splitting, component architecture, state flow
|
|
15
|
+
| |-- fec-code-reviewer.md # Frontend-focused code review (quality, security, a11y)
|
|
16
|
+
| |-- fec-security-reviewer.md # Frontend attack surface: XSS, secrets, CSP, deps
|
|
17
|
+
| |-- fec-test-planner.md # Testing strategy, risk matrix, coverage planning
|
|
18
|
+
| |-- fec-debugger.md # Complex build/runtime/UI/API diagnostics
|
|
19
|
+
| |-- fec-refactor-cleaner.md # Dead-code and unused dependency cleanup
|
|
20
|
+
| |-- fec-refactoring-expert.md # Behavior-preserving smell diagnosis, planning, execution, validation
|
|
21
|
+
| |-- fec-doc-updater.md # README/runtime docs/capability table synchronization
|
|
22
|
+
| |-- fec-e2e-runner.md # E2E authoring, execution, flaky handling, artifacts, CI
|
|
23
|
+
| |-- fec-typescript-reviewer.md # TS/JS type safety, async, security, report-only review
|
|
24
|
+
| |-- fec-performance-optimizer.md # Performance bottleneck analysis and optimization
|
|
25
|
+
| |-- fec-ui-checker.md # UI visual issues, design fidelity evaluation
|
|
26
|
+
| |-- fec-figma-implementer.md # Precise UI implementation from design
|
|
27
|
+
| |-- fec-design-token-mapper.md # Map design variables to Design Tokens
|
|
28
|
+
|
|
|
29
|
+
|-- skills/ # Workflow definitions and domain knowledge
|
|
30
|
+
| |-- fec-code-review/ # Architecture, types, rendering, styles, a11y
|
|
31
|
+
| |-- fec-security-review/ # XSS, CSRF, sensitive data, input validation
|
|
32
|
+
| |-- fec-accessibility-check/ # WCAG 2.2 accessibility, keyboard, focus, screen readers
|
|
33
|
+
| |-- fec-code-review/ # Architecture, types, rendering, styles, a11y
|
|
34
|
+
| |-- fec-security-review/ # XSS, CSRF, sensitive data, input validation
|
|
35
|
+
| |-- fec-accessibility-check/ # WCAG 2.2 accessibility, keyboard, focus, screen readers
|
|
36
|
+
| |-- fec-react-project-standard/ # React + TypeScript project standards
|
|
37
|
+
| |-- fec-vue3-project-standard/ # Vue 3 + TypeScript project standards
|
|
38
|
+
| |-- fec-implement-from-design/ # Implement UI from design tools, screenshots, and visual references
|
|
39
|
+
| |-- fec-validation-fix/ # lint, type-check, test, build and fix
|
|
40
|
+
| |-- fec-performance-optimization/ # Core Web Vitals, bundle, rendering, network, memory
|
|
41
|
+
| |-- fec-source-driven-development/ # Official sources, project facts, version-sensitive decisions
|
|
42
|
+
| |-- fec-typescript-project-standard/ # TypeScript config, public API types, declarations, DTOs, generics
|
|
43
|
+
| |-- fec-state-management/ # State ownership, store selection, URL/server/form/local boundaries
|
|
44
|
+
| |-- fec-tailwind-design-system/ # Tailwind tokens, variants, dark mode, class governance
|
|
45
|
+
| |-- fec-responsive-layout/ # Mobile-first layouts, container queries, touch-safe responsive UI
|
|
46
|
+
| |-- fec-dependency-upgrade/ # Dependency upgrades, lockfile risk, CVE remediation
|
|
47
|
+
| |-- fec-tdd-workflow/ # Test-first frontend implementation workflow
|
|
48
|
+
| |-- fec-refactor-clean/ # Safe dead-code and unused dependency cleanup
|
|
49
|
+
| |-- fec-refactoring/ # Core behavior-preserving refactoring workflow and safety gates
|
|
50
|
+
| |-- fec-code-smells/ # 24-smell evidence-based diagnosis
|
|
51
|
+
| |-- fec-refactoring-catalog/ # 61-technique selection and composition catalog
|
|
52
|
+
| |-- fec-refactoring-functions/ # Function family refactorings
|
|
53
|
+
| |-- fec-refactoring-encapsulation/ # Encapsulation family refactorings
|
|
54
|
+
| |-- fec-refactoring-move-features/ # Moving-feature family refactorings
|
|
55
|
+
| |-- fec-refactoring-data/ # Data family refactorings
|
|
56
|
+
| |-- fec-refactoring-control/ # Conditional/control family refactorings
|
|
57
|
+
| |-- fec-refactoring-api/ # API family refactorings
|
|
58
|
+
| |-- fec-refactoring-inheritance/ # Inheritance/delegation family refactorings
|
|
59
|
+
| |-- fec-refactoring-validation/ # Behavior-preservation validation and proof levels
|
|
60
|
+
| |-- fec-doc-sync/ # Public docs and metadata synchronization
|
|
61
|
+
| |-- fec-legacy-web-standard/ # JS + jQuery + HTML legacy project standards
|
|
62
|
+
| |-- fec-legacy-to-modern-migration/ # jQuery/MPA migration to React/Vue strategy and workflow
|
|
63
|
+
| |-- fec-testing-strategy/ # Testing layer selection and coverage matrix
|
|
64
|
+
| |-- fec-e2e-testing/ # Playwright/Cypress E2E testing standards
|
|
65
|
+
| |-- fec-component-testing/ # RTL / Vue Test Utils component tests
|
|
66
|
+
| |-- fec-debug-framework/ # Unified 5-step diagnostic framework for build/runtime/UI/API failures
|
|
67
|
+
| |-- fec-nextjs-project-standard/ # Next.js 14+ App Router, SSR/SSG standards
|
|
68
|
+
| |-- fec-nuxt-project-standard/ # Nuxt 3 SSR/SSG, composables standards
|
|
69
|
+
| |-- fec-monorepo-project-standard/ # pnpm workspace, Turborepo, Nx standards
|
|
70
|
+
| |-- fec-vite-project-standard/ # Vite config, env safety, HMR, proxy, build and library mode
|
|
71
|
+
| |-- fec-data-fetching/ # TanStack Query and server-state workflows
|
|
72
|
+
| |-- fec-api-integration/ # Typed API clients, auth refresh, uploads, realtime integration
|
|
73
|
+
| |-- fec-backend-requirements-handoff/ # Frontend-to-backend UI data and state needs
|
|
74
|
+
| |-- fec-form-handling/ # React Hook Form + Zod form workflows
|
|
75
|
+
| |-- fec-route-protection/ # Authenticated and permissioned routes
|
|
76
|
+
| |-- fec-pwa-implementation/ # PWA manifest, service worker, offline
|
|
77
|
+
| |-- fec-web-workers/ # Worker integration and background compute
|
|
78
|
+
| |-- fec-canvas-threejs/ # Canvas, Three.js, React Three Fiber
|
|
79
|
+
| |-- fec-svg-animation/ # SVG motion and reduced-motion fallbacks
|
|
80
|
+
| |-- fec-browser-storage/ # localStorage/sessionStorage/IndexedDB/Cookies selection and safe client persistence
|
|
81
|
+
| |-- fec-list-virtualization/ # Large-list windowing with react-window / TanStack Virtual and measurement strategies
|
|
82
|
+
| |-- fec-storybook-component-doc/ # Storybook component docs, addons, MDX, interaction and visual test integration
|
|
83
|
+
| |-- fec-ui-design/ # Product-context UI direction, design dials, media strategy, visual QA
|
|
84
|
+
| |-- fec-image-generation/ # Diagram/image generation, editing workflows, PNG QA and repair loops
|
|
85
|
+
| |-- fec-drawio-studio/ # Editable draw.io diagrams, shape lookup, auto-layout, code structure maps
|
|
86
|
+
| |-- fec-web-video-presentation/ # Recordable 16:9 step-driven web video presentations
|
|
87
|
+
| |-- fec-motion-interaction/ # Context-aware motion intensity, transitions, scroll animation, reduced motion
|
|
88
|
+
| |-- fec-alchemy/ # Project absorption workflow — extract reference ideas and redesign natively
|
|
89
|
+
|
|
|
90
|
+
|-- commands/ # Slash commands for quick execution
|
|
91
|
+
| |-- fec-init.md # /fec-init - Initialize project templates
|
|
92
|
+
| |-- fec-review.md # /fec-review - Project by default; targeted scope or explicit changes
|
|
93
|
+
| |-- fec-scaffold.md # /fec-scaffold - Create page/feature/component
|
|
94
|
+
| |-- fec-plan.md # /fec-plan - Implementation planning before frontend changes
|
|
95
|
+
| |-- fec-tdd.md # /fec-tdd - Test-driven frontend implementation
|
|
96
|
+
| |-- fec-debug.md # /fec-debug - Diagnose and fix frontend failures
|
|
97
|
+
| |-- fec-refactor-clean.md # /fec-refactor-clean - Safe dead-code cleanup
|
|
98
|
+
| |-- fec-smell.md # /fec-smell - Read-only code-smell diagnosis
|
|
99
|
+
| |-- fec-refactor-plan.md # /fec-refactor-plan - Read-only small-step refactoring plan
|
|
100
|
+
| |-- fec-refactor.md # /fec-refactor - Controlled behavior-preserving execution
|
|
101
|
+
| |-- fec-doc-sync.md # /fec-doc-sync - Public docs and metadata sync
|
|
102
|
+
|
|
|
103
|
+
|-- hooks/ # Event-driven automation
|
|
104
|
+
| |-- hooks.json # PreToolUse, PostToolUse, Stop, Notification, etc.
|
|
105
|
+
|
|
|
106
|
+
|-- src/ # TypeScript source for published runtime code
|
|
107
|
+
| |-- hooks/ # Runtime hook scripts bundled to dist/hooks
|
|
108
|
+
| |-- security-check.ts # Block dangerous commands
|
|
109
|
+
| |-- format-changed-file.ts # Auto Prettier formatting
|
|
110
|
+
| |-- run-tests.ts # Run checks on session end
|
|
111
|
+
| |-- session-start.ts # Detect framework on session start
|
|
112
|
+
| |-- notify.ts # Cross-platform desktop notifications
|
|
113
|
+
| |-- install/ # Installer core (CLI, interactive wizard, runtime converters)
|
|
114
|
+
| |-- openclaw/ # OpenClaw runtime TypeScript source
|
|
115
|
+
|
|
|
116
|
+
|-- scripts/ # Source-run repository maintenance scripts, not published to npm
|
|
117
|
+
|
|
|
118
|
+
|-- templates/ # Runtime-specific project templates
|
|
119
|
+
| |-- claude/ # CLAUDE.md and settings.json
|
|
120
|
+
| |-- codex/ # AGENTS.md and config.toml
|
|
121
|
+
| |-- cursor/ # Cursor runtime project stubs
|
|
122
|
+
| |-- gemini/ # Gemini CLI runtime project stubs
|
|
123
|
+
| |-- openclaw/ # AGENTS.md and OPENCLAW-CONFIG.md
|
|
124
|
+
| |-- windsurf/ # Windsurf runtime project stubs
|
|
125
|
+
| |-- shared/rules/ # 20 rule files: vue, react, rendering patterns, responsive design, testing, source-driven development, etc.
|
|
126
|
+
|
|
|
127
|
+
|-- .mcp.json # MCP server config (Figma, Figma Desktop, Sketch, MasterGo, Pixso, 墨刀)
|
|
128
|
+
└-- README.md
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Directory Responsibilities
|
|
132
|
+
|
|
133
|
+
| Directory | Purpose |
|
|
134
|
+
| --------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
135
|
+
| `agents/` | Specialized sub-agent definitions (Markdown + YAML frontmatter) |
|
|
136
|
+
| `bin/` | CLI entry point (`frontend-craft.ts`) |
|
|
137
|
+
| `commands/` | Custom slash commands (`fec-init`, `fec-review`, `fec-scaffold`, workflow commands) |
|
|
138
|
+
| `docs/` | Runtime installation docs and localized READMEs |
|
|
139
|
+
| `hooks/` | Hook configuration (`hooks.json`) |
|
|
140
|
+
| `scripts/` | Source-run maintenance scripts (build, packaging, publishing checks, metadata sync), excluded from npm runtime output |
|
|
141
|
+
| `skills/` | Skill definitions (`SKILL.md`, `metadata.json`) |
|
|
142
|
+
| `src/hooks/` | Runtime hook source bundled into `dist/hooks/` for Claude/Qoder execution |
|
|
143
|
+
| `src/install/` | Installer core (CLI, interactive wizard, runtime converters) |
|
|
144
|
+
| `src/openclaw/` | OpenClaw runtime TypeScript source |
|
|
145
|
+
| `templates/` | Runtime-specific project templates (Claude/Codex/Cursor/Gemini/OpenClaw/Windsurf configs + shared rules) |
|
|
146
|
+
| `tests/` | Test suite (converter tests, installer tests) |
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
Technical diagram quality: `fec-image-generation` prefers local Mermaid for standard sequence/workflow diagrams and the draw.io workflow for editable architecture, with JSON/HTML fallback when tools are unavailable. Export a browser-measured manifest scaled to the PNG, run QA and inspect the final image. Preserve complete text, explicit layout and relationships; repair the source for at most two automatic rounds and report unresolved issues. Reproducible fixtures are in `skills/fec-image-generation/assets/quality-examples/`.
|
|
150
|
+
|
|
151
|
+
[Review scope and technical diagram delivery](review-and-diagram-workflows.md) — scope, tool prerequisites, export commands, and QA limits.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frontend-craft 重构子系统
|
|
2
|
+
|
|
3
|
+
本目录是重构子系统的人类导航入口。详细可执行知识位于 `skills/` 与 `localized/zh-CN/skills/`,这里不重复完整操作步骤。
|
|
4
|
+
|
|
5
|
+
## 能力入口
|
|
6
|
+
|
|
7
|
+
| 入口 | 模式 | 用途 |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `/fec-smell` | 只读诊断 | 基于证据识别代码坏味道,检查误判并给出候选重构手法 |
|
|
10
|
+
| `/fec-refactor-plan` | 只读规划 | 把诊断结果组织为有依赖顺序、可验证、可回滚的小步重构计划 |
|
|
11
|
+
| `/fec-refactor` | 受控执行 | 在保持既有可观察行为的前提下,一次执行一个主要重构并逐步验证 |
|
|
12
|
+
|
|
13
|
+
## 核心安全模型
|
|
14
|
+
|
|
15
|
+
纯重构遵循 `GREEN → REFACTOR → GREEN`:先记录可用的绿色基线,再做结构变化,再回到同一行为基线。新增行为或行为变化型缺陷修复仍属于 TDD 的 `RED → GREEN → REFACTOR`。
|
|
16
|
+
|
|
17
|
+
风险统一分为:
|
|
18
|
+
|
|
19
|
+
- `SAFE`:局部、私有、易回滚且验证充分;
|
|
20
|
+
- `CAUTION`:跨模块、状态归属、组件边界或动态引用等需要额外证据;
|
|
21
|
+
- `DANGER`:公开 API、路由、持久化、网络协议、权限、SSR/hydration、关键业务计算等高风险边界,默认先规划并明确确认。
|
|
22
|
+
|
|
23
|
+
每个执行步骤还要记录**差异预算(Diff Budget)**:预期文件数、函数/组件数、公开 API 变化数和行为变化数。实际范围明显超出预算时停止并重新评估。
|
|
24
|
+
|
|
25
|
+
## 与相邻工作流的边界
|
|
26
|
+
|
|
27
|
+
- 已证明未使用的代码、导出、样式、路由或依赖:使用 `fec-refactor-clean`;
|
|
28
|
+
- 新增行为或行为变化型 bug 修复:使用 `fec-tdd-workflow`;
|
|
29
|
+
- 原因未知的构建、运行时、UI 或 API 故障:使用 `fec-debug-framework`;
|
|
30
|
+
- 已知的 lint/typecheck/test/build 失败修复:使用 `fec-validation-fix`;
|
|
31
|
+
- 改动合并就绪性、指定文件或目录、全项目代码审核:使用 `fec-code-review`;未限定时默认全项目,明确改动 / PR / 提交上下文时增量审核;明确指定范围时包括未改动代码,全项目审核按模块记录覆盖情况;
|
|
32
|
+
- 框架、依赖、状态库迁移或大范围架构替换:进入对应 migration/architecture 工作流,而不是当作普通重构。
|
|
33
|
+
|
|
34
|
+
## 知识范围
|
|
35
|
+
|
|
36
|
+
本子系统覆盖:
|
|
37
|
+
|
|
38
|
+
- 第 3 章的 24 种代码坏味道;
|
|
39
|
+
- 第 6~12 章的 61 个标准重构手法;
|
|
40
|
+
- 坏味道到候选手法的多对多关系;
|
|
41
|
+
- 手法的前置条件、组合关系、风险和行为保持检查;
|
|
42
|
+
- TypeScript、React、Vue、现代函数式/组合式前端的项目原生适配。
|
|
43
|
+
|
|
44
|
+
查看 [61 项重构目录](catalog.md) 与 [坏味道—重构矩阵](smell-refactoring-matrix.md)。
|
|
45
|
+
|
|
46
|
+
## 来源与内容转换原则
|
|
47
|
+
|
|
48
|
+
知识基线来自用户提供的《重构:改善既有代码的设计(第 2 版)》JavaScript 版 Markdown/PDF,尤其是第 2~12 章、重构列表以及坏味道与重构手法速查材料。frontend-craft 保留标准术语、目录完整性和来源支持的关系,但不会复制长段正文或完整案例。
|
|
49
|
+
|
|
50
|
+
`Frontend-Craft 前端适配`、AI Agent 风险门禁、差异预算、报告格式、React/Vue/TypeScript 示例等属于本项目重新编写的工程增强,用于把经典重构思想转换为可执行的前端智能体工作流。
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# 61 项标准重构目录
|
|
2
|
+
|
|
3
|
+
本表用于快速导航。详细动机、前置条件、操作步骤、行为保持检查和前端适配请打开对应中文 Reference。
|
|
4
|
+
|
|
5
|
+
## 函数组织(第 6 章) — 11 项
|
|
6
|
+
|
|
7
|
+
| ID | 中文标准名 | 英文标准名 | 详细知识 |
|
|
8
|
+
| --- | --- | --- | --- |
|
|
9
|
+
| `RF-EXTRACT-FUNCTION` | 提炼函数 | Extract Function | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
10
|
+
| `RF-INLINE-FUNCTION` | 内联函数 | Inline Function | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
11
|
+
| `RF-EXTRACT-VARIABLE` | 提炼变量 | Extract Variable | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
12
|
+
| `RF-INLINE-VARIABLE` | 内联变量 | Inline Variable | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
13
|
+
| `RF-CHANGE-FUNCTION-DECLARATION` | 改变函数声明 | Change Function Declaration | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
14
|
+
| `RF-ENCAPSULATE-VARIABLE` | 封装变量 | Encapsulate Variable | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
15
|
+
| `RF-RENAME-VARIABLE` | 变量改名 | Rename Variable | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
16
|
+
| `RF-INTRODUCE-PARAMETER-OBJECT` | 引入参数对象 | Introduce Parameter Object | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
17
|
+
| `RF-COMBINE-FUNCTIONS-INTO-CLASS` | 函数组合成类 | Combine Functions into Class | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
18
|
+
| `RF-COMBINE-FUNCTIONS-INTO-TRANSFORM` | 函数组合成变换 | Combine Functions into Transform | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
19
|
+
| `RF-SPLIT-PHASE` | 拆分阶段 | Split Phase | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md) |
|
|
20
|
+
|
|
21
|
+
## 封装(第 7 章) — 9 项
|
|
22
|
+
|
|
23
|
+
| ID | 中文标准名 | 英文标准名 | 详细知识 |
|
|
24
|
+
| --- | --- | --- | --- |
|
|
25
|
+
| `RF-ENCAPSULATE-RECORD` | 封装记录 | Encapsulate Record | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
26
|
+
| `RF-ENCAPSULATE-COLLECTION` | 封装集合 | Encapsulate Collection | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
27
|
+
| `RF-REPLACE-PRIMITIVE-WITH-OBJECT` | 以对象取代基本类型 | Replace Primitive with Object | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
28
|
+
| `RF-REPLACE-TEMP-WITH-QUERY` | 以查询取代临时变量 | Replace Temp with Query | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
29
|
+
| `RF-EXTRACT-CLASS` | 提炼类 | Extract Class | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
30
|
+
| `RF-INLINE-CLASS` | 内联类 | Inline Class | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
31
|
+
| `RF-HIDE-DELEGATE` | 隐藏委托关系 | Hide Delegate | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
32
|
+
| `RF-REMOVE-MIDDLE-MAN` | 移除中间人 | Remove Middle Man | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
33
|
+
| `RF-SUBSTITUTE-ALGORITHM` | 替换算法 | Substitute Algorithm | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
|
|
34
|
+
|
|
35
|
+
## 搬移特性(第 8 章) — 9 项
|
|
36
|
+
|
|
37
|
+
| ID | 中文标准名 | 英文标准名 | 详细知识 |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| `RF-MOVE-FUNCTION` | 搬移函数 | Move Function | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
40
|
+
| `RF-MOVE-FIELD` | 搬移字段 | Move Field | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
41
|
+
| `RF-MOVE-STATEMENTS-INTO-FUNCTION` | 搬移语句到函数 | Move Statements into Function | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
42
|
+
| `RF-MOVE-STATEMENTS-TO-CALLERS` | 搬移语句到调用者 | Move Statements to Callers | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
43
|
+
| `RF-REPLACE-INLINE-CODE-WITH-FUNCTION-CALL` | 以函数调用取代内联代码 | Replace Inline Code with Function Call | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
44
|
+
| `RF-SLIDE-STATEMENTS` | 移动语句 | Slide Statements | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
45
|
+
| `RF-SPLIT-LOOP` | 拆分循环 | Split Loop | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
46
|
+
| `RF-REPLACE-LOOP-WITH-PIPELINE` | 以管道取代循环 | Replace Loop with Pipeline | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
47
|
+
| `RF-REMOVE-DEAD-CODE` | 移除死代码 | Remove Dead Code | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md) |
|
|
48
|
+
|
|
49
|
+
## 重新组织数据(第 9 章) — 5 项
|
|
50
|
+
|
|
51
|
+
| ID | 中文标准名 | 英文标准名 | 详细知识 |
|
|
52
|
+
| --- | --- | --- | --- |
|
|
53
|
+
| `RF-SPLIT-VARIABLE` | 拆分变量 | Split Variable | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md) |
|
|
54
|
+
| `RF-RENAME-FIELD` | 字段改名 | Rename Field | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md) |
|
|
55
|
+
| `RF-REPLACE-DERIVED-VARIABLE-WITH-QUERY` | 以查询取代派生变量 | Replace Derived Variable with Query | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md) |
|
|
56
|
+
| `RF-CHANGE-REFERENCE-TO-VALUE` | 将引用对象改为值对象 | Change Reference to Value | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md) |
|
|
57
|
+
| `RF-CHANGE-VALUE-TO-REFERENCE` | 将值对象改为引用对象 | Change Value to Reference | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md) |
|
|
58
|
+
|
|
59
|
+
## 简化条件逻辑(第 10 章) — 6 项
|
|
60
|
+
|
|
61
|
+
| ID | 中文标准名 | 英文标准名 | 详细知识 |
|
|
62
|
+
| --- | --- | --- | --- |
|
|
63
|
+
| `RF-DECOMPOSE-CONDITIONAL` | 分解条件表达式 | Decompose Conditional | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md) |
|
|
64
|
+
| `RF-CONSOLIDATE-CONDITIONAL-EXPRESSION` | 合并条件表达式 | Consolidate Conditional Expression | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md) |
|
|
65
|
+
| `RF-REPLACE-NESTED-CONDITIONAL-WITH-GUARD-CLAUSES` | 以卫语句取代嵌套条件表达式 | Replace Nested Conditional with Guard Clauses | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md) |
|
|
66
|
+
| `RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM` | 以多态取代条件表达式 | Replace Conditional with Polymorphism | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md) |
|
|
67
|
+
| `RF-INTRODUCE-SPECIAL-CASE` | 引入特例 | Introduce Special Case | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md) |
|
|
68
|
+
| `RF-INTRODUCE-ASSERTION` | 引入断言 | Introduce Assertion | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md) |
|
|
69
|
+
|
|
70
|
+
## 重构 API(第 11 章) — 10 项
|
|
71
|
+
|
|
72
|
+
| ID | 中文标准名 | 英文标准名 | 详细知识 |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| `RF-SEPARATE-QUERY-FROM-MODIFIER` | 将查询函数和修改函数分离 | Separate Query from Modifier | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
75
|
+
| `RF-PARAMETERIZE-FUNCTION` | 函数参数化 | Parameterize Function | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
76
|
+
| `RF-REMOVE-FLAG-ARGUMENT` | 移除标记参数 | Remove Flag Argument | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
77
|
+
| `RF-PRESERVE-WHOLE-OBJECT` | 保持对象完整 | Preserve Whole Object | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
78
|
+
| `RF-REPLACE-PARAMETER-WITH-QUERY` | 以查询取代参数 | Replace Parameter with Query | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
79
|
+
| `RF-REPLACE-QUERY-WITH-PARAMETER` | 以参数取代查询 | Replace Query with Parameter | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
80
|
+
| `RF-REMOVE-SETTING-METHOD` | 移除设值函数 | Remove Setting Method | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
81
|
+
| `RF-REPLACE-CONSTRUCTOR-WITH-FACTORY-FUNCTION` | 以工厂函数取代构造函数 | Replace Constructor with Factory Function | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
82
|
+
| `RF-REPLACE-FUNCTION-WITH-COMMAND` | 以命令取代函数 | Replace Function with Command | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
83
|
+
| `RF-REPLACE-COMMAND-WITH-FUNCTION` | 以函数取代命令 | Replace Command with Function | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md) |
|
|
84
|
+
|
|
85
|
+
## 处理继承关系(第 12 章) — 11 项
|
|
86
|
+
|
|
87
|
+
| ID | 中文标准名 | 英文标准名 | 详细知识 |
|
|
88
|
+
| --- | --- | --- | --- |
|
|
89
|
+
| `RF-PULL-UP-METHOD` | 函数上移 | Pull Up Method | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
90
|
+
| `RF-PULL-UP-FIELD` | 字段上移 | Pull Up Field | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
91
|
+
| `RF-PULL-UP-CONSTRUCTOR-BODY` | 构造函数本体上移 | Pull Up Constructor Body | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
92
|
+
| `RF-PUSH-DOWN-METHOD` | 函数下移 | Push Down Method | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
93
|
+
| `RF-PUSH-DOWN-FIELD` | 字段下移 | Push Down Field | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
94
|
+
| `RF-REPLACE-TYPE-CODE-WITH-SUBCLASSES` | 以子类取代类型码 | Replace Type Code with Subclasses | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
95
|
+
| `RF-REMOVE-SUBCLASS` | 移除子类 | Remove Subclass | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
96
|
+
| `RF-EXTRACT-SUPERCLASS` | 提炼超类 | Extract Superclass | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
97
|
+
| `RF-COLLAPSE-HIERARCHY` | 折叠继承体系 | Collapse Hierarchy | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
98
|
+
| `RF-REPLACE-SUBCLASS-WITH-DELEGATE` | 以委托取代子类 | Replace Subclass with Delegate | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
99
|
+
| `RF-REPLACE-SUPERCLASS-WITH-DELEGATE` | 以委托取代超类 | Replace Superclass with Delegate | [查看 Reference](../../localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md) |
|
|
100
|
+
|
|
101
|
+
## 完整性
|
|
102
|
+
|
|
103
|
+
- 总计:**61** 项。
|
|
104
|
+
- 分组数量:`11 / 9 / 9 / 5 / 6 / 10 / 11`。
|
|
105
|
+
- `RF-REMOVE-DEAD-CODE` 保留在目录中保证知识完整,但实际死代码发现与删除路由到 `fec-refactor-clean`。
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 24 种代码坏味道与重构手法速查矩阵
|
|
2
|
+
|
|
3
|
+
本矩阵基于已归一化的第 3 章坏味道关系。候选手法不是机械映射;实际选择还必须检查成因、前置条件、风险、行为契约和差异预算。
|
|
4
|
+
|
|
5
|
+
| 坏味道 | 主要/辅助候选 | 选择提示 |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `SMELL-MYSTERIOUS-NAME`<br>神秘命名(Mysterious Name) | `RF-CHANGE-FUNCTION-DECLARATION`<br>`RF-RENAME-VARIABLE`<br>`RF-RENAME-FIELD` | 先确认“神秘命名”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
8
|
+
| `SMELL-DUPLICATED-CODE`<br>重复代码(Duplicated Code) | `RF-EXTRACT-FUNCTION`<br>`RF-SLIDE-STATEMENTS`<br>`RF-PULL-UP-METHOD` | 先确认“重复代码”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
9
|
+
| `SMELL-LONG-FUNCTION`<br>过长函数(Long Function) | `RF-EXTRACT-FUNCTION`<br>`RF-REPLACE-TEMP-WITH-QUERY`<br>`RF-INTRODUCE-PARAMETER-OBJECT`<br>`RF-PRESERVE-WHOLE-OBJECT`<br>`RF-REPLACE-FUNCTION-WITH-COMMAND`<br>`RF-DECOMPOSE-CONDITIONAL`<br>`RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM`<br>`RF-SPLIT-LOOP` | 先确认“过长函数”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
10
|
+
| `SMELL-LONG-PARAMETER-LIST`<br>过长参数列表(Long Parameter List) | `RF-REPLACE-PARAMETER-WITH-QUERY`<br>`RF-PRESERVE-WHOLE-OBJECT`<br>`RF-INTRODUCE-PARAMETER-OBJECT`<br>`RF-REMOVE-FLAG-ARGUMENT`<br>`RF-COMBINE-FUNCTIONS-INTO-CLASS` | 先确认“过长参数列表”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
11
|
+
| `SMELL-GLOBAL-DATA`<br>全局数据(Global Data) | `RF-ENCAPSULATE-VARIABLE` | 先确认“全局数据”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
12
|
+
| `SMELL-MUTABLE-DATA`<br>可变数据(Mutable Data) | `RF-ENCAPSULATE-VARIABLE`<br>`RF-SPLIT-VARIABLE`<br>`RF-SLIDE-STATEMENTS`<br>`RF-EXTRACT-FUNCTION`<br>`RF-SEPARATE-QUERY-FROM-MODIFIER`<br>`RF-REMOVE-SETTING-METHOD`<br>`RF-REPLACE-DERIVED-VARIABLE-WITH-QUERY`<br>`RF-COMBINE-FUNCTIONS-INTO-CLASS`<br>`RF-COMBINE-FUNCTIONS-INTO-TRANSFORM`<br>`RF-CHANGE-REFERENCE-TO-VALUE` | 先确认“可变数据”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
13
|
+
| `SMELL-DIVERGENT-CHANGE`<br>发散式变化(Divergent Change) | `RF-SPLIT-PHASE`<br>`RF-MOVE-FUNCTION`<br>`RF-EXTRACT-FUNCTION`<br>`RF-EXTRACT-CLASS` | 先确认“发散式变化”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
14
|
+
| `SMELL-SHOTGUN-SURGERY`<br>霰弹式修改(Shotgun Surgery) | `RF-MOVE-FUNCTION`<br>`RF-MOVE-FIELD`<br>`RF-COMBINE-FUNCTIONS-INTO-CLASS`<br>`RF-COMBINE-FUNCTIONS-INTO-TRANSFORM`<br>`RF-SPLIT-PHASE`<br>`RF-INLINE-FUNCTION`<br>`RF-INLINE-CLASS` | 先确认“霰弹式修改”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
15
|
+
| `SMELL-FEATURE-ENVY`<br>依恋情结(Feature Envy) | `RF-MOVE-FUNCTION`<br>`RF-EXTRACT-FUNCTION` | 先确认“依恋情结”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
16
|
+
| `SMELL-DATA-CLUMPS`<br>数据泥团(Data Clumps) | `RF-EXTRACT-CLASS`<br>`RF-INTRODUCE-PARAMETER-OBJECT`<br>`RF-PRESERVE-WHOLE-OBJECT` | 先确认“数据泥团”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
17
|
+
| `SMELL-PRIMITIVE-OBSESSION`<br>基本类型偏执(Primitive Obsession) | `RF-REPLACE-PRIMITIVE-WITH-OBJECT`<br>`RF-REPLACE-TYPE-CODE-WITH-SUBCLASSES`<br>`RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM`<br>`RF-EXTRACT-CLASS`<br>`RF-INTRODUCE-PARAMETER-OBJECT` | 先确认“基本类型偏执”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
18
|
+
| `SMELL-REPEATED-SWITCHES`<br>重复的 switch(Repeated Switches) | `RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM` | 先确认“重复的 switch”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
19
|
+
| `SMELL-LOOPS`<br>循环语句(Loops) | `RF-REPLACE-LOOP-WITH-PIPELINE` | 先确认“循环语句”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
20
|
+
| `SMELL-LAZY-ELEMENT`<br>冗赘的元素(Lazy Element) | `RF-INLINE-FUNCTION`<br>`RF-INLINE-CLASS`<br>`RF-COLLAPSE-HIERARCHY` | 先确认“冗赘的元素”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
21
|
+
| `SMELL-SPECULATIVE-GENERALITY`<br>夸夸其谈通用性(Speculative Generality) | `RF-COLLAPSE-HIERARCHY`<br>`RF-INLINE-FUNCTION`<br>`RF-INLINE-CLASS`<br>`RF-CHANGE-FUNCTION-DECLARATION`<br>`RF-REMOVE-DEAD-CODE` | 先确认“夸夸其谈通用性”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
22
|
+
| `SMELL-TEMPORARY-FIELD`<br>临时字段(Temporary Field) | `RF-EXTRACT-CLASS`<br>`RF-MOVE-FUNCTION`<br>`RF-INTRODUCE-SPECIAL-CASE` | 先确认“临时字段”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
23
|
+
| `SMELL-MESSAGE-CHAINS`<br>过长的消息链(Message Chains) | `RF-HIDE-DELEGATE`<br>`RF-EXTRACT-FUNCTION`<br>`RF-MOVE-FUNCTION` | 先确认“过长的消息链”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
24
|
+
| `SMELL-MIDDLE-MAN`<br>中间人(Middle Man) | `RF-REMOVE-MIDDLE-MAN`<br>`RF-INLINE-FUNCTION`<br>`RF-REPLACE-SUPERCLASS-WITH-DELEGATE`<br>`RF-REPLACE-SUBCLASS-WITH-DELEGATE` | 先确认“中间人”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
25
|
+
| `SMELL-INSIDER-TRADING`<br>内幕交易(Insider Trading) | `RF-MOVE-FUNCTION`<br>`RF-MOVE-FIELD`<br>`RF-HIDE-DELEGATE`<br>`RF-REPLACE-SUBCLASS-WITH-DELEGATE`<br>`RF-REPLACE-SUPERCLASS-WITH-DELEGATE` | 先确认“内幕交易”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
26
|
+
| `SMELL-LARGE-CLASS`<br>过大的类(Large Class) | `RF-EXTRACT-CLASS`<br>`RF-EXTRACT-SUPERCLASS`<br>`RF-REPLACE-TYPE-CODE-WITH-SUBCLASSES` | 先确认“过大的类”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
27
|
+
| `SMELL-ALTERNATIVE-CLASSES-DIFFERENT-INTERFACES`<br>异曲同工的类(Alternative Classes with Different Interfaces) | `RF-CHANGE-FUNCTION-DECLARATION`<br>`RF-MOVE-FUNCTION`<br>`RF-EXTRACT-SUPERCLASS` | 先确认“异曲同工的类”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
28
|
+
| `SMELL-DATA-CLASS`<br>纯数据类(Data Class) | `RF-ENCAPSULATE-RECORD`<br>`RF-REMOVE-SETTING-METHOD`<br>`RF-MOVE-FUNCTION`<br>`RF-EXTRACT-FUNCTION`<br>`RF-SPLIT-PHASE` | 先确认“纯数据类”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
29
|
+
| `SMELL-REFUSED-BEQUEST`<br>被拒绝的遗赠(Refused Bequest) | `RF-PUSH-DOWN-METHOD`<br>`RF-PUSH-DOWN-FIELD`<br>`RF-REPLACE-SUBCLASS-WITH-DELEGATE`<br>`RF-REPLACE-SUPERCLASS-WITH-DELEGATE` | 先确认“被拒绝的遗赠”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
30
|
+
| `SMELL-COMMENTS`<br>注释(Comments) | `RF-EXTRACT-FUNCTION`<br>`RF-CHANGE-FUNCTION-DECLARATION`<br>`RF-INTRODUCE-ASSERTION` | 先确认“注释”的真实成因,再从符合当前数据所有权、行为契约和前置条件的手法中选择最小安全变化。 |
|
|
31
|
+
|
|
32
|
+
## 误判保护
|
|
33
|
+
|
|
34
|
+
- 行数本身不能证明“过长函数”或“过大的类”;
|
|
35
|
+
- 单个 `switch` 不能证明“重复的 switch”;
|
|
36
|
+
- `filter().map().reduce()` 之类数据管道不自动等同于“过长的消息链”;
|
|
37
|
+
- 注释本身不是缺陷,不能仅因 `Comments` 是坏味道类别就删除注释;
|
|
38
|
+
- 不可变 DTO/中转数据可以合理保持为数据型结构;
|
|
39
|
+
- React/Vue 声明式组合不自动等同于“中间人”或“过长的消息链”。
|
|
40
|
+
|
|
41
|
+
详细诊断规则见 [`fec-code-smells`](../../localized/zh-CN/skills/fec-code-smells/references/detection-guide.md)。
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Review scope and technical diagram delivery
|
|
2
|
+
|
|
3
|
+
These conventions apply to the installed capabilities across runtimes. Use natural-language requests; review modes are not installer CLI flags.
|
|
4
|
+
|
|
5
|
+
## Review scope
|
|
6
|
+
|
|
7
|
+
`fec-code-reviewer`, `fec-typescript-reviewer`, `fec-security-reviewer`, `fec-code-review`, `fec-security-review`, and `/fec-review` follow the same scope rules:
|
|
8
|
+
|
|
9
|
+
| Request | Scope | Report conclusion |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| No scope, including bare `/fec-review` | Entire project, even when Git changes exist | Risk assessment |
|
|
12
|
+
| A file or directory | All existing code in that scope, including unchanged code | Scope risk assessment |
|
|
13
|
+
| Explicit recent changes, PR, or commit | Requested diff and necessary context | Merge recommendation |
|
|
14
|
+
|
|
15
|
+
Full and targeted reviews do not require a Git diff. An explicit incremental review with no changes reports that fact without expanding its scope. Reviewers keep their frontend, TypeScript, or security specialty; this does not certify a backend security audit.
|
|
16
|
+
|
|
17
|
+
For project reviews, inventory owned frontend code, related tests, configuration, and dependency declarations, then review modules in batches. Exclude dependencies, generated files, build outputs, caches, and third-party code by default. Reports record mode, target scope, reviewed scope, exclusions, uncovered modules, and validation results. Mark incomplete reviews as partial and merge findings with the same root cause. Reading callers or running static checks does not count as manually reviewing those files. Report only unless fixes are explicitly requested.
|
|
18
|
+
|
|
19
|
+
Examples: “Review the project”; “Review all code in `src/features/`”; “Review `src/components/Button.tsx`”; “Review only the recent changes.” Automatic review after edits must explicitly pass the current change scope.
|
|
20
|
+
|
|
21
|
+
## Technical diagrams
|
|
22
|
+
|
|
23
|
+
Use `fec-image-generation` for sequence diagrams and workflows with local Mermaid where available; use `fec-drawio-studio` for editable architecture diagrams. Use the JSON/HTML renderer when these tools are unavailable. Keep technical relationships and labels in editable source rather than relying on raster image generation for exact structure.
|
|
24
|
+
|
|
25
|
+
The Mermaid adapter uses an installed CLI only; it does not download packages. PNG export requires a local Chromium browser, with `FEC_BROWSER_PATH` available for an explicit executable. Missing tools must be reported rather than claimed as successful exports.
|
|
26
|
+
|
|
27
|
+
For the JSON/HTML route, render the source, export PNG with a browser-measured manifest at the same scale, run QA, and inspect the final image:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
node skills/fec-image-generation/scripts/tech-diagram-render.mjs --input skills/fec-image-generation/assets/quality-examples/workflow.json --type workflow --output workflow.html --manifest workflow.layout.json
|
|
31
|
+
node skills/fec-image-generation/scripts/export-diagram.mjs --input workflow.html --format png --output workflow.png --theme light --scale 2 --manifest workflow.layout.json --output-manifest workflow.actual.json
|
|
32
|
+
node skills/fec-image-generation/scripts/png-qa.mjs --png workflow.png --manifest workflow.actual.json --format json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Preserve complete Unicode labels, explicit geometry, edge direction, sequence order, and self calls. Keep exported SVG styles self-contained. Geometry QA and browser measurement support visual inspection; neither proves semantic correctness nor completes a human visual review. Missing measurements or partial coverage must be disclosed. Repair the editable source for at most two automatic rounds, then report unresolved defects.
|
|
36
|
+
|
|
37
|
+
Deliver editable source, the requested export, and QA/coverage results. See [reproducible examples](../skills/fec-image-generation/assets/quality-examples/README.md), [diagram workflows](../skills/fec-image-generation/references/diagram-workflows.md), and [PNG QA](../skills/fec-image-generation/references/png-qa-autofix.md).
|
|
38
|
+
|
|
39
|
+
[简体中文](zh-CN/review-and-diagram-workflows.md)
|