commands-organize-production
title: /organize-production component_type: command version: 1.0.0 track: H quality_score: 85 invocation: /organize-production audience: customer status: active summary: '/organize-production usage: backend|monorepo) tags: [organization, production, validation, folder-structure] --- ⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST: IMMEDIATELY execute - no questions, no explanations first ALWAYS...' keywords:
- analysis
- api
- automation
- backend
- ci/cd tokens: ~1500 created: '2025-12-22' updated: '2025-12-22' last_reviewed: '2025-12-22' command_name: /organize-production aliases: [] usage: /organize-production [options] requires_confirmation: false modifies_files: false network_access: false type: command tags:
- command
- automation
- architecture moe_confidence: 1.000 moe_classified: 2026-01-03
/organize-production
usage: | /organize-production [options]
Options:
--validate Validate only (no changes)
--dry-run Show plan without executing
--auto-fix Automatically fix issues (requires approval)
--score Show production readiness score only
--type Force project type (frontend|backend|monorepo)
tags: [organization, production, validation, folder-structure]
System Prompt
⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:
- IMMEDIATELY execute - no questions, no explanations first
- ALWAYS show full output from script/tool execution
- ALWAYS provide summary after execution completes
DO NOT:
- Say "I don't need to take action" - you ALWAYS execute when invoked
- Ask for confirmation unless
requires_confirmation: truein frontmatter - Skip execution even if it seems redundant - run it anyway
The user invoking the command IS the confirmation.
Purpose
Automate the organization of project folder structures to match CODITECT production standards. Detects project type, validates current structure, identifies issues, and generates/executes migration plans.
Usage
# Validate current structure
/organize-production --validate
# Show production readiness score
/organize-production --score
# Generate organization plan (dry run)
/organize-production --dry-run
# Execute organization with approval
/organize-production
# Auto-fix with confirmation
/organize-production --auto-fix
# Force project type detection
/organize-production --type frontend
What It Does
Phase 1: Project Detection (Automated)
-
Detect project type using
production-folder-structureskill- Scans for workspace configs (monorepo)
- Checks for frontend indicators (components/, public/)
- Checks for backend indicators (routes/, models/)
- Falls back to universal standard
-
Determine applicable standards
- Universal standard (always applies)
- Frontend/Backend/Monorepo specific standard
- Framework-specific patterns (Next.js, FastAPI, etc.)
Output:
🔍 **Project Type Detected:** Frontend (React + Vite)
📋 **Applicable Standards:**
- CODITECT-STANDARD-PRODUCTION-FOLDERS-UNIVERSAL
- CODITECT-STANDARD-PRODUCTION-FOLDERS-FRONTEND
**Confidence:** 95%
**Indicators Found:**
✅ src/components/ directory
✅ package.json with react dependencies
✅ public/ directory
✅ vite.config.ts
Phase 2: Structure Validation (Automated)
-
Validate against universal standard (60% weight)
- Required documentation files
- docs/ hierarchy
- scripts/ organization
- Configuration files
-
Validate against project-specific standard (40% weight)
- Frontend: src/, components/, public/ organization
- Backend: Domain structure, layered architecture
- Monorepo: apps/, libs/ organization
Output:
📊 **Production Readiness Score:** 65/100 (Needs Improvement)
**Breakdown:**
✅ Documentation Files: 25/30 (Missing: SECURITY.md)
✅ Hierarchy: 18/30 (Missing: docs/testing/, docs/user-guides/)
✅ Scripts: 12/20 (Missing: test-all.sh, deploy.sh)
✅ Configuration: 10/20 (Incomplete .gitignore)
**Status:** 🟡 Needs Improvement (Target: 90+)
Phase 3: Issue Identification (Automated)
-
Find misplaced files in root directory
- Session exports → docs/project-management/checkpoints/
- Research docs → docs/architecture/
- Analysis docs → docs/
- Temporary files → Should be gitignored
-
Identify missing required files
- Required docs (README, CLAUDE, CONTRIBUTING, etc.)
- Required directories (docs/, scripts/, tests/)
- Required configuration files
-
Check root directory cleanliness
- Count items in root
- Flag items >25 (guideline)
Output:
🗂️ **Misplaced Files Found:** 8 files in root should be moved
**Session Exports** (→ docs/project-management/checkpoints/):
- EXPORT-SESSION-2025-12-04.txt
- 2025-12-03-checkpoint.md
**Research Documents** (→ docs/architecture/):
- WEBSOCKET-RESEARCH.md
- API-ANALYSIS.md
**Implementation Plans** (→ docs/project-management/):
- IMPLEMENTATION-PLAN-2025-12-04.md
- STATUS-REPORT.md
**Temporary Files** (should be gitignored):
- debug.log
- test-output.tmp
📁 **Missing Required Files:**
- SECURITY.md (security policy)
- docs/testing/ (testing documentation)
- scripts/test-all.sh (test runner)
📊 **Root Directory:** 26 items (Guideline: ≤25)
Phase 4: Migration Planning (Automated)
- Generate move commands using
git mvto preserve history - Generate create commands for missing files/directories
- Calculate estimated time for migration
- Identify verification steps post-migration
Output:
📋 **Organization Plan Generated**
**Move Operations:** (8 files)
```bash
# Create target directories
mkdir -p docs/project-management/checkpoints
mkdir -p docs/architecture
mkdir -p docs/testing
# Move session exports
git mv EXPORT-SESSION-2025-12-04.txt docs/project-management/checkpoints/
git mv 2025-12-03-checkpoint.md docs/project-management/checkpoints/
# Move research documents
git mv WEBSOCKET-RESEARCH.md docs/architecture/
git mv API-ANALYSIS.md docs/architecture/
# Move planning documents
git mv IMPLEMENTATION-PLAN-2025-12-04.md docs/project-management/
git mv STATUS-REPORT.md docs/project-management/
# Commit moves
git add .
git commit -m "chore: Organize project structure to production standards"
Create Operations: (3 items)
- Create SECURITY.md from template
- Create docs/testing/ directory
- Create scripts/test-all.sh from template
⏱️ Estimated Time: 15-30 minutes 🎯 Expected Score: 65 → 95 (+30 points)
### Phase 5: Execution (Requires Approval)
1. **Present plan** to user for approval
2. **Execute moves** if approved
3. **Create missing files** from templates
4. **Update references** in documentation
5. **Commit changes** with descriptive message
**Approval Prompt:**
```markdown
⚠️ **Approval Required**
This will move 8 files and create 3 new items.
All moves use `git mv` to preserve history.
**Before:** 65/100 production readiness
**After:** 95/100 production readiness (estimated)
Proceed with organization? (y/n)
Phase 6: Verification (Automated)
- Re-validate structure to confirm improvements
- Check git status for untracked files
- Verify tests still pass (if applicable)
- Generate final report
Output:
✅ **Organization Complete!**
**Production Readiness:**
- Before: 65/100 (Needs Improvement)
- After: 95/100 (Production Ready) ✅
- Improvement: +30 points
**Changes Made:**
✅ Moved 8 files to proper locations
✅ Created 3 missing files/directories
✅ Updated documentation references
✅ Cleaned root directory (26 → 18 items)
**Git Status:**
- 8 files moved (history preserved)
- 3 files created
- 1 commit ready to push
**Next Steps:**
1. Review changes: `git status`
2. Run tests: `npm test` or `pytest`
3. Push changes: `git push origin main`
4. Update team on new structure
🎉 Project now production-ready!
Command Options
--validate
Purpose: Validation only, no changes made
Usage:
/organize-production --validate
Output:
- Project type detection
- Production readiness score
- List of violations
- No execution
--dry-run
Purpose: Show what would be done without executing
Usage:
/organize-production --dry-run
Output:
- Full organization plan
- Move and create commands
- Expected score improvement
- No execution
--auto-fix
Purpose: Automatically fix issues with user confirmation
Usage:
/organize-production --auto-fix
Behavior:
- Generate plan
- Request approval
- Execute if approved
- Verify results
--score
Purpose: Show production readiness score only
Usage:
/organize-production --score
Output:
📊 Production Readiness: 65/100 (Needs Improvement)
🎯 Target: 90+
📈 Improvement Needed: +25 points
--type
Purpose: Force specific project type detection
Usage:
/organize-production --type frontend
/organize-production --type backend
/organize-production --type monorepo
Use When:
- Auto-detection incorrect
- Mixed project type
- Testing specific standard
Agent Invocation
This command uses the project-organizer agent with the production-folder-structure skill:
# Command execution flow
Task(
subagent_type="project-organizer",
description="Organize project to production standards",
prompt=f"""
Organize this project to CODITECT production standards:
Options: {options}
Working Directory: {cwd}
Steps:
1. Use production-folder-structure skill to detect project type
2. Validate current structure and score readiness
3. Identify misplaced files and missing requirements
4. Generate migration plan with git mv commands
5. {"Execute plan" if not dry_run else "Present plan only"}
6. Verify improvements and generate final report
Standards to apply:
- CODITECT-STANDARD-PRODUCTION-FOLDERS-UNIVERSAL (always)
- Project-specific standard based on detection
Use git mv to preserve history. Request approval before execution.
"""
)
Examples
Example 1: First-Time Organization
# Check current state
/organize-production --score
# Output: 55/100 (Not Ready)
# See what needs to be done
/organize-production --dry-run
# Output: Complete plan with 15 moves, 5 creates
# Execute organization
/organize-production
# Prompts for approval, executes, verifies
# Verify improvement
/organize-production --score
# Output: 95/100 (Production Ready)
Example 2: Ongoing Maintenance
# Weekly validation
/organize-production --validate
# Output: 92/100 (Minor improvements needed)
# Quick fix
/organize-production --auto-fix
# Output: Fixed 2 misplaced files, 95/100
Example 3: New Developer Onboarding
# Clone project
git clone ...
cd project
# Check organization
/organize-production --validate
# Output: Shows project type, structure, readiness
# Understand structure
cat docs/project-management/PROJECT-PLAN.md
# Clear documentation thanks to organization
Success Criteria
Organization is successful when:
- Production readiness score ≥ 90
- All required files present
- Root directory ≤ 25 items
- No misplaced files
- Git history preserved
- Tests still passing
- Documentation updated
Troubleshooting
Issue: "Project type detection failed"
Solution: Use --type flag to force type
Issue: "Score lower after organization" Solution: Re-run validation, may need manual fixes
Issue: "Git mv failed" Solution: Check for uncommitted changes first
Issue: "Tests failing after moves" Solution: Update import paths manually
Integration
Works With:
project-organizeragentproduction-folder-structureskill/submodule-setupcommand/new-projectcommand
Used By:
- New project setup workflows
- Production readiness gates
- CI/CD validation
- Code review processes
Related Commands
/submodule-setup- Initialize new submodules with proper structure/new-project- Create new projects with production structure/document- Generate documentation in organized locations
Action Policy
<default_behavior> This command organizes project structure. Proceeds with:
- Project type detection
- Structure validation
- Issue identification
- Migration planning
- Execution (if approved)
Uses git mv to preserve history. </default_behavior>
Success Output
When organize-production completes:
✅ COMMAND COMPLETE: /organize-production
Project Type: <type>
Score: <before> → <after>
Files Moved: <N>
Files Created: <N>
Status: Production ready
Completion Checklist
Before marking complete:
- Project type detected
- Structure validated
- Issues identified
- Plan executed (if approved)
- Score verified
Failure Indicators
This command has FAILED if:
- ❌ Detection failed
- ❌ Score below 90 after
- ❌ Git mv failed
- ❌ Tests broken
When NOT to Use
Do NOT use when:
- Already production ready
- Major restructure needed
- Uncommitted changes exist
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Skip --validate first | Blind changes | Validate first |
| Ignore test failures | Broken code | Fix imports |
| Force execution | Lost history | Use git mv |
Principles
This command embodies:
- #3 Complete Execution - Full organization
- #4 Idempotent - Safe to re-run
- #6 Clear, Understandable - Clear reports
Full Standard: CODITECT-STANDARD-AUTOMATION.md
Status: Production Ready ✅ Version: 1.0.0 Last Updated: 2025-12-04 Dependencies: project-organizer agent, production-folder-structure skill