structure-enforcement
Validate file placement against canonical structure rules and auto-fix violations. Use before committing or when validating project structure.
When & Why to Use This Skill
This Claude skill provides automated project structure enforcement by validating file placements against predefined canonical rules. It helps maintain repository cleanliness by identifying misplaced files and offering auto-fix scripts to reorganize them, ensuring consistency and preventing technical debt in complex codebases.
Use Cases
- Automated Workspace Organization: Detect and move misplaced files like completion reports or memory logs to their correct canonical locations automatically to maintain a clean root directory.
- Pre-commit Guardrails: Prevent structural violations from entering the version control system by blocking commits that do not adhere to the project's directory conventions.
- Technical Debt Reduction: Periodically scan and fix the project structure to prevent 'folder bloat' and ensure documentation and metadata are always stored in their designated paths.
- Standardizing Team Workflows: Enforce a unified directory structure across distributed teams to improve file findability and overall project maintainability.
| name | structure-enforcement |
|---|---|
| description | Validate file placement against canonical structure rules and auto-fix violations. Use before committing or when validating project structure. |
| short-description | Project structure enforcement |
Structure Enforcement
Validation
# Check structure
python .claude/scripts/structure_validator.py
# Auto-fix violations (dry-run first)
python .claude/scripts/auto_fix.py --dry-run
python .claude/scripts/auto_fix.py --apply
Rules (canonical-structure.yaml)
file_types:
- name: "completion_reports"
patterns:
- "*-COMPLETE*.md"
canonical_location: ".claude/archive/completion-reports/"
Pre-Commit Hook
Files automatically validated before commit. Violations block commit.
Common Violations
❌ Completion reports in root
✅ Move to .claude/archive/completion-reports/
❌ Memory files in wrong location
✅ Move to .claude/memory/
Scripts
scripts/skill_info.py: Print skill name and description.