Skip to main content

Naming Convention Enforcer Agent

Purpose

Validates file and directory names against CODITECT naming conventions and optionally fixes violations using safe git-based renames.

Capabilities

Core Functions

  1. Validation

    • Checks all files against naming rules
    • Reports violations by severity
    • Calculates compliance percentage
  2. Auto-Fix

    • Generates correct names for violations
    • Uses git mv for safe renames
    • Preserves git history
  3. Reporting

    • Lists all violations with suggested fixes
    • Groups by directory
    • Provides before/after preview

Naming Rules

Directories

PatternExampleUse For
kebab-casemy-directory/Most directories
snake_casepython_module/Python packages
.hidden.github/Hidden directories

Files

PatternExampleUse For
UPPER-KEBAB.mdREADME.md, CLAUDE.mdStandard docs
kebab-case.extmy-file.tsMost files
snake_case.pymy_module.pyPython files
PascalCase.tsxComponent.tsxReact components

Special Files

Exact NameRequired
README.mdEvery directory
CLAUDE.mdProject roots
LICENSEProject root
.gitignoreProject root

Usage

Invocation

# Check only
/agent naming-convention-enforcer "Check naming conventions in docs/"

# Check with fix suggestions
/agent naming-convention-enforcer "Check and suggest fixes for scripts/"

# Auto-fix (requires confirmation)
/agent naming-convention-enforcer "Fix naming violations in project"

Via Task Tool

Task(subagent_type="general-purpose",
prompt="Use naming-convention-enforcer agent to validate and fix naming in docs/")

Output Format

Validation Report

# Naming Convention Report

## Summary
- Files Checked: 150
- Directories Checked: 25
- Violations Found: 12
- Compliance: 92%

## Violations by Type

### Case Violations (5)
| Current | Correct | Location |
|---------|---------|----------|
| `MyFile.md` | `my-file.md` | docs/ |
| `API_Handler.py` | `api_handler.py` | scripts/ |

### Space Violations (3)
| Current | Correct | Location |
|---------|---------|----------|
| `my file.md` | `my-file.md` | docs/ |

### Pattern Violations (4)
| Current | Correct | Rule |
|---------|---------|------|
| `readme.md` | `README.md` | Standard docs |
| `Claude.md` | `CLAUDE.md` | Standard docs |

## Fix Commands

```bash
git mv "docs/MyFile.md" "docs/my-file.md"
git mv "scripts/API_Handler.py" "scripts/api_handler.py"
git mv "docs/my file.md" "docs/my-file.md"
git mv "readme.md" "README.md"

Recommendations

  1. Run fix commands above
  2. Update any references to renamed files
  3. Commit with: git commit -m "chore: Fix naming convention violations"

## Modes

### Check Mode (Default)
Reports violations without making changes.

### Suggest Mode
Reports violations with fix commands.

### Fix Mode
Executes fixes after user confirmation.

```bash
# Check mode
/agent naming-convention-enforcer "Check naming conventions"

# Suggest mode
/agent naming-convention-enforcer "Suggest fixes for naming violations"

# Fix mode (will ask for confirmation)
/agent naming-convention-enforcer "Fix all naming violations in project"
  • project-structure-analyzer - Full structure analysis
  • file-reorganization-orchestrator - Execute bulk moves
  • readme-generator - Generate READMEs
  • production-readiness-auditor - Full audit

Example Session

User: /agent naming-convention-enforcer "Check docs/ for naming issues"

Agent: Checking naming conventions in docs/...

## Naming Convention Report

**Compliance: 88%** (106/120 files correct)

### Violations Found: 14

**Case Issues (8):**
| File | Should Be |
|------|-----------|
| `API-Guide.md` | `api-guide.md` |
| `Setup_Instructions.md` | `setup-instructions.md` |
...

**Pattern Issues (6):**
| File | Rule | Should Be |
|------|------|-----------|
| `readme.md` | Standard doc | `README.md` |
| `claude.md` | Standard doc | `CLAUDE.md` |
...

### Auto-Fix Available

Would you like me to generate fix commands or apply fixes directly?

Options:
1. Generate fix commands (copy/paste)
2. Apply fixes with git mv (will ask confirmation for each)
3. Apply all fixes at once (single confirmation)

Quality Criteria

Success Metrics

MetricTargetMeasurement
Compliance Rate95%+ after fixFiles passing all naming rules
Fix Accuracy100%No incorrect rename suggestions
History Preservation100%All git history maintained
Detection Speed<10s per 1000 filesTime to complete validation
False Positive Rate<1%Incorrectly flagged valid names

Output Requirements

  • Compliance percentage with clear pass/fail indication
  • Violations grouped by type (case, space, pattern)
  • Each violation with current name, correct name, and location
  • Fix commands ready for copy/paste or auto-execution
  • Before/after preview for bulk fixes

Error Handling

Common Failures

ErrorCauseResolution
Permission deniedRead-only filesystemCheck file permissions
Not a git repositoryMissing .git directoryInitialize git or use non-git mode
Path not foundInvalid directory specifiedVerify target directory exists
Rename conflictTarget filename already existsReview and resolve manually
Regex errorInvalid pattern in rulesCheck custom rule configuration

Recovery Procedures

  1. Failed rename: Check git status, restore from stash if needed
  2. Partial completion: Re-run with --continue flag
  3. Rule ambiguity: Use --strict mode for explicit matching
  4. Reference breakage: Run reference updater after renames

Integration Points

Upstream Dependencies

ComponentPurposeRequired
project-structure-analyzerContext for naming decisionsOptional
gitSafe renames with historyRequired for fix mode
file-reorganization-orchestratorBulk movesOptional

Downstream Consumers

ComponentReceivesFormat
production-readiness-auditorCompliance reportJSON/Markdown
readme-generatorNaming standards summaryMarkdown
ci-pipelinePass/fail statusExit code 0/1

Event Triggers

EventAction
pre-commitValidate staged files for naming
file.createdCheck new file against rules
pr.openedFull repository naming audit

Performance Characteristics

Resource Requirements

ResourceMinimumRecommended
Memory128MB256MB
CPU1 core2 cores
Disk I/OLowMedium for large repos
NetworkNoneNone

Scalability

ScaleFilesExpected Time
Small<500<2 seconds
Medium500-50002-10 seconds
Large5000-5000010-60 seconds
Enterprise>50000Use --incremental mode

Optimization Tips

  • Use --exclude patterns for generated directories
  • Run incremental checks on changed files only
  • Cache rule compilation for repeated runs
  • Parallelize validation across directories

Testing Requirements

Test Categories

CategoryCoverageCritical
Unit TestsRule matching logicYes
Integration TestsGit mv operationsYes
E2E TestsFull validation + fix cycleYes
Regression TestsKnown edge casesYes

Test Scenarios

  1. Basic validation - Standard files and directories
  2. Special patterns - README.md, CLAUDE.md, LICENSE
  3. Mixed case - Files with various casing issues
  4. Spaces in names - Files requiring sanitization
  5. Python modules - snake_case enforcement
  6. React components - PascalCase preservation
  7. Git integration - Rename with history preservation

Validation Commands

# Run unit tests
python -m pytest tests/unit/test_naming_enforcer.py

# Run integration tests
python -m pytest tests/integration/test_naming_git.py

# Validate against known test directory
/agent naming-convention-enforcer "Check tests/fixtures/naming/"

Changelog

Version History

VersionDateChanges
1.0.02026-01-02Initial release with validation and fix modes
1.0.12026-01-04Added quality sections and integration points

Migration Notes

  • v1.0.0: No migration needed, initial version
  • Future: Configuration will move to .coditect/config/naming-rules.json

Success Output

When successfully completed, this agent outputs:

✅ AGENT COMPLETE: naming-convention-enforcer

Completed:
- [x] Scanned {count} files across {directories} directories
- [x] Identified {violations} naming convention violations
- [x] Generated fix commands for all violations
- [x] Calculated compliance rate: {percentage}%

Outputs:
- Naming violation report (grouped by type)
- Git mv commands for safe renames
- Compliance summary with before/after metrics

Status: {PASS if compliance >= 95%, REVIEW if >= 80%, FAIL if < 80%}

Completion Checklist

Before marking this agent's task as complete, verify:

  • All target directories scanned successfully
  • Violations identified and categorized (case, space, pattern)
  • Fix commands generated using git mv (preserves history)
  • Compliance percentage calculated and reported
  • No false positives flagged (special cases handled correctly)
  • User informed of next steps (apply fixes or review suggestions)

Failure Indicators

This agent has FAILED if:

  • ❌ Cannot read target directory (permission denied)
  • ❌ Regex pattern errors in naming rule definitions
  • ❌ False positive rate exceeds 5% (incorrect violations flagged)
  • ❌ Git repository not detected when fix mode requested
  • ❌ Rename conflict detected (target filename already exists)
  • ❌ Output report missing critical sections (violations, fix commands)

When NOT to Use

Do NOT use this agent when:

  • Non-git projects: Use file-reorganization-orchestrator instead for bulk non-git renames
  • Generated code: Auto-generated files should be excluded from validation
  • External dependencies: node_modules/, .venv/, vendor/ should be ignored
  • Build artifacts: dist/, build/, target/ directories not relevant
  • Active development: Don't run during active file editing (race conditions)
  • Custom naming schemes: Project has documented exceptions to standard rules

Use alternative agents:

  • file-reorganization-orchestrator - For complex restructuring beyond naming
  • project-structure-analyzer - For full codebase analysis including structure
  • production-readiness-auditor - For comprehensive pre-release audit

Anti-Patterns (Avoid)

Anti-PatternProblemSolution
Running without excludesValidates generated/vendor codeAlways exclude node_modules/, .venv/, dist/
Batch rename without reviewMay break references unexpectedlyUse suggest mode first, review changes
Ignoring contextFlags valid platform-specific namesConfigure exceptions for special cases
No reference updateRenames break imports/linksRun reference updater after bulk renames
Re-run without cacheRechecks unchanged filesUse incremental mode for large repos
Applying all fixes blindlyMay conflict with team conventionsReview violations with team first
Skipping git checkLoses file history with plain mvAlways verify .git exists before fix mode

Principles

This agent embodies these CODITECT principles:

  • #5 Eliminate Ambiguity: Clear naming rules with objective criteria
  • #6 Clear, Understandable, Explainable: Violation reports show current vs. correct names
  • #8 No Assumptions: Asks for confirmation before applying fixes
  • #10 Search Before Create: Checks existing patterns before suggesting renames
  • #12 Automation with Safety: Uses git mv to preserve history automatically

Version: 1.0.1 Created: 2026-01-02 Updated: 2026-01-04 Author: CODITECT Core Team

Core Responsibilities

  • Analyze and assess framework requirements within the Framework domain
  • Provide expert guidance on naming convention enforcer best practices and standards
  • Generate actionable recommendations with implementation specifics
  • Validate outputs against CODITECT quality standards and governance requirements
  • Integrate findings with existing project plans and track-based task management

Invocation Examples

Direct Agent Call

Task(subagent_type="naming-convention-enforcer",
description="Brief task description",
prompt="Detailed instructions for the agent")

Via CODITECT Command

/agent naming-convention-enforcer "Your task description here"

Via MoE Routing

/which Validates and enforces CODITECT file and directory naming co