Skip to content

Latest commit

 

History

History
150 lines (110 loc) · 4.55 KB

File metadata and controls

150 lines (110 loc) · 4.55 KB

commit-generate - Documentation

Back to README

Prerequisites

  • Claude Code CLI installed with access to the skills directory
  • Git >= 2.23 (for git diff --cached and modern diff behavior)
  • Target project must be a Git repository

Installation

Into User Skills Directory

mkdir -p ~/.claude/skills
git clone https://github.com/pardnchiu/skill-commit-generate.git \
    ~/.claude/skills/commit-generate

Into Project Skills Directory

mkdir -p <project>/.claude/skills
git clone https://github.com/pardnchiu/skill-commit-generate.git \
    <project>/.claude/skills/commit-generate

Verify Installation

ls ~/.claude/skills/commit-generate/SKILL.md

Restart Claude Code; invoke via /commit-generate.

Usage

Basic

# 1. Stage the files you want in the commit
git add <file1> <file2>

# 2. Invoke the skill from Claude Code
/commit-generate

Example output:

feat: Add Docker environment auto-detection and database path switching
feat: 新增 Docker 環境自動偵測與資料庫路徑切換機制

Multi-Topic Changes

When the staged diff crosses unrelated modules or touches 2+ primary tags:

⚠️ Multi-topic change detected; consider splitting into multiple commits:
- Auth module refactor: internal/auth/*.go
- UI style tweaks: web/styles/*.css

If merging anyway, the rollup description is:
refactor: Split auth module and adjust UI styles
refactor: 重構認證模組並調整 UI 樣式

No Staged Changes

No staged changes. Run `git add` first to select files to commit.

Reference

Classification Tags

Tag Use Case
feat New feature, endpoint, or component
fix Bug fix, error handling, nil check
update Adjust existing behavior or parameters
add New file or resource (non-feature)
remove Delete code or files
refactor Refactor without behavior change
perf Performance optimization
style Formatting and layout
doc Documentation and comments
test Test-related changes
chore CI/CD, tooling, dependency management
security Security patch
breaking Breaking change

Tag Priority

BREAKING > FEAT > FIX > SECURITY > UPDATE > REFACTOR > PERF > others

Breaking Signals (hit → breaking)

Category Signal
Symbol removal Delete any exported or public function, class, method, type, constant, enum value
Signature change Parameter type, order, new required parameter, return type change
HTTP API Endpoint deletion, URL change, response schema field removed or type changed, status code change
Configuration Delete existing key, add required key, type or format change on existing key
Migration DROP COLUMN, required column added to populated table, type narrowing
CLI Flag deletion, new required positional argument, semantic change to existing flag
Imports Package or module restructure that breaks existing references

Security Signals (hit → security, unless Breaking also hits)

Category Signal
Injection SQL / XSS / Command / LDAP / Template injection
AuthZ Missing auth check, privilege escalation, JWT validation gap
Sensitive data Remove secrets, tokens, or PII from log / response / error message
Hardcoding Remove hardcoded tokens, default passwords, API keys
Web security CSRF / CORS / CSP / HSTS patches
CVE Dependency CVE patches (upgraded from chore: upgrade to security)

Multi-Topic Detection Criteria

Any one of the following triggers detection:

  • Diff touches 2+ primary tag categories (feat / fix / refactor / breaking / security)
  • Changed files span 2+ semantically unrelated modules (top-level directory or package boundary)
  • A single commit contains 3+ unrelated topics

Formatting, comment-only tweaks, and dependency bumps can ride along with the primary commit and do not count as multi-topic.

Output Format

tag: English one-line description
tag: 繁體中文一句話描述

Format Rules

Rule Description
Single tag Pick the tag that best represents the core intent
English subject Imperative mood, <= 72 chars (Add / Fix / Refactor / Remove / Update)
Traditional Chinese body <= 50 chars, verb-first (新增 / 修正 / 重構 / 移除 / 優化)
Merge related changes Roll small edits into a single description
Single topic first One intent per commit; warn before rolling up multi-topic changes