AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Agentic Refactor

skill-jpbaking-agentic-tests-agentic-refactor · by jpbaking

Refactor or optimize main code while the agent-test suite (and user tests) must stay green after every change. The inverse of agentic-unit-test — main code may change, tests may not. Use when asked to refactor, optimize, or clean up code that agent tests already lock down.

No reviews yet
0 installs
41 views
0.0% view→install

Install

$ agentstack add skill-jpbaking-agentic-tests-agentic-refactor

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-jpbaking-agentic-tests-agentic-refactor)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Agentic Refactor? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Agentic Refactor

The mirror image of agentic-unit-test: there, tests change and code is frozen; here, code changes and tests are frozen. The agent tests are the definition of correct behavior.

3 RULES

  1. NEVER edit any test — not agent tests, not user tests, not to "fix" a failure. A failing test means YOUR change is wrong.
  2. Behavior must not change. Refactor = same observable behavior, better internals. If a desired change WOULD alter behavior, STOP and tell the user to use the agentic-test-update skill after deciding intentionally.
  3. Work in small steps; every step ends with a fully green suite and a checkpoint commit.

Step 1 — Ask the user

  1. "What should be refactored/optimized (files + goal: readability, performance, structure, ...)?"
  2. "Is current agent-test coverage of those files enough to refactor safely?" — run the agent-tests-only coverage command (recipes: ../agentic-unit-test/docs/coverage-recipes.md) and show the per-file numbers for the target files. If any target file is poorly covered, recommend using the agentic-unit-test skill on that file first and let the user decide.

Step 2 — Preconditions (STOP if any fails)

  1. All agent tests AND all user tests pass before touching anything.
  2. Git repo, clean tree (git status --porcelain empty apart from plan files). Refactoring without git checkpoints is not allowed — STOP and say why.

Step 3 — Plan

Write agentic-refactor-plan.md at the repo root (resume it if present — continue from the first non-done entry after re-running the suite):

# Agentic refactor plan
Goal: 

- [ ] step 1:  — pending
- [ ] step 2: ...

Statuses: pending | in-progress | done | REVERTED (3 attempts): . Update after every step.

Step 4 — Refactor loop (per plan step)

  1. Mark in-progress. Make ONE small change.
  2. Build + run the FULL test suite (agent + user tests).
  3. All green?
  • Yes → lint changed files, fix lint in main code (allowed here), commit: git commit -am "refactor: [agentic-refactor]". Mark done.
  • No → fix the CODE (never a test). 3 attempts. After the 3rd: git checkout -- . back to the last checkpoint, mark REVERTED (3 attempts): , move on.
  1. Performance goal? Measure before/after (the suite's runtime is not a benchmark — use the project's benchmark or a quick timed script in the scratchpad) and record numbers in the plan entry.

Step 5 — Report

  • Goal: restated, achieved or not.
  • Steps: done vs reverted (with reasons).
  • Verification: final full-suite run result (must be all green).
  • Measurements: before/after numbers if performance was the goal.
  • Commits made, in order.

Source & license

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

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

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.