| name | code-formatter |
| description | Lightweight Haiku sub-agent for cleaning up C# code. Removes commented code, fixes indentation, removes debug Print() statements, and formats code consistently. Auto-triggers on cleanup requests. |
Code Formatter Sub-Agent
Purpose
Fast code cleanup using Gemini Flash delegation for routine formatting and cleanup operations.
Universal Path: ${PROJECT_ROOT}
Executors: ${BRAIN} (Reasoning), ${HANDS} (Gemini Flash via delegation_bridge)
When to Auto-Trigger
Automatically spawn a Haiku sub-agent when user requests:
- "Clean up the code"
- "Remove commented code"
- "Remove debug statements"
- "Format the code"
- "Clean up V8_3"
Sub-Agent Configuration
Model: haiku
Tools: Read, Edit
Type: general-purpose
Operations
1. Remove Commented Code
What to remove:
- Single-line comments that are code:
// int oldValue = 5;
- Multi-line comment blocks containing old code
- Commented-out method calls:
// Print("Debug message");
What to KEEP:
- Documentation comments explaining logic
- TODOs and FIXMEs
- Region markers:
#region, #endregion
- Comments explaining WHY (not WHAT)
Example:
double stop = entry + (currentATR * 0.5);
2. Remove Debug Print() Statements
What to remove:
- Temporary debug prints:
Print("DEBUG: value = " + value);
- Verbose logging during development
- Test messages:
Print("Hit this line");
What to KEEP:
- Production logging (errors, warnings)
- User-facing status messages
- Critical state information
Example:
Print("DEBUG: Entering OnBarUpdate");
Print("Price: " + Close[0]);
Print("⚠ STOP VALIDATION FAILED - flattening position");
Print($"OR LONG triggered at {entryPrice}");
3. Fix Indentation
Rules:
- Use tabs (not spaces) - NinjaTrader convention
- Proper nesting for braces
- Align property declarations
- Consistent spacing around operators
4. Remove Empty Lines
Rules:
- No more than 1 blank line between methods
- No blank lines at start/end of methods
- No blank lines before closing braces
5. Format Property Declarations
Make consistent:
[Range(1, 100)]
[Display(Name="Risk Per Trade", Order=1, GroupName="1. Risk Management")]
public double RiskPerTrade
{ get; set; }
[Range(1, 100)]
[Display(Name = "Risk Per Trade", Order = 1, GroupName = "1. Risk Management")]
public double RiskPerTrade { get; set; }
What NOT to Change
NEVER Modify:
- Trading Logic - Any calculation, condition, or order management
- Variable Names - Don't rename even if you think it's better
- Method Signatures - Don't change parameter names or return types
- String Literals - Don't change text in Print() statements
- Comments with Context - Explanatory comments stay
Pattern Detection:
If you see patterns like these, DO NOT CHANGE:
// CRITICAL: - Important warning comment
// v8.2 change: - Version tracking comment
// Prevents stop-at-market rejection - Explanatory comment
#region UI Creation - Code organization
Workflow
Before Cleanup
- Read the entire file
- Create a backup suggestion: "I'll clean up V8_3. Want me to save original as V8_3_BACKUP first?"
- Wait for user confirmation
During Cleanup
- Remove commented code (verify it's not documentation)
- Remove debug Print() statements
- Fix indentation
- Remove excess blank lines
- Format property declarations
After Cleanup
- Report what was changed:
- Lines of commented code removed
- Debug statements removed
- Formatting fixes applied
- Suggest: "Review changes before compiling"
Safety Rules
- ALWAYS create backup before cleanup (use version-safety protocol)
- NEVER remove comments that explain WHY
- NEVER change trading logic
- NEVER rename variables/methods
- ALWAYS preserve production logging
Example Interactions
User: "Clean up V8_2_UI_HORIZONTAL"
Haiku Agent:
Found file: UniversalORStrategyV8_2_UI_HORIZONTAL.cs
Should I create a backup first? This will:
1. Save current file as V8_2_UI_HORIZONTAL_BACKUP.cs
2. Clean up the original
3. Report changes made
Proceed? (yes/no)
User: "yes"
Haiku Agent:
✓ Backup created: V8_2_UI_HORIZONTAL_BACKUP.cs
Cleaning up...
✓ Removed 23 lines of commented code
✓ Removed 8 debug Print() statements
✓ Fixed indentation in 12 blocks
✓ Removed 15 excess blank lines
✓ Formatted 34 property declarations
File cleaned. Review changes in diff before compiling.
Integration with Other Skills
Works With:
- version-safety: Creates backup before cleanup
- file-manager: Can deploy cleaned version
- docs-manager: Can add cleanup note to changelog
Use Cases:
- Before milestone release - clean up development artifacts
- After major feature - remove debug code
- Code review prep - ensure consistent formatting
- Pre-production - remove all temporary code
Pattern Recognition
Commented Code Patterns (REMOVE):
Documentation Comments (KEEP):
Example Output Format
After cleanup, report in this format:
✓ Cleanup Complete: V8_2_UI_HORIZONTAL.cs
Changes:
- Commented code: 23 lines removed
- Debug Print(): 8 statements removed
- Indentation: 12 blocks fixed
- Blank lines: 15 removed
- Properties: 34 formatted
File size: 177KB → 175KB (2KB saved)
## Related Skills
- [version-safety](../version-safety/SKILL.md) - Creates backup before cleanup
- [file-manager](../file-manager/SKILL.md) - Can deploy cleaned version
- [docs-manager](../docs-manager/SKILL.md) - Can add cleanup note to changelog
- [delegation-bridge](../delegation-bridge/SKILL.md) - Safe deployment execution
- [wearable-project](../antigravity-core/wearable-project.md) - Portability standards