mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
refactor: SKILL.md abstraction cleanup + coordinator frontend detection
- Remove ui-ux-pro-max/Shared Memory sections from SKILL.md (implementation details belong in role.md) - Replace Frontend Detection code block with reference to coordinator/role.md - Add detectImplMode() to coordinator Phase 1 for auto-detecting frontend tasks - Add fe-only/fullstack/full-lifecycle-fe mode choices - Add fe-developer + fe-qa spawning in Phase 2 for frontend pipelines - Initialize shared-memory.json when frontend pipeline is active
This commit is contained in:
@@ -426,28 +426,9 @@ Full-lifecycle + FE:
|
|||||||
→ IMPL-001 ∥ DEV-FE-001 → TEST-001 ∥ QA-FE-001 → REVIEW-001
|
→ IMPL-001 ∥ DEV-FE-001 → TEST-001 ∥ QA-FE-001 → REVIEW-001
|
||||||
```
|
```
|
||||||
|
|
||||||
### Frontend Detection (Coordinator Phase 1)
|
### Frontend Detection
|
||||||
|
|
||||||
```javascript
|
Coordinator 在 Phase 1 根据任务关键词 + 项目文件自动检测前端任务并选择流水线模式(fe-only / fullstack / impl-only)。检测逻辑见 [roles/coordinator/role.md](roles/coordinator/role.md)。
|
||||||
const FE_KEYWORDS = /component|page|UI|前端|frontend|CSS|HTML|React|Vue|Tailwind|组件|页面|样式|layout|responsive|Svelte|Next\.js|Nuxt|shadcn|设计系统|design.system/i
|
|
||||||
|
|
||||||
const BE_KEYWORDS = /API|database|server|后端|backend|middleware|auth|REST|GraphQL|migration|schema|model|controller|service/i
|
|
||||||
|
|
||||||
function detectImplMode(taskDescription) {
|
|
||||||
const hasFE = FE_KEYWORDS.test(taskDescription)
|
|
||||||
const hasBE = BE_KEYWORDS.test(taskDescription)
|
|
||||||
|
|
||||||
// Also check project files
|
|
||||||
const hasFEFiles = Bash(`test -f package.json && (grep -q react package.json || grep -q vue package.json || grep -q svelte package.json || grep -q next package.json); echo $?`) === '0'
|
|
||||||
|
|
||||||
if (hasFE && hasBE) return 'fullstack'
|
|
||||||
if (hasFE || hasFEFiles) return 'fe-only'
|
|
||||||
return 'impl-only' // default backend
|
|
||||||
}
|
|
||||||
|
|
||||||
// Coordinator uses this in Phase 1 to select pipeline
|
|
||||||
const implMode = detectImplMode(requirements.scope + ' ' + requirements.originalInput)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Generator-Critic Loop (fe-developer ↔ fe-qa)
|
### Generator-Critic Loop (fe-developer ↔ fe-qa)
|
||||||
|
|
||||||
@@ -523,79 +504,6 @@ Coordinator supports `--resume` / `--continue` flags to resume interrupted sessi
|
|||||||
10. **Kick** — 向首个可执行任务的 worker 发送 `task_unblocked` 消息,打破 resume 死锁
|
10. **Kick** — 向首个可执行任务的 worker 发送 `task_unblocked` 消息,打破 resume 死锁
|
||||||
11. Jumps to Phase 4 coordination loop
|
11. Jumps to Phase 4 coordination loop
|
||||||
|
|
||||||
## ui-ux-pro-max Integration (Frontend Pipelines)
|
|
||||||
|
|
||||||
When frontend pipelines are active, the design intelligence chain leverages ui-ux-pro-max:
|
|
||||||
|
|
||||||
### Design Intelligence Chain
|
|
||||||
|
|
||||||
```
|
|
||||||
analyst (RESEARCH-001)
|
|
||||||
└→ Skill(skill="ui-ux-pro-max", args="${industry} ${keywords} --design-system")
|
|
||||||
└→ Output: {session}/analysis/design-intelligence.json
|
|
||||||
|
|
||||||
architect (via planner PLAN-001)
|
|
||||||
└→ Consumes design-intelligence.json → generates design-tokens.json
|
|
||||||
└→ Output: {session}/architecture/design-tokens.json
|
|
||||||
|
|
||||||
fe-developer (DEV-FE-*)
|
|
||||||
└→ Consumes design-tokens.json → generates src/styles/tokens.css (:root + dark mode)
|
|
||||||
└→ Consumes anti-patterns + implementation checklist from design-intelligence.json
|
|
||||||
|
|
||||||
fe-qa (QA-FE-*)
|
|
||||||
└→ Consumes design-intelligence.json → industry anti-pattern checks
|
|
||||||
└→ Consumes design-tokens.json → design compliance checks
|
|
||||||
└→ Uses industry strictness (standard/strict) for audit depth
|
|
||||||
```
|
|
||||||
|
|
||||||
### Skill Invocation
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// Full design system recommendation
|
|
||||||
Skill(skill="ui-ux-pro-max", args="${industry} ${keywords} --design-system")
|
|
||||||
|
|
||||||
// Domain-specific search (UX guidelines, typography, color)
|
|
||||||
Skill(skill="ui-ux-pro-max", args="${query} --domain ${domain}")
|
|
||||||
|
|
||||||
// Tech stack guidelines
|
|
||||||
Skill(skill="ui-ux-pro-max", args="${query} --stack ${stack}")
|
|
||||||
|
|
||||||
// Persist design system (cross-session reuse)
|
|
||||||
Skill(skill="ui-ux-pro-max", args="${query} --design-system --persist -p ${projectName}")
|
|
||||||
```
|
|
||||||
|
|
||||||
### Supported Domains & Stacks
|
|
||||||
|
|
||||||
- **Domains**: product, style, typography, color, landing, chart, ux, web
|
|
||||||
- **Stacks**: html-tailwind, react, nextjs, vue, svelte, shadcn, swiftui, react-native, flutter
|
|
||||||
|
|
||||||
### Fallback
|
|
||||||
|
|
||||||
若 ui-ux-pro-max skill 未安装,降级为 LLM 通用设计知识。安装命令:`/plugin install ui-ux-pro-max@ui-ux-pro-max-skill`
|
|
||||||
|
|
||||||
## Shared Memory (Frontend Pipelines)
|
|
||||||
|
|
||||||
Frontend pipelines use `shared-memory.json` for cross-role state accumulation:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"design_intelligence": {},
|
|
||||||
"design_token_registry": {
|
|
||||||
"colors": {}, "typography": {}, "spacing": {}, "shadows": {}
|
|
||||||
},
|
|
||||||
"component_inventory": [],
|
|
||||||
"style_decisions": [],
|
|
||||||
"qa_history": [],
|
|
||||||
"industry_context": { "industry": "SaaS/科技", "config": { "strictness": "standard" } }
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
| Role | Phase 2 (Read) | Phase 4/5 (Write) |
|
|
||||||
|------|---------------|-------------------|
|
|
||||||
| coordinator | — | Initialize shared-memory.json |
|
|
||||||
| fe-developer | design_intelligence, design_token_registry | component_inventory |
|
|
||||||
| fe-qa | design_intelligence, industry_context, qa_history | qa_history |
|
|
||||||
|
|
||||||
## Coordinator Spawn Template
|
## Coordinator Spawn Template
|
||||||
|
|
||||||
When coordinator creates teammates, use this pattern:
|
When coordinator creates teammates, use this pattern:
|
||||||
|
|||||||
@@ -288,7 +288,10 @@ if (!mode) {
|
|||||||
choices: [
|
choices: [
|
||||||
"spec-only - Generate specifications only",
|
"spec-only - Generate specifications only",
|
||||||
"impl-only - Implementation only (requires existing spec)",
|
"impl-only - Implementation only (requires existing spec)",
|
||||||
"full-lifecycle - Complete spec + implementation"
|
"full-lifecycle - Complete spec + implementation",
|
||||||
|
"fe-only - Frontend-only pipeline (plan → dev → QA)",
|
||||||
|
"fullstack - Backend + frontend parallel pipeline",
|
||||||
|
"full-lifecycle-fe - Full lifecycle with frontend (spec → fullstack)"
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -330,6 +333,38 @@ const requirements = {
|
|||||||
originalInput: userInput
|
originalInput: userInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Frontend Detection ---
|
||||||
|
// Auto-detect frontend tasks and adjust pipeline mode
|
||||||
|
const FE_KEYWORDS = /component|page|UI|前端|frontend|CSS|HTML|React|Vue|Tailwind|组件|页面|样式|layout|responsive|Svelte|Next\.js|Nuxt|shadcn|设计系统|design.system/i
|
||||||
|
const BE_KEYWORDS = /API|database|server|后端|backend|middleware|auth|REST|GraphQL|migration|schema|model|controller|service/i
|
||||||
|
|
||||||
|
function detectImplMode(taskDescription) {
|
||||||
|
const hasFE = FE_KEYWORDS.test(taskDescription)
|
||||||
|
const hasBE = BE_KEYWORDS.test(taskDescription)
|
||||||
|
|
||||||
|
// Also check project files for frontend frameworks
|
||||||
|
const hasFEFiles = Bash(`test -f package.json && (grep -q react package.json || grep -q vue package.json || grep -q svelte package.json || grep -q next package.json); echo $?`) === '0'
|
||||||
|
|
||||||
|
if (hasFE && hasBE) return 'fullstack'
|
||||||
|
if (hasFE || hasFEFiles) return 'fe-only'
|
||||||
|
return 'impl-only' // default backend
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply frontend detection for implementation modes
|
||||||
|
if (mode === 'impl-only' || mode === 'full-lifecycle') {
|
||||||
|
const detectedMode = detectImplMode(scope + ' ' + userInput)
|
||||||
|
if (detectedMode !== 'impl-only') {
|
||||||
|
// Frontend detected — upgrade pipeline mode
|
||||||
|
if (mode === 'impl-only') {
|
||||||
|
mode = detectedMode // fe-only or fullstack
|
||||||
|
} else if (mode === 'full-lifecycle') {
|
||||||
|
mode = 'full-lifecycle-fe' // spec + fullstack
|
||||||
|
}
|
||||||
|
requirements.mode = mode
|
||||||
|
Output(`[coordinator] Frontend detected → pipeline upgraded to: ${mode}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Output("[coordinator] Requirements clarified:")
|
Output("[coordinator] Requirements clarified:")
|
||||||
Output(` Mode: ${mode}`)
|
Output(` Mode: ${mode}`)
|
||||||
Output(` Scope: ${scope}`)
|
Output(` Scope: ${scope}`)
|
||||||
@@ -395,31 +430,42 @@ const sessionData = {
|
|||||||
Write(sessionFile, sessionData)
|
Write(sessionFile, sessionData)
|
||||||
Output(`[coordinator] Session file created: ${sessionFile}`)
|
Output(`[coordinator] Session file created: ${sessionFile}`)
|
||||||
|
|
||||||
// Spawn workers conditionally
|
// Spawn workers conditionally based on pipeline mode
|
||||||
if (requirements.mode === "spec-only" || requirements.mode === "full-lifecycle") {
|
const isFE = ['fe-only', 'fullstack', 'full-lifecycle-fe'].includes(requirements.mode)
|
||||||
TeamSpawn({
|
const isBE = ['impl-only', 'fullstack', 'full-lifecycle', 'full-lifecycle-fe'].includes(requirements.mode)
|
||||||
team_id: teamId,
|
const isSpec = ['spec-only', 'full-lifecycle', 'full-lifecycle-fe'].includes(requirements.mode)
|
||||||
role: "spec-writer",
|
|
||||||
count: 1
|
if (isSpec) {
|
||||||
})
|
TeamSpawn({ team_id: teamId, role: "spec-writer", count: 1 })
|
||||||
Output("[coordinator] Spawned spec-writer")
|
Output("[coordinator] Spawned spec-writer")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requirements.mode === "impl-only" || requirements.mode === "full-lifecycle") {
|
if (isBE) {
|
||||||
TeamSpawn({
|
TeamSpawn({ team_id: teamId, role: "implementer", count: 1 })
|
||||||
team_id: teamId,
|
|
||||||
role: "implementer",
|
|
||||||
count: 1
|
|
||||||
})
|
|
||||||
Output("[coordinator] Spawned implementer")
|
Output("[coordinator] Spawned implementer")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFE) {
|
||||||
|
TeamSpawn({ team_id: teamId, role: "fe-developer", count: 1 })
|
||||||
|
Output("[coordinator] Spawned fe-developer")
|
||||||
|
TeamSpawn({ team_id: teamId, role: "fe-qa", count: 1 })
|
||||||
|
Output("[coordinator] Spawned fe-qa")
|
||||||
|
|
||||||
|
// Initialize shared memory for frontend pipeline
|
||||||
|
const sharedMemoryPath = `${sessionFolder}/shared-memory.json`
|
||||||
|
Write(sharedMemoryPath, JSON.stringify({
|
||||||
|
design_intelligence: {},
|
||||||
|
design_token_registry: {},
|
||||||
|
component_inventory: [],
|
||||||
|
style_decisions: [],
|
||||||
|
qa_history: [],
|
||||||
|
industry_context: {}
|
||||||
|
}, null, 2))
|
||||||
|
Output("[coordinator] Initialized shared-memory.json for frontend pipeline")
|
||||||
|
}
|
||||||
|
|
||||||
// Always spawn researcher for ambiguity resolution
|
// Always spawn researcher for ambiguity resolution
|
||||||
TeamSpawn({
|
TeamSpawn({ team_id: teamId, role: "researcher", count: 1 })
|
||||||
team_id: teamId,
|
|
||||||
role: "researcher",
|
|
||||||
count: 1
|
|
||||||
})
|
|
||||||
Output("[coordinator] Spawned researcher")
|
Output("[coordinator] Spawned researcher")
|
||||||
|
|
||||||
goto Phase3
|
goto Phase3
|
||||||
|
|||||||
Reference in New Issue
Block a user