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 skills add richardcb/oh-my-gemini --skill refactorgit clone --depth 1 https://github.com/richardcb/oh-my-geminiWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/richardcb/oh-my-gemini/refactor)<a href="https://agentmods.dev/skills/richardcb/oh-my-gemini/refactor"><img src="https://agentmods.dev/badge/skills/richardcb/oh-my-gemini/refactor.svg" alt="Measured on agentmods" height="20"></a>What 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.1 | $0.00047 | $0.01319 |
| Opus 5 | $0.00023 | $0.00660 |
| Sonnet 5 | $0.00009 | $0.00264 |
| Haiku 4.5 | $0.00005 | $0.00132 |
Grade A, and why
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 6d 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 — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor Skill
Goal
Restructure existing code to improve quality, readability, or maintainability without changing external behavior. Every refactor must be provably safe through tests and type checks.
Activation Triggers
- User says "refactor", "restructure", "clean up", "reorganize", or "simplify"
- Code review identified structural issues
- Technical debt needs to be addressed
- Code duplication needs to be consolidated
Safety Checklist (Pre-Flight)
Before making any changes, verify all of these:
1. Git State is Clean
# Ensure no uncommitted changes
git status --short 2>/dev/null
If there are uncommitted changes, ask the user to commit or stash them first. Refactoring on a dirty working tree makes rollback difficult.
2. Tests Exist and Pass
# Run full test suite
npm test 2>&1 | tail -30
# Check exit code
echo "Exit code: $?"
If no tests exist: Stop and suggest using the test-generation skill first.
Refactoring without tests is risky - you cannot verify behavior is preserved.
3. Types Check Clean
# Verify no type errors
npm run typecheck 2>&1 | tail -20 || tsc --noEmit 2>&1 | tail -20
Process
1. Define Scope
Clearly identify what is being refactored and why:
Questions to answer:
- What specific code needs restructuring?
- Why does it need to change? (readability, performance, maintainability)
- What is explicitly NOT being changed?
- What is the expected outcome?
# Understand the code to refactor
cat [target-file] | head -100
# Find all usages/callers
grep -rn "functionOrClassName" src/ --include="*.ts" --include="*.js" | head -20
# Check test coverage for this code
find . -name "*.test.*" -o -name "*.spec.*" 2>/dev/null | xargs grep -l "functionOrClassName" 2>/dev/null
2. Verify Tests Pass (Before)
# Run tests - record baseline
npm test 2>&1 | tail -30
# Run typecheck - record baseline
npm run typecheck 2>&1 | tail -20 || tsc --noEmit 2>&1 | tail -20
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.
- 6d ago First seen · 195 lines · 47 tokens per session scan A df6f8dfb8320
refactor is a skill published in the GitHub repository richardcb/oh-my-gemini (16 stars, last pushed 5mo ago), licensed MIT. It adds 47 tokens to every session and 1,319 once invoked, about $0.0002 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 skills, from other repositories
intuitive-tests
Use this skill whenever the user asks about unit test best practices, test organization, flat test suites, redundant tests, test refactors, pytest/JUnit/Jest/xUnit layout, test taxonomy, flaky tests, coverage quality, fixtures, mocks, parametrization, pruning existing UTs, or "which tests are worth keeping." It…
intuitive-preflight
Turn a vague task, plan, issue, or "LGTM/go ahead" request into an approval-ready preflight contract before implementation starts. Use when the user wants prompt preflight, clearer scope, non-goals, context package, acceptance criteria, definition of done, verification, stop gates, the exact execution command, or…
intuitive-refactor
Refactor and cleanup router for known code/module/API seams, stale surfaces, compatibility shims, architecture cleanup targets, changed-code quality review, oversized modules, repeated cleanup campaigns, and recurring whole-repo architecture maintenance goals. Use this when the user names a concrete seam, wants…
skill-runner
Run a bounded development task through named skills in an isolated, tmux-backed Codex or Claude session. Use for durable or artifact-sensitive worker phases, supervised skill runs, and post-run skill evaluation.
intuitive-doc
Create and maintain an intuitive human documentation surface for AI-agent-developed repos. Use when humans should only need README.md, ARCHITECTURE.md, STATUS.md, and docs/human/ while planning logs, generated docs, retrospectives, ADR detail, and implementation evidence stay in AI-agent-only folders.
intuitive-shape
Shape a raw product or project idea into a bounded decision before planning or implementation. Use when deciding whether an idea deserves a bet, setting an appetite, comparing candidate bets under finite capacity, cutting scope, exposing rabbit holes and no-gos, or choosing BET, RESEARCH, RESHAPE, or PASS. This skill…