moai-workflow-ddd

Refactor existing codebases with AST-based analysis and characterization tests.

67|27|Updated Dec 24, 2025
One-click install
npx skills add https://github.com/modu-ai/cc-plugins --skill moai-workflow-ddd-modu-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-workflow-ddd
Source: https://github.com/modu-ai/cc-plugins/tree/main/.claude/skills/moai-workflow-ddd
Command: npx skills add https://github.com/modu-ai/cc-plugins --skill moai-workflow-ddd-modu-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables systematic refactoring of existing codebases, ensuring that observable behavior remains unchanged while improving code structure and reducing technical debt.

Core Features & Use Cases

  • Behavior Preservation: Guarantees that code modifications do not alter existing functionality through characterization tests and incremental changes.
  • Structural Improvement: Facilitates refactoring of legacy code, API migration, and technical debt reduction.
  • Use Case: Refactor a complex, legacy Python module by identifying domain boundaries, creating characterization tests to capture its current behavior, and then incrementally restructuring it using AST-grep, ensuring all tests pass after each small change.

Quick Start

Use the moai-workflow-ddd skill to refactor the existing 'user_authentication' module by analyzing its structure and preserving its behavior through 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 its behavior?

To refactor legacy code without changing behavior, you need characterization tests to capture existing functionality and incremental transformations to restructure it safely. This approach ensures observable behavior remains unchanged while reducing technical debt and improving structure.

What is AST-based analysis for code refactoring?

AST-based analysis for code refactoring uses abstract syntax trees to parse and identify structural patterns in existing codebases. It enables precise, incremental transformations by targeting specific syntax nodes, ensuring modifications are structurally sound and behavior-preserving.

How do I migrate legacy APIs while preserving functionality?

Migrating legacy APIs while preserving functionality requires identifying domain boundaries and creating characterization tests to capture current behavior. You then apply incremental, test-driven transformations to restructure the API, ensuring all tests pass after each modification.

Do I need characterization tests to reduce technical debt?

Yes, characterization tests are required to reduce technical debt safely. They capture the current observable behavior of legacy code before refactoring, providing a safety net that verifies incremental changes preserve functionality and do not introduce regressions.

What is the best way to modernize a complex legacy module?

The best way to modernize a complex legacy module is applying an analyze-preserve-improve cycle. You analyze the structure, preserve behavior with characterization tests, and incrementally improve the code using AST-based transformations, ensuring all tests pass after each change.

Can I use domain-driven development for technical debt reduction?

Yes, domain-driven development facilitates technical debt reduction by identifying domain boundaries in existing codebases. It enables systematic refactoring through behavior-preserving transformations and incremental restructuring, ensuring observable functionality remains unchanged while improving code quality.