A collection of commands I find usefull in Claude Code
-
-
Save maddiesch/1c44160a55be4f6f6db30b074de6ab25 to your computer and use it in GitHub Desktop.
This command helps you create well-formatted commits with conventional commit messages and emoji.
To create a commit, just type:
/commit
With options:
/commit --main
/commit --wip
/commit --main --wip
With optional context:
/commit <context>
With both context and options:
/commit <context> --main
/commit <context> --wip
/commit <context> --main --wip
- ALWAYS check if on the
mainbranch using Bash(git branch --show-current 2>/dev/null) - If we are on
mainand the--mainflag is not set, ALWAYS ask the user if we should switch to a new branch. - Checks which files are staged with Bash(
git status) - If 0 files are staged, automatically adds all modified files with
git add . - Use @agent-git-diff-analyzer to summarize the current diff unless
--wipflag is provided - If
--wipflag is provided, skips commit splitting analysis and creates a single bulk work-in-progress commit - Otherwise analyzes the git-diff-analyzer agent's response to determine if multiple commits are needed
- If multiple distinct changes are detected (and
--wipnot used), suggests breaking the commit into multiple smaller commits - For each commit (or the single commit if not split), creates a commit message using emoji conventional commit format based on the actual diff content
- If a
<context>argument is provided, incorporates the human-supplied context into the commit message generation to provide additional clarity and reasoning for the changes
- Atomic commits: Each commit should contain related changes that serve a single purpose
- Split large changes: If changes touch multiple concerns, split them into separate commits
- Conventional commit format: Use the format
<type>: <description>where type is one of:feat: A new featurefix: A bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc)refactor: Code changes that neither fix bugs nor add featuresperf: Performance improvementstest: Adding or fixing testschore: Changes to the build process, tools, etc.
- Present tense, imperative mood: Write commit messages as commands (e.g., "add feature" not "added feature")
- Concise first line: Keep the first line under 72 characters
- Emoji: Each commit type is paired with an appropriate emoji:
- β¨
feat: New feature - π
fix: Bug fix - π
docs: Documentation - π
style: Formatting/style - β»οΈ
refactor: Code refactoring - β‘οΈ
perf: Performance improvements - β
test: Tests - π§
chore: Tooling, configuration - π
ci: CI/CD improvements - ποΈ
revert: Reverting changes - π§ͺ
test: Add a failing test - π¨
fix: Fix compiler/linter warnings - ποΈ
fix: Fix security issues - π₯
chore: Add or update contributors - π
refactor: Move or rename resources - ποΈ
refactor: Make architectural changes - π
chore: Merge branches - π¦οΈ
chore: Add or update compiled files or packages - β
chore: Add a dependency - β
chore: Remove a dependency - π±
chore: Add or update seed files - π©π»βπ»
chore: Improve developer experience - π§΅
feat: Add or update code related to multithreading or concurrency - ποΈ
feat: Improve SEO - π·οΈ
feat: Add or update types - π¬
feat: Add or update text and literals - π
feat: Internationalization and localization - π
feat: Add or update business logic - π±
feat: Work on responsive design - πΈ
feat: Improve user experience / usability - π©Ή
fix: Simple fix for a non-critical issue - π₯
fix: Catch errors - π½οΈ
fix: Update code due to external API changes - π₯
fix: Remove code or files - π¨
style: Improve structure/format of the code - ποΈ
fix: Critical hotfix - π
chore: Begin a project - π
chore: Release/Version tags - π§
wip: Work in progress - π
fix: Fix CI build - π
chore: Pin dependencies to specific versions - π·
ci: Add or update CI build system - π
feat: Add or update analytics or tracking code - βοΈ
fix: Fix typos - βͺοΈ
revert: Revert changes - π
chore: Add or update license - π₯
feat: Introduce breaking changes - π±
assets: Add or update assets - βΏοΈ
feat: Improve accessibility - π‘
docs: Add or update comments in source code - ποΈ
db: Perform database related changes - π
feat: Add or update logs - π
fix: Remove logs - π€‘
test: Mock things - π₯
feat: Add or update an easter egg - π
chore: Add or update .gitignore file - πΈ
test: Add or update snapshots - βοΈ
experiment: Perform experiments - π©
feat: Add, update, or remove feature flags - π«
ui: Add or update animations and transitions - β°οΈ
refactor: Remove dead code - π¦Ί
feat: Add or update code related to validation βοΈ feat: Improve offline support
- β¨
When analyzing the diff, consider splitting commits based on these criteria:
- Different concerns: Changes to unrelated parts of the codebase
- Different types of changes: Mixing features, fixes, refactoring, etc.
- File patterns: Changes to different types of files (e.g., source code vs documentation)
- Logical grouping: Changes that would be easier to understand or review separately
- Size: Very large changes that would be clearer if broken down
Good commit messages:
- β¨ feat: add user authentication system
- π fix: resolve memory leak in rendering process
- π docs: update API documentation with new endpoints
- β»οΈ refactor: simplify error handling logic in parser
- π¨ fix: resolve linter warnings in component files
- π§βπ» chore: improve developer tooling setup process
- π feat: implement business logic for transaction validation
- π©Ή fix: address minor styling inconsistency in header
- ποΈ fix: patch critical security vulnerability in auth flow
- π¨ style: reorganize component structure for better readability
- π₯ fix: remove deprecated legacy code
- π¦Ί feat: add input validation for user registration form
- π fix: resolve failing CI pipeline tests
- π feat: implement analytics tracking for user engagement
- ποΈ fix: strengthen authentication password requirements
- βΏοΈ feat: improve form accessibility for screen readers
Example of splitting commits:
- First commit: β¨ feat: add new solc version type definitions
- Second commit: π docs: update documentation for new solc versions
- Third commit: π§ chore: update package.json dependencies
- Fourth commit: π·οΈ feat: add type definitions for new API endpoints
- Fifth commit: π§΅ feat: improve concurrency handling in worker threads
- Sixth commit: π¨ fix: resolve linting issues in new code
- Seventh commit: β test: add unit tests for new solc version features
- Eighth commit: ποΈ fix: update dependencies with security vulnerabilities
The optional <context> argument allows you to provide additional human insight about:
- The business reasoning behind the changes
- Background context that may not be obvious from the code diff
- External factors that influenced the implementation
- Links to related issues, tickets, or discussions
- Performance or architectural considerations
This context will be incorporated into the commit message to provide future developers (including yourself) with better understanding of why changes were made.
--main: Commits directly to the main branch without switching to a new branch--wip: Creates a single bulk work-in-progress commit with all changes, skipping commit splitting analysis. The commit message will include a note indicating it's a bulk WIP commit.
- If specific files are already staged, the command will only commit those files
- The commit message will be constructed based on the actual diff content, not conversation context
- Always examine the full
git diff --stagedoutput to understand what is actually being committed - When
--wipis not used, the command will review the diff to identify if multiple commits would be more appropriate - If suggesting multiple commits, it will help you stage and commit the changes separately
- Always reviews the commit diff to ensure the message accurately reflects the actual code changes
Create a draft GitHub pull request using the GitHub CLI. This command analyzes the current branch changes, creates an appropriate PR title and description following the established guidelines, and opens a draft PR.
- Check the current git status and branch information
- Analyze all commits that will be included in the PR (from base branch divergence to HEAD)
- Check if a GitHub PR template exists in the repository (.github/pull_request_template.md or .github/PULL_REQUEST_TEMPLATE.md)
- Create a PR title in Title Case that summarizes the changes
- Generate a description that:
- Uses the GitHub PR template if available
- Otherwise follows the CLAUDE.md formatting rules:
- Describes changes in paragraph form (avoid bullet points unless necessary)
- Focuses on the "why" rather than "how"
- Assumes reader has deep codebase understanding
- Uses backticks for code references
- Uses sentence case for body text
- Don't include information other than descriptions of changes
- Create the branch using
ms/<branch-name>format if not already done - Push the branch to remote if needed
- Use
gh pr create --draftto create ONLY a draft PR - Include the Claude Code signature in the PR description
/create-pr
This will analyze the current branch and create a draft PR with an appropriate title and description based on the changes made.