tend-refactor

tend-refactor is a skill for Claude Code, Codex from robcsaszar/tend. It costs 105 tokens per session (2,137 once invoked), scanned A, original, MIT.

A refactoring scanner for SvelteKit and TypeScript projects. It looks for one high-priority, mechanically provable cleanup at a time, such as duplicate code, weak types, dead code, or repeated component markup, then verifies the change.

In plain words
What is it for?
Use it to remove verified duplication or deprecated code, replace an unnecessarily broad type, or extract repeated markup into a component.
Why use it?
Large cleanup sessions can introduce unrelated changes or rely on guesses. Focusing on one evidenced issue keeps the refactor small and easier to review.

Skill for Claude CodeCodex

Part of the robcsaszar-tend plugin — 7 skills shipped together

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.

agentmods
npx agentmods add skills/robcsaszar/tend/tend-refactor
Any agent
npx skills add robcsaszar/tend --skill tend-refactor
Clone the repo
git clone --depth 1 https://github.com/robcsaszar/tend

Made for: Claude Code, Codex.

Or install robcsaszar-tend, the plugin that ships this one along with the rest of its 7 skills.

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 tend-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/robcsaszar/tend/tend-refactor.svg)](https://agentmods.dev/skills/robcsaszar/tend/tend-refactor)
Your own site
<a href="https://agentmods.dev/skills/robcsaszar/tend/tend-refactor"><img src="https://agentmods.dev/badge/skills/robcsaszar/tend/tend-refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 105 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,137 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00105 $0.02137
Opus 5 $0.00053 $0.01069
Sonnet 5 $0.00021 $0.00427
Haiku 4.5 $0.00011 $0.00214

Measured 3d ago against content hash 7d62944d1a04, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tend-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 3d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/validate-finding.mjs), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/tend-refactor/SKILL.md · 77 lines

How it starts

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

Tend Refactor — the Wright

Find the single highest-priority refactor opportunity in this repo, fix it minimally, verify, and hand the diff back for review. Every fix must be mechanically provable — grep evidence of duplication, an existing type inferred from context, or 2+ verified markup instances — never a guess dressed up as cleanup. One issue per run.

0. Load config

  • Read .claude/tend/config.yaml. Use skills.refactor (off-limits globs, notes) + the modules: list.
  • No config? Run at core tier: core SvelteKit + TS assumptions, no modules, conservative built-in off-limits (never touch lockfiles, CI, .env, config). Emit once: "run tend-onboard to sharpen." Continue.
  • Active modules gate which reference packs load in Phase 2 (progressive disclosure). This skill only ever loads data, validation, and feature-flags — the other two (auth, realtime) have no refactor-specific pack and are ignored even if active.

1. Triage

MANDATORY READ references/scan-core.md.

Establish: active modules (from config), off-limits set (config globs + built-in rails), this repo's domain/business-logic core (whatever skills.refactor.off-limits names, plus obvious candidates like a game/simulation engine, payment logic, or auth internals), and this repo's existing component-directory and type conventions — both are needed before tiers B and C can be evaluated honestly.

2. Scan — priority order, stop at the first real hit

Three sub-domains, safest tier first (full method, worked examples, and the extraction-safety checklist live in references/scan-core.md):

A. Dead code & duplication removal (always). @deprecated exports with no remaining callers, lint-flagged dead code, a duplicated inline pattern across 2+ files, consumers of a superseded helper. Scope: utility/component/helper directories, API-route call-site migration only (never new routes or logic) — never the domain/business-logic core, only utility and presentation layers; a repo names its own core paths to protect in skills.refactor.off-limits.

Read the full file on GitHub · 77 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. 3d ago First seen · 77 lines · 105 tokens per session scan A 7d62944d1a04

Subscribe to this mod's changes

tend-refactor is a skill published in the GitHub repository robcsaszar/tend (0 stars, last pushed 4d ago), licensed MIT. It adds 105 tokens to every session and 2,137 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.

Related

Other skills, from other repositories

software-code-refactoring

Improve production code quality while preserving all existing test behavior. Commonly used for the Refactor phase of TDD red-green-refactor, but applicable to any codebase with tests. Use when production code works but needs cleanup — reducing duplication, improving naming, simplifying complexity, aligning with…

stencila/stencila · 102 tokens

simplify-codebase

Simplification audit or authorized codebase simplification whose stated objective is to remove accidental complexity. Use for evidence-backed deletion or consolidation of dead code, duplicate state, redundant APIs or layers, ownerless abstractions, obsolete compatibility or design records, and over-engineering in any…

tt-a1i/simplify-codebase · 93 tokens

cyclomatic-complexity

Refactor code to reduce cyclomatic complexity so it stays readable, maintainable, and aligned with the long-term vision of the codebase, not just optimized for AI comprehension. Use whenever the user asks to refactor, simplify, clean up, or review code quality; mentions complexity, maintainability, readability…

saurabhkumar8112/cyclomatic-complexity-skill · 103 tokens

refactor

Refactor code to improve structure and maintainability.

vstorm-co/pydantic-deepagents · 12 tokens

absolute-simplify

Use when the user wants to simplify, clean up, refactor, tidy, or refine code — their staged/unstaged git changes or a target file/path. Reduces complexity, flattens nesting, removes redundancy and dead code, scores each change by value (holding low-value churn), then runs tests to prove nothing broke. Invoke on…

maddhruv/absolute · 178 tokens

techdebt

Find and fix technical debt including duplicated code, dead code, outdated patterns, and code smells. Run at the end of sessions to clean up.

brycewang-stanford/Auto-Empirical-Research-Skills · 33 tokens