decomposition

A guide for breaking an oversized source file into smaller files at meaningful boundaries, such as hooks, components, helpers, or types.

In plain words
What is it for?
It is for reorganising files that exceed a size limit, using an approved plan and checking that the extracted code still works.
Why use it?
It helps make a large file easier to understand and maintain without splitting it into arbitrary pieces or hiding the original problem.

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/vindm/dotclaude/decomposition
Any agent
npx skills add vindm/dotclaude --skill decomposition
Clone the repo
git clone --depth 1 https://github.com/vindm/dotclaude

Made for: Claude Code, Codex.

Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,291 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00080 $0.01291
Opus 5 $0.00040 $0.00646
Sonnet 5 $0.00016 $0.00258
Haiku 4.5 $0.00008 $0.00129

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

Security

Grade C, and why

decomposition scanned grade C with 1 finding 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 yesterday.

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.

Tells the agent never to refusehighAnti-refusal

Suppressing the ability to decline removes a core safety control; a later harmful request then succeeds.

The user invoked you because they thought work was needed; if it isn't, they need to know why — never refuse silently.
plugins/core/skills/decomposition/SKILL.md · 71 lines

How it starts

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

Decomposition

You decompose a bloated file. This task has a wrong way that looks right: extracting aggressively into eight micro-files (navigation gets worse, nothing is comprehensible in isolation), cutting on textual seams (a random split at line 500 instead of at a real boundary), hiding the file behind a barrel index.ts that re-exports a still-bloated internal module, or splitting a function across files purely to drain line count. The right way is below. The core doctrine: extract at cognitive boundaries, not textual ones. A large screen is not "the top half" + "the bottom half"; it is a few hooks, one or more sub-components, a handful of pure helpers, and maybe a types module — each of which has a natural file.

To decompose a file over the ceiling

Step 0 — Verify there is work to do, and that it's allowed

First confirm the file exists and is actually over the ceiling. If it's under, refuse — there's nothing to do. Then check for an exemption and refuse politely, saying why, if the file is:

  • Auto-generated — a *.gen.* file, a generated types file, or anything with an @generated / AUTOGENERATED header. Decomposition would just be undone on the next codegen.
  • A snapshot (a __snapshots__/ file) — snapshots are atomic by definition.
  • A test fixture of raw recorded data — it's tabular; line count is incidental.
  • A file where every extraction candidate is < 30 LOC — the result would be useless micro-files. The right action may be to consolidate, or to accept the file is fine.

The user invoked you because they thought work was needed; if it isn't, they need to know why — never refuse silently.

Step 1 — Read and classify

Read the whole file. Identify which extractable chunks it contains and note approximate LOC per chunk. Match against the project's own conventions, not a fixed dogma — discover them first by looking at how this codebase organizes itself when files stay healthy:

  • Pairs of a component file plus an adjacent use<Name> hook file → the project already uses hook extraction; follow that convention.
  • An operations/ or helpers/ directory under a domain → pure-helper extraction is established; use that exact path.
  • Sibling types.ts files → types get separated when they grow; replicate.
  • Sub-component directories (e.g. a components/ folder beside a screen) → the JSX-extraction convention.

Read the full file on GitHub · 71 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. yesterday First seen · 71 lines · 80 tokens per session scan C 7ec9d594c82e

Subscribe to this mod's changes

decomposition is a skill published in the GitHub repository vindm/dotclaude (1 stars, last pushed 5d ago), licensed MIT. It adds 80 tokens to every session and 1,291 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it C with 1 finding (tells the agent never to refuse). 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

claude-md-review

Audit a CLAUDE.md file for the patterns that actually degrade Claude Code's output — vagueness, unnamed files, stale facts, and bloat. Use when asked to review, audit, improve, shrink, or fix a CLAUDE.md, and when a project's results feel inconsistent or Claude keeps rediscovering the same context.

wesammustafa/Claude-Code-Everything-You-Need-to-Know · 69 tokens

code-reviewer

Automatic code quality and best practices analysis. Use proactively when files are modified, saved, or committed. Analyzes code style, patterns, potential bugs, and security basics. Triggers on file changes, git diff, code edits, quality mentions.

alirezarezvani/claude-code-tresor · 54 tokens

git-commit-helper

Generate conventional commit messages automatically. Use when user runs git commit, stages changes, or asks for commit message help. Analyzes git diff to create clear, descriptive conventional commit messages. Triggers on git commit, staged changes, commit message requests.

alirezarezvani/claude-code-tresor · 55 tokens

test-generator

Automatically suggest tests for new functions and components. Use when new code is written, functions added, or user mentions testing. Creates test scaffolding with Jest, Vitest, Pytest patterns. Triggers on new functions, components, test requests, testing mentions.

alirezarezvani/claude-code-tresor · 55 tokens

api-documenter

Auto-generate API documentation from code and comments. Use when API endpoints change, or user mentions API docs. Creates OpenAPI/Swagger specs from code. Triggers on API file changes, documentation requests, endpoint additions.

alirezarezvani/claude-code-tresor · 48 tokens

readme-updater

Keep README files current with project changes. Use when project structure changes, features added, or setup instructions modified. Suggests README updates based on code changes. Triggers on significant project changes, new features, dependency changes.

alirezarezvani/claude-code-tresor · 49 tokens