Skill v1.0.0
currentAutomated scan100/100name: commit-guidelines description: > Help users write excellent git commit messages following Conventional Commits for JavaScript and TypeScript projects. Use this skill whenever a user asks to write a commit message, improve a commit, stage changes, or summarize what to commit — even if they just say "help me commit this", "what should my commit say", "write a commit for these changes", or "is this a good commit message". Also trigger when reviewing staged files or a diff and the user wants to structure their commits well. Covers message format, scope, granularity, and when to split commits. metadata: version: "1.0.0"
Commit Guidelines Skill (JavaScript / TypeScript)
Help users write clear, consistent git commit messages using Conventional Commits.
The Format
<type>(<scope>): <short summary>[optional body][optional footer(s)]
Types
| Type | When to use | |
|---|---|---|
feat | New feature or capability | |
fix | Bug fix | |
docs | Documentation only | |
style | Formatting, whitespace (no logic change) | |
refactor | Code change with no feature/bug change | |
perf | Performance improvement | |
test | Adding or correcting tests | |
build | Build system, npm scripts, dependencies | |
ci | CI/CD configuration (GitHub Actions, etc.) | |
chore | Tooling, config, non-src changes | |
revert | Reverts a prior commit |
Breaking changes: Append ! to the type:
feat(api)!: remove deprecated v1 auth endpoints
Scopes for JS/TS Projects
Use scopes that reflect your project's actual structure. Common patterns:
By layer: feat(api): fix(db): refactor(ui): fix(middleware):
By feature/domain: feat(auth): fix(checkout): perf(search): test(dashboard):
By tooling: build(webpack): ci(github-actions): chore(eslint): build(tsconfig):
By framework area: fix(hooks): refactor(components): perf(context): test(reducers):
Tip: pick a scope convention and keep it consistent across the team.
Subject Line Rules
- 50 chars or fewer (hard limit: 72)
- Imperative mood: "add" not "added" / "adds"
- No period at the end
- Capitalize first word after the colon
- Say what changed, not that something changed
JS/TS Examples — Bad → Good
| ❌ Bad | ✅ Good | ||
|---|---|---|---|
fix types | `fix(auth): correct return type on getUser to User \ | null` | |
update deps | build: upgrade TypeScript to 5.4 and fix type errors | ||
refactor stuff | refactor(cart): extract price calculation into usePricing hook | ||
WIP | feat(search): add debounced filtering for product list | ||
fix bug in login | fix(auth): prevent redirect loop when session token expires | ||
async fix | fix(api): await Promise.all instead of sequential fetches | ||
lint | style: apply eslint --fix across src directory | ||
add tests | test(checkout): add coverage for failed payment state |
Writing the Body
Add a body when the why isn't obvious. Skip it for simple, self-explanatory changes.
Wrap at 72 chars. Explain what and why — not how.
perf(table): virtualize row rendering for large datasetsThe DataTable was rendering all rows on mount, causing 3–5s load timeswith 10k+ rows. Switched to react-window for windowed rendering.Reduces initial DOM nodes from ~10k to ~50 visible rows.
fix(hooks): add cleanup to useWebSocket to prevent memory leakThe previous implementation didn't close the WebSocket on unmount,causing errors in tests and potential leaks in long-running sessions.Added return function to useEffect to call ws.close().
Footers
feat(auth): add OAuth2 login via GoogleCloses #142Co-authored-by: Jane Smith <jane@example.com>
Breaking change footer:
refactor(api)!: rename userId to accountId across all endpointsBREAKING CHANGE: All API consumers must update request payloadsand response handling to use `accountId` instead of `userId`.
Commit Granularity
One logical change per commit. Ask: "If I reverted just this, would it make sense?"
Split when:
- Summary needs "and" to describe two separate things
- A dependency bump is mixed with feature code
- A refactor is mixed with a new feature
- Type fixes are mixed with logic changes
JS/TS-specific splitting guidance:
# ❌ One messy commitfix: update deps, fix login bug, and add type for UserProfile# ✅ Three clean commitsbuild: upgrade axios to 1.6.8fix(auth): handle expired token in login redirectfeat(types): add UserProfile interface to shared types
Workflow: Writing a Commit from a Diff
- What changed? Identify the logical unit of work.
- Type: Is it a fix, feat, refactor, build?
- Scope: Which module, hook, component, or domain?
- Subject: Imperative, specific, ≤50 chars.
- Body needed? Is the why non-obvious?
- Footers: Issue refs, breaking changes, co-authors.
- Split needed? Multiple concerns → multiple commits.
Provide the message in a code block, ready to copy:
fix(hooks): add cleanup function to useEventListenerWithout cleanup, each render was adding a new listener without removingthe old one, causing duplicate handlers and memory leaks.Closes #87
Quick Reference
feat(scope): New featurefix(scope): Bug fixrefactor(scope): Restructure, no behavior changeperf(scope): Performance improvementtest(scope): Add or fix testsbuild: Deps, npm scripts, tsconfig, webpackci: GitHub Actions, CI configstyle: Lint/format only, no logicdocs: README, JSDoc, commentschore: Misc tooling, config, cleanup