code-refactor-review
Fungsinya
Skill ini memandu AI untuk memeriksa apakah kode baru memakai ulang helper yang ada serta sesuai dengan pola dan penamaan proyek. Skill ini untuk pengembang yang meninjau pull request atau diff kode.
Kapan dipakai
- ✓Saat Anda ingin pull request atau diff kode ditinjau dari sisi penggunaan ulang dan konsistensi.
- ✓Saat Anda ingin memeriksa apakah kode baru menduplikasi sesuatu yang sudah ada di basis kode.
- ✓Saat Anda ingin tahu apakah perubahan sesuai dengan tata letak berkas dan penamaan proyek.
Link skill
https://github.com/trycompai/crm/blob/release/.agents/skills/code-refactor-review/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Bisakah Anda meninjau diff saya dan memberi tahu apakah kode ini menduplikasi helper yang ada atau tidak sesuai dengan pola kami?”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
AI membaca seluruh perubahan, menelusuri bagaimana fitur tersambung, dan mencari di basis kode sebelum menilai helper atau komponen baru.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Code Refactor Review
Review code changes deeply for reuse, composition, codebase consistency, and anything that reads like slop.
First Pass
- Inspect the full diff:
- Use
git difffor unstaged changes. - Use
git diff HEADif there are staged changes. - For a PR URL, inspect the changed files and understand the feature flow before reviewing details.
- Use
- Build the call stack / data flow when useful. Do not review isolated lines without understanding how the feature is wired.
- Search the codebase before judging new helpers, components, hooks, or patterns. Prefer nearby and sibling patterns over invented abstractions.
Review Lenses
1. Reuse Existing Code
- Look for existing utilities, components, hooks, server actions, route patterns, copy patterns, and styling primitives before accepting newly written code.
- Flag duplicated logic, copied helpers, or custom implementations of things the codebase already has.
- Prefer reusing the existing flow even if it needs a small extension.
- If the new code creates a shared helper, verify it has real reuse and is not just extracted private logic with a vague name.
2. Codebase Consistency
- File placement should match the domain and neighboring features. Be suspicious of random top-level
libdumps. - Naming should match what the code actually does and follow sibling file/function names.
- Avoid implementation details in names unless they are the actual product/API distinction.
- Use existing result/error/loading patterns. Do not invent bespoke success/failure types when the codebase has a standard one.
- Match existing copy and tone for user-facing text.
3. Composition and Boundaries
- Functions should do one thing at the right level of abstraction.
- Avoid grab-bag modules that mix unrelated concerns like flags, API calls, transformation, UI state, logging, and scheduling.
- Avoid parameter sprawl. If a function needs many knobs, check whether the boundary is wrong.
- Prefer simple composition over chains of callbacks, wrappers, memoized helpers, and prop plumbing.
- When two backing entities are presented as one product concept, package them into one transport/view model across intermediate components. Black-box components should receive one unified prop/callback and should not care about distinctions like remote vs prebuilt; split back into core entities only at roots/adapters where persistence or payload formats require it.
- Keep domain-specific logic close to its domain unless there is proven cross-domain reuse.
4. Slop Detection
Flag and, when asked, remove:
- Comment slop: obvious comments, comments defending awkward code, long comments that should become clearer code, stale context in PR descriptions.
- Helper slop: tiny wrappers that add no meaning, helper files created only to make one function look shorter, unnecessary indirection.
- Type slop: exported one-off types, custom result shapes, annotations where inference is clearer, types that only paper over awkward code.
- Memo/callback slop:
useMemo/useCallbackadded without a measured or structural reason. - Effect slop: effects that mirror props/state, reset derived state, or handle events after the fact.
- Compatibility cruft: bolted-on behavior that preserves accidental architecture instead of building the coherent end state.
- Diff churn: unrelated renames, formatting, comments, or wrappers that make the PR larger without improving the design.
5. React / Next.js Quality
- Apply “You Might Not Need an Effect”: derive values during render, move event-caused work into event handlers, and reset state with keys when appropriate.
- Avoid redundant state and synchronization effects.
- Do not add memoization just to quiet performance anxiety. Memoization should solve a real render identity or expensive computation issue.
- Prefer straightforward component boundaries over prop/callback gymnastics.
- For server/data code, avoid unnecessary waterfalls and run independent work concurrently when the codebase has a pattern for it.
6. Minimality
- Prefer deleting code over adding new structure.
- Prefer one clear function over several helper-y fragments unless extraction improves reuse or readability.
- Keep the fix proportional to the problem.
- Do not add architecture, docs, or comments unless they remove ambiguity for future readers.
Output Format
Start with a verdict:
clean— no meaningful concerns.mostly clean— m
Pertanyaan umum
Apa yang menjadi fokusnya?
Skill ini berfokus pada penggunaan ulang, komposisi, konsistensi, dan kebersihan kode.
Apakah perlu tautan pull request?
Tidak. Skill ini bisa meninjau diff saat ini, atau pull request jika Anda memberikan tautannya.
Apakah skill ini menilai kode secara terpisah?
Tidak. Skill ini meminta AI memahami alur fitur sebelum meninjau detailnya.
Detail
Deskripsi asli dari pembuat
Reviews code changes for reuse, composition, codebase consistency, and slop. Use when asked to review PRs/diffs, check code reuse, composition, cleanliness, or whether code fits the codebase.
repo: trycompai/crm
Popularitas
- Bintang GitHub
- 12k
- Peringkat
- #11516
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- …
Skill lain dari repositori ini
ai-elements
12kMembantu agent Anda membangun antarmuka chat AI dengan komponen siap pakai untuk percakapan, pesan, tampilan alat, dan input prompt.
ai-sdk
12kMembantu agent Anda membangun fitur AI dengan Vercel AI SDK, termasuk pembuatan teks, streaming, pemanggilan alat, dan agent.
better-accessibility
12kMembantu agent Anda membuat antarmuka dapat digunakan dengan keyboard dan pembaca layar, mencakup fokus, label, ARIA, dan formulir.
better-auth-best-practices
12kMembantu agent Anda menyiapkan Better Auth untuk login, sesi, OAuth, dan plugin di aplikasi TypeScript, dengan mengikuti langkah yang didokumentasikan.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.