# feature-executor-generator > This skill should be used when the user asks to 'generate executor skill', 'create dynamic feature executor', 'build hybrid executor', or needs to generate a self-deleting executor with architect design and phase-based implementation. - Author: Ngoc - Repository: Vegarnom/mega-team-v4 - Version: 20260202115326 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/Vegarnom/mega-team-v4 - Web: https://mule.run/skillshub/@@Vegarnom/mega-team-v4~feature-executor-generator:20260202115326 --- --- name: feature-executor-generator description: This skill should be used when the user asks to 'generate executor skill', 'create dynamic feature executor', 'build hybrid executor', or needs to generate a self-deleting executor with architect design and phase-based implementation. allowed-tools: Read, Write, Edit, Bash, Glob, Grep version: 1.1 --- # Feature Executor Generator v1.1 Generate dynamic executor skill với Hybrid approach. --- ## WHAT'S NEW IN v1.1 - **Hybrid Approach**: Architect Design → Implement → Architect Review - **Scope from Plan**: Sử dụng scope từ PLAN.md - **Phase-based Architect Review**: Review sau mỗi phase (Backend → Frontend → Mobile) - **Multi-Round Fix**: Fix issues từ architect review (max 2 rounds) --- ## WHAT THIS DOES 1. Đọc PLAN.md từ `.claude/plans/feat-{ISSUE_ID}/` 2. Tạo skill mới tại `.claude/skills/_dynamic/exec-feat-{ISSUE_ID}/SKILL.md` 3. Skill mới chứa: - Toàn bộ context của task (phases, specs, etc.) - Architect Review sau mỗi phase - Multi-round fix nếu có issues 4. Khi execute xong, skill tự xóa chính nó --- ## USAGE ```bash /feature-executor-generator # Find plan and generate skill /feature-executor-generator .claude/plans/feat-456/ # Specific plan ``` --- ## GENERATED SKILL LOCATION ``` .claude/skills/_dynamic/ ├── exec-feat-456/ │ ├── SKILL.md # Generated executor for Issue #456 │ └── context.json # Embedded context from plan ├── exec-feat-789/ │ └── SKILL.md # Generated executor for Issue #789 └── ... ``` --- ## WORKFLOW ### Step 1: Parse Plan ```typescript // Find plan PLAN_DIR = ".claude/plans/feat-${ISSUE_ID}" PLAN_FILE = "${PLAN_DIR}/PLAN.md" ISSUE_ID = extractIssueId(PLAN_DIR) // Read plan ${PLAN_FILE} // Parse to extract structured data plan = { issue_id: ISSUE_ID, summary: extractSection("Summary"), scope: extractScope(), // ["Backend", "Frontend", "Mobile"] phases: extractPhases(), files_summary: extractFilesSummary() } // Load detail files details = {} IF exists("${PLAN_DIR}/details/data-flow.md"): ${PLAN_DIR}/details/data-flow.md details.data_flow = content IF exists("${PLAN_DIR}/details/api-spec.md"): ${PLAN_DIR}/details/api-spec.md details.api_spec = content IF exists("${PLAN_DIR}/details/ui-spec.md"): ${PLAN_DIR}/details/ui-spec.md details.ui_spec = content IF exists("${PLAN_DIR}/details/test-cases.md"): ${PLAN_DIR}/details/test-cases.md details.test_cases = content ``` ### Step 2: Generate Dynamic Skill with Hybrid Approach ```typescript // Create skill directory SKILL_DIR = ".claude/skills/_dynamic/exec-feat-${ISSUE_ID}" mkdir -p ${SKILL_DIR} // Generate SKILL.md with embedded context + Hybrid approach skill_content = ` --- name: exec-feat-${ISSUE_ID} description: Execute feature #${ISSUE_ID} with Hybrid approach. Auto-generated, will self-delete after completion. allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Task, TodoWrite version: 1.0 auto-generated: true issue-id: ${ISSUE_ID} scope: ${plan.scope.join(", ")} hooks: PostToolUse: - matcher: { tool_name: "Edit" } command: "bash ~/.claude/scripts/auto-lint.sh" - matcher: { tool_name: "Write" } command: "bash ~/.claude/scripts/auto-lint.sh" PreToolUse: - matcher: { tool_name: "Edit", file_pattern: "*.entity.ts" } command: "bash ~/.claude/scripts/pre-entity-edit.sh" --- # Executor for Feature #${ISSUE_ID} > **Auto-generated skill** - Hybrid Approach: Phase Implement → Architect Review → Fix > **Scope:** ${plan.scope.join(", ")} --- ## EMBEDDED CONTEXT ### Feature Summary ${plan.summary} ### Scope ${plan.scope.join(", ")} ### Phases ${plan.phases.map((phase, pi) => ` #### Phase ${pi + 1}: ${phase.name} ${phase.steps.map((step, si) => ` ##### Step ${step.index}: ${step.title} - **Files:** ${step.files.join(", ")} - **Type:** ${step.type} - **Sub-steps:** ${step.sub_steps.map(s => ` - ${s.description}`).join('\n')} `).join('\n')} `).join('\n')} ### Files Summary | File | Purpose | Status | |------|---------|--------| ${plan.files_summary.map(f => `| \`${f.path}\` | ${f.purpose} | [ ] |`).join('\n')} ${details.data_flow ? ` ### Data Flow Spec ${details.data_flow} ` : ''} ${details.api_spec ? ` ### API Spec ${details.api_spec} ` : ''} ${details.ui_spec ? ` ### UI Spec ${details.ui_spec} ` : ''} --- ## EXECUTION (Hybrid Approach - Phase by Phase) ### Initialize \`\`\`typescript ISSUE_ID = "${ISSUE_ID}" PLAN_DIR = ".claude/plans/feat-${ISSUE_ID}" SKILL_DIR = ".claude/skills/_dynamic/exec-feat-${ISSUE_ID}" PROGRESS_FILE = "\${PLAN_DIR}/.progress-${ISSUE_ID}.json" SCOPE = ${JSON.stringify(plan.scope)} // Load or create progress IF exists(PROGRESS_FILE): progress = JSON.parse(\${PROGRESS_FILE}) current_phase = progress.current_phase current_step = progress.current_step ELSE: current_phase = 0 current_step = 0 progress = { issue_id: "${ISSUE_ID}", scope: SCOPE, phases_completed: [], steps_completed: [], current_phase: 0, current_step: 0, architect_reviews: {}, review_rounds: {} } console.log("🚀 Executing Feature #${ISSUE_ID} (Hybrid Approach)") console.log("📋 Phases: ${plan.phases.length}") console.log("📁 Scope: ${plan.scope.join(', ')}") \`\`\` ### Execute Phases (with Architect Review after each) ${plan.phases.map((phase, pi) => ` #### Phase ${pi + 1}: ${phase.name} ##### ${pi + 1}.1 Implement Steps \`\`\`typescript IF current_phase <= ${pi}: console.log("\\n${"#".repeat(50)}") console.log("PHASE ${pi + 1}: ${phase.name.toUpperCase()}") console.log("${"#".repeat(50)}\\n") ${phase.steps.map((step, si) => ` // Step ${step.index}: ${step.title} IF current_phase == ${pi} && current_step <= ${si}: console.log("\\n== Step ${step.index}: ${step.title} ==") // Read files ${step.files.map(f => `${f}`).join('\n ')} // Implement ${step.sub_steps.map(s => `// - ${s.description}`).join('\n ')} // Verify ${phase.name === 'Backend' ? `cd packages/backend && npx tsc --noEmit 2>&1 | head -20` : phase.name === 'Frontend' ? `cd packages/frontend && npx vue-tsc --noEmit 2>&1 | head -20` : phase.name === 'Mobile' ? `cd packages/mobile && flutter analyze 2>&1 | head -20` : `// Skip verification for ${phase.name}` } // Save progress progress.current_phase = ${pi} progress.current_step = ${si + 1} progress.steps_completed.push("${pi}.${si}") \${JSON.stringify(progress, null, 2)} console.log("✅ Step ${step.index} COMPLETE") `).join('\n')} \`\`\` ##### ${pi + 1}.2 Architect Review for ${phase.name} \`\`\`typescript console.log("\\n🏗️ ARCHITECT REVIEW - ${phase.name}") ${phase.name === 'Backend' ? ` // Get backend files from this phase backend_files = ${JSON.stringify(phase.steps.flatMap(s => s.files).filter(f => f.includes('packages/backend') || f.includes('.entity.ts') || f.includes('.service.ts') || f.includes('.controller.ts') || f.includes('.module.ts') ))} ## Phase ${pi + 1} Code Review - Backend **Feature:** #${ISSUE_ID} - ${plan.summary} **Phase:** ${phase.name} **Files Implemented:** ${phase.steps.flatMap(s => s.files).map(f => `- ${f}`).join('\n')} **Review Focus:** 1. NestJS best practices - Proper DI, decorators, error handling 2. Entity design - Relations, indexes, constraints 3. Service layer - Business logic separation 4. Controller - Input validation, response format 5. Performance - No N+1 queries, proper eager/lazy loading 6. Security - Authorization, input sanitization **Output Format:** - PASS: Code is good - ISSUES: List specific issues with file:line and fix suggestion ` : phase.name === 'Frontend' ? ` // Get frontend files from this phase frontend_files = ${JSON.stringify(phase.steps.flatMap(s => s.files).filter(f => f.includes('packages/frontend') || f.includes('.vue') || f.includes('.ts') ))} ## Phase ${pi + 1} Code Review - Frontend **Feature:** #${ISSUE_ID} - ${plan.summary} **Phase:** ${phase.name} **Files Implemented:** ${phase.steps.flatMap(s => s.files).map(f => `- ${f}`).join('\n')} **Review Focus:** 1. Vue 3 Composition API - Proper reactivity, composables 2. Component structure - Props, emits, slots, expose 3. State management - Pinia store patterns 4. TypeScript - Proper typing, no any 5. Performance - Computed vs methods, v-memo, lazy loading 6. Accessibility - ARIA, keyboard navigation **Output Format:** - PASS: Code is good - ISSUES: List specific issues with file:line and fix suggestion ` : phase.name === 'Mobile' ? ` // Get mobile files from this phase mobile_files = ${JSON.stringify(phase.steps.flatMap(s => s.files).filter(f => f.includes('packages/mobile') || f.includes('.dart') ))} ## Phase ${pi + 1} Code Review - Mobile **Feature:** #${ISSUE_ID} - ${plan.summary} **Phase:** ${phase.name} **Files Implemented:** ${phase.steps.flatMap(s => s.files).map(f => `- ${f}`).join('\n')} **Review Focus:** 1. Flutter best practices - Widget composition, keys 2. State management - BLoC/Provider patterns 3. Performance - Build method optimization, const constructors 4. Platform handling - iOS/Android differences 5. Error handling - User feedback, offline support **Output Format:** - PASS: Code is good - ISSUES: List specific issues with file:line and fix suggestion ` : ` // No architect review for ${phase.name} phase console.log("⏭️ Skip architect review for ${phase.name}") `} // Save review results progress.architect_reviews["${phase.name}"] = review_result \${JSON.stringify(progress, null, 2)} \`\`\` ##### ${pi + 1}.3 Fix Issues (if any) \`\`\`typescript console.log("\\n🔧 FIX REVIEW ISSUES - ${phase.name}") review = progress.architect_reviews["${phase.name}"] IF review && review.hasIssues: progress.review_rounds["${phase.name}"] = (progress.review_rounds["${phase.name}"] || 0) + 1 IF progress.review_rounds["${phase.name}"] > 2: console.log("⚠️ Max review rounds (2) reached for ${phase.name}. Manual review needed.") ELSE: FOR issue IN review.issues: console.log(\`Fixing: \${issue.file}:\${issue.line}\`) \${issue.file} Apply fix: \${issue.suggestion} // Re-verify ${phase.name === 'Backend' ? `cd packages/backend && npx tsc --noEmit 2>&1 | head -20` : phase.name === 'Frontend' ? `cd packages/frontend && npx vue-tsc --noEmit 2>&1 | head -20` : phase.name === 'Mobile' ? `cd packages/mobile && flutter analyze 2>&1 | head -20` : `// Skip verification` } \${JSON.stringify(progress, null, 2)} console.log("✅ Review issues fixed for ${phase.name}") ELSE: console.log("✅ No issues from architect review for ${phase.name}") // Mark phase complete progress.phases_completed.push(${pi}) console.log("\\n✅ Phase ${pi + 1}: ${phase.name} COMPLETE") \`\`\` `).join('\n')} ### Final Verification \`\`\`typescript console.log("\\n🔍 FINAL VERIFICATION") ${plan.scope.includes('Backend') ? ` cd packages/backend && npx tsc --noEmit cd packages/backend && npm run lint -- --quiet cd packages/backend && npm run test -- --passWithNoTests ` : ''} ${plan.scope.includes('Frontend') ? ` cd packages/frontend && npx vue-tsc --noEmit cd packages/frontend && npm run lint -- --quiet cd packages/frontend && npm run test:unit ` : ''} ${plan.scope.includes('Mobile') ? ` cd packages/mobile && flutter analyze cd packages/mobile && flutter test ` : ''} await allBackgroundTasks() IF all_passed: console.log("✅ All verifications passed!") ELSE: console.log("❌ Some verifications failed") showFailures() \`\`\` ### Self-Cleanup \`\`\`typescript console.log("\\n🧹 CLEANUP") IF all_passed: ASK USER: "Delete executor skill and temp files? (Y/N)" IF user_confirms: // Delete progress file rm "\${PROGRESS_FILE}" // Delete detail files rm -rf "\${PLAN_DIR}/details/" // DELETE THIS SKILL (self-cleanup) rm -rf "\${SKILL_DIR}" console.log("🎉 Feature #${ISSUE_ID} complete! Skill self-deleted.") console.log("ℹ To cleanup plan: rm -rf \${PLAN_DIR}") \`\`\` --- ## STRICT RULES 1. **PHASE ORDER** - Backend → Frontend → Mobile → Database → Testing 2. **NO SKIP** - Execute each step in order within phase 3. **VERIFY** - TypeScript + Lint after each step 4. **ARCHITECT REVIEW** - Run after EACH phase completes 5. **FIX ISSUES** - Apply fixes from architect review (max 2 rounds per phase) 6. **SAVE** - Progress after each step and phase 7. **SELF-DELETE** - Remove this skill after completion ` ${skill_content} // Save context as JSON for reference ${JSON.stringify({ plan, details }, null, 2)} console.log(` ✅ Dynamic executor skill created (Hybrid Approach)! Location: ${SKILL_DIR}/SKILL.md Issue: #${ISSUE_ID} Scope: ${plan.scope.join(", ")} Phases: ${plan.phases.length} Flow (per phase): 1. Implement phase steps 2. Architect Review (${plan.scope.map(s => s + "-architect").join(" / ")}) 3. Fix issues (if any, max 2 rounds) 4. Next phase... 5. Final verification 6. Self-cleanup To execute: /exec-feat-${ISSUE_ID} This skill will self-delete after successful completion. `) ``` --- ## CLEANUP Skill tự xóa sau khi hoàn thành, hoặc manual: ```bash # Delete specific dynamic skill rm -rf .claude/skills/_dynamic/exec-feat-456/ # Delete all dynamic skills rm -rf .claude/skills/_dynamic/ ```