xiaohongshu
xiaohongshu
moai-alfred-clone-pattern
Enterprise Master-Clone pattern implementation guide for complex multi-step tasks with full project context, autonomous delegation, parallel processing, and intelligent task distribution; activates for large-scale migrations, complex refactoring, parallel exploration, architecture restructuring, ...
Full skill instructions
| Field | Value |
|---|---|
| Skill Name | moai-alfred-clone-pattern |
| Version | 4.0.0 Enterprise (2025-11-12) |
| Allowed tools | Read, Bash, Task |
| Auto-load | On demand for complex multi-step tasks |
| Tier | Alfred (Orchestration) |
| Lines of Content | 900+ with 12+ enterprise examples |
| Progressive Disclosure | 3-level (quick-start, patterns, advanced) |
Provides comprehensive guidance for Alfred's Master-Clone pattern - a delegation mechanism where Alfred creates autonomous clones (Task-delegated agents) to handle complex multi-step tasks that don't require domain-specific expertise but benefit from:
Use Clone Pattern when:
Examples:
DON'T use Clone Pattern when:
Master Agent (Alfred)
↓ Creates with Task()
Clone Agent #1 Clone Agent #2 Clone Agent #3
(Parallel execution with shared context)
↓ ↓ ↓
[Exploration] [Analysis] [Implementation]
↓ ↓ ↓
Results aggregation & synthesis by Master
↓
User presentation + next steps
Master Responsibilities:
Clone Responsibilities:
Scenario: Explore multiple implementation approaches in parallel
// Master agent: Create parallel clones for exploration
const clones = [
Task({
description: "Explore PostgreSQL implementation for user persistence",
prompt: "Analyze PostgreSQL libraries, schema design, migration strategy. Provide pros/cons and code examples."
}),
Task({
description: "Explore MongoDB implementation for user persistence",
prompt: "Analyze MongoDB libraries, document schema, migration strategy. Provide pros/cons and code examples."
}),
Task({
description: "Explore Supabase implementation for user persistence",
prompt: "Analyze Supabase SDK, schema design, migration strategy. Provide pros/cons and code examples."
})
];
// Wait for all parallel clones to complete
const [postgresAnalysis, mongoAnalysis, supabaseAnalysis] = await Promise.all(clones);
// Master synthesizes results
const comparison = {
options: [postgresAnalysis, mongoAnalysis, supabaseAnalysis],
recommendation: selectBestOption(clones),
tradeoffs: analyzeTradeoffs(clones)
};
Scenario: Complex migration where later steps depend on earlier analysis
// Step 1: Analyze current state
const analysisResult = await Task({
description: "Analyze v0.14.0 codebase structure",
prompt: "Scan project for all imports of 'old-api'. Document usage patterns, edge cases, and dependencies. Provide summary with file-by-file breakdown."
});
// Step 2: Plan migration strategy (depends on analysis)
const planResult = await Task({
description: "Plan migration strategy from v0.14.0 to v0.15.2",
prompt: `Using this analysis: ${analysisResult}\n\nCreate a step-by-step migration plan with:\n- Phased approach (phase 1, 2, 3)\n- Risk mitigation\n- Testing strategy\n- Rollback procedure`
});
// Step 3: Execute migration (depends on plan)
const migrationResult = await Task({
description: "Execute v0.14.0 → v0.15.2 migration",
prompt: `Using this plan: ${planResult}\n\nExecute the migration:\n- Update imports\n- Modify APIs\n- Update tests\n- Verify compatibility`
});
// Step 4: Validate results (depends on migration)
const validationResult = await Task({
description: "Validate migration completeness",
prompt: `Verify migration:\n- All imports updated\n- No breaking changes\n- Tests passing\n- Performance metrics maintained`
});
// Master reports final state
return {
analysis: analysisResult,
plan: planResult,
migration: migrationResult,
validation: validationResult,
status: validationResult.passed ? "SUCCESS" : "NEEDS_REVIEW"
};
Scenario: Large refactoring with parallel analysis, synchronized implementation
// Phase 1: Parallel analysis clones
const [apiAnalysis, dbAnalysis, authAnalysis] = await Promise.all([
Task({ description: "Analyze API layer usage...", prompt: "..." }),
Task({ description: "Analyze DB layer usage...", prompt: "..." }),
Task({ description: "Analyze Auth layer usage...", prompt: "..." })
]);
// Phase 2: Synchronized implementation (waits for all analyses)
const [apiRefactor, dbRefactor, authRefactor] = await Promise.all([
Task({
description: "Refactor API layer",
prompt: `Based on analysis:\n${apiAnalysis}\n\nRefactor API with:\n- New patterns\n- Tests\n- Documentation`
}),
Task({
description: "Refactor DB layer",
prompt: `Based on analysis:\n${dbAnalysis}\n\nRefactor DB with:\n- Schema updates\n- Migration scripts\n- Tests`
}),
Task({
description: "Refactor Auth layer",
prompt: `Based on analysis:\n${authAnalysis}\n\nRefactor Auth with:\n- New strategy\n- Migration\n- Tests`
})
]);
// Phase 3: Integration validation
const integrationResult = await Task({
description: "Validate refactored layer integration",
prompt: `Verify all refactored layers work together:\n- API uses new DB patterns\n- Auth integrates with API\n- No breaking changes\n- All tests passing`
});
return {
phase1: { apiAnalysis, dbAnalysis, authAnalysis },
phase2: { apiRefactor, dbRefactor, authRefactor },
phase3: integrationResult,
status: "COMPLETE"
};
// Create 3 clones exploring different approaches
const explorations = await Promise.all(approaches.map(approach =>
Task({
description: `Explore ${approach.name} approach`,
prompt: `Research ${approach.name}...\nProvide: pros, cons, code example, learning curve`
})
));
// Master synthesizes into comparison table
return {
comparison: createComparisonTable(explorations),
recommendation: selectBestApproach(explorations),
decisionRationale: explainDecision(explorations)
};
// Phase 1: Analyze
const analysis = await analyzeCurrentState();
// Phase 2: Plan (depends on analysis)
const plan = await planMigration(analysis);
// Phase 3: Implement (depends on plan)
const implementation = await implementMigration(plan);
// Phase 4: Validate (depends on implementation)
const validation = await validateMigration(implementation);
return { analysis, plan, implementation, validation };
// Split files into groups, refactor each group in parallel
const fileGroups = splitFilesIntoGroups(files, 5);
const refactorResults = await Promise.all(
fileGroups.map(group =>
Task({
description: `Refactor files: ${group.join(", ")}`,
prompt: `Refactor these files using new patterns:\n${group.join("\n")}`
})
)
);
// Master validates all refactored files work together
return validateIntegration(refactorResults);
| Scenario | Why | Use Instead |
|---|---|---|
| Single file change | Too much overhead | Direct tdd-implementer |
| 2-3 quick steps | Sequential simpler | Direct execution |
| Domain expertise required | Needs specialist | Specialist agent (security, DB, etc.) |
| Real-time interaction | Clones run independently | Interactive agent |
| Simple query | Overkill complexity | Direct lookup |
moai-alfred-agent-guide (Agent architecture & delegation)moai-alfred-task-decomposition (Breaking down complex tasks)moai-essentials-refactor (Refactoring patterns & examples)For detailed API specifications: reference.md
For real-world examples: examples.md
Last Updated: 2025-11-12
Status: Production Ready (Enterprise v4.0.0)
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience