ECC is a toolkit that organizes and improves how coding agents work through skills, memory, security checks, research practices, and related extensions. It is for developers using agents such as Claude Code, Codex, OpenCode, and Cursor.
Borrowing it
Nothing to install: this file belongs to affaan-m/ECC. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/affaan-m/ECC/main/.github/prompts/refactor.prompt.mdgit clone --depth 1 https://github.com/affaan-m/ECCWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/affaan-m/ecc/refactor)<a href="https://agentmods.dev/commands/affaan-m/ecc/refactor"><img src="https://agentmods.dev/badge/commands/affaan-m/ecc/refactor/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/affaan-m/ecc/refactor"><img src="https://agentmods.dev/badge/commands/affaan-m/ecc/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00014 | $0.00413 |
| Opus 5 | $0.00007 | $0.00206 |
| Sonnet 5 | $0.00003 | $0.00083 |
| Haiku 4.5 | $0.00001 | $0.00041 |
Grade A, and why
refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Refactor & Cleanup
Improve the internal structure of the selected code without changing its observable behavior. All tests must pass before and after.
Before Starting
- Confirm the test suite is passing.
- Note the current coverage baseline.
- Identify the scope: single function, file, or module?
Refactoring Targets
Dead Code Removal
- Unused variables, imports, functions, and exports
- Commented-out code blocks (delete, don't leave as comments)
- Feature flags that are permanently enabled/disabled
- Unreachable branches
Duplication Reduction
- Repeated logic that can be extracted into a shared utility
- Copy-pasted blocks differing only in a parameter (extract with that parameter)
- Inline constants that appear in multiple places (extract to named constants)
Structure Improvements
- Functions over 50 lines → break into smaller, named steps
- Files over 800 lines → extract cohesive sub-modules
- Nesting deeper than 4 levels → extract early-return guards or helper functions
- Mixed concerns in one function → split into focused single-responsibility functions
Naming
- Rename variables/functions whose names don't match their behavior
- Replace magic numbers and strings with named constants
- Align naming with the domain language used elsewhere in the codebase
Constraints
- No behavior changes — refactoring is purely structural.
- One concern at a time — do not mix refactoring with feature work or bug fixes.
- Keep tests green — run the suite after each meaningful change.
- Don't add abstractions preemptively — extract only what has already proven to be duplicated (rule of three).
Output
After refactoring, summarize:
- What was removed (dead code, duplication)
- What was extracted (new utilities, constants)
- What was renamed and why
- Coverage before / after (should not decrease)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 51 lines · 14 tokens per session scan A 1fe05960dc20
refactor is a command published in the GitHub repository affaan-m/ECC (253,158 stars, last pushed today), licensed MIT. It adds 14 tokens to every session and 413 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-07.
Other commands, from other repositories
t00-playwright-test
A command for testing a locally running web app in a real browser with Playwright, a browser automation and testing tool. It checks normal user flows and selected edge cases, then reports results with screenshots.
code-permutation-tester
Test multiple code variations through simulation before implementation with quality gates and performance prediction.
boundary-heatmap
Generate a visual heatmap of knowledge boundaries showing safe zones, risk areas, and semantic coverage.
prepare-release
Command "prepare-release" from qdhenry/Claude-Command-Suite, covering prepare release command, instructions, emergency hotfix process, make minimal fix and fast-track testing and deployment.
test
Run the repository's actual test suite: every ecosystem's canonical runner — NOT run is never green.
tdd
Test-driven change — write the failing test first, then implement.