بنقرة واحدة
refactor
Use when improving existing code structure without changing behavior, after tests are green
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when improving existing code structure without changing behavior, after tests are green
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when reviewing a spec or task graph for completeness before implementation
Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, logging in, or automating browser actions
Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, logging in, or automating browser actions
Use when decomposing a spec, design, or feature description into a task dependency graph with self-evaluating acceptance criteria
Use when doing creative product, feature, component, functionality, or behavior design work
Use when infrastructure or features are built but before declaring done -- verifies work is wired into the system and actively used
| name | refactor |
| description | Use when improving existing code structure without changing behavior, after tests are green |
Safe refactoring with a green test baseline. No behavior changes — only structural improvements.
NO REFACTORING WITHOUT GREEN TESTS FIRST
If tests aren't passing before you start, you can't distinguish refactoring breakage from pre-existing issues.
# Go
go test ./...
# Python
uv run pytest
All tests must pass before any changes.
Identify:
Each change should be:
For each step:
After all steps:
When refactoring, prefer these transformations:
| From | To |
|---|---|
| Mutable state | Immutable values |
| Side effects in logic | Pure core, impure edges |
| Imperative loops | map/filter/reduce |
| Class with methods | Functions + data |
| Shared mutable state | Passed parameters |
| Excuse | Reality |
|---|---|
| "Tests are mostly passing" | Mostly ≠ all. Fix first. |
| "This small change can't break anything" | Run tests. Trust evidence, not intuition. |
| "I'll add the feature while refactoring" | Separate concerns. Refactor then feature. |
| "Testing each step is slow" | Slower than debugging a broken refactor. |