// "Handle template comparison and optimization workflows including backup detection, smart merging, and update completion reporting. Enhanced with Context7 MCP for up-to-date documentation."
| name | moai-project-template-optimizer |
| version | 4.0.0 |
| created | "2025-11-12T00:00:00.000Z" |
| updated | "2025-11-12T00:00:00.000Z" |
| status | stable |
| tier | specialization |
| description | Handle template comparison and optimization workflows including backup detection, smart merging, and update completion reporting. Enhanced with Context7 MCP for up-to-date documentation. |
| allowed-tools | Read, Glob, Grep, WebSearch, WebFetch, mcp__context7__resolve-library-id, mcp__context7__get-library-docs |
| primary-agent | alfred |
| secondary-agents | [] |
| keywords | ["project","template","optimizer","test"] |
| tags | ["project","template","optimization","backup","merge","comparison"] |
| orchestration | null |
| can_resume | true |
| typical_chain_position | middle |
| depends_on | [] |
Project Template Optimizer
Primary Agent: alfred
Secondary Agents: none
Version: 4.0.0
Keywords: project, template, optimizer, test
Purpose: Handle template comparison and optimization workflows including backup detection, smart merging, and update completion reporting. Enhanced with Context7 MCP for up-to-date documentation.
When to Use:
Quick Start Pattern:
# Basic example
# TODO: Add practical example
Workflow Phases
Purpose: Automatically discover and analyze existing project backups Trigger: Skill invocation or moai-adk version update detection
Process:
Backup Directory Scan
# Check for .moai-backups/ directory
if [ -d ".moai-backups/" ]; then
# List available backups with timestamps
ls -la .moai-backups/ | grep "backup-"
fi
Backup Content Analysis
Backup Selection Strategy
Purpose: Detect differences between current templates and backup versions Method: Intelligent file comparison with template-aware parsing
Comparison Matrix:
File Type | Comparison Strategy | Merge Priority
------------------ | ----------------------- | --------------
.claude/settings.json | Structured JSON diff | Template defaults
.moai/config.json | User config preservation | User customizations
CLAUDE.md | Section-based diff | User content
Hook files | Code-aware diff | Template updates
Skills | Content analysis | Template defaults
Difference Detection:
Purpose: Preserve user customizations while updating template structure Strategy: Three-way merge with intelligence
Merge Process:
Extraction Phase
# Extract user customizations from backup
user_customizations = extract_user_content(backup_files)
# Get latest template defaults
template_defaults = get_current_templates()
# Analyze current project state
current_state = analyze_current_project()
Merge Strategy
Conflict Resolution
Purpose: Identify and preserve only non-template content during updates Method: Pattern recognition and content analysis
Detection Patterns:
Template Indicators | User Content Indicators
---------------------------- | -------------------------
"{{PROJECT_NAME}}" | Specific project names
"{{CONVERSATION_LANGUAGE}}" | Actual language codes
"src/moai_adk/templates/" | Custom file paths
Template placeholders | Real configuration values
Default examples | Custom implementations
Content Classification:
Purpose: Maintain version tracking and update history sections Output: Comprehensive update reports and history tracking
Version Tracking:
{
"template_version": "0.17.0",
"previous_version": "0.16.0",
"update_timestamp": "2025-11-05T12:00:00Z",
"backup_used": "backup-2025-10-15-v0.16.0",
"optimization_applied": true
}
HISTORY Section Updates:
Purpose: Update project configuration with optimization flags and metadata
Target: .moai/config/config.json and related configuration files
Optimization Configuration:
{
"template_optimization": {
"last_optimized": "2025-11-05T12:00:00Z",
"backup_version": "backup-2025-10-15-v0.16.0",
"template_version": "0.17.0",
"customizations_preserved": ["language", "team_settings", "domains"],
"optimization_flags": {
"merge_applied": true,
"conflicts_resolved": 0,
"user_content_extracted": true
}
}
}
Usage Patterns
# Complete optimization workflow
Skill("moai-project-template-optimizer")
# Executes: Backup Discovery → Template Comparison → Smart Merge → Configuration Update
# Analyze existing backups without making changes
Skill("moai-project-template-optimizer", mode="analyze_only")
# Restore from specific backup
Skill("moai-project-template-optimizer",
mode="restore",
backup="backup-2025-10-15-v0.16.0")
# Rollback to previous state
Skill("moai-project-template-optimizer", mode="rollback")
Performance Optimizations
Reporting & Analytics
Template Optimization Report
Generated: 2025-11-05T12:00:00Z
Backup Analysis:
- Backups found: 3
- Selected backup: backup-2025-10-15-v0.16.0
- Backup integrity: 100%
Template Comparison:
- Files compared: 47
- Differences found: 12
- Conflicts detected: 0
Smart Merge Results:
- User customizations preserved: 8
- Template updates applied: 12
- Files modified: 15
Configuration Updates:
- Optimization flags set: true
- Version tracking updated: true
- History section updated: true
Performance:
- Total time: 2.3 seconds
- Success rate: 100%
Implementation Notes
This skill consolidates complex template optimization workflows into a focused, intelligent system that:
The skill serves as the foundation for template lifecycle management and can be extended with additional optimization patterns as template structures evolve.
Note: Advanced patterns for complex scenarios.
Coming soon: Deep dive into expert-level usage.
Must-Have:
Recommended:
Security:
When to Use Context7 for This Skill:
This skill benefits from Context7 when:
Example Usage:
# Fetch latest documentation
from moai_adk.integrations import Context7Helper
helper = Context7Helper()
docs = await helper.get_docs(
library_id="/org/library",
topic="project",
tokens=5000
)
Relevant Libraries:
| Library | Context7 ID | Use Case |
|---|---|---|
| [Library 1] | /org/lib1 | [When to use] |
When to use moai-project-template-optimizer:
Start
├─ Need project?
│ ├─ YES → Use this skill
│ └─ NO → Consider alternatives
└─ Complex scenario?
├─ YES → See Level 3
└─ NO → Start with Level 1
Prerequisite Skills:
Complementary Skills:
Next Steps:
Primary Documentation:
Best Practices:
** .0** (2025-11-12)
Generated with: MoAI-ADK Skill Factory
Last Updated: 2025-11-12
Maintained by: Primary Agent (alfred)