commit-staged
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
Analyze these staged changes and generate commit message, then commit the changes:
!uv run prek run >/dev/null 2>&1 || git add -u
!git --no-pager status || true
!git --no-pager diff --cached || true
!git --no-pager diff --cached --stat || true
<user_notes> $ARGUMENTS </user_notes>
Commit message format
Follow conventional commits format (no footer, except for breaking change footer):
<type>(<scope>): <description>
[optional body]
Types
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- style: Code style changes (formatting, missing semicolons)
- refactor: Code refactoring
- test: Adding or updating tests
- chore: Maintenance tasks
Examples
Feature commit:
feat(auth): add JWT authentication
Implement JWT-based authentication system with:
- Login endpoint with token generation
- Token validation middleware
- Refresh token support
Bug fix:
fix(api): handle null values in user profile
Prevent crashes when user profile fields are null.
Add null checks before accessing nested properties.
Refactor:
refactor(database): simplify query builder
Extract common query patterns into reusable functions.
Reduce code duplication in database layer.
Commit message guidelines
DO:
- Use imperative mood ("add feature" not "added feature")
- Keep first line under 50 characters
- Capitalize first letter
- No period at end of summary
- Explain WHY not just WHAT in body
DON'T:
- Use vague messages like "update" or "fix stuff"
- Include technical implementation details in summary
- Write paragraphs in summary line
- Use past tense
Multi-file commits
When committing multiple related changes:
refactor(core): restructure authentication module
- Move auth logic from controllers to service layer
- Extract validation into separate validators
- Update tests to use new structure
- Add integration tests for auth flow
Breaking change: Auth service now requires config object
Scope Rules
Scope MUST identify WHERE in the codebase, NOT what type of change.
The scope is a module, component, or directory name - never a description of the change itself.
Determining Scope
-
Single module/directory: Use that module name
- Changes to
src/auth/*.py→auth - Changes to
plugins/gitlab-skill/→gitlab-skill
- Changes to
-
Multiple files in same area: Use the common parent
- Changes to
skills/python3-dev/assets/*.py→assetsorpython3-dev
- Changes to
-
Cross-cutting changes: Use the primary affected area OR omit scope
- Config + code changes → use primary area:
feat(auth): add OAuth support - Truly scattered changes → omit:
chore: update dependencies across modules
- Config + code changes → use primary area:
-
Root config files: Use the config type
pyproject.tomllinting rules →lintorruffpyproject.tomldependencies →deps.github/workflows/→ci
Scope Anti-Patterns
NEVER use these as scopes - they describe WHAT, not WHERE:
| ❌ Wrong | ✅ Correct | Why |
|---|---|---|
docs |
readme, api-docs, skills |
"docs" is a change type, not a location |
tests |
auth-tests, api |
Be specific about what's being tested |
types |
models, api |
Types belong to a module |
refactor |
(use as type, not scope) | "refactor" is a type, not a location |
bugfix |
(use fix as type) |
"bugfix" is a type, not a location |
Scope Examples
By domain:
feat(auth): add JWT authenticationfix(payments): handle currency conversionrefactor(users): extract validation logic
By layer:
feat(api): add user profile endpointfix(db): resolve connection pool leakchore(ci): update Node version to 20
By plugin/skill:
feat(gitlab-skill): add MR approval supportfix(python3-dev): correct shebang detectiondocs(commit-staged): clarify scope selection
Breaking changes
Indicate breaking changes clearly:
feat(api)!: restructure API response format
BREAKING CHANGE: All API responses now follow JSON:API spec
Previous format:
{ "data": {...}, "status": "ok" }
New format:
{ "data": {...}, "meta": {...} }
Migration guide: Update client code to handle new response structure
Template workflow
- Review changes:
git diff --staged - Identify type: Is it feat, fix, refactor, etc.?
- Determine scope: What part of the codebase?
- Write summary: Brief, imperative description
- Add body: Explain why and what impact
- Note breaking changes: If applicable
Interactive commit helper
Use git add -p for selective staging:
# Stage changes interactively
git add -p
# Review what's staged
git diff --staged
# Commit with message
git commit -m "type(scope): description"
Amending commits
Fix the last commit message:
# Amend commit message only
git commit --amend
# Amend and add more changes
git add forgotten-file.js
git commit --amend --no-edit
Best practices
- Atomic commits - One logical change per commit
- Test before commit - Ensure code works
- Reference issues - Include issue numbers if applicable
- Keep it focused - Don't mix unrelated changes
- Write for humans - Future you will read this
Commit message checklist
- Type is appropriate (feat/fix/docs/etc.)
- Scope identifies WHERE (module/directory), NOT what type of change
- Scope is NOT a banned word:
docs,tests,types,refactor,bugfix - Summary is under 50 characters
- Summary uses imperative mood
- Body explains WHY not just WHAT
- Breaking changes are clearly marked
- Related issue numbers are included
Finally, you will commit the changes with the generated commit message, without using --no-verify:
git commit -m "<commit-message>"
If you are blocked by a pre-commit or prek hook, you should stop, and announce your intended commit message, and that it was blocked, and requires a linting-agent to be run against the issues found.
More from jamie-bitflight/claude_skills
perl-lint
This skill should be used when the user asks to lint Perl code, run perlcritic, check Perl style, format Perl code, run perltidy, or mentions Perl Critic policies, code formatting, or style checking.
24brainstorming-skill
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or when users request help with ideation, marketing, and strategic planning. Explores user intent, requirements, and design before implementation using 30+ research-validated prompt patterns.
11design-anti-patterns
Enforce anti-AI UI design rules based on the Uncodixfy methodology. Use when generating HTML, CSS, React, Vue, Svelte, or any frontend UI code. Prevents "Codex UI" — the generic AI aesthetic of soft gradients, floating panels, oversized rounded corners, glassmorphism, hero sections in dashboards, and decorative copy. Applies constraints from Linear/Raycast/Stripe/GitHub design philosophy: functional, honest, human-designed interfaces. Triggers on: UI generation, dashboard building, frontend component creation, CSS styling, landing page design, or any task producing visual interface code.
7python3-review
Comprehensive Python code review checking patterns, types, security, and performance. Use when reviewing Python code for quality issues, when auditing code before merge, or when assessing technical debt in a Python codebase.
7hooks-guide
Cross-platform hooks reference for AI coding assistants — Claude Code, GitHub Copilot, Cursor, Windsurf, Amp. Covers hook authoring in Node.js CJS and Python, per-platform event schemas, inline-agent hooks and MCP in agent frontmatter, common JSON I/O, exit codes, best practices, and a fetch script to refresh docs from official sources. Use when writing, reviewing, or debugging hooks for any AI assistant.
7agent-creator
Create high-quality Claude Code agents from scratch or by adapting existing agents as templates. Use when the user wants to create a new agent, modify agent configurations, build specialized subagents, or design agent architectures. Guides through requirements gathering, template selection, and agent file generation following Anthropic best practices (v2.1.63+).
6