Husky
Husky is a Git hooks manager that lets you run scripts at key moments in the Git workflow for quality assurance.
Presentation
Pre-configured Git hooks for automated formatting, conventional commit validation, and auto-amending formatted code.
Requires: Git repository
What create-faster adds
Beyond the official setup, we include:
Three Git Hooks:
- Pre-commit - Auto-format code before committing
- Commit-msg - Validate conventional commit format
- Post-commit - Auto-amend if formatter changed files
Smart Package Manager Detection:
- Detects bun, pnpm, npm, or yarn from lock files
- Defaults to bun if no lock file found
- Runs formatter only if Biome or similar is installed
Conventional Commits Validation:
- Enforces
<type>(<scope>): <subject>format - Accepted types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert,workflow,wip,security - Example:
feat(auth): add email login - Shows helpful emoji guide on invalid format
- Allows commit to proceed (warning, not error)
Auto-Amend Workflow:
- If pre-commit hook formats files, post-commit auto-amends
- Prevents "formatting" commits cluttering history
- Uses
--no-verifyto avoid infinite hook loop
Files created:
.husky/
├── pre-commit # Auto-format before commit
├── commit-msg # Validate conventional commit format
└── post-commit # Auto-amend if formatting changed filesPre-Commit Hook:
# Detects package manager from lock files
# Runs {pm} run format if linter installedCommit-Msg Hook:
# Validates: <type>(<scope>): <subject>
# Example: feat(auth): add email login
# Shows warning with emoji guide if invalidPost-Commit Hook:
# Checks if formatting changed files
# Auto-amends commit if changes detected
# Uses --no-verify to prevent loop
