refactor-loop
Autonomous /goal loop that refactors a project on every axis without changing its behavior. Start it only when the user names refactor-loop.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- refactor-loop
- description
- Autonomous /goal loop that refactors a project on every axis without changing its behavior. Start it only when the user names refactor-loop.
- argument-hint
- [focus] [branch=...] [limits]
- user-invocable
- true
02 资源文件 1
- 参考文档agents/openai.yaml289 B
03 SKILL.md 正文
Refactor loop
Improve this project on every axis: structure, data model, queries, performance, readability, tests, and docs. Behavior must stay identical: same outputs, side effects, contracts, and functional logs. Zero regressions. The only exception is a fix for a real bug. The arguments of the request can set a focus, a branch, or extra limits.
Invoking this skill approves the work below within the unattended-run limits.
Work on a new branch, refactor/loop-YYYY-MM-DD, unless the arguments name one. Read real data from dev or staging.
Keep every external contract: API schemas and fields, CLI output, event and file formats, shared database schemas, config names, and logs that alerts read. Internal names can change.
Fix real bugs and harmful side effects when the evidence proves them. Record each fix with before and after, and demonstrate the correction against the baseline. When you are not sure it is a bug, record the question with your recommendation and continue independent work.
Verification first
Before refactoring, agree with the user on the definition of done and a proven regression gate, as an autonomous run requires.
Start from what the project already has to check regressions. Use brainstorming and create-test for what is missing.
Work
Audit from first principles, and challenge the project's patterns and your own assumptions. Look first at queries and I/O in loops, heavy libraries where simpler or faster code does the job, missing typed models such as Pydantic, time, space, and cyclomatic complexity, blocking code that async would speed up, dead code, bad names, and wrong or noisy docs. Back every finding with evidence from the code, real data, logs, or measurements, and check library behavior in the official docs for the installed version.
Rank the backlog by impact. Use rethink to challenge the ranking and design choices.
Work in small, verifiable changes, preserving the reasons for non-obvious behavior and useful discoveries in the task records.
Report the result, bugs fixed, verification, and remaining questions against the agreed definition of done.
Done
The loop is done when, on its last commit:
- The gate exits 0, and its only differences from the baseline are the recorded bug fixes.
- The independent review of the whole branch has no open CRITICAL or HIGH finding.
- A final audit in a fresh context finds no new item of MEDIUM severity or higher, and no backlog item is open.
- Docs and task records are current, and
git statusis clean.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.