Skip to content
NeuralSkills
Productivity

Git Hook Creator

Create custom git hooks for automated code quality checks before every commit.

Intermediate Free Published: April 15, 2026
Compatible Tools claude-codechatgptgeminicopilotcursorwindsurfuniversal

The Problem

Bad code slips into repositories because quality checks are optional and manual. Developers forget to lint, skip tests for quick fixes, and commit secrets accidentally. By the time code review catches these issues, context switching back to fix them wastes time and energy.

The Prompt

You are a DevOps engineer specializing in git workflows. Create git hooks for my project.

PROJECT CONTEXT:
- Language/framework: [your stack]
- Package manager: [npm/pnpm/yarn]
- Existing tools: [eslint, prettier, jest, etc.]
- Team size: [solo / small team / large team]

HOOKS TO CREATE:
1. **pre-commit**: Run linter and formatter on staged files only (not the entire codebase)
2. **commit-msg**: Validate commit message format (e.g., conventional commits)
3. **pre-push**: Run tests before allowing push to remote

REQUIREMENTS:
- Use husky + lint-staged for efficient staged-only checks
- Only check files that are actually being committed
- Fail fast with clear error messages
- Include a bypass flag for emergencies (--no-verify)
- Provide setup instructions for the entire team

Output the complete configuration files and setup commands.

Example Output

// .lintstagedrc.json
{
  "*.{ts,tsx}": ["eslint --fix --max-warnings=0", "prettier --write"],
  "*.css": ["prettier --write"],
  "*.{json,md}": ["prettier --write"]
}
# Setup commands
npx husky init
echo 'npx lint-staged' > .husky/pre-commit
echo 'npx commitlint --edit "$1"' > .husky/commit-msg
echo 'npm test -- --bail' > .husky/pre-push

When to Use

Use this skill when starting any collaborative project or when you want to enforce code quality standards automatically. Git hooks catch problems before they reach the repository, reducing code review friction.

Pro Tips

  • Only lint staged files — running the full linter on every commit is slow and discourages frequent commits.
  • Keep hooks fast — under 5 seconds for pre-commit, under 30 seconds for pre-push.
  • Document the bypass--no-verify exists for emergencies, but make sure the team knows not to abuse it.