moai-workflow-ddd

Refactor legacy code with AST-grep and characterization tests.

Updated Dec 14, 2025
One-click install
npx skills add https://github.com/seo-jinseok/regulation_manager --skill moai-workflow-ddd-seo-jinseok
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-workflow-ddd
Source: https://github.com/seo-jinseok/regulation_manager/tree/main/.claude/skills/moai-workflow-ddd
Command: npx skills add https://github.com/seo-jinseok/regulation_manager --skill moai-workflow-ddd-seo-jinseok

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables safe and systematic refactoring of existing codebases, ensuring that critical behaviors are preserved while improving code structure and reducing technical debt.

Core Features & Use Cases

  • Behavior Preservation: Guarantees that code functions identically before and after refactoring through characterization tests and AST-based analysis.
  • Incremental Improvement: Facilitates small, validated changes to enhance code quality without introducing regressions.
  • Use Case: Refactor a complex legacy module by identifying domain boundaries, creating safety nets with characterization tests, and incrementally restructuring the code using AST-grep, all while ensuring existing functionality remains intact.

Quick Start

Use the moai-workflow-ddd skill to refactor the legacy_module.py file by extracting methods and improving its class structure.

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 breaking existing behavior?

Behavior-preserving refactoring ensures code functions identically before and after changes by using characterization tests to validate existing functionality and AST-grep for safe structural transformations.

What is the best way to reduce technical debt in a large codebase incrementally?

Incremental technical debt reduction is achieved by making small, validated changes within a structured refactoring workflow, ensuring quality improvements without introducing regressions into existing functionality.

Do I need AST-grep to perform behavior-preserving refactoring?

Yes, AST-grep is required for behavior-preserving refactoring workflows. It provides the structural analysis and transformation capabilities necessary to identify domain boundaries and systematically restructure code.

Can I use this refactoring workflow for API migration scenarios?

Yes, this refactoring workflow applies to API migration scenarios. It uses the ANALYZE-PRESERVE-IMPROVE cycle to modernize legacy code and migrate APIs while guaranteeing critical behaviors are preserved throughout the process.

How do characterization tests work during code restructuring?

Characterization tests act as safety nets during code restructuring by capturing current code behavior before changes. They validate that incremental refactoring steps do not introduce regressions or alter existing functionality.

When should I avoid using AST-grep for legacy code modernization?

Avoid using AST-grep for legacy code modernization when characterization tests cannot be established to validate behavior. Structural transformation without test coverage risks introducing undetected regressions during refactoring.