Borrowing it
Nothing to install: this file belongs to eddiesanjuan/markupr. 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/eddiesanjuan/markupr/main/.claude/commands/refactor.mdgit clone --depth 1 https://github.com/eddiesanjuan/markuprWrote 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/eddiesanjuan/markupr/refactor)<a href="https://agentmods.dev/commands/eddiesanjuan/markupr/refactor"><img src="https://agentmods.dev/badge/commands/eddiesanjuan/markupr/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/eddiesanjuan/markupr/refactor"><img src="https://agentmods.dev/badge/commands/eddiesanjuan/markupr/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.00000 | $0.01098 |
| Opus 5.5 | $0.00000 | $0.00439 |
| Sonnet 5.5 | $0.00000 | $0.00220 |
| Haiku 4.5 | $0.00000 | $0.00110 |
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 1mo ago.
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.
How it starts
The opening of the file, as written. The whole thing — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor -- Safe Refactoring with Test Guard Rails
Perform incremental, test-guarded refactoring of a specified area of the markupr codebase. Every change is validated by re-running the test suite to ensure nothing breaks.
Target area: $ARGUMENTS
If no argument is provided, ask the user what area to refactor. Examples:
- A specific file:
src/main/SessionController.ts - A module:
src/main/pipeline/ - A pattern:
error handling,IPC layer,AI pipeline
Instructions
1. Establish Baseline -- Run Tests First
cd ~/Projects/markupr && npm test -- --run 2>&1
Record the baseline: total tests, passed, failed. If any tests are ALREADY failing, report them and ask the user whether to proceed (refactoring on a red test suite is risky).
2. Read and Analyze the Target Code
Read the target file(s) thoroughly. Identify refactoring opportunities specific to markupr's Electron + React + TypeScript stack:
Electron Main Process (src/main/)
- SessionController FSM: overly complex state transitions, duplicated guard clauses
- IPC handlers in
src/main/ipc/: handlers doing too much work (should delegate to services) - CrashRecovery: deeply nested try/catch, unclear recovery paths
- Pipeline steps: tight coupling between PostProcessor, TranscriptAnalyzer, FrameExtractor
- Settings: redundant validation that Zod should handle
React Renderer (src/renderer/)
- Components over 200 lines that should be split (especially
App.tsx,SettingsPanel.tsx,SessionReview.tsx) - Props drilling that should use React context or composition
useEffectcleanup functions missing for event subscriptions viawindow.markupr.*- Inline styles or magic numbers that should be Tailwind utilities or constants
- State that lives in components but should be lifted or extracted to hooks
Shared / Cross-cutting
- Type definitions in
src/shared/types.tsthat have grown too large (split by domain) - Duplicated type definitions between main and renderer
- String-based IPC channel names that could benefit from a type-safe wrapper
- Error handling patterns that swallow errors silently
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.
- 1mo ago First seen · 129 lines · 0 tokens per session scan A 93efd11ef953
refactor is a command published in the GitHub repository eddiesanjuan/markupr (18 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,098 tokens. 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-08-30.
Other commands, from other repositories
voxpip
Watch any video and get a transcript — even without an API key. Extends /watch with a local speech-to-text fallback.
e2e-testing
:::info The Playwright suite launches the real Electron main process and built React UI on Windows and macOS. It exercises the preload bridge, IPC handlers, and file storage. See Testing Commands for the separate Vitest suite. ::.
pre-ship
Run the pre-ship quality gate checklist before publishing your agent.
gen-install
Generate install script and README instructions for your agent or automation.
watch
Watch a video (URL or local path). Downloads with yt-dlp, extracts frames with ffmpeg, transcribes from captions or local Whisper (no API key), and answers questions about what's in the video.
checklist
Generate a custom checklist for the current feature based on user requirements.