keryx: Skill for Claude Code

.claude/skills/refactor/SKILL.md

refactor is a skill for Claude Code from actionhero/keryx. It costs 87 tokens per session (949 once invoked), scanned A, original, MIT.

A guided method for changing code structure while keeping its behavior, tests, and public interfaces intact.

In plain words
What is it for?
Use it to simplify code, move logic, rename or reorganize files, remove duplication, and split large refactors into smaller steps.
Why use it?
It reduces the risk of breaking callers or introducing unnoticed problems during code cleanup.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is actionhero/keryx's own configuration. It tells Claude Code how to work on keryx itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything keryx configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { api } from "../api";.

Reuse

Borrowing it

Nothing to install: this file belongs to actionhero/keryx. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/actionhero/keryx/main/.claude/skills/refactor/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/actionhero/keryx

Made for: Claude Code.

Wrote 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.

agentmods badge for refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/actionhero/keryx/refactor/github.svg)](https://agentmods.dev/skills/actionhero/keryx/refactor)
Your own site
<a href="https://agentmods.dev/skills/actionhero/keryx/refactor"><img src="https://agentmods.dev/badge/skills/actionhero/keryx/refactor/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.

agentmods 80×15 button for refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/actionhero/keryx/refactor"><img src="https://agentmods.dev/badge/skills/actionhero/keryx/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 949 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00087 $0.00949
Opus 5.5 $0.00035 $0.00380
Sonnet 5.5 $0.00017 $0.00190
Haiku 4.5 $0.00009 $0.00095

Measured 2mo ago against content hash 5b398fc043dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 2mo 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.

.claude/skills/refactor/SKILL.md · 102 lines

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

  1. Read the target code — understand what it does, who calls it, and what depends on it
  2. 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
  3. 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
    
  4. 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-error with 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 _unused renames or // removed comments

Read the full file on GitHub · 102 lines

Changes

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.

  1. 2mo ago First seen · 102 lines · 87 tokens per session scan A 5b398fc043dd

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository actionhero/keryx (46 stars, last pushed 8d ago), licensed MIT. It adds 87 tokens to every session and 949 once invoked, about $0.0003 per session on Opus 5.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.