commit-detection
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
More from fusengine/agents
solid-php
SOLID principles for Laravel 12 and PHP 8.5. Files < 100 lines, interfaces separated, PHPDoc mandatory. Auto-detects Laravel and FuseCore architecture.
51tailwindcss-v4
Tailwind CSS v4.1 core features, @theme, directives, migration guide
46laravel-api
Build RESTful APIs with Laravel using API Resources, Sanctum authentication, rate limiting, and versioning. Use when creating API endpoints, transforming responses, or handling API authentication.
46nextjs-zustand
Zustand v5 state management for Next.js 16 App Router. Use when implementing global state, stores, persist, hydration, or client-side state in Client Components.
43cve-research
Research CVEs and security advisories for project dependencies. Uses Exa, NVD API, OSV.dev, and GitHub Advisory Database to find known vulnerabilities.
42laravel-permission
Spatie Laravel Permission - roles, permissions, middleware, Blade directives, teams, wildcards, super-admin, API, testing. Use when implementing RBAC, role-based access control, or user authorization.
39