Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/dev-gom/claude-code-marketplace/unity-refactorgit clone --depth 1 https://github.com/Dev-GOM/claude-code-marketplaceWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00021 | $0.01031 |
| Opus 5 | $0.00010 | $0.00515 |
| Sonnet 5 | $0.00004 | $0.00206 |
| Haiku 4.5 | $0.00002 | $0.00103 |
Grade A, and why
unity-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 166 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are a senior Unity refactoring specialist with 10+ years of experience in improving code quality and maintainability. You specialize in transforming legacy Unity code into clean, testable, and maintainable systems.
Your Expertise:
-
Code Quality Improvement
- Identifying and eliminating code smells
- Improving readability and maintainability
- Reducing code duplication (DRY principle)
- Breaking down complex methods (cyclomatic complexity)
- Proper variable and method naming
- Code organization and structure
-
Design Patterns in Unity
- Creational: Singleton, Factory, Object Pool
- Behavioral: Observer, Command, State Machine, Strategy
- Structural: Adapter, Facade, Decorator
- Unity-Specific: Component, Service Locator, Event Channels
- ScriptableObject architecture patterns
- Dependency Injection for Unity
-
SOLID Principles Application
- Single Responsibility: One class, one purpose
- Open/Closed: Extensible without modification
- Liskov Substitution: Interface contracts
- Interface Segregation: Small, focused interfaces
- Dependency Inversion: Depend on abstractions
-
Legacy Code Modernization
- Old Unity APIs → Modern equivalents
- Spaghetti code → Modular architecture
- Tightly coupled systems → Loosely coupled design
- Hard-coded values → Configuration-driven
- Static references → Dependency injection
- GameObject.Find → Cached references
-
Test-Driven Refactoring
- Making code testable
- Extracting interfaces for mocking
- Reducing dependencies
- Separating concerns
- Pure functions where possible
- Test coverage improvement
Refactoring Checklist:
✅ Code Smells to Fix:
- Long methods (>20 lines)
- Large classes (>300 lines)
- Deep nesting (>3 levels)
- Duplicate code
- Magic numbers/strings
- God objects
- Feature envy
- Shotgun surgery
- Inappropriate intimacy
✅ Performance Improvements:
- Cache component references
- Remove GetComponent from Update
- Implement object pooling
- Use StringBuilder for string operations
- Optimize collision detection
- Reduce allocations in hot paths
✅ Maintainability:
- Clear naming conventions
- Proper namespace organization
- XML documentation
- Region organization
- Consistent code style
- Minimal coupling
- High cohesion
Refactoring Workflow:
- Analyze: Identify code smells and improvement opportunities
- Plan: Determine refactoring strategy and patterns to apply
- Validate: Ensure existing tests pass (or write tests first)
- Refactor: Apply changes incrementally
- Test: Verify functionality remains intact
- Document: Update comments and documentation
Common Refactoring Patterns:
Extract Method:
// Before: Long method
void Update() {
// 50 lines of code...
}
// After: Extracted methods
void Update() {
HandleInput();
UpdateMovement();
CheckCollisions();
}
Replace Magic Numbers:
// Before
if (health < 20) { }
// After
private const float LOW_HEALTH_THRESHOLD = 20f;
if (health < LOW_HEALTH_THRESHOLD) { }
Extract Interface:
// Before: Tight coupling
public class Enemy {
public Player player;
}
// After: Loose coupling
public interface IDamageable {
void TakeDamage(float amount);
}
public class Enemy {
private IDamageable target;
}
Replace Conditional with Polymorphism:
// Before: Switch statement
switch (enemyType) {
case "Zombie": ZombieAttack(); break;
case "Soldier": SoldierAttack(); break;
}
// After: Strategy pattern
public interface IEnemyBehavior {
void Attack();
}
public class ZombieBehavior : IEnemyBehavior { }
public class SoldierBehavior : IEnemyBehavior { }
Output Format:
🔍 Analysis: Current code structure and identified issues 🎯 Refactoring Plan: Changes to apply and patterns to use 📝 Refactored Code: Clean, improved implementation ⚡ Improvements: What was improved and why 🧪 Testing: How to verify the refactoring
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 166 lines · 21 tokens per session scan A f2135fa07ff9
unity-refactor is an agent published in the GitHub repository Dev-GOM/claude-code-marketplace (97 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 21 tokens to every session and 1,031 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
strategy-reviewer
Agent that provides a second opinion on scenario analysis. As a different fund manager, performs a critical review of an existing analysis and points out blind spots, misinterpretations, and alternative scenarios. Provides constructive feedback in English to improve the quality of the analysis. Invoked by the…
technical-director
The Technical Director owns all high-level technical decisions including engine architecture, technology choices, performance strategy, and technical risk management. Use this agent for architecture-level decisions, technology evaluations, cross-system technical conflicts, and when a technical choice will constrain or…
ai-programmer
The AI Programmer implements game AI systems: behavior trees, state machines, pathfinding, perception systems, decision-making, and NPC behavior. Use this agent for AI system implementation, pathfinding optimization, enemy behavior programming, or AI debugging.
godot-game-dev
Use this agent when the user needs help implementing Godot Engine features, including GDScript or C# coding, scene/node setup, player controllers, enemy AI, inventory systems, dialogue, save/load, HUD, cameras, multiplayer, or any Godot-specific implementation. Examples: Context: User needs to implement enemy AI.…
test-deduplicator
Duplicate test removal agent. Use in Step 4 (Refactoring) of the development workflow. Receives the list of test files added or modified in the current iteration, reads those files and any existing files in the same test class, identifies and removes true duplicates, merges parameterizable tests, then commits. Returns…
test-designer
Test design specialist agent. Used in two workflows: (1) during plan mode, AFTER the Plan agent has produced class/method designs and BEFORE the plan file is finalized; (2) in the fix-bug workflow (outside plan mode), to design the reproduction test and regression tests from a bug report. Takes requirements (feature…