tdd
Fungsinya
Skill ini memandu perbaikan bug yang dimulai dengan tes regresi yang terfokus. Cocok untuk pengembang yang menginginkan bukti bahwa bug sudah diperbaiki dan tidak akan kembali.
Kapan dipakai
- ✓Saat Anda meminta pengembangan berbasis tes atau tes regresi.
- ✓Saat sebuah bug memiliki tes sederhana dan murah yang bisa menunjukkan perilaku yang rusak.
- ✓Saat Anda menginginkan perbaikan yang dibuktikan oleh tes agar tidak kembali.
Link skill
https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/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
“Perbaiki bug login, tetapi tulis tes yang gagal dulu agar kita tahu bug itu benar-benar sudah diperbaiki.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent mendeskripsikan bug, menulis tes kecil yang seharusnya gagal, menjalankannya untuk memastikan kegagalan itu, lalu membuat perubahan kode paling kecil yang membuatnya lulus. Jika tes murah tidak praktis, ia memakai pemeriksaan lain yang paling dekat dan berguna.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
TDD Bug Fix
When fixing a bug with a clear, cheap test path, make the broken behavior executable before changing production code. The goal is a focused regression test that fails before the fix and passes after it.
Do not force a test when it would be impractical. If the available test would require broad harness setup, brittle mocks, slow end-to-end infrastructure, production-only state, vague reproduction steps, or large unrelated fixture churn, skip adding a new test and use the closest useful verification instead.
Workflow
- Understand the bug. Identify the intended behavior, current behavior, affected path, and smallest observable reproduction.
- Choose the narrowest executable check. Prefer the closest unit, component, integration, or regression test already used for that codepath. If no practical test path is obvious, do not create one from scratch just to satisfy the workflow.
- Write the failing test first. Add the smallest focused test that would have caught the bug. The test should encode intended behavior, not mirror the current implementation.
- Run the new test before fixing. Confirm it fails for the intended reason. If it passes or fails for an unrelated reason, correct the test or reproduction before editing the implementation.
- Fix the bug. Make the smallest production change that satisfies the intended behavior while preserving nearby contracts.
- Rerun the regression test. Confirm the test now passes.
If a Failing Test Is Impractical
Use the closest executable regression check instead: a targeted script, manual reproduction command, browser automation, snapshot comparison, log assertion, or focused integration check.
Prefer no new test over a bad test. A bad test is one that mostly tests mocks, encodes current implementation details, depends on timing or unrelated global state, needs expensive infrastructure for a small fix, or would be deleted immediately after proving the fix.
Guardrails
- Do not change tests merely to match a wrong implementation.
- Do not weaken existing assertions unless the expected behavior has genuinely changed and the reason is clear.
- Keep the regression test focused on the bug. Avoid broad fixture churn or unrelated coverage expansion.
- If the bug is flaky, make the test deterministic where possible and document the signal being locked down.
- If the bug exposes a broader class of failures, first land the focused regression path, then consider additional sibling coverage.
Final Response
Report the evidence, not just the outcome:
- Name the failing-before test or executable check and the failure it produced.
- Name the passing-after test run and any nearby validation performed.
- If failing-before evidence could not be demonstrated, state why and describe the closest regression check used instead.
Pertanyaan umum
Bagaimana jika tidak ada tes yang praktis?
Skill ini tidak memaksakannya. Ia memakai pemeriksaan terdekat yang berguna sebagai gantinya.
Apakah tes harus gagal dulu?
Ya. Tes baru dijalankan sebelum perbaikan untuk memastikan ia gagal karena alasan yang tepat.
Mengapa menulis tes sebelum perbaikan?
Itu menunjukkan bahwa bug memang ada lebih dulu, dan kemudian menunjukkan kapan bug itu sudah diperbaiki.
Detail
Deskripsi asli dari pembuat
Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested.
repo: cursor/plugins
Popularitas
- Bintang GitHub
- 15k
- Peringkat
- #10999
- Lisensi
- —
- Diperbarui
- 31/10/2026
Komentar
- …
Skill lain dari repositori ini
advisor
15kMemungkinkan agent Anda berkonsultasi dengan model kedua yang lebih kuat pada titik pemeriksaan penting, seperti sebelum keputusan besar atau saat terhenti pada error, jika Anda mengaktifkannya.
check-agent-compatibility
15kMenjalankan pemeriksaan menyeluruh tentang apakah agent pengodean AI bisa memulai, memverifikasi, dan mendokumentasikan repositori, lalu mengembalikan satu skor kompatibilitas dengan masalah utamanya.
cli-for-agents
15kMengajarkan agent Anda merancang atau meninjau alat baris perintah agar agent AI bisa menjalankannya tanpa prompt, dengan teks bantuan dan contoh yang jelas.
continual-learning
15kMenjaga catatan AGENTS.md Anda tetap mutakhir dengan menyerahkan pekerjaan meninjau chat sebelumnya kepada pembaru memori khusus.
Skill serupa
test-driven-development
311kMengajari agent Anda menulis tes yang gagal dulu, melihatnya gagal, lalu menulis kode terkecil yang lulus, sebelum membangun fitur atau perbaikan apa pun.
verification-before-completion
311kMengajari agent Anda menjalankan pemeriksaan nyata dan membaca keluarannya sebelum menyatakan tugas, perbaikan, atau build sudah selesai atau lulus.
migrate-to-shoehorn
310kMengganti type cast berisiko di file tes Anda dengan pustaka shoehorn, sehingga tes bisa memakai data parsial dan tetap lulus pemeriksaan tipe.