moai-workflow-ddd

Refactor legacy code with behavior-preserving transformations using AST-grep and characterization tests.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/skeeper75/widget.creator --skill moai-workflow-ddd-skeeper75
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-workflow-ddd
Source: https://github.com/skeeper75/widget.creator/tree/main/.claude/skills/moai-workflow-ddd
Command: npx skills add https://github.com/skeeper75/widget.creator --skill moai-workflow-ddd-skeeper75

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill enables systematic refactoring of existing codebases, ensuring that code structure is improved without altering its observable behavior, thereby reducing technical debt and modernizing systems safely.

Core Features & Use Cases

  • Behavior Preservation: Guarantees that code changes do not introduce regressions by using characterization tests and AST-based analysis.
  • Code Modernization: Facilitates the safe migration of legacy code, API updates, and structural improvements.
  • Use Case: A team needs to refactor a critical, but poorly structured, module in their production system. They use this Skill to analyze the module, create characterization tests to capture its current behavior, and then incrementally improve its structure while ensuring all tests pass, thus minimizing risk.

Quick Start

Use the moai-workflow-ddd skill to refactor the legacy_auth module by analyzing its structure and creating characterization tests.

Frequently Asked Questions about moai-workflow-ddd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor legacy code without changing behavior?

Behavior-preserving refactoring uses an ANALYZE-PRESERVE-IMPROVE cycle with AST-grep for structural analysis and characterization tests to validate that code transformations do not introduce regressions or alter observable behavior.

What is the best way to reduce technical debt in a poorly structured production module?

Reduce technical debt by systematically analyzing the module's structure, creating characterization tests to capture its current behavior, and incrementally improving its structure while ensuring all tests pass to minimize regression risk.

Do I need AST-grep to perform Domain-Driven Development refactoring?

Yes, AST-grep is required for structural analysis during the Domain-Driven Development workflow to parse, characterize, and safely execute behavior-preserving code transformations.

Can I use this workflow for API migrations on existing codebases?

Yes, you can use this workflow for API migrations with behavior preservation, ensuring that structural improvements and API updates do not introduce regressions by validating changes against characterization tests.

How do characterization tests work during code modernization?

Characterization tests capture the current observable behavior of legacy code before refactoring, serving as a safety net to guarantee that structural improvements and modernization changes do not introduce functional regressions.

What are the limitations of behavior-preserving refactoring?

Behavior-preserving refactoring is limited to structural improvements and API migrations without functional changes, requiring comprehensive characterization tests to validate behavior, making it unsuitable for adding new features or altering observable logic.