# Refactor

> Use for authorised, behaviour-preserving structural simplification backed by characterisation and equivalence evidence. Not for new behaviour, read-only review, or unknown root cause; use tdd, code-review, or diagnose.

- **Type:** Skill
- **Install:** `agentstack add skill-mblauberg-provenant-refactor`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [mblauberg](https://agentstack.voostack.com/s/mblauberg)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [mblauberg](https://github.com/mblauberg)
- **Source:** https://github.com/mblauberg/provenant/tree/main/skills/refactor

## Install

```sh
agentstack add skill-mblauberg-provenant-refactor
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Refactor

Execute a structural method inside an authorised `implement` run. This skill
inherits exact paths, non-goals and repair limits; it cannot widen scope, accept
the change, release it or turn nearby cleanup into work.

## Entry evidence

Before editing, record:

- the named cost/risk to remove and the observable behaviours that must not
  change;
- public API, schema, protocol, data, ordering, error and performance invariants;
- a green baseline plus characterisation, differential, replay, property or
  compatibility checks selected by risk;
- the dependency cone: callers, exports, registration/configuration, generated
  artifacts, persistence and mixed-version boundaries;
- canonical ownership, duplicate/parallel paths, rollback seam and a
  move/deletion manifest.

Use SOLID and related principles as probes, not success metrics: improve
cohesion and single ownership; preserve substitutability and caller contracts;
segregate interfaces only where clients carry unused coupling; invert volatile
dependencies only when the new seam hides real complexity. Prefer simple,
explicit state and information hiding over speculative abstraction, pattern
count, DRY-by-text or acronym compliance.

If the desired structure or behaviour is undecided, route to `scope`. If a
failure's cause is unknown, use `diagnose`. Changed behaviour is a separate TDD
slice, never hidden in the refactor.

## Method

1. Establish a seam while green. Do not start by deleting the old path.
2. Move one independently reviewable responsibility at a time. Preserve the
   public contract or use an approved compatibility adapter with an expiry.
3. Switch callers/registrations to one canonical owner and verify after each
   slice. Keep focused checks fast; run affected and full required gates at the
   enclosing tranche.
4. Delete only when caller, runtime, build, registry, reflection/dynamic-load,
   configuration and data evidence show the path is unreachable or replaced.
   Unknown, user-owned and unrelated files stay untouched.
5. Stop on behaviour drift, unexplained performance/resource change, scope
   expansion or an invariant the evidence cannot cover. Revert only exact
   run-owned hunks under authority and return to `scope`/`diagnose` as needed.

## Completion gate

Provide before/after ownership and dependency deltas, the classified
move/deletion manifest, exact verification results and residual risk. Pass only
when observable/API/schema/data contracts remain equivalent, the named
structural debt is measurably reduced, no unowned parallel path remains,
relevant performance/resource budgets hold, documentation is current and an
independent `code-review` finds no blocking regression. Lines deleted alone are
never proof.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [mblauberg](https://github.com/mblauberg)
- **Source:** [mblauberg/provenant](https://github.com/mblauberg/provenant)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-mblauberg-provenant-refactor
- Seller: https://agentstack.voostack.com/s/mblauberg
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
