Skip to content
Back to skills

Generate Precommit Hooks

ASecurity

Detect project type and set up appropriate pre-commit hooks

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentsjavascripttypescriptpythonrustgojavanodegit

Works with

  • cli

Security analysis

A100/100

Scanned September 2, 2026

npx -y skills add ADWilkinson/claude-code-tools --skill generate-precommit-hooks --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Generate Precommit Hooks?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Generate Precommit Hooks
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adwilkinson-generate-precommit-hooks/badge)](https://www.skillsdirectory.com/skills/adwilkinson-generate-precommit-hooks)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: generate-precommit-hooks
author: Andrew Wilkinson (github.com/ADWilkinson)
description: Detect project type and set up appropriate pre-commit hooks
disable-model-invocation: true
---

# Generate Pre-commit Hooks

Analyze the current project and generate appropriate pre-commit hooks based on the tech stack.

## Instructions

1. **Detect project type** by checking for:
   - `package.json` (Node/TypeScript/JavaScript)
   - `Cargo.toml` (Rust)
   - `pyproject.toml` or `requirements.txt` (Python)
   - `go.mod` (Go)
   - `foundry.toml` (Solidity/Foundry)
   - `hardhat.config.js/ts` (Solidity/Hardhat)

2. **Check existing setup**:
   - Look for `.husky/` directory
   - Check for `lint-staged` config in package.json
   - Check for `.pre-commit-config.yaml`
   - Check for existing git hooks in `.git/hooks/`

3. **Generate appropriate hooks** based on project:

   **Node/TypeScript projects:**
   - Install husky + lint-staged if not present
   - Add pre-commit: lint-staged (eslint, prettier)
   - Add pre-push: type-check, tests
   - Configure lint-staged in package.json

   **Python projects:**
   - Create `.pre-commit-config.yaml`
   - Add: ruff (format + lint), mypy, pytest
   - Run `pre-commit install`

   **Rust projects:**
   - Create `.cargo/config.toml` with rustfmt settings if needed
   - Add git hook for: cargo fmt --check, cargo clippy, cargo test

   **Go projects:**
   - Add git hook for: gofmt, go vet, go test

   **Solidity/Foundry projects:**
   - Add git hook for: forge fmt --check, forge build, forge test

4. **Install and test**:
   - Run the installation commands
   - Make a test commit to verify hooks work
   - Show the user what was set up

## Example Output

After generating hooks, provide:
- Summary of what was installed
- How to skip hooks if needed (`git commit --no-verify`)
- How to modify the configuration

## Usage

```
/generate-precommit-hooks
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.