$npx -y skills add fusengine/agents --skill commit-detectionDetects optimal commit type from git changes. Use when analyzing commits, determining commit type, or before committing.
| 1 | # Commit Type Detection Skill |
| 2 | |
| 3 | Expert knowledge for detecting the optimal conventional commit type. |
| 4 | |
| 5 | ## Detection Algorithm |
| 6 | |
| 7 | ### Step 1: Gather Data |
| 8 | |
| 9 | ```bash |
| 10 | # Get modified files |
| 11 | git diff --name-only |
| 12 | git diff --staged --name-only |
| 13 | |
| 14 | # Get change statistics |
| 15 | git diff --stat |
| 16 | git diff --staged --stat |
| 17 | |
| 18 | # Check for keywords in diff |
| 19 | git diff | grep -i "fix\|bug\|error" | head -5 |
| 20 | ``` |
| 21 | |
| 22 | ### Step 2: Categorize Files |
| 23 | |
| 24 | | Category | File Patterns | |
| 25 | |----------|---------------| |
| 26 | | docs | `*.md`, `*.txt`, `*.rst`, `README*`, `CHANGELOG*` | |
| 27 | | test | `*.test.*`, `*.spec.*`, `__tests__/*`, `test/*` | |
| 28 | | config | `*.json`, `*.yml`, `*.yaml`, `*.toml`, `.*rc` | |
| 29 | | ci | `.github/*`, `.gitlab-ci.yml`, `Jenkinsfile` | |
| 30 | | build | `package.json`, `Makefile`, `webpack.*`, `vite.*` | |
| 31 | | style | Only whitespace, formatting changes | |
| 32 | | src | `*.ts`, `*.js`, `*.py`, `*.go`, `*.rs`, etc. | |
| 33 | |
| 34 | ### Step 3: Apply Rules |
| 35 | |
| 36 | ``` |
| 37 | IF only docs files changed: |
| 38 | → docs |
| 39 | |
| 40 | IF only test files changed: |
| 41 | → test |
| 42 | |
| 43 | IF only config/build files changed: |
| 44 | → chore |
| 45 | |
| 46 | IF only CI files changed: |
| 47 | → ci |
| 48 | |
| 49 | IF diff contains "fix", "bug", "error", "issue", "resolve": |
| 50 | → fix |
| 51 | |
| 52 | IF new files added with business logic: |
| 53 | → feat |
| 54 | |
| 55 | IF files renamed/moved without logic change: |
| 56 | → refactor |
| 57 | |
| 58 | IF performance keywords ("optimize", "perf", "speed", "cache"): |
| 59 | → perf |
| 60 | |
| 61 | IF formatting only (whitespace, semicolons): |
| 62 | → style |
| 63 | |
| 64 | DEFAULT: |
| 65 | → Use /commit-pro:commit for smart analysis |
| 66 | ``` |
| 67 | |
| 68 | ### Step 4: Determine Scope |
| 69 | |
| 70 | Extract scope from primary directory: |
| 71 | |
| 72 | ``` |
| 73 | src/components/Button.tsx → ui or button |
| 74 | src/api/auth.ts → auth |
| 75 | lib/utils/date.ts → utils |
| 76 | server/routes/user.ts → user |
| 77 | ``` |
| 78 | |
| 79 | ## Quick Reference |
| 80 | |
| 81 | | Type | When | Version Bump | |
| 82 | |------|------|-------------| |
| 83 | | `feat` | New functionality | PATCH | |
| 84 | | `fix` | Bug correction | PATCH | |
| 85 | | `docs` | Documentation only | PATCH | |
| 86 | | `style` | Formatting only | PATCH | |
| 87 | | `refactor` | Code restructure | PATCH | |
| 88 | | `perf` | Performance | PATCH | |
| 89 | | `test` | Tests only | PATCH | |
| 90 | | `build` | Build/deps | PATCH | |
| 91 | | `ci` | CI/CD config | PATCH | |
| 92 | | `chore` | Maintenance | PATCH | |
| 93 | |
| 94 | > MINOR/MAJOR bumps are **manual user decisions**, never automatic. |
| 95 | |
| 96 | ## Post-Commit Actions |
| 97 | |
| 98 | See the `post-commit` skill for universal CHANGELOG, version bump, and tag logic (works for all repos). |
| 99 | |
| 100 | ## Examples |
| 101 | |
| 102 | **Example 1: Only README changed** |
| 103 | ``` |
| 104 | Files: README.md |
| 105 | → /commit-pro:docs |
| 106 | ``` |
| 107 | |
| 108 | **Example 2: New component + test** |
| 109 | ``` |
| 110 | Files: src/Button.tsx, src/Button.test.tsx |
| 111 | → /commit-pro:feat (primary is new feature) |
| 112 | ``` |
| 113 | |
| 114 | **Example 3: Fix in existing file** |
| 115 | ``` |
| 116 | Files: src/api/auth.ts |
| 117 | Diff contains: "fix login bug" |
| 118 | → /commit-pro:fix |
| 119 | ``` |