commit-craft
Skill này làm gì
Skill này lập kế hoạch một chuỗi commit git nhỏ, tập trung từ một tập thay đổi lớn và trộn lẫn. Skill dành cho lập trình viên muốn các commit dễ xem lại, dễ revert và dễ hiểu.
Khi nào nên dùng
- ✓Khi bạn có nhiều thay đổi lẫn lộn và muốn commit chúng thành các nhóm hợp lý.
- ✓Khi bạn sắp push và muốn kiểm tra các thay đổi đã stage xem có bí mật hoặc file .env không.
- ✓Khi bạn cần một thông điệp commit rõ ràng, viết tốt cho một thay đổi.
Liên kết skill
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/commit-craft/skills/commit-craft/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi có một đống thay đổi lẫn lộn trong repo. Hãy tách chúng thành các commit sạch và kiểm tra không có gì nhạy cảm được stage.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent nhóm các file thành commit hợp lý và gợi ý thứ tự, rồi chạy kiểm tra bí mật trên những gì đã stage. Nó cũng kiểm tra định dạng thông điệp commit. Bạn quyết định khi nào stage và commit từng nhóm.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Commit Craft
Portability: 3 stdlib Python scripts that call
gitread-only. No network. The scripts never stage, commit or push. You do, one group at a time, after the gate passes.
Agents leave large mixed diffs: a feature, a reformat, a dependency bump and a
stray .env, all in one tree. Committed as one blob, that diff cannot be
reviewed, reverted or bisected. This skill turns it into a series where each
commit is one logical change, builds on its own, holds no secrets and says why.
Workflow
# 1 - Plan: which commits, in which order, staged how?
python scripts/commit_planner.py # working tree vs HEAD, untracked included
# 2 - For each group: stage exactly its files, then gate what is staged
git add -- <files of group N> # or git add -p for MIXED_FORMATTING files
python scripts/secret_gate.py # blocks before the commit exists
# 3 - Write the message, lint it, commit
python scripts/message_linter.py -m "<message>" --staged && git commit -m "<message>"
# 4 - Before push: the whole series, and proof every commit builds
python scripts/message_linter.py --range @{upstream}..HEAD
git rebase -x "<test command>" @{upstream}
Step 1 groups files: manifest with lockfile, pure moves, whitespace-only
files, each module's changes with their tests, then docs and CI. It holds back
.env, keys and tfstate (exit 4), flags files that mix formatting with real
hunks, and flags a move whose callers' import edits sit in another group, since
that commit would not build. It never picks feat vs fix: decide from what the change does.
Step 2 scans only the added lines of what is staged: provider-shaped
tokens, high-entropy values assigned to key/secret/token/password, sensitive
files and conflict markers. Output is redacted. A false positive is waived in
.commit-craft-allow by fingerprint or path, with a reason.
Step 3 blocks vague subjects ("fix", "update"), subjects over 72 characters, no blank line after the subject, and a change of 40+ lines or 4+ files with no body. It enforces Conventional Commits only if the repo already uses them.
Step 4 also blocks fixup!/squash!/WIP commits and warns on duplicates and
revert pairs. Install assets/hooks/ to run steps 2 to 4 on every commit and push.
Hard rules
- Never
git add -Aorgit add .on a mixed tree. Stage each group by name or by hunk. - A blocked gate means no commit. Remove the value and load it at runtime. Never
--no-verify, never waive a real secret. - A pushed secret is rotated first. Deleting it in a new commit leaves it in history (
references/secret_response.md). - Each commit builds. Tests ride with their change; moves carry their callers.
- The body says why. The diff already says what.
- Rewrite only unpushed history. Rebasing or amending shared commits is the user's call.
Scripts
| Script | Role | Exit codes |
|---|---|---|
scripts/commit_planner.py |
Groups, order, staging commands, MOVE/MIXED/SIZE flags | 0 one commit · 2 split · 3 bad input · 4 secrets file held back |
scripts/secret_gate.py |
Staged or range scan for credentials, sensitive files, conflict markers | 0 · 2 warnings · 3 · 4 blocked |
scripts/message_linter.py |
One message (-m, --message-file) or a series (--range) |
0 · 2 warnings · 3 · 4 blocked |
All support --help, --sample and --output json.
References and assets
references/commit_series_design.md: split, order and verify, with sources (7)references/message_discipline.md: subject, why-body, breaking changes, trailers (7)references/secret_response.md: what the gate catches, its limits, and the leak response order (7)assets/hooks/:pre-commit,commit-msg,pre-pushassets/commit-craft-allow.example: waiver formatassets/series_checklist.md: pre-push sign-off
Câu hỏi thường gặp
Nó có commit hoặc push thay cho tôi không?
Không. Các script chỉ đọc git và không bao giờ stage, commit hay push. Bước đó do bạn tự làm.
Nó chặn những gì?
Bí mật đã stage và file .env bị chặn trước khi commit được tạo.
Nó có kiểm tra cả chuỗi trước khi push không?
Có. Nó kiểm tra mọi thông điệp trong khoảng commit và có thể chạy lệnh test trên từng commit.
Chi tiết
Mô tả gốc của tác giả
Use when committing a mix of changes, before a push, or when asked to split work into commits or write commit messages. Plans a reviewable series, blocks staged secrets and .env files, and lints messages with commit_planner.py, secret_gate.py and message_linter.py.
Độ phổ biến
- Sao GitHub
- 29k
- Vị trí xếp hạng
- #9551
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agent-launcher-orchestrator
29kGiúp agent của bạn lên kế hoạch, xây dựng, kiểm thử và lên lịch một Claude managed agent trong tài khoản riêng, từng bước một, bắt đầu từ một mục tiêu rõ ràng.
grade-iterate
29kCho phép agent của bạn chấm kết quả một managed AI agent theo bảng tiêu chí và cải thiện qua số vòng cố định, nên không bao giờ lặp vô tận.
interview
29kCho phép agent của bạn phỏng vấn bạn về ý tưởng agent AI và biến câu trả lời thành một kế hoạch xây dựng đơn giản trước khi khởi chạy bất cứ điều gì.
run-without-you
29kGiúp agent của bạn thiết lập một managed AI agent chạy theo lịch hoặc khi có sự kiện xảy ra, với thời gian cron được kiểm tra trước khi khởi chạy.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.