W Refactor

blockmatic/basilic-skills/skills/workflow/w-refactor

by blockmatic7e05e2abd052dc6b526e8a28e36d102d42bfd635No license1 starsListed Oct 9, 2026Updated Oct 9, 2026Repository updated 6 days ago

Refactor selected code while preserving behavior, then verify.

Instructions onlySoftware Development
AI-generated overview

Refactors selected code while preserving behavior, then verifies the change with existing checks.

What it does
This skill guides a behavior-preserving refactor of selected files or a named concern. It has the agent record a baseline of caller dependencies and proving checks, make the smallest useful structural diff, and only change algorithms or data structures with measured evidence. It then runs the affected checks from the baseline and restores behavior if they fail. It does not authorize commit, push, or pull requests.
When to use it
Use it when code needs structural improvement such as extracting duplication, clarifying names, or reducing nesting without changing behavior. It fits work where a baseline of tests, types, or a manual scenario can be captured first. It is not meant for committing, pushing, or opening pull requests.
Requirements
No scripts or special tooling are required; it is instructions only. It relies on the repository's existing tests, type checks, profiler, or traces to establish and verify a baseline.

Use the selected files or a named concern. Capture current behavior with tests, types, or a manual scenario before editing. Refactor does not authorize commit, push, or PR.

  1. Record a baseline: what callers depend on, which checks prove it, and what must not change.
  2. Improve structure in the smallest useful diff: extract duplication, clarify names, reduce nesting. Reuse existing packages. Do not add comments that restate the code.
  3. Change algorithms or data structures only with measured evidence from the repository's profiler, tests, or traces.
  4. Run the affected checks from the baseline. Restore behavior if they fail. Never the full pre-push suite.
  5. Docs: /w-docs if behavior or commands changed.

Source and attribution

Source:blockmatic/basilic-skillsinskills/workflow/w-refactorat commit7e05e2a

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal