oma-refactor
Skill1.3k starsChanged 59 days agoMITView on GitHub
Restructure existing code while preserving observable behavior. Use
1 other project uses a version of this, 1 of them edited.
Trending
More talk lately.about the whole repository
Most recently taken up by
- deathrashed/agentsedited, first seen Jul 25, 2026
Who's talking about first-fluke/oh-my-agent
- A Hacker News story“Show HN: Oh-my-agent – A structural harness for AI agents in real projects”Hacker News · Mar 17, 2026 · 3 points
- sudosubin/agents.nix“agent-skills.github.first-fluke.oh-my-agent: 6d96258 → e7abefd”GitHub · Oct 5, 2026
- sudosubin/agents.nix“agent-skills.github.first-fluke.oh-my-agent: 0-unstable-2026-10-04 → 0-unstable-2026-10-05”GitHub · Oct 5, 2026
- awesome-dsh-plugin/awesome-dsh-plugin“Add OMA project hook integration”GitHub · Oct 5, 2026
- sudosubin/agents.nix“agent-plugins.github.first-fluke.oh-my-agent: init at 0-unstable-2026-10-04”GitHub · Oct 4, 2026
The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 15
Talked about on GitHub and Hacker News (15 times).
On GitHub · 14
- Oct 5, 2026agent-skills.github.first-fluke.oh-my-agent: 6d96258 → e7abefd — sudosubin/agents.nix0 reactions
- Oct 5, 2026agent-skills.github.first-fluke.oh-my-agent: 0-unstable-2026-10-04 → 0-unstable-2026-10-05 — sudosubin/agents.nix0 reactions
- Oct 5, 2026Add OMA project hook integration — awesome-dsh-plugin/awesome-dsh-plugin0 reactions
- Oct 4, 2026agent-plugins.github.first-fluke.oh-my-agent: init at 0-unstable-2026-10-04 — sudosubin/agents.nix0 reactions
- Oct 4, 2026agent-skills.github.first-fluke.oh-my-agent: 0-unstable-2026-10-03 → 0-unstable-2026-10-04 — sudosubin/agents.nix0 reactions
9 more on GitHub
- Oct 3, 2026agent-skills.github.first-fluke.oh-my-agent: 7.0.0 → 0-unstable-2026-10-03 — sudosubin/agents.nix0 reactions
- Sep 27, 2026agent-skills.github.first-fluke.oh-my-agent: init at 7.0.0 — sudosubin/agents.nix0 reactions
- Sep 21, 2026[Resource]: oh-my-agent — hesreallyhim/awesome-claude-code0 reactions
- Jul 16, 2026Feature roadmap tracking against OMO and OMC — witt3rd/oh-my-hermes0 reactions
- May 12, 2026feat: Comparability to OmO and other similar tools — siddsachar/row-bot0 reactions · 2 comments
- Apr 18, 2026Audit candidate: first-fluke/oh-my-agent — xiaolai/nlpm0 reactions · 2 comments
- Mar 17, 2026📱 SNS 콘텐츠 - 2026-03-17 22:15 KST — leaf468/autothreads0 reactions
- Mar 17, 2026🤖 AI 트렌드 리포트 - 2026-03-17 22:15 KST — leaf468/autothreads0 reactions
- Mar 16, 2026oh-my-agent 2.9.1 (new formula) — Homebrew/homebrew-core0 reactions · 1 comment
On Hacker News · 1
- Mar 17, 2026Show HN: Oh-my-agent – A structural harness for AI agents in real projects3 points · 1 comment
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- deathrashed/agents★ 190% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository69 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cli/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- cli/CLAUDE.mdCLAUDE.md
- oma-academic-writingSkill
- oma-architectureSkill
- oma-backendSkill
- oma-brainstormSkill
- oma-coordinationSkill
- oma-dbSkill
- oma-debugSkill
- oma-deepsecSkill
- oma-designSkill
- oma-dev-workflowSkill
- oma-docsSkill
- oma-explanationSkill
- oma-frontendSkill
- oma-hwpSkill
- oma-imageSkill
- oma-marketSkill
- oma-mobileSkill
- oma-observabilitySkill
- oma-orchestrationSkill
- oma-pdfSkill
- oma-pmSkill
- oma-qaSkill
- oma-recapSkill
- oma-refactorSkill
- oma-scholarSkill
- oma-scmSkill
- oma-searchSkill
- oma-skill-creationSkill
- oma-slideSkill
- oma-tf-infraSkill
- oma-translationSkill
- oma-videoSkill
- oma-voiceSkill
- oma-academic-writingSkill
- oma-architectureSkill
- oma-backendSkill
- oma-brainstormSkill
- oma-coordinationSkill
- oma-dbSkill
- oma-debugSkill
- oma-deepsecSkill
- oma-designSkill
- oma-dev-workflowSkill
- oma-docsSkill
- oma-explanationSkill
- oma-frontendSkill
- oma-hwpSkill
- oma-imageSkill
- oma-marketSkill
- oma-mobileSkill
- oma-observabilitySkill
- oma-orchestrationSkill
- oma-pdfSkill
- oma-pmSkill
- oma-qaSkill
- oma-recapSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 11 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Commit splitting / staging mechanics -> use oma-scm
- Distinctive: line 43
Before/after report: metric delta (cyclomatic/cognitive complexity, size, coupling) + readability verdict
- Distinctive: line 76
ACQUIRE: Read target code via symbol tools.
- Distinctive: line 80
FINALIZE: Before/after metric delta + readability judgment (metric improvement alone is not success).
- Distinctive: line 83
If the safety net is missing or weak (low diff coverage, flaky, no assertions), write characterization / golden-master tests FIRST, …
- Distinctive: line 84
If verification fails repeatedly, switch to the Mikado method: never carry a half-broken tree forward.
- Very specific: line 85
If the right fix is a convention or pattern change (new dialect), stop and route to oma-architecture for an ADR + ratchet plan.
- Distinctive: line 86
If the target involves persisted state or external consumers, plan expand-contract (parallel change) with feature flags.
- Very specific: line 87
If a behavior bug is discovered mid-refactoring, record it and route to oma-debug.
- Very specific: line 88
If the work is large enough to collide with teammates' branches, recommend announcement + short merge window.
- Very specific: line 124
Test stack: preserve the project runner and configuration.
- Distinctive: line 129
If brownfield: find a seam, write characterization (golden-master) tests for CURRENT behavior, commit.
- Distinctive: line 152
Never alters observable behavior, public contracts, or persisted data without an expand-contract plan.
- Distinctive: line 156
Verifiable: never restructure without a net.
- Distinctive: line 159
Separated (two hats): never mix behavior changes into refactor commits.
- Distinctive: line 162
All metrics are proxies (Goodhart): a 499-line mechanical split, assertion-free coverage, or pattern-count gains are failures, not wins.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Refactor Agent - Behavior-Preserving Restructuring Specialist
Scheduling
Goal
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.
Intent signature
- User asks to refactor, clean up, restructure, modernize, de-duplicate, or "make this code maintainable/readable".
- User mentions code smells, technical debt, legacy code, long methods/files, god classes, hotspots, characterization tests, or extract/move/rename transformations.
- User asks "where should we refactor first?" or wants a refactoring plan/priority for a codebase.
When to use
- Executing a refactoring on specific files/modules (extract, move, rename, decompose, pattern/idiom alignment)
- Preparatory refactoring before a feature ("make the change easy, then make the easy change")
- Legacy (brownfield) rescue: seam discovery + characterization tests, then restructuring
- Refactoring target selection and prioritization (smells + SATD + hotspot = churn x complexity)
- Auditing whether code is safe to refactor now (coverage breadth x mutation strength x flakiness)
When NOT to use
- Fixing a reported bug or failing behavior -> use
oma-debug(refactoring must not change behavior) - Security/performance/accessibility review or quality audit -> use
oma-qa - System design, module boundary decisions, ADRs, convention changes -> use
oma-architecture(a convention/pattern change is an architecture decision, not a local refactoring) - DB schema design or migration mechanics -> use
oma-db(this skill only plans the expand-contract sequence) - Commit splitting / staging mechanics -> use
oma-scm - Performance optimization as a goal -> out of scope by definition (tuning is a side effect, never the objective)
Expected inputs
target: file/module/path, smell report, SATD marker, or the feature request motivating preparatory refactoringverification: existing project test command(s); coverage/mutation tooling if already availableconstraints: coding guide / conventions, regulated-environment flags, merge-window concerns- Optional: prior metric reports, hotspot data, ADRs touching the target area
Expected outputs
- Refactored code as a sequence of atomic, refactor-only commits (no test changes mixed in)
- Safety-net additions when missing (characterization / golden-master tests) as separate commits
- Before/after report: metric delta (cyclomatic/cognitive complexity, size, coupling) + readability verdict
outputs:
- name: report
description: refactoring plan or before/after report
artifact: ".agents/results/refactor/*.md"
required: falseStandalone 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.
Dependencies
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(optional organization conventions and existing verification tools)- Configured code-intelligence symbol/reference tools; existing project test runners for the target language
- Git history for churn/ownership/hotspot analysis
Control-flow features
- Branches by safety-net state (greenfield vs brownfield), statefulness (code-only vs expand-contract), and verification outcome (pass vs Mikado revert)
- Reads code/history/metrics; writes code, tests (in separate commits), and reports
- Stops and routes to
oma-architecturewhen the change requires a convention/boundary decision
Structural Flow
Entry
- Establish what motivates the refactoring (smell, SATD, hotspot, or upcoming feature) and the target scope.
- Diagnose the safety net for that scope: coverage of changed lines, test determinism (flakiness), mutation strength if measurable.
- Identify the destination form: the language idiom and codebase convention the result must match.
Scenes
- PREPARE: Classify greenfield (safety net exists) vs brownfield (build net first); check size gates and hotspot rank; confirm two-hats scope (no feature/bug work mixed in).
- ACQUIRE: Read target code via symbol tools; collect metrics (complexity, size, coupling) and git signals (churn, ownership); read the coding guide for conventions.
- REASON: Decompose the goal into a sequence of named atomic transformations; for stateful targets plan expand-contract; verify each step is independently verifiable and revertible.
- ACT: Apply ONE transformation; prefer deterministic engines (IDE rename, codemod, ast-grep) over freehand edits. When one feature spans several files after a split, consider G-5's optional header map if it helps navigation.
- VERIFY: Re-run existing tests unchanged. Pass -> commit (refactor-only) -> next transformation. Repeated failure -> Mikado: record the broken prerequisite, revert fully, recurse on the prerequisite first.
- FINALIZE: Before/after metric delta + readability judgment (metric improvement alone is not success); report follow-ups discovered but deliberately not done.
Transitions
- If the safety net is missing or weak (low diff coverage, flaky, no assertions), write characterization / golden-master tests FIRST, committed separately, before touching production code.
- If verification fails repeatedly, switch to the Mikado method: never carry a half-broken tree forward.
- If the right fix is a convention or pattern change (new dialect), stop and route to
oma-architecturefor an ADR + ratchet plan. - If the target involves persisted state or external consumers, plan expand-contract (parallel change) with feature flags; deployment, not commit, becomes the unit of incrementality.
- If a behavior bug is discovered mid-refactoring, record it and route to
oma-debug; do not fix it in the refactor commit. - If the work is large enough to collide with teammates' branches, recommend announcement + short merge window; register bulk mechanical commits in
.git-blame-ignore-revs.
Failure and recovery
| 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 |
Exit
- Success: behavior verified unchanged, structure measurably improved, readability confirmed, refactor-only commits, follow-ups reported.
- Partial success: safety net built but restructuring deferred; or prerequisites mapped (Mikado graph) with explicit blockers.
- Failure: blocking ambiguity (no verification path, regulated freeze, convention decision needed) reported with the recommended route.
Logical Operations
Actions
| 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 |
Tools and instruments
- Configured code intelligence for symbol/reference/pattern impact analysis; an available semantic rename engine for renames. Native inspection remains valid, but do not replace a semantic rename with blind text replacement
- Deterministic transformers: IDE refactoring actions, codemods (jscodeshift / OpenRewrite / ast-grep / comby)
- Metrics: use already installed complexity tools such as lizard / radon and existing project lint limits; installing or downloading additional tools requires authorization
- Test stack: preserve the project runner and configuration; use mutation tooling only when available and appropriate (see
resources/governance.md) - Git forensics one-liners (see
resources/measurement.md)
Canonical workflow path
- Diagnose: run coverage on the target scope and check test determinism; classify green/brownfield.
- If brownfield: find a seam, write characterization (golden-master) tests for CURRENT behavior, commit.
- Select targets by hotspot rank (complexity x churn), not by smell aesthetics alone.
- Plan a sequence of named atomic transformations toward the language-idiomatic, convention-conforming form.
- Loop per transformation: apply (engine-first) -> re-run tests UNCHANGED -> commit
refactor:only. On repeated failure: record prerequisite, revert fully, recurse (Mikado). - Finish: metric delta + readability verdict; list discovered-but-deferred work; never mix in behavior changes.
Resource scope
| 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 |
Preconditions
- A verification path exists or can be built (tests/types/tooling); otherwise the first deliverable is the safety net, not restructuring.
- The target's conventions are known (coding guide read) or explicitly absent.
Effects and side effects
- Mutates production code (structure only) and adds tests in separate commits.
- Runs test/coverage/mutation commands; reads git history.
- May write reports under
.agents/results/refactor/and entries to.git-blame-ignore-revs. - Never alters observable behavior, public contracts, or persisted data without an expand-contract plan.
Guardrails
- Behavior-preserving: the consumer contract (Hyrum-aware) is inviolable; tuning is a side effect, never a goal.
- Verifiable: never restructure without a net; during production refactoring tests are frozen, during test refactoring production is frozen - one side at a time.
- Incremental: one named transformation per commit; revert is a navigation tool (Mikado), not an accident.
- Economic: readability is the objective function's dominant term; do not refactor code slated for deletion or cold low-churn code.
- Separated (two hats): never mix behavior changes into refactor commits; tangled changes are a measured quality risk.
- Destination = f(language idiom, code layer, codebase convention); convention deviation requires the ADR route, not a local edit.
- Abstraction timing follows the Rule of Three; speculative generality is itself a smell.
- All metrics are proxies (Goodhart): a 499-line mechanical split, assertion-free coverage, or pattern-count gains are failures, not wins.
References
- Local code tools:
../_shared/core/code-intelligence.md(code search/navigation) - Invariant definition (5 properties, boundaries, destination, naming roles, contexts, D&C, inline evidence):
resources/definition.md - Measurement: 4 layers + git forensics commands:
resources/measurement.md - Optional organization conventions and existing verification tools:
resources/governance.md - Context loading:
../_shared/core/context-loading.md - Quality principles:
../_shared/core/quality-principles.md - Adjacent skills:
oma-debug(bugs),oma-qa(audits),oma-architecture(boundaries/ADR),oma-db(schema),oma-scm(commits)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

