Prompt Rencana Sebelum Coding
Prompt perencanaan yang mencakup bisnis, domain, tech design, dan langkah kerja, lalu mendaftar keputusan yang perlu Anda ambil.
- Claude Code
- Cursor
- Claude.ai
1 file2.3 KB.md
Prompt debugging yang mewajibkan agent mereproduksi bug dan membuktikan penyebabnya sebelum menyentuh kode.
Oleh Matthews WongDiperbarui
Poin utama
Tempel prompt ini bersama laporan bug dan agent bekerja dengan urutan tetap: mereproduksi kegagalan dengan satu perintah atau test yang bisa diulang, mengumpulkan bukti, menyatakan penyebabnya dengan bukti itu, membuat fix terkecil, menjalankan ulang reproduksi yang sama, dan menyimpannya sebagai regression test. Bila bug tidak bisa direproduksi, agent berhenti dan meminta hal yang kurang. Ia tidak menebak fix.
Persis isi unduhannya. Baca dulu, lalu salin atau unduh.
Help me debug this. Do not change any code until you have reproduced the bug and can show what is wrong with evidence.
The bug: [WHAT HAPPENS, AND WHAT SHOULD HAPPEN INSTEAD]
How I trigger it: [STEPS, COMMAND, INPUT OR FAILING TEST, OR "UNKNOWN"]
What I already have: [ERROR MESSAGE, STACK TRACE, LOGS, OR "NOTHING YET"]
## Work in this order
1. **Reproduce.** Trigger the failure yourself with one concrete, repeatable command, input or test. Show me the command and its real output. A failing test is the best reproduction.
2. **Gather evidence.** Read the stack trace, logs, console output or network traffic. If they do not show the cause, add temporary logging or run with debug output. List every temporary line you add.
3. **State the cause.** In two or three sentences: what is wrong, where (file and line), and why it produces this symptom. Quote the evidence that proves it. If two causes fit the evidence, say so and name the check that would tell them apart.
4. **Fix.** Only now, make the smallest change that removes the cause. Do not refactor, rename or tidy nearby code.
5. **Re-run.** Run the exact reproduction from step 1 and show the output. Then run the existing test suite with the project's own command.
6. **Keep it.** Turn the reproduction into a regression test that fails without the fix and passes with it. Remove all temporary logging.
## If you cannot reproduce it
Stop. Do not guess a fix. Tell me what you tried and what happened, then ask for exactly what is missing: the steps, the input data, the logs, the version or the environment.
## Do not
- Do not edit code before step 3 is written down.
- Do not say "this should fix it". Say what you ran and what it printed.
- Do not silence the error: no empty catch blocks, no skipped or deleted tests, no loosened assertions.
- Do not fix other problems you notice. List them at the end.
## Report at the end
- **Reproduction:** the command
- **Cause:** one paragraph, with the evidence
- **Fix:** the files changed, and why
- **Proof:** the output before and after
- **Regression test:** its path and name
- **Noticed but not touched:** a list, or "nothing"
If you cannot run commands here, say so at the start. Then give me one command at a time and wait for the output I paste back before you move to the next step.
Jelaskan apa yang terjadi dan apa yang seharusnya terjadi, cara Anda memicunya, dan apa yang sudah Anda punya: pesan error, stack trace, atau log. Menulis unknown diperbolehkan; agent lalu harus mencari pemicunya lebih dulu.
Hal pertama yang harus Anda lihat adalah sebuah perintah beserta output aslinya yang menunjukkan kegagalan. Bila agent langsung mengubah kode, hentikan dan tunjuk langkah 1. Tanpa reproduksi, tidak ada cara untuk tahu apakah sebuah fix berhasil.
Agent menyatakan apa yang salah, file dan barisnya, serta kenapa itu menimbulkan gejalanya, dengan bukti yang dikutip. Periksa apakah bukti itu mendukung klaimnya. Bila ada dua penyebab yang cocok, agent menyebut pemeriksaan yang membedakannya.
Setelah fix, agent menjalankan ulang reproduksi yang sama persis dan test suite yang ada, lalu menampilkan kedua output. Laporan penutup memuat reproduksi, penyebab, fix, bukti, dan path regression test.
Review diff-nya, pastikan logging sementara sudah dihapus, lalu commit fix dan regression test-nya bersama-sama. Daftar hal yang terlihat tetapi tidak disentuh menjadi tiket Anda berikutnya.
Prompt ini menahan perubahan kode sampai penyebab dinyatakan dengan bukti. Agent yang dibiarkan sendiri membaca error, mencocokkannya dengan fix yang mirip, lalu mengubah kode. Hasilnya sering kali gejalanya berubah dan bug-nya tetap ada.
Perintah atau test yang gagal bisa dijalankan lagi setelah fix, oleh agent maupun oleh Anda. Langkah manual yang ditulis sebagai narasi tidak bisa, dan sedikit bergeser setiap kali diulang.
Bila kegagalan tidak muncul, agent melaporkan apa yang dicobanya dan meminta langkah, data, log, versi, atau environment yang kurang. Tanpa aturan ini, agent yang tidak bisa melihat bug tetap mengirim patch yang tampak masuk akal.
Tidak boleh ada catch block kosong, test yang dilewati atau dihapus, maupun assertion yang dilonggarkan. Masing-masing membuat kegagalan hilang dari output sementara cacatnya tetap ada di kode.
Test itu harus gagal tanpa fix dan lolos dengan fix. Itulah bukti bahwa fix menangani bug ini, dan itulah yang mencegah bug yang sama kembali tanpa ketahuan.
Jawaban singkat sebelum Anda mengunduhnya.
Pelajaran dan artikel gratis di situs ini yang menjelaskan gagasan di baliknya.
Prompt perencanaan yang mencakup bisnis, domain, tech design, dan langkah kerja, lalu mendaftar keputusan yang perlu Anda ambil.
1 file2.3 KB.md
Prompt read-only yang memetakan repository asing: fungsinya, cara menjalankannya, alur request, dan area yang berisiko.
1 file2.3 KB.md
Prompt review yang melaporkan bug lengkap dengan file, baris, skenario gagal, severity, dan fix, tanpa komentar soal gaya.
1 file2.3 KB.md