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/actionhero/keryx/refactornpx skills add actionhero/keryx --skill refactorgit clone --depth 1 https://github.com/actionhero/keryxWhat 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.00087 | $0.00949 |
| Opus 5 | $0.00044 | $0.00475 |
| Sonnet 5 | $0.00017 | $0.00190 |
| Haiku 4.5 | $0.00009 | $0.00095 |
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 2d 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 — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Workflow
Refactoring means changing code structure without changing behavior. Every step must preserve the existing test suite and public API contracts.
Phase 1: Understand Before Touching
- Read the target code — understand what it does, who calls it, and what depends on it
- Check for tests — find existing test coverage for the code being refactored
- Search in
packages/keryx/__tests__/for framework code - Search in
example/backend/__tests__/for app code
- Search in
- Run the existing tests to establish a green baseline before making changes:
cd packages/keryx && bun test # framework code cd example/backend && bun test # app code - Check for stale processes if tests behave unexpectedly:
ps aux | grep "bun keryx" | grep -v grep
Phase 2: Plan the Refactoring
Before writing code, state the plan concisely:
- What structural change you're making and why it improves the code
- Which files will be created, modified, or deleted
- Any import paths that will change
- Whether the public API surface changes (it shouldn't)
If the refactoring is large (touches more than 5 files), break it into incremental steps where tests pass after each step.
Phase 3: Make Changes
Apply changes incrementally. After each logical step, verify nothing broke.
Import Conventions (must follow)
- In
packages/keryx/— use relative imports:import { api } from "../api"; import { Action } from "../classes/Action"; - In
example/backend/— use"keryx"for framework, relative for app-local:import { api, Action, type ActionParams, HTTP_METHOD } from "keryx"; import { SessionMiddleware } from "../middleware/session";
Code Quality Rules
- No
as any— use@ts-expect-errorwith a comment if the type system can't express something - JSDoc annotations on any new or modified public APIs in
packages/keryx/ - Don't add unnecessary abstractions — three similar lines are better than a premature helper
- Don't add comments, docstrings, or type annotations to code you didn't change
- If something is unused after the refactor, delete it completely — no
_unusedrenames or// removedcomments
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.
- 2d ago First seen · 102 lines · 87 tokens per session scan A 5b398fc043dd
refactor is a skill published in the GitHub repository actionhero/keryx (33 stars, last pushed 10d ago), licensed MIT. It adds 87 tokens to every session and 949 once invoked, about $0.0004 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
code-simplifier
Review RTK Rust code for idiomatic simplification. Detects over-engineering, unnecessary allocations, verbose patterns. Applies Rust idioms without changing behavior.
architecture-cleanup
Use when performing a behavior-preserving architectural cleanup or refactor on a codebase and you need strict guardrails against changing functionality, building a framework, or rewriting tests to fit the new design.
clean-code-dotnet
Clean Code principles adapted for C#/.NET including naming, variables, functions, SOLID, error handling, and async patterns. Use when: (1) reviewing C# code, (2) refactoring for clarity, (3) writing new code, (4) code review feedback.
Code Simplifier
Rewrites code to its simplest possible form while preserving exact external behavior (KISS, YAGNI).
code-simplifier
Review RTK Rust code for idiomatic simplification. Detects over-engineering, unnecessary allocations, verbose patterns. Applies Rust idioms without changing behavior.
send-pr
Prepare, validate, and send or update a pull request with full due diligence.