Langsung ke konten
Skillpedia
Pemrograman umum12k · #11523

pit-of-success

Fungsinya

Skill ini memandu AI untuk menemukan pemanggilan API, setter, dan prop yang bisa disalahgunakan, lalu memindahkan perilaku yang diperlukan ke dalam kode bersama. Skill ini untuk pengembang yang meninjau atau merapikan kode.

Kapan dipakai

  • ✓Saat sebuah API, setter, atau prop komponen memiliki jebakan yang bisa terjerumus oleh pemanggilan yang wajar.
  • ✓Saat Anda merapikan kode agar jalur yang aman menjadi jalur default.
  • ✓Saat Anda ingin helper atau wrapper yang duplikat diganti dengan satu implementasi bersama.

Link skill

https://github.com/trycompai/crm/blob/release/.agents/skills/pit-of-success/SKILL.md

Salin 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

Gunakan skill ini untuk membantu saya: https://github.com/trycompai/crm/blob/release/.agents/skills/pit-of-success/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Setter ini rusak saat seseorang memasukkan null. Bisakah Anda mengubah kodenya agar pemanggilan normal selalu berhasil?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

AI menemukan setiap pemanggil dari titik masuk publik, memeriksa apakah pemanggilan yang jelas merusak perilaku, lalu memindahkan aturannya ke kode bersama.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Pit of Success

Make misuse hard and the obvious call correct.

Steps

  1. Find the public seam being used: exported function, hook return value, setter, component prop, route body, schema, or command. Then search every caller of that seam. Done when you know the natural call a future maintainer would write.
  2. Run the footgun test: “If someone does the obvious thing without knowing the hidden helper or convention, does behavior break?” Examples: setSelection(null) should mean the product’s normal clear behavior; a schema should reject states the UI never wants; a prop should not require sibling props in the right combo.
  3. Move the invariant into the seam. Prefer, in order:
    • make the existing API do the safe thing,
    • narrow the type/schema so bad states cannot be represented,
    • rename/split the API so the dangerous path is explicit,
    • only then add a helper, and only if all natural callers use it.
  4. Delete bypasses and duplicate meanings. Replace local wrappers, parallel helper names, and comments that explain the trap with one shared implementation at the seam.
  5. Prove the pit with one check: a focused test or type/schema assertion showing the obvious call now preserves behavior, plus a grep confirming no caller still uses the old footgun.

Rules

  • Do not fix only the named callsite. If the seam is wrong, fix the seam.
  • Do not rely on “remember to call this helper first” when callers can still call the raw API.
  • Do not add comments as a substitute for making misuse impossible or obvious.
  • Keep the diff boring: one invariant, one owner, no speculative abstraction.
  • If compatibility prevents changing the seam, name the dangerous API accordingly and expose a safe default API beside it.
Pertanyaan umum

Apakah hanya memperbaiki satu titik pemanggilan?

Tidak. Jika API itu sendiri salah, skill ini menyarankan untuk memperbaiki titik sambung bersama, bukan satu pemanggil saja.

Urutan perbaikan apa yang diutamakan?

Skill ini lebih dulu membuat API yang ada menjadi aman, lalu mempersempit tipe, lalu memisahkan API, dan menambahkan helper paling akhir.

Bagaimana skill ini membuktikan perbaikannya?

Skill ini memakai tes fokus atau pemeriksaan tipe untuk menunjukkan bahwa pemanggilan yang jelas kini berhasil, ditambah pencarian untuk memastikan tidak ada pemanggil lama yang tersisa.

Detail

Deskripsi asli dari pembuat

Review or refactor code so the correct behavior is the default path; use when APIs, setters, hooks, helpers, or component props have footguns where a natural call bypasses required semantics.

repo: trycompai/crm

Popularitas

Bintang GitHub
12k
Peringkat
#11523
Lisensi
MIT
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa