Audits and refactors App Router pages and colocated UI for repo rules, @ui usage, and Slashie design. Use when the user runs /refactor-page, asks to bring a page up to standards, align with new rules or DESIGN, or modernize route files under src/app.
Install
npx skillscat add slashieapp/web/page-refactor-audit Install via the SkillsCat registry.
SKILL.md
Page refactor audit
When this applies
- User targets one or more files under
src/app/**(especiallypage.tsx, layouts, or colocatedcomponents/). - Goal: standards compliance, design-system alignment, and rule parity—not a full product redesign unless asked.
Before editing
- Read docs/coding-guidebook.md for layers,
page.tsxcontract, and lifecycle. - Read the full file(s) to change and immediate imports; match existing naming and patterns in that folder.
- For visual or UX work, read and follow .cursor/skills/slashie-design/SKILL.md.
- Skim AGENTS.md for product language (task, quote, worker, map-first discovery).
Audit checklist (fix gaps by refactoring)
Layers (@ui / shell / feature)
- Prefer
@uiprimitives:Button,FormField,Input,IconButton,Badge,Card,Avatar,Footer,Logo, etc. (seesrc/ui/index.ts). - App chrome:
Header/Dockfrom@/ui/Header/@/ui/Dock(or@ui) — not a separatesrc/componentstree. - Layout composition may use
@chakra-ui/react(Box,Stack,Grid, …). - Navigation:
@uiLinkwith bare paths (href="/tasks") — Link localizes; do not wrap withuseLocalizedHref(.cursor/rules/chakra-next-link.mdc). - Copy: colocated
i11n.json+useI11n(bag)(.cursor/rules/i11n-colocation.mdc). - Layer boundaries:
.cursor/rules/ui-layer-boundaries.mdc.
Repo rules (always-applied)
- Effects: do not add
useEffectfor new behavior; prefer handlers, callbacks, and callback refs (.cursor/rules/no-useeffect-callback-ref.mdc). - GraphQL: colocate
.gqlbeside the owningpage.tsx; runbun run codegenwhen ops change (.cursor/rules/graphql-route-colocation.mdc,graphql-codegen.mdc). - Structure:
page.tsxowns the screen (content + orchestration); noPageContentpass-through — sections in colocatedcomponents/with concern subfolders when files cluster; client pages putgenerateMetadatain colocatedlayout.tsx(.cursor/rules/repo-structure-and-exports.mdc,app-route-page-data-flow.mdc). - Barrels: after moves under
EXPORT_CONFIGS, runbun run exports-gen.
Quality bar
- Scope: only change what’s needed for compliance and the requested page(s); no drive-by refactors elsewhere.
- Theming: interactive states and text meet WCAG AA in light and dark (contrast, focus visibility).
- Verification: run
bun run linton the touched area; fix any new diagnostics. Runbunx tsc --noEmitif types or imports shifted materially.
Refactor workflow
- List concrete violations (e.g. raw
<a>, ChakraButtonwhere@uiButtonis standard, missingNextLinkpattern, copy off-product, pass-through*PageLayoutthat should live inpage.tsx). - Apply fixes in small, readable steps; preserve behavior and public URLs.
- If a rule conflicts with an explicit user instruction, follow the user and note the tradeoff briefly.
Out of scope unless requested
- Backend or schema changes, new GraphQL operations for unrelated features, or repo-wide renames.
- Editing
codegen.tsor committing.codegen/output.