Get the FREE Ultimate OpenClaw Setup Guide →

ln-720-structure-migrator

npx machina-cli add skill levnikolaevich/claude-code-skills/ln-720-structure-migrator --openclaw
Files (1)
SKILL.md
7.6 KB

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.

ln-720-structure-migrator

Type: L2 Domain Coordinator Category: 7XX Project Bootstrap Parent: ln-700-project-bootstrap

Coordinates project restructuring to Clean Architecture. Mode-aware: delegates to workers with appropriate mode parameters based on CREATE/TRANSFORM pipeline.


Purpose & Scope

AspectDescription
InputCurrent project structure + mode (CREATE/TRANSFORM) from ln-700
OutputRestructured project with Clean Architecture
WorkersSee Workers table below

Workers

WorkerRoleCREATE modeTRANSFORM mode
ln-721Frontend structureSCAFFOLD (generate starter)RESTRUCTURE (migrate monolith)
ln-722Backend generatorRUN (generate backend)RUN (generate backend)
ln-723Seed dataGENERATE (from entities)MIGRATE (from ORM schemas)
ln-724Artifact cleanerSKIP (no artifacts)CONDITIONAL (only if platform detected)

Scope boundaries:

  • Analyzes current project structure (TRANSFORM) or accepts target config (CREATE)
  • Generates migration plan or scaffold plan
  • Delegates to specialized workers via Task tool
  • Verifies final result

Workflow

PhaseNameCREATE modeTRANSFORM mode
1AnalyzeReceive target stack configScan structure, detect framework, map files
2PlanCalculate scaffold actionsCalculate moves, identify conflicts
3ExecuteDelegate: ln-721 SCAFFOLD → ln-722 → ln-723 GENERATEDelegate: ln-724 (conditional) → ln-721 RESTRUCTURE → ln-722 → ln-723 MIGRATE
4VerifyCheck file structure, validate configsRun builds, check imports, validate structure

Target Structures

Frontend (React)

src/frontend/
├── public/
├── src/
│   ├── components/
│   │   ├── layout/      # AppLayout, Header, Sidebar
│   │   └── ui/          # Reusable UI components
│   ├── contexts/        # React contexts
│   ├── hooks/           # Custom hooks
│   ├── lib/             # Utilities, API clients
│   ├── pages/           # Page components
│   │   └── {Feature}/   # Feature-specific files
│   ├── App.tsx
│   ├── main.tsx
│   └── index.css
├── package.json
├── vite.config.ts
└── tsconfig.json

Backend (.NET Clean Architecture)

src/
├── {Project}.Api/
│   ├── Controllers/
│   ├── DTOs/
│   ├── Middleware/
│   ├── MockData/
│   ├── Extensions/
│   ├── Program.cs
│   └── appsettings.json
├── {Project}.Domain/
│   ├── Entities/
│   ├── Enums/
│   └── Common/
├── {Project}.Services/
│   └── Interfaces/
├── {Project}.Repositories/
│   └── Interfaces/
└── {Project}.Shared/

Delegation Protocol

To ln-724 (Artifact Cleaner)

When to invoke: TRANSFORM mode AND platform artifacts detected (.replit, .stackblitzrc, sandbox.config.json, glitch.json). Skip conditions: CREATE mode OR no platform config files found.

Context:
  projectPath: /project
  skipPreview: false
Options:
  # ln-724 auto-detects platform, no need to specify
  cleanConfigFiles: true
  cleanDirectories: true
  cleanPackages: true
  cleanBuildConfig: true
  cleanCodeComments: true
  cleanGitignore: true

To ln-721 (Frontend)

Context:
  mode: SCAFFOLD | RESTRUCTURE          # From pipeline mode
  # SCAFFOLD mode:
  targetPath: /project/src/frontend
  projectName: MyApp
  # RESTRUCTURE mode:
  sourcePath: /project/client
  targetPath: /project/src/frontend
  framework: react
  features:
    - Dashboard
    - Settings
    - Profile
Options:
  # RESTRUCTURE only:
  splitMonolithicFiles: true
  extractConstants: true
  extractTypes: true
  createComponentLibrary: true

To ln-722 (Backend)

Context:
  projectName: MyApp
  targetPath: /project/src
  targetFramework: net10.0
  features:
    - Dashboard
    - Users
Options:
  createMockData: true
  addSwagger: true
  addHealthChecks: true

To ln-723 (Seed Data)

Context:
  mode: MIGRATE | GENERATE              # From pipeline mode
  targetFormat: csharp | typescript | python | json | sql
  # MIGRATE mode:
  sourceORM: auto                        # Auto-detect (drizzle/prisma/typeorm/efcore/sqlalchemy/django)
  sourcePath: /project/shared/schema.ts
  # GENERATE mode:
  entities:                              # Optional — if empty, starter template used
    - name: User
      fields: [id, name, email, role, createdAt]
    - name: Role
      fields: [id, name, description]
  targetPath: /project/src/MyApp.Api/MockData

Critical Rules

  • Orchestrator Pattern: Analyze and delegate via Task tool, do not execute transformations directly
  • Mode Awareness: Pass correct mode to all workers — CREATE vs TRANSFORM determines worker behavior
  • Conditional Workers: ln-724 runs ONLY in TRANSFORM mode when platform artifacts detected; SKIP otherwise
  • Sequential Workers: Execute in order (ln-724 conditional → ln-721 → ln-722 → ln-723)
  • Pre-flight Checks: Verify git status clean, target paths available
  • No Data Loss: Copy before delete, verify before removing source (TRANSFORM mode)
  • Build Verification: All builds must pass (npm run build, dotnet build)
  • Rollback Ready: Keep backup branch until verification complete (TRANSFORM mode)

Definition of Done

CREATE mode:

  • Target stack config received from ln-700
  • ln-721 completed: Frontend scaffolded (SCAFFOLD mode)
  • ln-722 completed: Backend generated
  • ln-723 completed: Seed data generated (GENERATE mode)
  • File structure matches target templates
  • All configs valid (package.json, tsconfig.json, .csproj)

TRANSFORM mode:

  • Current structure analyzed and documented
  • Migration plan generated
  • ln-724 completed: Platform artifacts removed (if applicable)
  • ln-721 completed: Frontend restructured (RESTRUCTURE mode)
  • ln-722 completed: Backend generated
  • ln-723 completed: Seed data migrated (MIGRATE mode)
  • Frontend builds successfully (npm run build)
  • Backend builds successfully (dotnet build)
  • No orphan files in old locations
  • All imports resolve correctly
  • Migration report generated

Risk Mitigation

RiskDetectionMitigation
Uncommitted changesgit status not cleanRequire clean working directory
Build failure (frontend)npm run build failsRollback, delegate to ln-721 for fix
Build failure (backend)dotnet build failsRollback, delegate to ln-722 for fix
Lost filesFiles missing after migrationRestore from backup branch
Import errorsModule not foundRe-run import update phase
Partial migrationWorker fails mid-executionAtomic: complete all or rollback all
Wrong worker modeMode mismatchValidate mode parameter before delegation

Reference Files

FilePurpose
references/clean_architecture_dotnet.md.NET project structure template
references/frontend_structure.mdReact project structure template

Version: 3.0.0 Last Updated: 2026-02-07

Source

git clone https://github.com/levnikolaevich/claude-code-skills/blob/master/ln-720-structure-migrator/SKILL.mdView on GitHub

Overview

ln-720-structure-migrator coordinates project restructuring to Clean Architecture. It operates in CREATE and TRANSFORM modes, delegating tasks to specialized workers (ln-721 to ln-724) to scaffold, migrate, or clean up as needed.

How This Skill Works

The coordinator analyzes the current project or target config, generates a migration or scaffold plan, then delegates work to the appropriate workers via the Task tool. It orchestrates phases (Analyze, Plan, Execute, Verify) and validates the final structure after execution.

When to Use It

  • Starting a new project and scaffolding a Clean Architecture layout
  • Transforming an existing monolith or legacy codebase to Clean Architecture
  • Aligning frontend and backend structures to feature-based modules
  • Generating the initial skeleton for React frontend and .NET Core backend
  • Cleaning up platform-specific artifacts only when a compatible platform is detected

Quick Start

  1. Step 1: Provide a target mode (CREATE or TRANSFORM) and target paths in ln-700 inputs
  2. Step 2: Run the ln-720-structure-migrator workflow to Analyze, Plan, and Execute via delegated workers
  3. Step 3: Run Verify to confirm the new Clean Architecture structure and fix any conflicts

Best Practices

  • Define the target Clean Architecture layout before CREATE, including modules, boundaries, and file placement
  • Keep mode handoffs explicit: CREATE vs TRANSFORM guide which workers run
  • Analyze and Plan before Execute to minimize conflicts
  • Verify builds and imports after execution to ensure structural integrity
  • Use ln-724 only when platform artifacts are detected and cleanup is required

Example Use Cases

  • Scaffold a new React + .NET project from scratch with Clean Architecture folders and dependencies
  • Migrate a monolithic backend to Layered architecture with Domain/Services/Repositories while reorganizing frontend into feature-based modules
  • Reorganize frontend code into components, hooks, and contexts aligned with features
  • Migrate seed data generation from ORM schemas to a dedicated Seed module
  • Conditionally remove platform-specific artifacts (e.g., .replit, sandbox.config.json) after detecting platform presence

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers