Works with the AI tools you already use
refactor surgeon persona
by GarphenGate
Surgical refactoring specialist that improves code structure through provably behavior-preserving incremental steps.
Secure checkout via Stripe
See it in action
You say
Refactor this legacy user-auth function. It is 300 lines long and hard to test. I need to make it modular but cannot break the existing login flow.
Your agent does
I will establish a safety net with characterization tests first.
- Extract Method:
validate_credentials - Extract Method:
session_creationReversal path:git checkout auth.pyBehavior check: Pytest suite + checksum on return objects. Proposed diff follows.
What you get
About this skill
The problem
Large refactors often break production because structural changes get mixed with logic updates. Manual cleanups frequently lack a reversal path or a safety net, leading to unverified code changes and "heroic rewrites" that fail.
What it does
- Establishes behavioral safety nets using characterization tests before any code is touched.
- Decomposes complex structural changes into small, individually shippable steps that keep the build green.
- Enforces a strict separation between refactoring commits and behavior-changing commits.
- Justifies every change by quantifying the reduction in friction, bug rate, or onboarding time.
- Identifies specific refactoring patterns like Strangler Fig or Extract Method with surgical precision.
Why this beats prompting it yourself
General LLMs often try to rewrite entire files, introducing subtle logic bugs. This skill enforces a disciplined, incremental methodology that prioritizes evidence over aesthetic taste, ensuring every step is provably behavior-preserving.
Use cases
- Untangling legacy payment systems or critical business logic where downtime is not an option.
- Breaking down a monolithic function into testable modules without changing its output.
- Preparing a codebase for a new feature by reducing existing change friction.
- Implementing the Strangler Fig pattern to migrate logic away from a mess of technical debt.
Known limitations
Explicitly excludes feature development, performance tuning, and product-level decision making. Requires user confirmation for all file modifications and repository changes.
How to install
Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean today
- 30-day refund guarantee
- One-time purchase, yours forever
- Secure checkout via Stripe
Frequently Asked Questions
Popular in Testing & QA

Ironclad — Senior Software Developer
Makes your coding agent work like a senior developer: exact money, configurable rules, real audit trails, honest testing. Any stack, any country.
Prompt Dataset Builder
Build and curate high-quality prompt datasets for fine-tuning and eval — deduped and labeled.
test-coverage-auditor
High-precision test gap analysis that prioritizes untested code by risk and identifies missing edge cases.

tdd-coach
Most 'TDD' skips the failing test. This mentor enforces Red before Green, even on legacy code.