refactor

refactor is a skill for Claude Code from GlamgarOnDiscord/claude-saas-blueprint. It costs 17 tokens per session (450 once invoked), scanned A, original, MIT.

A cautious workflow for changing code structure without changing what the software does. Refactoring includes tasks such as extracting functions, renaming code, reducing duplication, and replacing loose types with stricter ones.

In plain words
What is it for?
Use it to refactor files or modules, update imports, add missing tests before changes, and verify the project after each transformation.
Why use it?
Code changes that are meant to improve structure can accidentally break users or dependent modules. The workflow checks usage and tests first, then applies changes incrementally.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Good fit Use it to refactor files or modules, update imports, add missing tests before changes, and verify the project after each transformation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/glamgarondiscord/claude-saas-blueprint/refactor
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.

Any agent
npx skills add GlamgarOnDiscord/claude-saas-blueprint --skill refactor
Clone the repo
git clone --depth 1 https://github.com/GlamgarOnDiscord/claude-saas-blueprint

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 refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/glamgarondiscord/claude-saas-blueprint/refactor/github.svg)](https://agentmods.dev/skills/glamgarondiscord/claude-saas-blueprint/refactor)
Your own site
<a href="https://agentmods.dev/skills/glamgarondiscord/claude-saas-blueprint/refactor"><img src="https://agentmods.dev/badge/skills/glamgarondiscord/claude-saas-blueprint/refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/glamgarondiscord/claude-saas-blueprint/refactor"><img src="https://agentmods.dev/badge/skills/glamgarondiscord/claude-saas-blueprint/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 450 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00017 $0.00450
Opus 5 $0.00009 $0.00225
Sonnet 5 $0.00003 $0.00090
Haiku 4.5 $0.00002 $0.00045

Measured 11d ago against content hash 45abb5df57cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

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 11d 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.

.claude/skills/refactor/SKILL.md · 43 lines

What it actually says

Arguments

  • scope : Quoi refactorer (fichier, module, pattern)
  • goal : L'objectif du refactoring

Instructions

Phase 1 — Comprendre l'existant

  1. Lire le code à refactorer
  2. Lister TOUS les fichiers qui importent/utilisent le code concerné (Grep)
  3. Vérifier que les tests existent pour le code à refactorer
  4. Si pas de tests → en écrire AVANT de refactorer

Phase 2 — Planifier

Utiliser EnterPlanMode si blast radius > 3 fichiers.

Types de refactoring courants :

  • Extract : Sortir une fonction/composant d'un fichier trop long
  • Rename : Renommer pour clarifier (utiliser replace_all avec Grep)
  • Restructure : Déplacer des fichiers dans une meilleure organisation
  • Simplify : Réduire la complexité (dé-nester, éliminer les duplications)
  • Type-safe : Remplacer any par des types stricts
  • Pattern : Appliquer un design pattern (repository, factory, etc.)

Phase 3 — Exécuter

Règles strictes :

  1. Un changement à la fois — commit logique entre chaque transformation
  2. Tests verts entre chaque étape — si un test casse, rollback
  3. Pas de changement de comportement — le refactoring ne change que la forme
  4. Imports à jour — vérifier après chaque déplacement de fichier

Phase 4 — Valider

  1. tsc --noEmit — zero erreur
  2. Tous les tests passent
  3. Grep pour vérifier qu'aucun ancien import/nom n'est resté
  4. Review visuelle si UI impactée
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. 11d ago First seen · 43 lines · 17 tokens per session scan A 45abb5df57cf

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository GlamgarOnDiscord/claude-saas-blueprint (2 stars, last pushed 3mo ago), licensed MIT. It adds 17 tokens to every session and 450 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.