setup-pre-commitlisted
Install: claude install-skill chrislacey89/skills
# Setup Pre-Commit Hooks
## Invocation Position
This is an infrastructure skill, not a normal feature-delivery stage.
Use `/setup-pre-commit` when a project needs commit-time formatting, linting, type checking, and test hooks.
Do not use it as part of the default feature pipeline. It prepares the repo so later `/execute` and `/pre-merge` steps have stronger feedback loops.
## What This Sets Up
- **Lefthook** for git hook management (fast, zero-dependency, config-as-code)
- **Formatting + linting** on staged files (Biome preferred; Prettier, ESLint, or others supported)
- **Typecheck** and **test** scripts in the pre-commit hook
## Steps
### 1. Detect Package Manager
Check for `pnpm-lock.yaml` (pnpm), `package-lock.json` (npm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whichever is present. Default to npm if unclear.
Store the detected package manager — it's used for all install and run commands below.
### 2. Detect Existing Formatter/Linter
Before installing anything, check what's already in the project:
```bash
# Check package.json for existing tools
cat package.json | grep -E "biome|prettier|eslint|oxlint|dprint" 2>/dev/null
# Check for config files
ls biome.json biome.jsonc .prettierrc .prettierrc.* prettier.config.* .eslintrc* eslint.config.* 2>/dev/null
```
**If an existing formatter/linter is detected:** use it. Don't install a competing tool.
**If nothing is detected:** recommend Biome (single tool for formatting + linting, fast, zero-config defaults) a