Behavior-preserving refactoring specialist - plans and executes safe incremental restructuring with code smell / SATD / hotspot targeting, characterization-test safety nets, metric and coverage gates, and refactor-only commits. Use for refactor, refactoring, code smell, technical debt, legacy code modernization, extract method, hotspot, and characterization test work.
npx skills add https://github.com/first-fluke/oh-my-agent --skill oma-refactor
Improve internal code structure - readability first - without changing observable behavior, through small verified transformations, each gated by a safety net (tests / tooling / types) and committed separately from any behavior change.
oma-debug (refactoring must not change behavior)oma-qaoma-architecture (a convention/pattern change is an architecture decision, not a local refactoring)oma-db (this skill only plans the expand-contract sequence)oma-scmtarget: file/module/path, smell report, SATD marker, or the feature request motivating preparatory refactoringverification: project test command(s) per the tool registry; coverage/mutation tooling if availableconstraints: coding guide / conventions, regulated-environment flags, merge-window concernsoutputs:
- name: report
description: refactoring plan or before/after report
artifact: ".agents/results/refactor/*.md"
required: false
Standalone runs write plan / before-after reports under .agents/results/refactor/; orchestrated runs (via the refactor-engineer agent) write .agents/results/result-refactor[-{sessionId}].md per the agent execution protocol.
resources/definition.md (invariant definition: 5 properties, boundaries, destination principle, naming roles, inline evidence)resources/measurement.md (4-layer measurement + git forensics commands)resources/governance.md (org parameters: budget floor, 500-line gate, tool registry)oma-architecture when the change requires a convention/boundary decisionoma-architecture for an ADR + ratchet plan.oma-debug; do not fix it in the refactor commit..git-blame-ignore-revs.| Failure | Recovery |
|---------|----------|
| Tests fail after a transformation | Mikado: record prerequisite, revert all, attack prerequisite first |
| No tests and code is untestable | Find a seam; apply only minimal mechanical changes to inject test access, then characterize |
| Tests are flaky | Fix or quarantine flaky tests before refactoring - an unreliable net is no net |
| Metric improves but readability worsens | Reject the transformation; readability is the success criterion, metrics are proxies |
| Scope keeps growing | Stop; report the boundary issue and split into a Mikado graph or route to architecture |
| Refactoring engine/codemod produces wrong output | Engines are not infallible - tests re-run is mandatory; fall back to manual atomic edits |
| Action | SSL primitive | Evidence |
|--------|---------------|----------|
| Diagnose safety net | VALIDATE | Coverage/flakiness/mutation state of target scope |
| Collect signals | READ | Metrics, git churn/ownership, smells, SATD |
| Rank targets | COMPARE | Hotspot = complexity x churn |
| Plan atomic sequence | INFER | Named transformations, Mikado graph |
| Write characterization tests | WRITE | Golden-master/snapshot tests (separate commit) |
| Apply transformation | WRITE / CALL_TOOL | One atomic refactor, engine-first |
| Verify preservation | VALIDATE | Existing tests re-run unchanged |
| Commit separately | UPDATE_STATE | refactor:-typed commits only |
| Report delta | NOTIFY | Metric + readability before/after |
find_symbol, find_referencing_symbols, search_for_pattern for impact analysis; rename_symbol for engine-executed renamesuvx lizard / uvx radon so no pre-install is required; per-language linters with max-lines gatesresources/governance.md)resources/measurement.md)refactor: only.On repeated failure: record prerequisite, revert fully, recurse (Mikado).
| Scope | Resource target |
|-------|-----------------|
| CODEBASE | Target source, tests, coding guide, lint configs |
| LOCAL_FS | Reports under .agents/results/refactor/, .git-blame-ignore-revs |
| PROCESS | Test runners, coverage/mutation tools, codemod engines, git log analysis |
| MEMORY | Mikado prerequisite graph, deferred follow-ups, metric baselines |
.agents/results/refactor/ and entries to .git-blame-ignore-revs.resources/definition.mdresources/measurement.mdresources/governance.md../_shared/core/context-loading.md../_shared/core/quality-principles.mdoma-debug (bugs), oma-qa (audits), oma-architecture (boundaries/ADR), oma-db (schema), oma-scm (commits)Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping
Comprehensive GitHub code review with AI-powered swarm coordination
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
Use this skill to review code. It supports both local changes (staged or working tree) and remote Pull Requests (by ID or URL). It focuses on correctness, maintainability, and adherence to project standards.
Refactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation.
Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits). Use when the user asks to commit, craft a commit message, stage changes, or split work into multiple commits.
Take first-fluke/oma-refactor from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference uvx.
Without those the skill loads but fails at the first command.