refactor-discipline

Constrains code edits to behavior-preserving refactors within a graphify-defined blast radius.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/NarenKarthikBM/specseyal --skill refactor-discipline-narenkarthikbm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-discipline
Source: https://github.com/NarenKarthikBM/specseyal/tree/main/specs/000-sample/.claude/skills/refactor-discipline
Command: npx skills add https://github.com/NarenKarthikBM/specseyal --skill refactor-discipline-narenkarthikbm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Refactoring tasks often drift: agents add new public APIs, widen the change scope, or tweak failing tests to force a pass. This Skill enforces strict discipline on behavior-preserving edits so a refactor changes structure without changing observable behavior. ## Core Features & Use Cases - No new public surface: Blocks new exported symbols, routes, tables, CLI flags, or config keys during a refactor. - Blast radius enforcement: Uses the graphify dependency graph to ensure every dependent file still compiles and passes tests. - Test integrity: Forbids modifying tests to make a change pass, treating failures as evidence of unpreserved behavior. - Use Case: When a SpecSeyal task is marked preserves_behavior, this Skill is injected automatically so the implementing agent renames, extracts, or reorganizes code and lands it in one commit stating what was preserved. ## Quick Start Apply the refactor-discipline rules to this behavior-preserving task and refactor the target module without adding any public surface.

Frequently Asked Questions about refactor-discipline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor code without changing its behavior?

Restrict edits to existing files, add no new exported symbols or routes, and preserve return values, error types, side effects, and ordering. Verify every dependent file still compiles and passes its existing tests before committing.

What is a blast radius in code refactoring?

A blast radius is the set of files that depend on the code being changed. This Skill computes it with graphify, a dependency graph of the codebase, and requires every file in that set to still compile and pass tests after the edit.

When is the refactor-discipline skill activated?

It is injected automatically when a SpecSeyal task has preserves_behavior set to true. It supplements the agent's base instructions rather than running as a standalone command.

Can I add a new function during a behavior-preserving refactor?

No new public surface is allowed: no exported symbols, routes, tables, CLI flags, or config keys. If the task seems to require one, it is not behavior-preserving and you should stop and flag it.

Why did my refactor fail tests and what should I do?

A failing test after a behavior-preserving edit means some observable behavior was not preserved. Fix the code to restore the original behavior; never modify the test to make the change pass.