Create FasterCreate Faster

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.

→ Husky Documentation

Requires: Git repository

What create-faster adds

Beyond the official setup, we include:

Three Git Hooks:

  1. Pre-commit - Auto-format code before committing
  2. Commit-msg - Validate conventional commit format
  3. 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-verify to 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 files

Pre-Commit Hook:

# Detects package manager from lock files
# Runs {pm} run format if linter installed

Commit-Msg Hook:

# Validates: <type>(<scope>): <subject>
# Example: feat(auth): add email login
# Shows warning with emoji guide if invalid

Post-Commit Hook:

# Checks if formatting changed files
# Auto-amends commit if changes detected
# Uses --no-verify to prevent loop

On this page