commit
Commit theo Conventional Commits + Jira ID
Lấy Jira ID từ tham số của skill (args). Ví dụ: /commit WRA-9 → args = "WRA-9". Nếu args trống, dừng lại và hỏi người dùng Jira ID trước khi làm tiếp.
Quy trình
-
Kiểm tra trạng thái repo — chạy song song (một message, nhiều tool call):
git status(KHÔNG dùng cờ-uall)git diff HEAD(bao gồm cả phần đã staged và phần chưa staged — mọi thứ sẽ được commit)git log -n 5 --onelineđể nắm convention hiện tại của repo
-
Nếu không có thay đổi nào (không có file untracked và không có modification), KHÔNG tạo commit rỗng. Báo cho người dùng và dừng.
-
Phân tích thay đổi và soạn commit message:
- Xác định
typetừ bảng bên dưới dựa trên bản chất thay đổi thực tế. - Chọn
scopengắn gọn (thường là tên module / thư mục chính bị ảnh hưởng, ví dụauth,admin,reports). Có thể bỏscopenếu đổi trải rộng nhiều module. - Jira ID BẮT BUỘC nằm ở vị trí đầu tiên của dòng summary, trước cả
<type>. Format:<JIRA-ID> <type>(<scope>): <subject>. Không lặp lại Jira ID ở footer. subjectviết ngắn, imperative (dạng mệnh lệnh), KHÔNG chấm cuối, ưu tiên tiếng Việt nếu các commit trước trong repo đang dùng tiếng Việt (kiểm tragit log).body(tùy chọn) giải thích why hơn là what; tránh mô tả chi tiết diff.- Nếu là breaking change, thêm
!sautype(scope)(vdfeat(api)!:) và thêm footerBREAKING CHANGE: <mô tả>.
- Xác định
-
Không commit các file có khả năng chứa secrets (
.env,credentials.json, key files, v.v.). Nếu người dùng chủ động yêu cầu commit các file này, cảnh báo trước. -
Stage đúng file cần thiết — liệt kê từng file bằng tên thay vì
git add -A/git add .để tránh lôi nhầm file nhạy cảm hay binary lớn. -
Tạo commit bằng HEREDOC để giữ format.
<scope>là tùy chọn — nếu thay đổi trải rộng nhiều module thì bỏ luôn phần(<scope>):
# Dạng có scope
git commit -m "$(cat <<'EOF'
<JIRA-ID> <type>(<scope>): <subject>
<body tùy chọn>
EOF
)"
# Dạng không scope
git commit -m "$(cat <<'EOF'
<JIRA-ID> <type>: <subject>
<body tùy chọn>
EOF
)"
KHÔNG tự động chèn dòng Co-Authored-By: vào commit — repo này không dùng convention đó.
-
Sau khi commit, chạy
git statusđể xác nhận commit đã tạo thành công. -
Nếu pre-commit hook fail, KHÔNG dùng
--amend(commit trước đó đã fail nên chưa tồn tại). Sửa lỗi, stage lại, tạo commit mới. -
KHÔNG push trừ khi người dùng yêu cầu rõ ràng.
Các type được phép
| Type | Ý nghĩa | Version bump |
|---|---|---|
feat |
Tính năng mới | MINOR (1.X.0) |
fix |
Sửa bug | PATCH (1.0.X) |
perf |
Cải thiện hiệu năng | PATCH |
refactor |
Refactor không đổi behavior | — |
docs |
Tài liệu | — |
test |
Thêm/sửa test | — |
chore |
Maintenance, build config | — |
ci |
CI/CD config | — |
Breaking change là một modifier, không phải type riêng. Bất kỳ type nào có hậu tố
!(vdfeat(api)!:) hoặc có footerBREAKING CHANGE: <mô tả>đều kích hoạt MAJOR bump (X.0.0).
Ví dụ tham chiếu
WRA-201 feat(auth): thêm JWT refresh token rotation
Implement sliding expiration cho refresh token, revoke
token cũ khi phát hiện reuse.
WRA-334 fix(billing): tính sai VAT cho đơn hàng có discount
WRA-412 refactor(order): tách OrderService thành các handler nhỏ
Không đổi behavior, chuẩn bị cho việc thêm payment provider.
WRA-450 feat(api)!: đổi response format endpoint /users
BREAKING CHANGE: field `user_id` đổi thành `id`. Clients
phải cập nhật trước khi deploy.
Lưu ý quan trọng
- Nhiều thay đổi thuộc các
typekhác nhau → chia thành nhiều commit khi hợp lý, mỗi commit mộttype. Nếu người dùng muốn một commit duy nhất, chọntypephản ánh thay đổi chủ đạo. - Trước khi commit, hỏi lại người dùng nếu có nghi ngờ về việc gộp/tách commit.
- Tuân thủ Git Safety Protocol của Claude Code (không
--no-verify, không force push, không sửa git config).
More from nguyenvanchiens/my-skills
gitlab-flow
Standard end-to-end workflow for shipping a feature/bugfix from a Jira task to a merged GitLab MR. Use when the user references a Jira task ID (WRA-XX, etc.), asks to "start a task", "create branch from task", "review the last change", "review the whole branch", "commit and push", "create a merge request", "review the MR !N", "post review result to the MR", "fix all issues", or "merge the request". Covers branch naming, commit format, MR creation, micro + macro code review (3-agent parallel), fix loop, and merge.
15impeccable
Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
11karpathy-guidelines
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
10review-branch
Review the cumulative changes of the current branch against main (committed + uncommitted) for reuse, quality, and efficiency, then fix any issues found. Use when finishing a feature branch before opening an MR.
4blazor
Build Blazor apps on .NET 8+: unified Blazor Web App với render modes (SSR, Stream, Server, WebAssembly, Auto), components/parameters/EventCallback, lifecycle, EditForm validation, JS interop, state management. Use when project has .razor files, Components/ folder, App.razor, MainLayout.razor, or _Imports.razor.
1modern-csharp
Write idiomatic modern C# (C# 12/13/14) trong .NET repos: primary constructors, collection expressions `[..]`, required members, `field` keyword, params collections, lambdas with default params, lock object (.NET 9), extension members. Use khi user hỏi về C# language features, refactor sang syntax mới hơn, kiểm tra LangVersion compat trước khi dùng feature, hoặc review code có pattern cũ (`new()` constructor verbose, ctor + field assignment lặp, raw collection init). Verify TargetFramework và LangVersion trước, không dùng preview feature mặc định.
1