moai-workflow-worktree

0
0
Source

Git worktree management for parallel SPEC development with isolated workspaces, automatic registration, and seamless MoAI-ADK integration

Install

mkdir -p .claude/skills/moai-workflow-worktree && curl -L -o skill.zip "https://mcp.directory/api/skills/download/7887" && unzip -o skill.zip -d .claude/skills/moai-workflow-worktree && rm skill.zip

Installs to .claude/skills/moai-workflow-worktree

About this skill

MoAI Worktree Management

Git worktree management system for parallel SPEC development with isolated workspaces, automatic registration, and seamless MoAI-ADK integration.

Core Philosophy: Each SPEC deserves its own isolated workspace to enable true parallel development without context switching overhead.

Quick Reference (30 seconds)

What is MoAI Worktree Management? A specialized Git worktree system that creates isolated development environments for each SPEC, enabling parallel development without conflicts.

Key Features:

  • Isolated Workspaces: Each SPEC gets its own worktree with independent Git state
  • Automatic Registration: Worktree registry tracks all active workspaces
  • Parallel Development: Multiple SPECs can be developed simultaneously
  • Seamless Integration: Works with /moai:1-plan, /moai:2-run, /moai:3-sync workflow
  • Smart Synchronization: Automatic sync with base branch when needed
  • Cleanup Automation: Automatic cleanup of merged worktrees

Quick Access:

  • CLI commands: Refer to Worktree Commands Module at modules/worktree-commands.md
  • Management patterns: Refer to Worktree Management Module at modules/worktree-management.md
  • Parallel workflow: Refer to Parallel Development Module at modules/parallel-development.md
  • Integration guide: Refer to Integration Patterns Module at modules/integration-patterns.md
  • Troubleshooting: Refer to Troubleshooting Module at modules/troubleshooting.md

Use Cases:

  • Multiple SPECs development in parallel
  • Isolated testing environments
  • Feature branch isolation
  • Code review workflows
  • Experimental feature development

Implementation Guide (5 minutes)

1. Core Architecture - Worktree Management System

Purpose: Create isolated Git worktrees for parallel SPEC development.

Key Components:

  1. Worktree Registry - Central registry tracking all worktrees
  2. Manager Layer - Core worktree operations including create, switch, remove, and sync
  3. CLI Interface - User-friendly command interface
  4. Models - Data structures for worktree metadata
  5. Integration Layer - MoAI-ADK workflow integration

Registry Structure:

The registry file stores worktree metadata in JSON format. Each worktree entry contains an identifier, file path, branch name, creation timestamp, last sync time, status (active or merged), and base branch reference. The config section defines the worktree root directory, auto-sync preference, and cleanup behavior for merged branches.

File Structure:

The worktree system creates a dedicated directory structure in the user's global home directory. At the worktree root (~/.moai/worktrees/{ProjectName}/), you will find the central registry JSON file and individual directories for each SPEC. Each SPEC directory contains a .git file for worktree metadata and a complete copy of all project files.

Detailed Reference: Refer to Worktree Management Module at modules/worktree-management.md


2. CLI Commands - Complete Command Interface

Purpose: Provide intuitive CLI commands for worktree management.

Core Commands:

To create a new worktree for a SPEC, use the new command followed by the SPEC ID and description. To list all worktrees, use the list command. To switch to a specific worktree, use the switch command with the SPEC ID. To get the worktree path for shell integration, use the go command with eval. To sync a worktree with its base branch, use the sync command. To remove a worktree, use the remove command. To clean up merged worktrees, use the clean command. To show worktree status, use the status command. For configuration management, use the config command with get or set subcommands.

Command Categories:

  1. Creation: The new command creates an isolated worktree
  2. Navigation: The list, switch, and go commands enable browsing and navigating
  3. Management: The sync, remove, and clean commands maintain worktrees
  4. Status: The status command checks worktree state
  5. Configuration: The config command manages settings

Shell Integration:

For switching to a worktree directory, two approaches work well. The switch command directly changes to the worktree directory. The go command outputs a cd command that can be evaluated by the shell, which is the recommended pattern for shell scripts and automation.

Detailed Reference: Refer to Worktree Commands Module at modules/worktree-commands.md


3. Parallel Development Workflow - Isolated SPEC Development

Purpose: Enable true parallel development without context switching.

Workflow Integration:

During the Plan Phase using /moai:1-plan, the SPEC is created and the worktree new command sets up automatic worktree isolation.

During the Development Phase, the isolated worktree environment provides independent Git state with zero context switching overhead.

During the Sync Phase using /moai:3-sync, the worktree sync command ensures clean integration with conflict resolution support.

During the Cleanup Phase, the worktree clean command provides automatic cleanup with registry maintenance.

Parallel Development Benefits:

  1. Context Isolation: Each SPEC has its own Git state, files, and environment
  2. Zero Switching Cost: Instant switching between worktrees
  3. Independent Development: Work on multiple SPECs simultaneously
  4. Safe Experimentation: Isolated environment for experimental features
  5. Clean Integration: Automatic sync and conflict resolution

Example Workflow:

First, create a worktree for SPEC-001 with a description like "User Authentication" and switch to that directory. Then run /moai:2-run SPEC-001 to develop in isolation. Next, navigate back to the main repository and create another worktree for SPEC-002 with description "Payment Integration". Switch to that worktree and run /moai:2-run SPEC-002 for parallel development. When needed, switch between worktrees and continue development. Finally, sync both worktrees when ready for integration.

Detailed Reference: Refer to Parallel Development Module at modules/parallel-development.md


4. Integration Patterns - MoAI-ADK Workflow Integration

Purpose: Seamless integration with MoAI-ADK Plan-Run-Sync workflow.

Integration Points:

During Plan Phase Integration with /moai:1-plan, after SPEC creation, create the worktree using the new command with the SPEC ID. The output provides guidance for switching to the worktree using either the switch command or the shell eval pattern with the go command.

During Development Phase with /moai:2-run, worktree isolation provides a clean development environment with independent Git state preventing conflicts and automatic registry tracking.

During Sync Phase with /moai:3-sync, before PR creation run the sync command for the SPEC. After PR merge, run the clean command with the merged-only flag to remove completed worktrees.

Auto-Detection Patterns:

The system detects worktree environments by checking for the registry file in the parent directory. When detected, the SPEC ID is extracted from the current directory name. The status command with sync-check option automatically identifies worktrees that need synchronization.

Configuration Integration:

The MoAI configuration supports worktree settings including auto_create for automatic worktree creation, auto_sync for automatic synchronization, cleanup_merged for automatic cleanup of merged branches, and worktree_root for specifying the worktree directory location with project name substitution.

Detailed Reference: Refer to Integration Patterns Module at modules/integration-patterns.md


Advanced Implementation (10+ minutes)

Multi-Developer Worktree Coordination

Shared Worktree Registry:

Configure team worktree settings by setting the registry type to team mode and specifying a shared registry path accessible to all team members. For developer-specific worktrees within the shared environment, use the developer flag when creating worktrees to prefix entries with the developer name. The list command with all-developers flag shows worktrees from all team members, and the status command with team-overview provides a consolidated team view.

Advanced Synchronization Strategies

Selective Sync Patterns:

The sync command supports selective synchronization with include and exclude patterns to sync only specific directories or files. For conflict resolution, choose between auto-resolve for simple conflicts, interactive resolution for manual conflict handling, or abort to cancel the sync operation.

Worktree Templates and Presets

Custom Worktree Templates:

Create worktrees with specific setups using the template flag. A frontend template might include npm install and eslint setup with pre-commit hooks. A backend template might include virtual environment creation, activation, and dependency installation. Configure custom templates through the config command by setting template-specific setup commands.

Performance Optimization

Optimized Worktree Operations:

For faster worktree creation, use the shallow flag with a depth value for shallow clones. The background flag enables background synchronization. The parallel flag with all option enables parallel operations across all worktrees. Enable caching through configuration with cache enable and cache TTL settings for faster repeated operations.


Works Well With

Commands:

  • moai:1-plan - SPEC creation with automatic worktree setup
  • moai:2-run - Development in isolated worktree environment
  • moai:3-sync - Integration with automatic worktree sync
  • moai:9-feedback - Worktree workflow improvements

Skills:

  • moai-foundation-core - Parallel development patterns
  • moai-workflow-project - Project management integration
  • moai-workflow-spec - SPEC-driven development
  • moai-git-strategy - Git workflow optimization

Tools:

  • Git worktree - Native Git worktree functionality
  • Rich CLI - Formatted terminal output
  • Click framework - Command-line interface framework

Quick Decision Guide

For new SPEC development, use the worktree isolation pattern with


Content truncated.

moai-domain-database

modu-ai

"Manage and query domain-specific data efficiently, enabling streamlined access to information and insights."

776

moai-translation-korean-multilingual

modu-ai

Enterprise-grade technical document translation system for Korean↔English↔Japanese with OpenAI GPT-4 integration, code block preservation, glossary management, and bilingual review workflows. Optimized for technical books and documentation under 50 pages with comprehensive quality validation including code preservation, terminology consistency, bilingual review, and automated testing.

802

moai-lang-python

modu-ai

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.

52

moai-project-documentation

modu-ai

Enhanced project documentation with AI-powered features and Context7 integration

781

moai-platform-chrome-extension

modu-ai

Chrome Extension Manifest V3 development specialist covering service workers, content scripts, message passing, chrome.* APIs, side panel, declarativeNetRequest, permissions model, and Chrome Web Store publishing. Use when building browser extensions, implementing content scripts, configuring service workers, or publishing to Chrome Web Store. [KO: 크롬 확장 프로그램, 매니페스트 V3, 서비스 워커, 콘텐츠 스크립트] [JA: Chrome拡張機能、マニフェストV3、サービスワーカー] [ZH: Chrome扩展程序、Manifest V3、Service Worker]

250

moai-domain-uiux

modu-ai

Domain UI/UX Expert - Enterprise design systems, component architecture, accessibility, icons, and theming integration.

10

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

9521,094

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

846846

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

571699

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

548492

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

673466

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

514280

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.