agentsclimarketplace

Setup pre commit

Skill mauriciovieira/skills/skills/misc/setup-pre-commit

Skills for real engineers - not vibe coding

Install
npx -y skills add mauriciovieira/skills --skill setup-pre-commit

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Set up Husky pre-commit hooks with lint-staged (Biome), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/linting/typechecking/testing.

SKILL.md

3.1 KB, as published. Nobody here has run it

Setup Pre-Commit Hooks

What This Sets Up

  • Husky pre-commit hook
  • lint-staged running Biome on all staged files
  • Biome config (if missing) — formatter + linter, replaces Prettier + ESLint
  • typecheck and test scripts in the pre-commit hook

Steps

1. Detect package manager

Check for package-lock.json (npm), pnpm-lock.yaml (pnpm), yarn.lock (yarn), bun.lockb (bun). Use whichever is present. Default to npm if unclear.

2. Install dependencies

Install as devDependencies:

husky lint-staged @biomejs/biome

3. Initialize Husky

npx husky init

This creates .husky/ dir and adds prepare: "husky" to package.json.

4. Create .husky/pre-commit

Write this file (no shebang needed for Husky v9+):

npx lint-staged
npm run typecheck
npm run test

Adapt: Replace npm with detected package manager. If repo has no typecheck or test script in package.json, omit those lines and tell the user.

5. Create .lintstagedrc

{
  "*": "biome check --write --no-errors-on-unmatched"
}

biome check formats and lints. --write applies safe fixes; --no-errors-on-unmatched stops Biome erroring when a staged file isn't a type it handles (images, etc.).

6. Create biome.json (if missing)

Only create if no Biome config exists (biome.json or biome.jsonc). Use these defaults:

{
  "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 80
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "double",
      "trailingCommas": "es5",
      "semicolons": "always",
      "arrowParentheses": "always"
    }
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  },
  "assist": {
    "actions": {
      "source": {
        "organizeImports": "on"
      }
    }
  }
}

Pin the $schema version to the installed Biome version (check npx biome --version) so the config matches the binary.

7. Verify

  • .husky/pre-commit exists and is executable
  • .lintstagedrc exists
  • prepare script in package.json is "husky"
  • biome.json config exists
  • Run npx lint-staged to verify it works

8. Commit

Stage all changed/created files and commit with message: Add pre-commit hooks (husky + lint-staged + biome)

This will run through the new pre-commit hooks — a good smoke test that everything works.

Notes

  • Husky v9+ doesn't need shebangs in hook files
  • biome check does formatting and linting in one pass — no separate Prettier/ESLint steps
  • --no-errors-on-unmatched skips files Biome can't handle (images, etc.) instead of failing the commit
  • The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.