mags-legacy
Scannednpx machina-cli add skill doancan/mags/mags-legacy --openclawMAGS Legacy Init
Initialize MAGS for an existing (brownfield/legacy) project that already has code but lacks documentation.
Steps
1. Scan existing codebase
Use mags_detect_stack to detect the project's tech stack automatically.
Use mags_discover_modules to find existing modules in the code.
Report findings:
Detected Stack:
Languages: <detected>
Frameworks: <detected>
Databases: <detected>
API Style: <detected>
Discovered Modules:
- <module> (confidence: <score>%)
- ...
2. Gather legacy context from user
Ask the user these questions (all at once):
- What is the migration goal? (modernize, rewrite, extend, maintain)
- What are the main pain points in the current codebase?
- Are there parts of the system that must be preserved as-is?
- What is the target architecture? (keep current, monolith, microservices, serverless)
3. Create legacy documentation
Using mags_create_doc, create these documents from the legacy templates:
current-architecture— Document the current architecture based on scan resultsmigration-plan— Create a migration plan based on user goalstech-debt— Start a tech debt registrytarget-architecture— Document the target architecture
Also create standard docs:
tech-stack— Based on detected stackproject-structure— Based on discovered modules
4. Show summary
MAGS Legacy Init Complete
Stack: <detected stack summary>
Modules: <N> modules discovered
Documents Created:
- current-architecture.md
- migration-plan.md
- tech-debt.md
- target-architecture.md
- tech-stack.md
- project-structure.md
Run /mags-status to see your project dashboard.
Related commands:
| Command | Description |
|---|---|
/mags-init | Initialize MAGS for a new project |
/mags-status | View project progress dashboard |
/mags-setup | Get Claude Code configuration recommendations |
Overview
MAGS Legacy Init bootstraps documentation for brownfield projects that already have code but lack docs. It detects the stack and modules, collects legacy goals, and generates a standard set of documentation templates to accelerate knowledge capture.
How This Skill Works
The tool runs mags_detect_stack to infer the project's tech stack and mags_discover_modules to enumerate existing modules. It then prompts for legacy context and uses mags_create_doc to generate key documents (current-architecture, migration-plan, tech-debt, target-architecture) plus standard docs like tech-stack and project-structure.
When to Use It
- You have a codebase with no docs and need visibility into stack and modules
- You want a migration or modernization plan for a brownfield project
- You need to register tech-debt and document the current architecture
- You plan to document both current and target architectures for alignment
- You are preparing documentation templates before a formal rewrite or microservice breakdown
Quick Start
- Step 1: Run mags_detect_stack to detect the stack and mags_discover_modules to enumerate modules
- Step 2: Answer the legacy context questions (migration goal, pain points, preserved parts, target architecture)
- Step 3: Run mags_create_doc to generate current-architecture, migration-plan, tech-debt, target-architecture, plus tech-stack and project-structure docs
Best Practices
- Scan the codebase first to accurately detect stack and modules using mags_detect_stack and mags_discover_modules
- Capture all legacy questions at once to avoid back-and-forth, per the workflow
- Use mags_create_doc to produce current-architecture, migration-plan, tech-debt, and target-architecture documents from templates
- Create tech-stack and project-structure docs based on actual findings for a holistic view
- Review generated docs with stakeholders and keep them up to date as the project evolves
Example Use Cases
- Brownfield e-commerce app with a monolith needing documentation before a rewrite
- Legacy internal toolset with unclear module boundaries and outdated tech stack
- CMS migrating to a microservices or serverless architecture with documented targets
- On-premise backend with a rich tech stack requiring a current-architecture baseline
- Data-heavy legacy app where tech-debt landmarks help prioritize modernization