factorize

factorize is a skill for Claude Code, Codex from Bidiche49/claude-conf. It costs 12 tokens per session (1,947 once invoked), scanned A, original, MIT.

A project-wide scan for duplicated code, repeated patterns, and places where shared code could replace repetition.

In plain words
What is it for?
Use it to inspect the whole project or a selected directory, either to report opportunities only or to plan and apply refactoring.
Why use it?
It helps reveal maintenance problems that may be missed when reviewing only recently changed files.

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/bidiche49/claude-conf/factorize
Any agent
npx skills add Bidiche49/claude-conf --skill factorize
Clone the repo
git clone --depth 1 https://github.com/Bidiche49/claude-conf

Made for: Claude Code, Codex.

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 factorize

README.md
[![agentmods](https://agentmods.dev/badge/skills/bidiche49/claude-conf/factorize.svg)](https://agentmods.dev/skills/bidiche49/claude-conf/factorize)
Your own site
<a href="https://agentmods.dev/skills/bidiche49/claude-conf/factorize"><img src="https://agentmods.dev/badge/skills/bidiche49/claude-conf/factorize.svg" alt="Measured on agentmods" height="20"></a>
Per session 12 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,947 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.00012 $0.01947
Opus 5 $0.00006 $0.00974
Sonnet 5 $0.00002 $0.00389
Haiku 4.5 $0.00001 $0.00195

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

Security

Grade A, and why

factorize 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.

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.

factorize/skills/factorize/SKILL.md · 208 lines

How it starts

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

Scan the codebase to detect duplicated code, repeated patterns, and factorization opportunities. Unlike /simplify (which refines recently changed code), this command performs a project-wide analysis.

Modes:

  • /factorize — full scan, all source files
  • /factorize src/services — scoped to a specific directory
  • /factorize --dry-run — report only, no code changes
  • /factorize --scope small — override auto-detected project size

Step 1 — Context

  1. Read CLAUDE.md to understand:

    • Stack (language, framework, conventions)
    • Project structure (where source lives, what's generated/vendored)
    • Naming conventions and existing abstractions
  2. Detect project size:

    • Count source files (exclude tests, config, generated, vendor, node_modules)
    • Small (< 30 files): 1 analysis agent
    • Medium (30-100 files): 2 agents (split by directory)
    • Large (> 100 files): 3 agents (split by layer/concern)
  3. Present the plan:

    FACTORIZE — [project name]
    Stack: [detected]
    Scope: [full / directory]
    Size: [X source files] → [small/medium/large]
    Agents: [1-3]
    Mode: [analysis + refactor / dry-run (report only)]
    
    Proceed? [Y/n]
    

Step 2 — Detection phase

Launch agents in parallel (subagent_type: feature-dev:code-explorer).

Each agent receives its assigned files and this mission:

You are analyzing [project name] ([stack]) for factorization opportunities.
Your assigned files: [list].

Scan for these patterns:

1. **DUPLICATED CODE** — identical or near-identical blocks (>5 lines) that appear in 2+ files.
   Report: both locations, the duplicated block, and a suggested shared function/module name.

2. **REPEATED PATTERNS** — same logical pattern implemented differently across files
   (e.g., 3 different ways to validate input, 4 similar API call wrappers).
   Report: all occurrences, the common pattern, and a suggested unified approach.

3. **MISSED ABSTRACTIONS** — operations that could benefit from a shared utility
   (e.g., repeated string transformations, common data reshaping, recurring error handling).
   Report: occurrences and suggested abstraction.

4. **COPY-PASTE DRIFT** — code that was clearly copied then modified slightly,
   creating divergence that will cause bugs (one copy gets fixed, others don't).
   Report: all copies, the differences, and which version is likely "correct".

For each finding, report:
- **Type**: DUPLICATION / PATTERN / ABSTRACTION / DRIFT
- **Impact**: HIGH (>3 occurrences or >20 lines each) / MEDIUM (2-3 occurrences) / LOW (minor)
- **Locations**: file:line for each occurrence
- **Code snippets**: the duplicated/similar blocks (abbreviated if >15 lines)
- **Suggestion**: concrete refactoring approach (function name, module location, signature)

Do NOT report:
- Similar test setup code (tests are allowed to be repetitive for readability)
- Framework boilerplate that cannot be abstracted (e.g., route definitions)
- Config files or generated code
- Differences that are intentional (check comments, commit messages)

Read the full file on GitHub · 208 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 · 208 lines · 12 tokens per session scan A 4093a50b03b9

Subscribe to this mod's changes

factorize is a skill published in the GitHub repository Bidiche49/claude-conf (2 stars, last pushed 4mo ago), licensed MIT. It adds 12 tokens to every session and 1,947 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-31.

Related

Other skills, from other repositories

hooks-eval

Evaluate hook security, performance, and SDK compliance. Use for audits.

athola/claude-night-market · 18 tokens

webmcp-setup

Bootstraps webmcp-react into an existing React or Next.js app. Installs dependencies, adds WebMCPProvider, creates a first tool, and configures the MCP client bridge. Use when the user wants to set up WebMCP, add MCP tools to their app, integrate webmcp-react, or make their React app accessible to AI agents.

agentcathq/webmcp-react · 80 tokens

goal

Run a large or unfamiliar goal through the full ballast pipeline — mobilize what you already hold, terrain scan, full skeleton, atomic foundation learning with verification, then build from bedrock to a verified done. Use when the user hands over a big goal, enters a new field, or asks to learn X in order to achieve Y.

svy04/ballast · 69 tokens

report

Read the delivery log and say which rules actually fire, which never have, and what to prune or fix. Use when the user asks whether ballast is doing anything, wants to clean up their rule catalog, or on a periodic review.

svy04/ballast · 49 tokens

engram

Claude Engram persistent memory — quick reference for all MCP tools and automatic hook behaviors. Use when you need to remember how to store, search, or manage memories, or query session history.

20alexl/claude-engram · 41 tokens

eval-harness

Assessment-driven development — Quantify code generation quality with pass@k / pass^k metrics, automatically scored by Grader.

majiayu000/vibeguard · 29 tokens