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 agentmods add skills/clubpay/ronykit/refactoring-patternsnpx skills add clubpay/ronykit --skill refactoring-patternsgit clone --depth 1 https://github.com/clubpay/ronykitWhat 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 | $0.00057 | $0.03516 |
| Opus 5 | $0.00028 | $0.01758 |
| Sonnet 5 | $0.00011 | $0.00703 |
| Haiku 4.5 | $0.00006 | $0.00352 |
Grade A, and why
refactoring-patterns 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 3d 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.
This is a copy
91% identical to refactoring-patterns — 34 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 241 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Patterns Framework
A disciplined approach to improving the internal structure of existing code without changing its observable behavior. Every refactoring follows the same loop: verify tests pass, apply one small structural change, verify tests still pass.
Core Principle
Refactoring is not rewriting. It is a sequence of small, behavior-preserving transformations, each backed by tests. You never change what the code does — only how it is organized. Big-bang rewrites fail because they combine structural change with behavioral change, making it impossible to know which broke things.
The foundation: Bad code is a natural consequence of delivering under time pressure, not a character flaw. Code smells are objective signals of degraded structure; the smell catalog tells you where to look, and the refactoring catalog tells you what to do.
When to use
- Restructuring before or after a feature (preparatory refactoring).
- A PR review flags duplication, long methods, or tangled conditionals.
- Preparing a RonyKit
internal/appmethod for clearer unit tests.
Prerequisites: tests green before you start. No coverage? Read
working-with-legacy-code first, then go-testing. Run
verification-before-completion after each step — never mix structure and
behavior in one commit.
Scoring
Goal: 10/10. Score structural quality by how many of the eight Quick Diagnostic rows pass — score = round(passed / 8 × 10), adjusting down when a single smell is severe. Bands:
- 9-10: no obvious smells remain, each function does one thing, names reveal intent, duplication is eliminated, conditionals use polymorphism where apt, and tests cover the refactored paths.
- 5-6: a few smells remain (a Long Method, some duplication) but structure is mostly sound.
- ≤3: pervasive smells — tangled conditionals, God classes, duplication everywhere — or no tests to refactor safely.
Always state the current score, name the smells driving it down, and list the specific refactorings needed to reach 10/10.
What ships with it
6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 3d ago First seen · 241 lines · 57 tokens per session scan A f613975fe311
refactoring-patterns is a skill published in the GitHub repository clubpay/ronykit (38 stars, last pushed 5d ago), licensed BSD-3-Clause. It adds 57 tokens to every session and 3,516 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 91% identical to refactoring-patterns, differing in 34 lines, and is treated as a copy.
Other skills, from other repositories
procedure
Vovk.ts procedures — atomic unit of server-side logic in Vovk project. Use whenever user asks to build ANYTHING producing or consuming data on server — page loading data ("users page", "dashboard", "product list"), endpoint, API handler, server action, form submission, controller, validation with Zod / Valibot /…
rpc
Vovk.ts RPC client — how vovk generate turns controllers into type-safe client modules, composed vovk-client vs segmented clients, call shape (apiRoot, params, body, query, meta, init, disableClientValidation, validateOnClient, interpretAs, transform, fetcher), customizing generation via outputConfig.imports.fetcher +…
tools
Building LLM tools with Vovk.ts — deriveTools() (procedures → tools), createTool() (standalone tools, no controller/procedure needed), @operation.tool({ name, title, description, hidden }) decorator, x-tool metadata, ToModelOutput.DEFAULT vs ToModelOutput.MCP formatters, the tools + toolsByName return shape, the meta…
mixins
Vovk.ts OpenAPI mixins — importing third-party OpenAPI 3.x schemas as typed client modules that share the same call signature as native Vovk RPC modules. Use whenever the user asks to "call a third-party API from my Vovk app", "mixin an OpenAPI schema", "import an OpenAPI spec as a client", "wrap an external service…
bundle
Vovk.ts vovk bundle CLI — packages composed TypeScript client as zero-dep publishable npm package. Covers bundle.build async fn, [email protected] recipe, outputConfig.origin / package / reExports / imports.validateOnClient: null, prebundleOutDir / outDir / keepPrebundleDir, --include/--exclude segments, --openapi- mixin…
decorators
Vovk.ts decorators — built-in (@prefix, @operation, @get/@post/@put/@patch/@del, .auto()) and custom via createDecorator. Covers authorization / auth decorators, middleware-style wrapping (pre-handler + post-handler logic), req.vovk.meta() for cross-decorator state, stacking order, the decorate() alternative for…