refactor-green

A refactoring step for improving source-code structure while all tests continue to pass. Refactoring changes how code is organized without changing its agreed behavior.

In plain words
What is it for?
Use it after a working implementation to address code smells, simplify structure, and apply established design and refactoring practices.
Why use it?
It removes design problems and keeps the implementation consistent with its fixed type contract. The tests and contract file remain unchanged while the source is cleaned up.

Skill for Claude CodeCodex

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/nullhack/temple8/refactor-green
Any agent
npx skills add nullhack/temple8 --skill refactor-green
Clone the repo
git clone --depth 1 https://github.com/nullhack/temple8

Made for: Claude Code, Codex.

Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 281 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.00023 $0.00281
Opus 5 $0.00012 $0.00140
Sonnet 5 $0.00005 $0.00056
Haiku 4.5 $0.00002 $0.00028

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

Security

Grade A, and why

refactor-green 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.

.opencode/skills/refactor-green/SKILL.md · 13 lines

What it actually says

Refactor Green

  1. Load [[software-craft/refactoring-techniques]], [[software-craft/smell-catalogue]], [[software-craft/object-calisthenics]], [[software-craft/solid]], [[software-craft/design-patterns]] — the refactoring moves, smell taxonomy, quality criteria, and pattern catalog.
  2. Improve the source structure while tests stay green. The source .py is fluid; the .pyi is fixed; tests are fixed contracts — do not edit them.
  3. IF a smell is present THEN remove it using the catalogue and a matching technique per [[software-craft/smell-catalogue]], [[software-craft/refactoring-techniques]]. Apply SOLID, DRY, KISS, YAGNI, Object Calisthenics per [[software-craft/solid]], [[software-craft/object-calisthenics]].
  4. Keep the .py consistent with its sibling .pyi so stubtest stays clean. IF a change requires editing the .pyi THEN stop — a contract change is escalated at review.
  5. Read the target's .pyi first; touch the .py only where the stub omits needed detail. Loop until the structure is clean.
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. 2d ago First seen · 13 lines · 23 tokens per session scan A 596eb2d13667

Subscribe to this mod's changes

refactor-green is a skill published in the GitHub repository nullhack/temple8 (11 stars, last pushed 27d ago), licensed MIT. It adds 23 tokens to every session and 281 once invoked, about $0.0001 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.