/skills:add-pre-commit-checksfrom skills
Sets up pre-commit hooks with Husky and lint-staged to format staged files, type-check, and run related tests. Blocks broken commits while keeping doc-only changes fast.
Ships in skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A pre-commit hook should stop broken code before it lands while keeping doc edits fast.
Check the lockfile (pnpm-lock.yaml, yarn.lock, bun.lockb, or package-lock.json) to pick the package manager. Read package.json for prepare, typecheck, and test scripts, plus any existing .husky/ hooks, tsconfig files, or Prettier config.
Keep existing hooks such as .husky/commit-msg intact. If no Prettier config exists, ask the user before creating .prettierrc.
Install husky and lint-staged as dev dependencies (plus prettier if missing) using the repo's package manager.
Do not run husky init when .husky/pre-commit or a prepare script already exists, because it can overwrite both. Instead, add husky to prepare (extending an existing script with && husky), run husky through the package manager to configure git hooks, and create or extend .husky/pre-commit while keeping it executable.
Configure lint-staged in .lintstagedrc.json or package.json to format staged files and skip unknown types:
{
"*": "prettier --ignore-unknown --write"
}
Do not put tsc as a string task in lint-staged. Because lint-staged appends staged file paths to string tasks, tsc ignores tsconfig.json and breaks path aliases and compiler options.
In .husky/pre-commit, run lint-staged first. Then check staged file paths so doc-only commits such as README.md skip type-checking and tests:
set -e
pnpm exec lint-staged
staged=$(git diff --cached --name-only --diff-filter=ACMRD)
if printf '%s\n' "$staged" | grep -Eq '\.(ts|tsx|mts|cts|js|jsx)$'
then
pnpm exec tsc --noEmit -p tsconfig.json
pnpm test
fi
Adapt the package manager, tsconfig file, and test command to the repo. Run tsc --noEmit -p <project config> without passing filenames, or call the repo's project-wide typecheck script. If the test runner supports related-file mode (such as vitest related --run or jest --findRelatedTests), pass the staged code files to it, else run the fast test suite. Omit the test line if the repo has no test script and tell the user.
Test the real hook in a temporary git clone or worktree so you do not pollute the user's history:
git commit: the hook must fail and block the commit.tsconfig path alias (such as @/lib): the hook must pass and commit cleanly..husky/commit-msg) is still present and unchanged.README.md edit and time git commit: it must skip type-check and tests and finish in under 5 seconds.Clean up the temporary fixture and leave the repo ready without auto-committing.
Based on mattpocock/skills (MIT), rewritten by Copybook.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
24 skills in this plugin
/build-throwaway-prototypeUse when asked to prototype, spike, try an idea out quickly, sanity-check a state model or logic, or mock up what a UI should look like. Builds a throwaway prototype that answers one named design question from one command or one HTML file while leaving production code untouched. Not for building a finished production page (design-web-page)./check-current-docsUse when asked to use the latest docs, check if an API is still current, check which version the project is on, follow modern HTML or CSS best practices, or avoid outdated patterns; also when adding or changing code that calls a library pinned in the project, such as validation with a schema library. Reads the project lockfile and manifest, checks the official docs or browser guidance for the exact pinned versions, implements the current pattern without deprecated calls, and cites each choice with its URL, version, and date read. Not for moving existing code off an old API (migrate-off-deprecated-api)./check-live-deployUse when asked if a merge is live, if the deploy worked, or to check production after shipping and merging. Verifies that the canonical public URL serves the merged commit past any cache and that the change itself works live, reporting live, not live or unknown with evidence. Not for checking code before a merge (verify-work-done).npx claudepluginhub heyvhuang/copybook-skills --plugin skillsOther plugins' skills for the same job