simplify
Fungsinya
Skill ini membuat kode yang sudah berfungsi menjadi lebih jelas dan sederhana tanpa mengubah perilakunya. Skill ini ditujukan untuk developer yang ingin kodenya lebih mudah dibaca dan diubah oleh orang lain.
Kapan dipakai
- ✓Saat sebuah fitur sudah berfungsi dan pengujiannya lolos, tetapi kodenya terasa lebih rumit dari yang dibutuhkan.
- ✓Saat sebuah fungsi panjang, bersarang dalam, atau memiliki nama yang tidak jelas.
- ✓Saat tinjauan kode menandai masalah keterbacaan atau kerumitan.
Link skill
https://github.com/alvinunreal/oh-my-opencode-slim/blob/master/src/skills/simplify/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
“Fungsi ini sudah berjalan, tetapi sulit diikuti. Sederhanakan tanpa mengubah apa yang dilakukannya.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill ini memastikan perilakunya dipahami, lalu membuat perubahan yang menjaga input, output, dan penanganan galat tetap sama. Kode yang sudah jelas dilewati.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Code Simplification
Overview
Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines - it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"
When to Use
- After a feature is working and tests pass, but the implementation feels heavier than it needs to be
- During code review when readability or complexity issues are flagged
- When you encounter deeply nested logic, long functions, or unclear names
- When refactoring code written under time pressure
- When consolidating related logic scattered across files
- After merging changes that introduced duplication or inconsistency
When NOT to use:
- Code is already clean and readable - don't simplify for the sake of it
- You don't understand what the code does yet - comprehend before you simplify
- The code is performance-critical and the "simpler" version would be measurably slower
- You're about to rewrite the module entirely - simplifying throwaway code wastes effort
The Five Principles
1. Preserve Behavior Exactly
Don't change what the code does - only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
Before every change, ask:
- Does this produce the same output for every input?
- Does this maintain the same error behavior?
- Does this preserve the same side effects and ordering?
- What proportionate final-state verification will reveal a behavior change?
2. Follow Project Conventions
Simplification means making code more consistent with the codebase, not imposing external preferences.
Before simplifying:
- Read
AGENTS.md/ project conventions - Study how neighboring code handles similar patterns
- Match the project's style for imports, naming, function style, error handling, and type annotations
Simplification that breaks project consistency is not simplification - it's churn.
3. Prefer Clarity Over Cleverness
Explicit code is better than compact code when the compact version requires a mental pause to parse.
- Replace nested ternaries with readable control flow
- Replace dense inline transforms with named intermediate steps when they clarify intent
- Keep helpful names even if they cost a few extra lines
4. Maintain Balance
Watch for over-simplification:
- Don't inline away names that carry meaning
- Don't merge unrelated logic into one larger function
- Don't remove abstractions that serve testability or extensibility
- Don't optimize for line count over comprehension
5. Scope to What Changed
Default to simplifying recently modified code. Avoid unrelated drive-by refactors unless explicitly asked.
Process
Step 1: Understand Before Touching
Before changing or removing anything, understand why it exists.
Answer:
- What is this code's responsibility?
- What calls it? What does it call?
- What are the edge cases and error paths?
- Are there tests that define expected behavior?
- Why might it have been written this way?
If you can't answer these, read more context first.
Step 2: Look for Simplification Opportunities
Signals:
- Deep nesting
- Long functions with mixed responsibilities
- Nested ternaries
- Boolean flag arguments
- Repeated conditionals
- Generic or misleading names
- Duplicated logic
- Dead code
- Wrappers or abstractions that add no value
Step 3: Apply Changes Incrementally
Make one simplification at a time.
For each simplification:
- Make the change
- Use the proportionate final-state verification plan to check preservation
- Keep it only when the evidence supports preservation
Separate refactoring from feature work whenever possible.
Step 4: Verify the Result
After simplifying, confirm:
- The code is genuinely easier to understand
- The diff is clean and reviewable
- Project conventions still match
- No behavior, error handling, or side effects changed
Guidance for This Repository
- Prefer straightforward TypeScript over clever compression
- Preserve existing runtime behavior, tests, and hooks
- Favor explicit names and smaller focused helpers when they improve readability
- Keep refactors tightly scoped to the task or review feedback
Final-state verification
Use a proportionate final-state verification plan for the final diff. Run checks required by r
Pertanyaan umum
Apakah skill akan mengubah cara kode berperilaku?
Skill menyatakan perilaku harus tetap persis sama, sehingga ia menghindari perubahan apa pun yang tidak yakin aman.
Apakah tujuannya mengurangi jumlah baris?
Tidak. Tujuannya adalah kode yang lebih mudah dibaca, dipahami, dan diubah.
Kapan sebaiknya saya melewatkannya?
Ketika kode sudah bersih, atau ketika kodenya sensitif terhadap kinerja dan versi yang lebih sederhana terbukti lebih lambat.
Detail
Deskripsi asli dari pembuat
Simplifies code for clarity without changing behavior. Use for readability, maintainability, and complexity reduction after behavior is understood.
Popularitas
- Bintang GitHub
- 10k
- Peringkat
- #12017
- Lisensi
- MIT
- Diperbarui
- 2/11/2026
Komentar
- …
Skill lain dari repositori ini
cli-review
10kMembantu agent Anda menjalankan tinjauan kode Greptile pada cabang lokal Anda sebelum Anda membuka pull request, lalu merangkum temuannya dengan bahasa yang sederhana.
ai-estimates
10kMembantu agent Anda memperkirakan berapa lama sebuah pekerjaan selesai ketika seseorang bekerja dengan AI, dengan memisahkan pekerjaan AI yang cepat dari penundaan manusia dan pihak luar.
clonedeps
10kMembantu agent Anda menyalin kode sumber dependensi utama proyek ke dalam folder lokal, sehingga agent dapat membaca cara kerja pustaka tersebut dari dalam.
codemap
10kMembuat peta terstruktur dari proyek kode yang belum Anda kenal, sehingga agent Anda dapat menemukan bagian-bagian utamanya dengan cepat. Paling baik dipakai saat Anda memintanya.
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.