Commit Type Detection Skill
Expert knowledge for detecting the optimal conventional commit type.
Detection Algorithm
Step 1: Gather Data
# Get modified files
git diff --name-only
git diff --staged --name-only
# Get change statistics
git diff --stat
git diff --staged --stat
# Check for keywords in diff
git diff | grep -i "fix\|bug\|error" | head -5
Step 2: Categorize Files
| Category |
File Patterns |
| docs |
*.md, *.txt, *.rst, README*, CHANGELOG* |
| test |
*.test.*, *.spec.*, __tests__/*, test/* |
| config |
*.json, *.yml, *.yaml, *.toml, .*rc |
| ci |
.github/*, .gitlab-ci.yml, Jenkinsfile |
| build |
package.json, Makefile, webpack.*, vite.* |
| style |
Only whitespace, formatting changes |
| src |
*.ts, *.js, *.py, *.go, *.rs, etc. |
Step 3: Apply Rules
IF only docs files changed:
→ docs
IF only test files changed:
→ test
IF only config/build files changed:
→ chore
IF only CI files changed:
→ ci
IF diff contains "fix", "bug", "error", "issue", "resolve":
→ fix
IF new files added with business logic:
→ feat
IF files renamed/moved without logic change:
→ refactor
IF performance keywords ("optimize", "perf", "speed", "cache"):
→ perf
IF formatting only (whitespace, semicolons):
→ style
DEFAULT:
→ Use /commit-pro:commit for smart analysis
Step 4: Determine Scope
Extract scope from primary directory:
src/components/Button.tsx → ui or button
src/api/auth.ts → auth
lib/utils/date.ts → utils
server/routes/user.ts → user
Quick Reference
| Type |
When |
Version Bump |
feat |
New functionality |
PATCH |
fix |
Bug correction |
PATCH |
docs |
Documentation only |
PATCH |
style |
Formatting only |
PATCH |
refactor |
Code restructure |
PATCH |
perf |
Performance |
PATCH |
test |
Tests only |
PATCH |
build |
Build/deps |
PATCH |
ci |
CI/CD config |
PATCH |
chore |
Maintenance |
PATCH |
MINOR/MAJOR bumps are manual user decisions, never automatic.
Post-Commit Actions
See the post-commit skill for universal CHANGELOG, version bump, and tag logic (works for all repos).
Examples
Example 1: Only README changed
Files: README.md
→ /commit-pro:docs
Example 2: New component + test
Files: src/Button.tsx, src/Button.test.tsx
→ /commit-pro:feat (primary is new feature)
Example 3: Fix in existing file
Files: src/api/auth.ts
Diff contains: "fix login bug"
→ /commit-pro:fix
1---2name: commit-detection3description: Detects optimal commit type from git changes. Use when analyzing commits, determining commit type, or before committing.4allowed-tools: Bash, Read, Grep5metadata:6 source: https://skillmd.com/skills/fusengine/commit-detection7---89<objective>10Detects the optimal conventional commit type (feat/fix/docs/style/refactor/perf/test/build/ci/chore) from staged and unstaged git changes, using file-pattern categorization (docs/test/config/ci/build/src) plus diff-keyword heuristics ("fix", "bug", "optimize", etc.), and derives a scope suggestion from the primary changed directory (e.g. `src/api/auth.ts` → `auth`). Covers the full detection algorithm, the rule cascade, scope extraction, and worked examples. Does not perform the commit itself — routes to the matching `/commit-pro:<type>` command, or to the `commit` skill for full smart analysis when no rule matches cleanly.11</objective>1213# Commit Type Detection Skill1415Expert knowledge for detecting the optimal conventional commit type.1617## Detection Algorithm1819### Step 1: Gather Data2021```bash22# Get modified files23git diff --name-only24git diff --staged --name-only2526# Get change statistics27git diff --stat28git diff --staged --stat2930# Check for keywords in diff31git diff | grep -i "fix\|bug\|error" | head -532```3334### Step 2: Categorize Files3536| Category | File Patterns |37|----------|---------------|38| docs | `*.md`, `*.txt`, `*.rst`, `README*`, `CHANGELOG*` |39| test | `*.test.*`, `*.spec.*`, `__tests__/*`, `test/*` |40| config | `*.json`, `*.yml`, `*.yaml`, `*.toml`, `.*rc` |41| ci | `.github/*`, `.gitlab-ci.yml`, `Jenkinsfile` |42| build | `package.json`, `Makefile`, `webpack.*`, `vite.*` |43| style | Only whitespace, formatting changes |44| src | `*.ts`, `*.js`, `*.py`, `*.go`, `*.rs`, etc. |4546### Step 3: Apply Rules4748```49IF only docs files changed:50 → docs5152IF only test files changed:53 → test5455IF only config/build files changed:56 → chore5758IF only CI files changed:59 → ci6061IF diff contains "fix", "bug", "error", "issue", "resolve":62 → fix6364IF new files added with business logic:65 → feat6667IF files renamed/moved without logic change:68 → refactor6970IF performance keywords ("optimize", "perf", "speed", "cache"):71 → perf7273IF formatting only (whitespace, semicolons):74 → style7576DEFAULT:77 → Use /commit-pro:commit for smart analysis78```7980### Step 4: Determine Scope8182Extract scope from primary directory:8384```85src/components/Button.tsx → ui or button86src/api/auth.ts → auth87lib/utils/date.ts → utils88server/routes/user.ts → user89```9091## Quick Reference9293| Type | When | Version Bump |94|------|------|-------------|95| `feat` | New functionality | PATCH |96| `fix` | Bug correction | PATCH |97| `docs` | Documentation only | PATCH |98| `style` | Formatting only | PATCH |99| `refactor` | Code restructure | PATCH |100| `perf` | Performance | PATCH |101| `test` | Tests only | PATCH |102| `build` | Build/deps | PATCH |103| `ci` | CI/CD config | PATCH |104| `chore` | Maintenance | PATCH |105106> MINOR/MAJOR bumps are **manual user decisions**, never automatic.107108## Post-Commit Actions109110See the `post-commit` skill for universal CHANGELOG, version bump, and tag logic (works for all repos).111112## Examples113114**Example 1: Only README changed**115```116Files: README.md117→ /commit-pro:docs118```119120**Example 2: New component + test**121```122Files: src/Button.tsx, src/Button.test.tsx123→ /commit-pro:feat (primary is new feature)124```125126**Example 3: Fix in existing file**127```128Files: src/api/auth.ts129Diff contains: "fix login bug"130→ /commit-pro:fix131```