·
Last changedVersion:
This version passed the hardening gate. Hardening applied 8 targeted changes and preserved all other text. Classified findings before hardening: 1. Classified findings closed: 0. Classified findings remaining: 1. Unclassified scanner findings remaining: 0. Review findings closed: 12. Review findings remaining: 1.
1
1
Expand | File | Group | Subtype | Severity | Status |
|---|---|---|---|---|---|
SKILL.md | Supply Chain & Install-Time Trust | — | Medium | Open |
1 finding
Confirm the current directory is inside a git repository and that package.json exists. If either check fails, stop and tell the user before installing anything.
Tell the user that the prepare script runs on every install and the pre-commit hook runs on every commit for all contributors, and continue only with their agreement.
Check for package-lock.json (npm), pnpm-lock.yaml (pnpm), yarn.lock (yarn), bun.lockb (bun). Use whichever is present. If no lockfile or more than one lockfile is found, ask the user which package manager to use. Keep a single lockfile, and use the detected package manager's command forms in every later step, including in place of npx.
Install as devDependencies:
Use the detected package manager's command for adding dev dependencies. Confirm the install succeeded and that husky and lint-staged are now listed as local devDependencies before continuing; if not, stop and tell the user. Report the installed versions to the user, and keep the lockfile so the exact versions are recorded. If the installed Husky version does not match the Husky v9+ assumption below, stop and tell the user.
First check for an existing prepare script in package.json, a custom git hooks path, an existing .husky/ dir or .husky/pre-commit file, and any existing lint-staged configuration (a config file or a lint-staged key in package.json). If any exist, show the user what init would replace, keep the existing prepare command alongside husky, keep prior hook commands, and get the user's confirmation before continuing.
Run only the locally installed binary from step 2. If npx would need to download a package, stop and tell the user.
This creates .husky/ dir and adds prepare: "husky" to package.json.
.husky/pre-commitWrite this file (no shebang needed for Husky v9+):
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. Before adding the typecheck and test lines, show the user the exact contents of those scripts from package.json. The hook must run lint-staged from the local install only. If a .husky/pre-commit file already exists, keep its prior commands and add these lines after confirming with the user.
.lintstagedrcIf a lint-staged configuration already exists, add this rule to it after the user confirms instead of creating a second file. This pattern lets Prettier rewrite every staged file it can parse; tell the user, offer to narrow the pattern to the file types the repo uses, and make sure a Prettier ignore file excludes lockfiles, build output and vendored directories.
.prettierrc (if missing)Only create if no Prettier config exists. Use these defaults:
.husky/pre-commit exists and is executable.lintstagedrc existsprepare script in package.json is "husky"prettier config existsnpx lint-staged to verify it works, using the local install only and after telling the user it will reformat staged filesCheck the working tree status first. Stage only the files this skill created or changed, by explicit path: package.json, the lockfile, .husky/pre-commit, .lintstagedrc, and .prettierrc if it was created. Leave any unrelated changes that already existed unstaged and tell the user about them. Show the staged diff, remind the user that the commit runs the typecheck and test scripts, and get the user's confirmation before committing with message: Add pre-commit hooks (husky + lint-staged + prettier)
This will run through the new pre-commit hooks: a good smoke test that everything works. If the hook fails, report the failing command and its output to the user and wait for their direction; keep the hooks active for the commit unless the user explicitly asks otherwise.
In the final summary, list the exact hook commands and explain that the hooks can be removed by deleting the .husky/ dir and the prepare script.
prettier --ignore-unknown skips files Prettier can't parse (images, etc.)Get started with chainctlchainctl skill install public/mattpocock/setup-pre-commit:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.chainreg.biz/public/github.com/mattpocock/skills/misc/setup-pre-commit:latest
MIT
HARDENING.md
LICENSE
SKILL.md
agents/openai.yaml