thoughtbox:refactor

thoughtbox:refactor is a skill for Claude Code from Kastalien-Research/thoughtbox. It costs 111 tokens per session (1,016 once invoked), scanned A, original, MIT.

A controlled method for changing code structure, such as moving, renaming, or reorganizing code. It limits the files that may be changed, requires a reason to expand that list, and checks each logical change while tracking test failures.

In plain words
What is it for?
Use it when renaming functions across files, restructuring modules, or making other code-organization changes that need clear scope and checkpoints.
Why use it?
It reduces the risk that a small refactor grows into unrelated work or breaks other parts of the codebase. A refactor changes how code is organized without intending to change what it does.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when renaming functions across files, restructuring modules, or making other code-organization changes that need clear scope and checkpoints.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kastalien-research/thoughtbox/thoughtbox-refactor
Install

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.

Any agent
npx skills add Kastalien-Research/thoughtbox --skill thoughtbox-refactor
Clone the repo
git clone --depth 1 https://github.com/Kastalien-Research/thoughtbox

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 thoughtbox:refactor

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/kastalien-research/thoughtbox/thoughtbox-refactor"><img src="https://agentmods.dev/badge/skills/kastalien-research/thoughtbox/thoughtbox-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,016 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
SkillSpector: 1 finding, up to low

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • low Excessive Agency · line 69
    Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.
    Fix: Limit the skill's scope to its documented purpose. Remove instructions that enable the agent to perform actions outside its stated functionality.
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.00111 $0.01016
Opus 5.5 $0.00044 $0.00406
Sonnet 5.5 $0.00022 $0.00203
Haiku 4.5 $0.00011 $0.00102

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

Security

Grade A, and why

thoughtbox: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 1mo 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.

.agents/skills/thoughtbox-refactor/SKILL.md · 127 lines

How it starts

The opening of the file, as written. The whole thing — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Theseus Refactoring Protocol

Refactoring has a failure mode: scope creep. You start renaming one function and end up restructuring three modules. Theseus prevents this by locking your file scope upfront, requiring explicit justification to expand it, and tracking how often your changes break tests.

Core Mechanics

  • Scope: declared file list at init — you can only touch these files
  • Visa: explicit request to touch an out-of-scope file (requires justification)
  • Checkpoint: submit each logical change for audit before proceeding
  • B-counter: tracks test failures — high B means your refactor is causing breakage
  • Terminal state: completed, abandoned, or rolled back

Workflow

Phase 1: Declare Scope

Identify every file you expect to touch. Be specific — this is your contract.

// thoughtbox_execute
async () => {
  return await tb.theseus({
    operation: "init",
    scope: ["src/auth/handler.ts", "src/auth/types.ts", "src/auth/middleware.ts"],
    description: "Extract token validation into standalone module"
  });
}

The session starts with B=0 (no test failures yet).

Phase 2: Work Within Scope

Make changes to declared files. After each logical unit of work:

  1. Checkpoint the change:
async () => {
  return await tb.theseus({
    operation: "checkpoint",
    diffHash: "abc123",  // git diff hash or commit SHA
    commitMessage: "refactor(auth): extract TokenValidator class",
    approved: true,
    feedback: "Clean extraction, no behavior change"
  });
}
  1. Run tests and record outcome:
async () => {
  return await tb.theseus({
    operation: "outcome",
    testsPassed: true,
    details: "All 47 auth tests pass"
  });
}

If tests fail, B increments. If B reaches 3, stop and reassess — your refactor is causing too much breakage.

Phase 3: Expand Scope (If Needed)

If you discover you need to touch a file outside your declared scope, request a visa:

async () => {
  return await tb.theseus({
    operation: "visa",
    filePath: "src/routes/login.ts",
    justification: "Login route imports TokenValidator directly — need to update import path",
    antiPatternAcknowledged: true
  });
}

Read the full file on GitHub · 127 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. 1mo ago First seen · 127 lines · 111 tokens per session scan A 422615e8a222

Subscribe to this mod's changes

thoughtbox:refactor is a skill published in the GitHub repository Kastalien-Research/thoughtbox (65 stars, last pushed 3mo ago), licensed MIT. It adds 111 tokens to every session and 1,016 once invoked, about $0.0004 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.

Related

Other skills, from other repositories

matlab

Builds, reviews, migrates, and plans MATLAB or GNU Octave numerical workflows. Use for arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.

K-Dense-AI/scientific-agent-skills · 44 tokens

phylogenetics

Builds and analyzes phylogenetic trees using MAFFT multiple sequence alignment, IQ-TREE maximum likelihood with ModelFinder and branch support, and FastTree approximate inference. Uses ETE3 for tree summaries and visualization. Applies to homologous nucleotide or protein sequences, microbial gene trees, protein…

K-Dense-AI/scientific-agent-skills · 71 tokens

unity-yaml-editing

Last-resort guidance for safely hand-editing Unity YAML.

Besty0728/Unity-Skills · 17 tokens

ad-policy-check

Checks paid ads against the ad platform's rules (Meta, TikTok, Google, LinkedIn and others) and the brand's category rules: the copy, on-image or on-screen text, pictures and people. Rewrites what can be fixed honestly, adds the disclosures that are needed, and flags anything that needs a human or legal review, with…

gooseworks-ai/goose-skills · 128 tokens

render-3d-product-showcase

Assemble a premium 3D product-showcase ad from a config — four beat clips (an orbiting hero rotation, a macro push-in, a physics reveal, a typographic close) normalized to the chosen backdrop colour, hard-concatenated in order, closed on a deterministic Playwright brand end card, and mixed under one instrumental bed…

gooseworks-ai/goose-skills · 159 tokens

render-airdrop-carousel

Assemble a viral iOS "AirDrop" notification-carousel video ad (≈6–8s, 9:16) from a brand line plus 6–16 real product photos — a native AirDrop share-sheet card ("Brand would like to share a · Decline / Accept") springs up and its preview window CYCLES through the products, landing on a range/lineup payoff with an…

gooseworks-ai/goose-skills · 207 tokens