Perform a refactor pass focused on simplicity after recent changes. Use when the user asks for a refactor/cleanup pass, simplification, dead-code removal, or says "refactor pass".
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Perform a refactor pass focused on simplicity after recent changes. Use when the user asks for a refactor/cleanup pass, simplification, dead-code removal, or says "refactor pass".
Extract duplicated logic into custom hooks (src/hooks/) or shared components (src/components/)
Verify — run all three checks:
yarn build:verify && yarn lint && yarn typecheck
Optional suggestions — identify abstractions or reusable patterns only if they clearly improve clarity. Keep suggestions brief; don't refactor speculatively.
Project-Specific Patterns to Enforce
When refactoring, watch for these anti-patterns from AGENTS.md:
Anti-pattern
Refactor to
useState for shared state
Zustand store in src/stores/
useEffect for data fetching
plebbit-react-hooks (useComment, useFeed, etc.)
useEffect to sync derived state
Calculate during render
Copy-pasted logic across components
Custom hook in src/hooks/
Boolean flag soup (isLoading, isError, isSuccess)
State machine in Zustand
Prop drilling through many layers
Zustand store
Rules
Don't change behavior — refactors must be semantically equivalent
Don't introduce new dependencies
Format edited files with npx oxfmt <file> after changes
If the build/lint/type-check fails after refactoring, fix it before finishing