ln-720-structure-migrator

Scaffolds new or restructures existing projects to Clean Architecture. Use when setting up project structure.

310 stars

Best use case

ln-720-structure-migrator is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Scaffolds new or restructures existing projects to Clean Architecture. Use when setting up project structure.

Teams using ln-720-structure-migrator should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ln-720-structure-migrator/SKILL.md --create-dirs "https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/main/skills-catalog/ln-720-structure-migrator/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ln-720-structure-migrator/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ln-720-structure-migrator Compares

Feature / Agentln-720-structure-migratorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Scaffolds new or restructures existing projects to Clean Architecture. Use when setting up project structure.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

> **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. If `shared/` is missing, fetch files via WebFetch from `https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}`.

# 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

| Aspect | Description |
|--------|-------------|
| **Input** | Current project structure + mode (CREATE/TRANSFORM) from ln-700 |
| **Output** | Restructured project with Clean Architecture |
| **Workers** | See Workers table below |

### Workers

| Worker | Role | CREATE mode | TRANSFORM mode |
|--------|------|-------------|----------------|
| ln-721 | Frontend structure | SCAFFOLD (generate starter) | RESTRUCTURE (migrate monolith) |
| ln-722 | Backend generator | RUN (generate backend) | RUN (generate backend) |
| ln-723 | Seed data | GENERATE (from entities) | MIGRATE (from ORM schemas) |
| ln-724 | Artifact cleaner | **SKIP** (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 Agent tool
- Verifies final result

---

## Workflow

| Phase | Name | CREATE mode | TRANSFORM mode |
|-------|------|-------------|----------------|
| 1 | Analyze | Receive target stack config | Scan structure, detect framework, map files |
| 2 | Plan | Calculate scaffold actions | Calculate moves, identify conflicts |
| 3 | Execute | Delegate: ln-721 SCAFFOLD → ln-722 → ln-723 GENERATE | Delegate: ln-724 (conditional) → ln-721 RESTRUCTURE → ln-722 → ln-723 MIGRATE |
| 4 | Verify | Check file structure, validate configs | Run 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.

```yaml
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)

```yaml
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)

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

### To ln-723 (Seed Data)

```yaml
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 Skill 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)

**Invocations:**
```
Skill(skill: "ln-724-artifact-cleaner", args: "{projectPath}")  # TRANSFORM only, conditional
Skill(skill: "ln-721-frontend-restructure", args: "{projectPath} --mode {SCAFFOLD|RESTRUCTURE}")
Skill(skill: "ln-722-backend-generator", args: "{projectPath}")
Skill(skill: "ln-723-seed-data-generator", args: "{projectPath} --mode {GENERATE|MIGRATE}")
```

---

**TodoWrite format (mandatory):**
```
- Invoke ln-724-artifact-cleaner (conditional TRANSFORM) (pending)
- Invoke ln-721-frontend-restructure (pending)
- Invoke ln-722-backend-generator (pending)
- Invoke ln-723-seed-data-generator (pending)
- Verify structure and builds (pending)
```

## Worker Invocation (MANDATORY)

| Phase | Worker | Context |
|-------|--------|---------|
| 3a | ln-724-artifact-cleaner | Shared (Skill tool) — remove platform artifacts (TRANSFORM only, conditional) |
| 3b | ln-721-frontend-restructure | Shared (Skill tool) — scaffold or restructure frontend |
| 3c | ln-722-backend-generator | Shared (Skill tool) — generate backend project structure |
| 3d | ln-723-seed-data-generator | Shared (Skill tool) — generate or migrate seed data |

**All workers:** Invoke via Skill tool — workers see coordinator context.

## 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

| Risk | Detection | Mitigation |
|------|-----------|------------|
| Uncommitted changes | `git status` not clean | Require clean working directory |
| Build failure (frontend) | `npm run build` fails | Rollback, delegate to ln-721 for fix |
| Build failure (backend) | `dotnet build` fails | Rollback, delegate to ln-722 for fix |
| Lost files | Files missing after migration | Restore from backup branch |
| Import errors | Module not found | Re-run import update phase |
| Partial migration | Worker fails mid-execution | Atomic: complete all or rollback all |
| Wrong worker mode | Mode mismatch | Validate mode parameter before delegation |

---

## Reference Files

| File | Purpose |
|------|---------|
| `references/clean_architecture_dotnet.md` | .NET project structure template |
| `references/frontend_structure.md` | React project structure template |

---

## Meta-Analysis

**MANDATORY READ:** Load `shared/references/meta_analysis_protocol.md`

Skill type: `execution-orchestrator`. Run after all phases complete. Output to chat using the `execution-orchestrator` format.

---

**Version:** 3.0.0
**Last Updated:** 2026-02-07

Related Skills

ln-743-test-infrastructure

310
from levnikolaevich/claude-code-skills

Sets up test infrastructure with Vitest, xUnit, and pytest. Use when adding testing frameworks and sample tests to a project.

ln-721-frontend-restructure

310
from levnikolaevich/claude-code-skills

Scaffolds new React projects or restructures monoliths to component-based architecture. Use when setting up frontend structure.

ln-646-project-structure-auditor

310
from levnikolaevich/claude-code-skills

Checks file hygiene, ignore files, framework conventions, domain/layer organization, naming. Use when auditing project structure.

ln-637-test-structure-auditor

310
from levnikolaevich/claude-code-skills

Checks test file organization, directory layout, test-to-source mapping, domain grouping, co-location. Use when auditing test structure.

ln-611-docs-structure-auditor

310
from levnikolaevich/claude-code-skills

Checks hierarchy, links, SSOT, compression, requirements compliance, freshness, legacy cleanup. Use when auditing documentation structure.

ln-914-community-responder

310
from levnikolaevich/claude-code-skills

Responds to unanswered GitHub discussions and issues with codebase-informed replies. Use when clearing community question backlog.

ln-913-community-debater

310
from levnikolaevich/claude-code-skills

Launches RFC and debate discussions on GitHub. Use when proposing changes that need community input or voting.

ln-912-community-announcer

310
from levnikolaevich/claude-code-skills

Composes and publishes announcements to GitHub Discussions. Use when sharing releases, updates, or news with the community.

ln-911-github-triager

310
from levnikolaevich/claude-code-skills

Produces prioritized triage report from open GitHub issues, PRs, and discussions. Use when reviewing community backlog.

ln-910-community-engagement

310
from levnikolaevich/claude-code-skills

Analyzes community health and delegates engagement tasks. Use when managing GitHub issues, discussions, and announcements.

ln-840-benchmark-compare

310
from levnikolaevich/claude-code-skills

Runs built-in vs hex-line benchmark with scenario manifests, activation checks, and diff-based correctness. Use when measuring hex-line MCP performance against built-in tools.

ln-832-bundle-optimizer

310
from levnikolaevich/claude-code-skills

Reduces JS/TS bundle size via tree-shaking, code splitting, and unused dependency removal. Use when optimizing frontend bundle size.