Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/the-open-agent/oss-skillsnpx agentmods add skills/the-open-agent/oss-skills/refactor-safelyWrote 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/the-open-agent/oss-skills/refactor-safely)<a href="https://agentmods.dev/skills/the-open-agent/oss-skills/refactor-safely"><img src="https://agentmods.dev/badge/skills/the-open-agent/oss-skills/refactor-safely/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/the-open-agent/oss-skills/refactor-safely"><img src="https://agentmods.dev/badge/skills/the-open-agent/oss-skills/refactor-safely.svg" alt="Reviewed on agentmods" width="80" 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.00109 | $0.02049 |
| Opus 5 | $0.00055 | $0.01025 |
| Sonnet 5 | $0.00022 | $0.00410 |
| Haiku 4.5 | $0.00011 | $0.00205 |
Grade A, and why
refactor-safely 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 9d 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 — 179 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Safely
In a private codebase a refactor is a Tuesday. In a public one it is a coordination problem with strangers who did not agree to be coordinated.
First: should you?
The Second System Effect is real and rewrites kill projects. Before agreeing:
| Reason to refactor | Verdict |
|---|---|
| A specific bug class keeps recurring here | Yes — targeted refactor |
| New feature is genuinely blocked by the structure | Yes — refactor exactly enough to unblock |
| Performance ceiling hit, profiled and proven | Yes |
| Onboarding contributors repeatedly stall in this file | Yes |
| "The code is ugly" | No — write tests instead, and reconsider in a month |
| "I'd write it differently now" | No |
| "Let's move to " | Only with a user-facing reason |
| "Full rewrite, v2, from scratch" | Almost never — see below |
The full rewrite trap. A from-scratch v2 means: shipping nothing for months, maintaining v1 anyway, re-discovering every edge case that the ugly code in v1 was silently handling, and a migration your users may simply decline. Projects have died here. If the user wants a rewrite, propose the strangler-fig alternative first, and only lose that argument once.
Rewriting is genuinely correct when the original's core assumption is wrong — single-threaded when it must be concurrent, synchronous when it must stream, a data model that cannot express the domain. Incremental refactoring cannot fix an axiom.
Preconditions
Do not start until all of these hold:
- Characterization tests exist. Before changing anything, write tests that pin current behavior — including behavior you think is wrong. Bugs get depended upon; those tests tell you which ones.
- The public API surface is snapshotted and asserted in CI (see
api-design). - The refactor is sequenced into reviewable PRs. Nobody can review 5,000 lines, including you in three weeks.
mainstays releasable at every commit. A long-lived refactor branch accumulates conflicts and blocks everyone else's work.
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.
- 9d ago First seen · 179 lines · 109 tokens per session scan A ccf90de50d8e
refactor-safely is a skill published in the GitHub repository the-open-agent/oss-skills (5 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 109 tokens to every session and 2,049 once invoked, about $0.0005 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-31.
Other skills, from other repositories
cn-check
Install and run the Continue CLI (cn) to execute AI agent checks on local code changes. Use when asked to "run checks", "lint with AI", "review my changes with cn", or set up Continue CI locally.
mindos
MindOS: local knowledge assistant & shared KB. Keeps decisions, notes, SOPs, debugging lessons, research findings, preferences across sessions/agents. Core: save notes, search KB, organize files, run workflows, review, append CSV, hand off context, distill lessons. NOT for app source or paths outside KB. Triggers…
superlint
This skill describes the mandatory standard operating procedure for using our internal SuperLint tool. Use this when tasks require fixing code quality issues according to corporate standards.
pr-review
Review a GitHub pull request and post one formal review — advance the existing discussion and give precision-first, high-signal feedback. Judgement on the diff, not a build gate — CI validates that it builds, and a targeted probe is allowed as evidence. Use when asked to review a PR or on a cron PR scan.
PR Etiquette
This skill should be used when responding to maintainer review feedback, writing or reviewing PR descriptions, following up on dormant PRs, validating PR quality before submission, or deciding how to communicate with maintainers. Sibling to oss-contribution and contribution-ethics.
pr-comment
Answer a maintainer's question about an open PR with concrete, code-cited evidence. The PR-side counterpart to issue-comment — for questions tied to the diff, not a full review.