-
Notifications
You must be signed in to change notification settings - Fork 1
Hooks Reference
Complete reference for all available hooks in Claude Hooks Manager.
Pre-commit hooks run before a commit is created. They can prevent commits that don't meet quality standards.
Purpose: Ensures consistent code formatting across the project.
Supported Tools:
- Prettier
- ESLint (with --fix)
- Black (Python)
- rustfmt (Rust)
Configuration:
{
"format-check": {
"prettier": true,
"eslint": true,
"extensions": ["js", "jsx", "ts", "tsx", "json", "css", "md"]
}
}
Example:
claude-hooks install format-check
Purpose: Runs linting tools on staged files to catch potential issues.
Supported Tools:
- ESLint
- TSLint
- Pylint
- RuboCop
Configuration:
{
"lint-check": {
"eslint": {
"fix": false,
"maxWarnings": 10
},
"failOnWarning": false
}
}
Purpose: Runs tests related to changed files before committing.
Features:
- Only runs tests for modified files
- Supports watch mode integration
- Configurable test patterns
Configuration:
{
"test-check": {
"pattern": "**/*.test.{js,jsx,ts,tsx}",
"coverage": true,
"bail": true
}
}
Purpose: Performs TypeScript or Flow type checking on staged files.
Configuration:
{
"type-check": {
"typescript": true,
"strict": true,
"skipLibCheck": true
}
}
Purpose: Scans for security vulnerabilities in dependencies and code.
Features:
- Dependency vulnerability scanning
- Secret detection
- Security best practices checking
Configuration:
{
"security-check": {
"auditLevel": "moderate",
"scanSecrets": true,
"excludePaths": ["test/", "docs/"]
}
}
These hooks run after you write a commit message but before the commit is finalized.
Purpose: Enforces conventional commit message format.
Format: type(scope): subject
Valid Types:
-
feat
: New feature -
fix
: Bug fix -
docs
: Documentation changes -
style
: Code style changes -
refactor
: Code refactoring -
test
: Test updates -
chore
: Maintenance tasks
Configuration:
{
"commit-format": {
"types": ["feat", "fix", "docs", "style", "refactor", "test", "chore"],
"maxLength": 72,
"requireScope": false
}
}
Purpose: Enhances commit messages using Claude AI.
Features:
- Analyzes staged changes
- Suggests improved commit messages
- Maintains conventional format
- Adds context and clarity
Configuration:
{
"ai-commit-msg": {
"style": "conventional",
"maxLength": 72,
"includeContext": true,
"interactive": true
}
}
Purpose: Checks commit messages for spelling errors.
Configuration:
{
"spell-check-msg": {
"language": "en-US",
"customDictionary": [".claude-hooks/dictionary.txt"],
"ignoreUrls": true
}
}
Pre-push hooks run before code is pushed to a remote repository.
Purpose: Runs the full test suite before pushing.
Features:
- Parallel test execution
- Coverage reporting
- Performance benchmarks
Configuration:
{
"test-suite": {
"parallel": true,
"coverage": {
"threshold": 80,
"reportDir": "coverage/"
},
"timeout": 300000
}
}
Purpose: Ensures the project builds successfully before pushing.
Configuration:
{
"build-check": {
"command": "npm run build",
"checkSize": true,
"maxSize": "500kb",
"failOnWarning": true
}
}
Purpose: Validates documentation before pushing.
Features:
- Checks for broken links
- Validates markdown syntax
- Ensures API docs are updated
Configuration:
{
"doc-check": {
"checkLinks": true,
"validateMarkdown": true,
"requiredFiles": ["README.md", "CHANGELOG.md"]
}
}
These hooks run after a commit is created.
Purpose: Sends notifications about commits to team channels.
Configuration:
{
"notify-team": {
"slack": {
"webhook": "https://hooks.slack.com/...",
"channel": "#commits"
},
"includeStats": true
}
}
Purpose: Automatically updates CHANGELOG.md based on commits.
Configuration:
{
"update-changelog": {
"file": "CHANGELOG.md",
"format": "keepachangelog",
"unreleased": true
}
}
Purpose: Runs custom scripts as hooks.
Configuration:
{
"script-runner": {
"pre-commit": "./scripts/pre-commit.sh",
"commit-msg": "node ./scripts/validate-commit.js"
}
}
claude-hooks install format-check lint-check type-check test-check commit-format
claude-hooks install format-check lint-check test-check commit-format
claude-hooks install spell-check-msg doc-check commit-format
{
"global": {
"skipCI": true,
"verbose": false,
"parallel": true,
"timeout": 60000
}
}
{
"hooks": {
"test-check": {
"enabled": true,
"skipCI": false,
"timeout": 120000
}
}
}
- Use Parallel Execution: Enable for hooks that support it
- Configure Timeouts: Set appropriate timeouts for long-running hooks
-
Skip in CI: Use
skipCI
for hooks that duplicate CI checks - Selective Running: Configure hooks to only check relevant files