Langsung ke konten
Skillpedia
Testing41k Β· #7027

tdd

Fungsinya

Skill ini memandu agent membangun kode dengan menulis tes lebih dulu, lalu kode terkecil yang membuat tes itu lulus. Skill ini untuk pengembang yang ingin setiap perubahan dibuktikan oleh tes yang ditulis sebelum kodenya.

Kapan dipakai

  • βœ“Saat Anda ingin perilaku baru dibangun dengan uji-dulu, satu langkah kecil dalam satu waktu.
  • βœ“Saat Anda ingin bug diperbaiki dengan menulis lebih dulu tes yang mereproduksinya.
  • βœ“Saat Anda ingin tes ditulis dari sumber kebenaran, bukan dari kode itu sendiri.

Link skill

https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/tdd/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/Yeachan-Heo/oh-my-claudecode/blob/main/skills/tdd/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

β€œBangun aturan diskon dengan uji-dulu, satu langkah kecil dalam satu waktu, memakai contoh-contoh di spesifikasi harga kami.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent menulis tes berikutnya pada titik yang disepakati, memastikan tes itu gagal karena alasan yang seharusnya, lalu menulis perubahan terkecil yang membuatnya lulus. Agent mengulang loop ini dan menyimpan refaktor untuk tahap tinjauan berikutnya.

Konten teknis (SKILL.md asli)

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

TDD

Red-green in small steps, at seams that were agreed in advance. In a launch run the seam list is C2's approved output; outside launch, agree the seams with the user before the first test exists β€” a seam nobody approved gets no tests.

The loop

One test β†’ one implementation β†’ repeat:

  1. Write the next test at a seam. Run it. Watch it fail for the reason you expect β€” a test that cannot fail is not a test.
  2. Implement the smallest change that turns it green.
  3. Repeat. Each test is a tracer bullet: a narrow but complete path through the behavior, not a layer finished in isolation.

Rules

  • Expected values come from an independent source of truth β€” a spec line, a worked example, a documented output. Never from the implementation under test: a test that asserts what the code happens to do is a mirror, not a check.
  • Substitute at the seam's declared boundary class only β€” in-process, locally substitutable, owned-remote port, or true-external, the class C2 records for each seam. No substitutes inside the boundary the test is exercising.
  • Refactoring is not part of the loop. It belongs to the review stage; the repair worker owns it. Do not refactor mid-red-green.
  • A bug fix starts with the failing test that reproduces it β€” reproduction before theory, the debugger's rule.
  • When proposing a seam, say in one line what it catches and what it lets through β€” a seam choice nobody can price is a guess, not a decision.

When no seam fits

If the behavior cannot be tested at any approved seam, stop and say so: report the missing seam as a finding (it feeds architecture-survey and refit) rather than inventing a seam or testing through internals.

Output

  • The seam list used, with boundary classes and each seam's catch/miss line
  • Red/green evidence β€” the failing run and the passing run
  • Any seam-absence findings
Pertanyaan umum

Apakah tes hanya menyalin apa yang dilakukan kode?

Tidak. Nilai yang diharapkan berasal dari sumber independen, seperti spesifikasi atau contoh yang sudah dikerjakan, bukan dari kode yang diuji.

Di mana tes sebaiknya ditulis?

Hanya pada titik yang disepakati sebelumnya, sehingga tidak ada tes untuk titik yang tidak disetujui siapa pun.

Kapan refaktor dilakukan?

Tidak di dalam loop merah-hijau. Refaktor termasuk tahap tinjauan nanti.

Detail

Deskripsi asli dari pembuat

Test-first at pre-agreed seams β€” one test, one implementation, tracer-bullet red/green; independent expected values; substitutions only at the seam's boundary class; launch Phase 4 reference.

repo: Yeachan-Heo/oh-my-claudecode

Popularitas

Bintang GitHub
41k
Peringkat
#7027
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa