/gabbe:refactorfrom GABBE
Restructures code in small steps while a green test suite guards behavior. Reports tests, coverage, and complexity before and after each change.
Ships in GABBE. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Improve code structure, readability, or maintainability while guaranteeing that all existing behavior is preserved. Tests are the safety net — if they fail after refactoring, the refactor was incorrect.
For existing code without tests, start with characterization-tests.skill, then safe-refactoring.skill (this skill applies once a green suite covers the code).
Establish the safety net
[test command from AGENTS.md]Identify the refactoring target
Apply ONE refactoring at a time
Common refactoring patterns
Extract Function:
// Before: complex inline logic
function processOrder(order) {
// 40 lines of validation + calculation + notification
}
// After: extracted with clear names
function processOrder(order) {
validateOrder(order);
const total = calculateTotal(order);
notifyUser(order, total);
}
Early Returns (reduce nesting):
// Before: deeply nested
function getDiscount(user) {
if (user) {
if (user.isPremium) {
if (user.yearsActive > 5) {
return 0.3;
}
}
}
return 0;
}
// After: early returns
function getDiscount(user) {
if (!user) return 0;
if (!user.isPremium) return 0;
if (user.yearsActive <= 5) return 0;
return 0.3;
}
Extract Constants:
// Before: magic numbers
if (attempts > 3) lockAccount(15 * 60 * 1000);
// After: named constants
const MAX_LOGIN_ATTEMPTS = 3;
const LOCKOUT_DURATION_MS = 15 * 60 * 1000; // 15 minutes
if (attempts > MAX_LOGIN_ATTEMPTS) lockAccount(LOCKOUT_DURATION_MS);
After each refactoring step
[test command] → must pass[typecheck command] → must pass[lint command] → must passCheck architecture boundaries (agentic-linter)
Final verification
Report: "Refactored [target]. All [N] tests still passing. Coverage: [X]%. Complexity reduced from [A] to [B]."
if that guarded them.characterization-tests.skill.grep) and confirm none was lost.pbt-strategy.skill); prefer readable code to short code.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub andreibesleaga/gabbe --plugin gabbe49 skills in this plugin
/adr-writerGenerate Architecture Decision Records for significant technical decisions. Use when: architecture decision, ADR, why did we choose, why are we using, architectural choice./api-designAPI contract (OpenAPI, GraphQL SDL or proto) written before code, with resources, errors, pagination and authentication. Use when a new endpoint or API is needed or the contract of an existing one must change./arch-designArchitecture design from approved requirements — quality scenarios, style choice, decomposition, 4+1 or arc42 views, ADRs and risks. Use when a new system or major subsystem needs an architecture before implementation planning./assurance-ladderChoose how strongly a component must be verified, from plain tests (level 0) to a machine-checked proof of a small core (level 3), record the choice in an ASSURANCE_PLAN, and know which evidence each level leaves. Use at S01/S02 when planning verification, when a requirement mentions concurrency, money, authorisation or safety, or when asked how sure we are that code is correct. Use when: assurance level, how strongly to verify, formal verification, choose verification level, assurance plan, prove correctness, model checking, high-risk component./audit-trailAppends one structured row per decision, phase change, approval or failure to agents/memory/AUDIT_LOG.md. Use when a decision, human approval, gate result or task outcome must be recorded, or when someone asks why something was done./characterization-testsUse before changing code that has no tests or weak tests. Pins what the code does today with golden-master and characterisation tests, handles non-determinism, and records a coverage baseline, so later changes can be checked against it. Use when: characterization test, characterisation test, golden master, approval test, pin behaviour, no tests, legacy tests, snapshot current behaviour, baseline coverage.Other plugins' skills for the same job