simplify-transform

simplify-transform is a command for Claude Code from axiomantic/spellbook. It costs 14 tokens per session (3,342 once invoked), scanned A, original, MIT.

A command that applies code simplifications after they have passed verification. It preserves behavior, asks for approval before committing, and checks the result again after editing.

In plain words
What is it for?
It helps turn approved complexity-reduction suggestions into code changes in automated, guided, or report-only modes.
Why use it?
It reduces the risk of changing what the software does while making its code easier to understand. Failed checks can cause the changes to be reverted.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md). Also seen: names the AskUserQuestion tool.

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 commands/axiomantic/spellbook/simplify-transform
Clone the repo
git clone --depth 1 https://github.com/axiomantic/spellbook

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 simplify-transform

README.md
[![agentmods](https://agentmods.dev/badge/commands/axiomantic/spellbook/simplify-transform.svg)](https://agentmods.dev/commands/axiomantic/spellbook/simplify-transform)
Your own site
<a href="https://agentmods.dev/commands/axiomantic/spellbook/simplify-transform"><img src="https://agentmods.dev/badge/commands/axiomantic/spellbook/simplify-transform.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,342 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.1 $0.00014 $0.03342
Opus 5 $0.00007 $0.01671
Sonnet 5 $0.00003 $0.00668
Haiku 4.5 $0.00001 $0.00334

Measured 2d ago against content hash 777e5712f843, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

simplify-transform 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.

commands/simplify-transform.md · 549 lines

How it starts

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

/simplify-transform

Runs after /simplify-verify. Applies changes in Automated, Wizard, or Report-Only mode.

Invariant Principles

  1. Behavior preservation is mandatory - Every transformation must pass verification; no changes without proof of equivalence
  2. Never commit without approval - All git operations require explicit user consent via AskUserQuestion
  3. Post-application verification - Re-verify after applying changes; revert on failure
  4. Atomic or batch commits - User chooses commit granularity; provide clear messages with complexity deltas

Step 5: Presentation

Present verified simplifications based on selected mode.

5.1 Generate Report

Create comprehensive simplification report:

# Simplification Analysis: <branch-name or scope>

**Scope:** <X functions in Y files>
**Base:** merge-base with <main|master|devel> @ <commit> (if changeset mode)
**Mode:** <Automated|Wizard|Report>
**Date:** <YYYY-MM-DD HH:MM:SS>

## Summary

| Metric | Before | After | Delta |
|--------|--------|-------|-------|
| Total Cognitive Complexity | <sum_before> | <sum_after> | <delta> (<percent>%) |
| Max Function Complexity | <max_before> | <max_after> | <delta> |
| Functions Above Threshold | <count_before> | <count_after> | <delta> |
| Functions Analyzed | <total> | - | - |
| Simplifications Proposed | <count> | - | - |

## Changes by File

### <file_path>

#### `<function_name>()` - Complexity: <before> -> <after>

**Patterns Applied:**
1. <Pattern name> (<category>)
2. <Pattern name> (<category>)

**Before:**
\`\`\`<language>
<original code with line numbers>
\`\`\`

**After:**
\`\`\`<language>
<transformed code with line numbers>
\`\`\`

**Verification:**
- [x] Syntax valid
- [x] Type check passed
- [x] <N> tests passed
- [x] Complexity reduced by <delta> (<percent>%)

---

## Skipped (No Coverage)

| Function | File | Complexity | Reason |
|----------|------|------------|--------|
| `<function>` | <file> | <score> | 0% test coverage |

Use `--allow-uncovered` to include these functions (higher risk).

## Skipped (Category Disabled)

| Function | File | Pattern | Flag |
|----------|------|---------|------|
| `<function>` | <file> | <pattern> | --no-<category> |

## Skipped (Verification Failed)

| Function | File | Reason |
|----------|------|--------|
| `<function>` | <file> | Parse error: <details> |
| `<function>` | <file> | Type error: <details> |
| `<function>` | <file> | Tests failed: <details> |

## Action Plan

### High Priority (>5 complexity reduction, tested)
- [ ] Apply <N> simplifications in <file>

### Medium Priority (2-5 complexity reduction, tested)
- [ ] Apply <N> simplifications in <file>

### Review Recommended
- [ ] Review <N> flagged dead code blocks
- [ ] Consider adding tests for <N> uncovered functions

Read the full file on GitHub · 549 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. 2d ago First seen · 549 lines · 14 tokens per session scan A 777e5712f843

Subscribe to this mod's changes

simplify-transform is a command published in the GitHub repository axiomantic/spellbook (10 stars, last pushed 2d ago), licensed MIT. It adds 14 tokens to every session and 3,342 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-09-03.