| name | pre-commit-setup |
| version | 1.0.0 |
| description | Set up cross-language pre-commit hooks for any git repository — auto-formatting,
linting, type-checking, secret scanning, large-file detection, and Conventional Commit
message checks. Detects which languages the repo uses (Node.js / TypeScript, Python,
PHP, Java, Go, Rust, Ruby, Shell, generic) and wires the right hooks via the universal
pre-commit framework, with an optional Husky + lint-staged + Prettier track for
pure-Node repos. Use whenever the user wants to add pre-commit hooks, set up husky,
install pre-commit, configure lint-staged, run formatting/linting/typecheck/tests on
commit, scan for secrets at commit time, enforce conventional commits, or hits you with
phrases like 'set up pre-commit', 'add husky', 'wire up commit hooks', 'block secrets at
commit', 'make my repo lint on commit', or 'configure git hooks'.
|
| license | MIT |
| compatibility | claude-code opencode |
| allowed-tools | ["Read","Write","Edit","Grep","Glob","Bash"] |
| metadata | {"author":"MKAbuMattar"} |
Pre-commit setup
Wire pre-commit hooks into any git repo. Default to the universal pre-commit framework (works for any language); use Husky + lint-staged for pure-Node repos when the user explicitly asks. Always cover formatting, linting, type-checking (where applicable), secret scanning, and Conventional Commits.
When to use
- The user asked to set up pre-commit hooks, install husky, configure lint-staged, or wire up commit-time checks.
- A new repo is being bootstrapped and you're standardizing the dev experience.
- An existing repo has commit-time issues (secrets leaked, lint fails after merge, large files committed) and the user wants prevention.
- A monorepo or polyglot repo needs a single pre-commit configuration that covers multiple languages.
Skip this skill for: repos that already have a working pre-commit configuration the user is happy with (touch only with explicit ask), build-time CI checks (those belong in CI, not pre-commit), or pre-push hooks (different lifecycle).
Required outcome
After this runs, a fresh git commit in the repo must:
- Auto-format staged files (Prettier / Black / gofmt / etc., per language).
- Lint staged files (ESLint / Ruff / PHPStan / Checkstyle / golangci-lint / etc.).
- Run type checks (where the language supports them).
- Scan for secrets and large files.
- Validate the commit message format (Conventional Commits).
- Block the commit on any failure with a readable error.
- Be fast — the full pre-commit run should be under ~10 seconds for typical changes.
Workflow
- Verify a git repo.
git rev-parse --is-inside-work-tree. If not, ask whether to git init or stop.
- Detect languages. Run
bash scripts/detect-languages.sh or do the equivalent: check for package.json, pyproject.toml / requirements.txt / setup.py, composer.json, pom.xml / build.gradle*, go.mod, Cargo.toml, Gemfile, *.sh files. Multiple matches → multi-language.
- Pick the framework:
- Default → universal
pre-commit framework (pre-commit.com). Works for any language, has thousands of hook integrations. Load .