module-based-refactor
Über
Diese Fähigkeit strukturiert flache Repositorys in eine modulare 5-Ebenen-Architektur (src/tests/specs/docs/examples) um, während der Git-Verlauf erhalten bleibt. Sie ist für größere Umstrukturierungen, Importpfad-Migrationen und die Bereinigung von Artefakten oder doppelten Verzeichnissen konzipiert. Zu den Hauptmerkmalen gehören eine parallele Agenten-Strategie und ein 4-Phasen-Atom-Commit-Workflow für zuverlässige Refactorings im großen Maßstab.
Schnellinstallation
Claude Code
Empfohlennpx skills add vamseeachanta/workspace-hub/plugin add https://github.com/vamseeachanta/workspace-hubgit clone https://github.com/vamseeachanta/workspace-hub.git ~/.claude/skills/module-based-refactorKopieren Sie diesen Befehl und fügen Sie ihn in Claude Code ein, um diese Fähigkeit zu installieren
Dokumentation
Module-Based Refactor Skill
Reorganize a repository from flat to a consistent module-based 5-layer architecture while preserving git history. Handles cleanup of artifacts, runtime data, and hidden folders.
See references/patterns.md for: full checklists, hidden-folder
consolidation patterns, cleanup categories table, benchmark reorganization,
complete session workflow, metrics tracking, and common issues/solutions.
When to Use
- Reorganizing a flat repository to module-based layout
- Consolidating scattered modules into a unified hierarchy
- Migrating import paths while preserving git history
- Cleaning up root-level artifacts (logs, temp files, build artifacts)
- Consolidating duplicate directories (agents/, coordination/, memory/)
- Reviewing and removing obsolete hidden folders
Pre-flight Checks
Run before starting any reorganization:
# Git tracking status
git ls-files | head -50
git ls-files --others --exclude-standard | grep -v "/"
# Duplicate directory detection
find . -type d -name "skills" -o -name "agents" 2>/dev/null
# Hidden folder inventory
ls -la .* 2>/dev/null | grep "^d"
# Stale artifacts at root
ls *.log *.tmp *.html *.sim 2>/dev/null
Target Structure
src/<package>/modules/<module_name>/
tests/modules/<module_name>/
specs/modules/<module_name>/
docs/modules/<module_name>/
examples/modules/<module_name>/
Process Steps
Phase 1 — Analysis (parallel): List directories, inventory root artifacts, audit hidden folders.
Phase 2 — Directory creation (sequential):
mkdir -p src/<pkg>/modules tests/modules specs/modules docs/modules examples/modules
touch specs/modules/.gitkeep docs/modules/.gitkeep examples/modules/.gitkeep
Phase 3 — Module moves (parallel per module): Always use git mv.
git mv src/<pkg>/<module> src/<pkg>/modules/<module>
git mv tests/<module> tests/modules/<module>
Phase 3.5 — Hidden folder consolidation (parallel per folder):
See references/patterns.md §Hidden Folder Consolidation.
Phase 4 — Import updates (parallel by file type):
find . -name "*.py" -exec sed -i \
's/from <pkg>\.<mod>/from <pkg>.modules.<mod>/g' {} \;
Phase 5 — Cleanup (parallel): Remove root artifacts, consolidate
agent dirs, update .gitignore.
Phase 6 — Verification (parallel then sequential):
uv run pytest tests/ -v
git log --follow --oneline -- src/<pkg>/modules/<module>/<file>.py
Quick Start
# Pre-flight
git status && git ls-files --others --exclude-standard | wc -l
# Create module structure
mkdir -p src/<pkg>/modules tests/modules specs/modules docs/modules examples/modules
# Archive completed plan files
git mv specs/modules/<completed-plan>.md specs/archive/
# Verify after cleanup
uv run pytest tests/ -v && git status
Atomic Commit Strategy
| Phase | Commit Message Pattern |
|---|---|
| 1 | refactor: Reorganize to module-based 5-layer architecture |
| 2 | refactor: Consolidate <folders> into .claude (N files) |
| 3 | chore: Delete legacy config and consolidate scripts |
| 4 | docs: Update README structure and skill documentation |
Related Skills
../context-management/SKILL.md— Managing context during large refactors../meta/session-start-routine/SKILL.md— Session initialization
GitHub Repository
Verwandte Skills
legal-sanity-review
AndereThis mandatory workflow scans code for legal risks like client names or proprietary references before cross-review. It blocks the review cycle if violations are found, requiring fixes first. Use it as a pre-gate for PR creation, code porting, or any cross-review trigger.
brainstorming
AndereThe brainstorming skill transforms initial ideas into detailed specifications through iterative questioning and collaborative dialogue. It helps developers explore design options, evaluate trade-offs, and create shared understanding before implementation. This prevents rework by systematically refining concepts into actionable plans.
repo-cleanup-progress-tracking-commands
AndereThis sub-skill provides shell commands for tracking file counts during repository cleanup operations, specifically for hidden folders like `.claude` and `.agent-os`. It includes verification scripts to ensure no files are lost after merging changes. Use it when consolidating or reorganizing project directories to monitor progress and validate results.
brainstorming-metrics
AndereThis skill provides structured metrics for evaluating brainstorming sessions, including targets for questions per design, validation rates, and stakeholder alignment. It helps developers measure brainstorming effectiveness and implementation quality. Use it to establish clear success criteria and track rework during project planning phases.
