Template Skill Claude (SKILL.md)
SKILL.md beranotasi yang tinggal diisi, plus file referensi yang menunjukkan cara menjaga file utama tetap pendek.
- Claude Code
- Agent Skills format
2 file3.2 KB.zip
Membaca staged diff lalu menulis commit message yang menjelaskan apa yang berubah dan kenapa. Tidak pernah meng-commit untuk Anda.
Oleh Matthews WongDiperbarui Dicek dengan Claude Code 2.1.323 docs
Poin utama
Masukkan folder ini ke direktori skills Anda dan Claude menulis commit message dari apa yang benar-benar di-stage. Skill ini membaca git diff --staged, mengikuti gaya riwayat commit terakhir Anda, menjaga satu perubahan logis per commit, dan menulis subject imperatif dengan body yang menjelaskan apa dan kenapa. Ia tidak mengarang alasan, dan tidak commit atau push kecuali Anda minta.
Persis isi unduhannya. Baca dulu, lalu salin atau unduh.
---
name: commit-message
description: Writes a git commit message from the staged diff, with an imperative subject line and a body that explains what changed and why. Use when the user asks to write a commit message, describe staged changes, "what should I call this commit", or prepare a commit.
allowed-tools: Bash(git status *) Bash(git diff *) Bash(git log *)
---
# Commit message
Write a commit message for the changes that are staged right now. The message
describes only what the diff shows.
## Steps
1. Run `git status --short` to see what is staged and what is not.
2. Run `git diff --staged` and read all of it. If it is long, run
`git diff --staged --stat` first, then read the diff file by file.
3. If nothing is staged, say so and stop. Do not stage files yourself.
4. Run `git log -n 10 --oneline` and match the style the repository already
uses (prefixes such as `feat:` or `fix:`, capitalization, language).
5. Decide whether the staged diff is one logical change. If it mixes
unrelated changes, say which files belong together and propose one
message per group. Do not hide two changes behind one subject.
6. Write the message in the format below and show it in a code block.
## Format
```text
<subject line>
<body>
<footer, only if needed>
```
Subject line:
- Imperative mood, as if completing "This commit will ...". Write
"Add retry to webhook sender", not "Added" or "Adds".
- 50 characters or fewer when possible, never more than 72.
- No period at the end.
- Name the thing that changed, not the file list.
- Keep the prefix style found in step 4. If the history has none, add none.
Body:
- One blank line after the subject.
- Wrap lines at 72 characters.
- Say what changed and why. The diff already shows how.
- State the reason only if the diff, the code comments or the user gave it.
If the reason is not known, describe the change and ask the user for the
reason instead of making one up.
- Leave the body out for a change that the subject fully explains, such as
a typo fix.
Footer:
- Issue references or `BREAKING CHANGE:` notes, only when the user or the
diff provides them. Never invent an issue number.
## Rules
- Describe only changes present in `git diff --staged`. Unstaged and
untracked files are not part of this commit.
- Never claim that tests pass, that a bug is fixed or that performance
improved unless the conversation contains the output that shows it.
- Do not run `git add`, `git commit`, `git commit --amend` or `git push`
unless the user asks for that action in plain words. Writing the message
is the whole job.
- If the diff contains something that looks like a secret, a key or a
password, stop and tell the user before writing anything else.
- No marketing words. "Improve", "enhance" and "refactor" need an object and
a reason, or a more exact verb.
## What to report
1. The proposed message, in a code block, ready to copy.
2. One line listing the staged files it covers.
3. Any warning: mixed changes, unstaged files that look related, a missing
reason, or a suspected secret.
## Additional resources
- For good and bad messages side by side, see [examples.md](examples.md).
Read it when the right wording is not obvious.
# Commit message examples
Each pair shows a message to avoid and the message to write instead.
## 1. Vague subject
Bad:
```text
Update files
```
Good:
```text
Reject empty email in signup form
The form accepted a blank email and the API answered with a 500.
Validate the field on the client and return a 422 with a field
error from the API, so the user sees which input to fix.
```
Why: the subject names the behavior that changed, and the body gives the
reason a reader will look for in a year.
## 2. Past tense and a file list
Bad:
```text
Changed user-service.ts and user-service.test.ts
```
Good:
```text
Cache user lookups for the length of a request
The order page loaded the same user once per line item. Keep the
result in a request-scoped map so each user is read once.
```
Why: imperative mood, and the files are already listed by git.
## 3. Two changes in one commit
Bad:
```text
Fix date parsing and add export button
```
Good: say that the staged diff holds two unrelated changes, then propose two
commits.
```text
Parse ISO dates without a timezone as UTC
```
```text
Add CSV export button to the orders table
```
Why: one logical change per commit keeps a revert or a bisect clean.
## 4. An invented reason
Bad:
```text
Increase timeout to 30s to fix the flaky production outage
```
The diff only shows a number changing from 10 to 30. Nothing in it mentions
an outage.
Good:
```text
Raise HTTP client timeout from 10s to 30s
```
Then ask the user for the reason and add it to the body once they give it.
## 5. A claim nobody checked
Bad:
```text
Fix login bug, all tests pass
```
Good:
```text
Compare session tokens in constant time
Replace the string equality check in verifySession with
timingSafeEqual, so the comparison time does not depend on how
many leading characters match.
```
Why: "all tests pass" belongs in the message only when the test output is
in the conversation.
## 6. Matching the repository's prefix style
When `git log` shows prefixes such as these:
```text
feat(blog): add reading time to post cards
fix(api): return 404 for unknown slugs
```
write the new message in the same style:
```text
fix(search): keep the query when the dialog reopens
```
When the history has no prefixes, do not add them.
## 7. A change that needs no body
```text
Fix typo in README install step
```
Arsipnya berisi satu folder, commit-message. Ekstrak ke .claude/skills/ di proyek Anda sehingga filenya berada di .claude/skills/commit-message/SKILL.md, atau ke ~/.claude/skills/ untuk memakainya di semua proyek di mesin Anda.
Di Claude Code, tanyakan What skills are available? atau buka /skills dan cari commit-message. Bila folder skills belum ada saat sesi dimulai, jalankan /reload-skills lebih dulu.
Jalankan git add pada file untuk satu perubahan logis. Lalu ketik /commit-message, atau minta Claude menulis commit message. Skill ini membaca staged diff dan log terakhir Anda sebelum menulis apa pun.
Anda mendapat message dalam code block, daftar file yang dicakup, dan peringatan bila ada: perubahan campur aduk, file terkait yang belum di-stage, atau alasan yang tidak ditemukan. Lengkapi alasan yang kurang, lalu commit sendiri atau minta Claude melakukannya.
Sunting bagian Format di SKILL.md bila tim Anda memakai panjang subject lain, prefix wajib, atau footer tiket. Tambahkan pasangan contoh Anda sendiri ke examples.md agar skill mengikuti gaya kalimat Anda.
Langkah pertamanya menjalankan git status dan git diff --staged. Message hanya menjelaskan apa yang ditampilkan keduanya, jadi pekerjaan yang dibahas tetapi tidak di-stage tidak ikut masuk.
Subject dalam bentuk imperatif, 50 karakter bila memungkinkan dan tidak pernah lebih dari 72, tanpa titik. Body dibungkus pada 72 karakter dan menjelaskan apa serta kenapa. Batas yang tertulis lebih mudah diikuti daripada perintah tulis message yang bagus.
Tidak ada alasan kecuali berasal dari diff, komentar, atau Anda. Tidak ada nomor issue kecuali diberikan. Tidak ada klaim tes lolos tanpa output-nya di percakapan. Bila alasannya tidak ada, skill akan bertanya.
Baris allowed-tools memuat git status, git diff, dan git log, sehingga Claude bisa menjalankannya tanpa prompt izin selama giliran yang memanggil skill. git add, git commit, dan git push tidak ada di daftar itu.
examples.md berisi tujuh pasangan contoh baik dan buruk. SKILL.md menautkannya, dan Claude membukanya hanya saat pilihan katanya tidak jelas, jadi contoh itu tidak dimuat di setiap pemakaian.
Jawaban singkat sebelum Anda mengunduhnya.
Pelajaran dan artikel gratis di situs ini yang menjelaskan gagasan di baliknya.
Sumber primer yang diperiksa pada tanggal riset. Ikuti tautannya untuk versi terbaru.
SKILL.md beranotasi yang tinggal diisi, plus file referensi yang menunjukkan cara menjaga file utama tetap pendek.
2 file3.2 KB.zip
Membaca diff branch lalu mengisi template PR: kenapa, apa yang berubah, hasil tes nyata, risiko, dan rollback.
2 file5.8 KB.zip
CLAUDE.md awal 70 baris: proyek, stack, perintah, aturan keras, cara memverifikasi pekerjaan, dan yang tidak boleh dilakukan.
1 file2.1 KB.md