Harness Kit

skill

refactor

Branch-aware simplification. On feature branches, compare against base and simplify the diff before merge. On primary branch, scan for the highest impact deletion, consolidation, or boundary improvement. Use when: "refactor this", "simplify this diff", "clean this up", "reduce complexity", "pay down tech debt", "make this easier to maintain", "make this more elegant", "reduce the number of states", "clarify naming". Trigger: /refactor.

/refactor

Source: skills/refactor/SKILL.md

What it does

Branch-aware simplification. On feature branches, compare against base and simplify the diff before merge. On primary branch, scan for the highest impact deletion, consolidation, or boundary improvement. Use when: "refactor this", "simplify this diff", "clean this up", "reduce complexity", "pay down tech debt", "make this easier to maintain", "make this more elegant", "reduce the number of states", "clarify naming". Trigger: /refactor.

Workflow role

Improve primitive in the Harness Kit operating loop.

Source contract preview

This generated excerpt gives readers the beginning of the live primitive contract before they jump to GitHub.

Reduce complexity without reducing correctness. Favor fewer states, clearer
names, stronger invariants, better tests, and current docs. Deletion first,
then consolidation, then abstraction, then mechanical cleanup.

## Delegation Floor

Delegation floor applies: probe the roster first; dispatch two or more
providers for substantive work; direct solo only for mechanical, emergency,
user-forbidden, or fewer-than-two-providers cases. See
`harnesses/shared/AGENTS.md` (Roster).

Local lane guidance: Use one lane to map complexity and another to challenge behavior-preservation risk; add a builder lane for the selected change.

## Completion Evidence

Completion evidence core applies: use `harnesses/shared/AGENTS.md`
(Completion Evidence) as the universal evidence shape, then fill the local
fields for behavior preservation, deletion/consolidation choice, and residual
risk.

## Deslop Pass

When invoked after implementation or review, run a behavior-preserving deslop
pass before broader refactoring. Remove:

- unnecessary AI-style comments and restatements of obvious code
- defensive checks or try/catch blocks that are abnormal for trusted internal
  paths
- casts, optionality, and fallback branches that paper over unclear invariants
- deeply nested code that can become early returns or a smaller model
- bespoke helpers or wrappers that duplicate canonical local utilities

Keep behavior unchanged unless fixing a clear bug. If cleanup would alter
behavior, stop and route the finding back through `/shape` or `/implement`.

## Branch-Aware Routing

Detect the current branch and primary branch first:
1. Current: `git rev-parse --abbrev-ref HEAD`
2. Primary: `git symbolic-ref --short refs/remotes/origin/HEAD | sed 's#^origin/##'`
   (fallback `main`, then `master`)

If current branch != primary branch: run **Feature Branch Mode**.
...

What to verify