setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), 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/typechecking/testing.
- License 许可
- MIT
- 最近更新
- 2026-07-05
- Stars
- ★ 7
- Forks
- 0
01 前言 Front Matter
- name
- setup-pre-commit
- description
- Set up Husky pre-commit hooks with lint-staged (Prettier), 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/typechecking/testing.
02 资源文件 1
- 参考文档README.md2.5 KB
03 SKILL.md 正文
Setup Pre-Commit Hooks
What This Sets Up
- Husky pre-commit hook
- lint-staged running Prettier on all staged files
- Prettier config (if missing)
- 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 prettier
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
{
"*": "prettier --ignore-unknown --write"
}
6. Create .prettierrc (if missing)
Only create if no Prettier config exists. Use these defaults:
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
7. Verify
- [ ]
.husky/pre-commitexists and is executable - [ ]
.lintstagedrcexists - [ ]
preparescript in package.json is"husky" - [ ]
prettierconfig exists - [ ] Run
npx lint-stagedto verify it works
8. Commit
Stage all changed/created files and commit 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.
Notes
- Husky v9+ doesn't need shebangs in hook files
prettier --ignore-unknownskips files Prettier can't parse (images, etc.)- The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests
04 同仓库更多 Skills
static-project-gallery-upload
Use when a user provides project/portfolio/gallery images for a static website and wants them displayed on the site, exact duplicate images removed, visually related building views kept together, images optimized, and a host upload folder such as "UP FILE" prepared. Triggers include Persian requests like "عکس پروژه ها", "تکراری نباشن", "توی سایت نمایش داده بشن", "فایل های هاست", "UP FILE".
contact-location-section
暂无简介
azerbaijan-website-build
Build premium tri-lingual websites from scratch for Azerbaijani businesses. Handles data gathering (website scrape, social media, or interview), brand development, and full Astro + Tailwind build with AZ/RU/EN language support.
local-business-rebuild
Build a stunning new website for a local business prospect. Adapted from the full website-rebuild skill but optimized for speculative local business pitches. 10-phase process: brand extraction, SEO audit, design audit, rebuild plan, full build with design system, copy optimization, combined QA, pre-deploy checklist, and output to monorepo. Uses scraped content from prospect-scrape as input. No tools/calculator research phase. Single combined QA round. Triggers on: "rebuild prospect", "local business rebuild", "build prospect site", "rebuild their site", "prospect rebuild", or any request to build a new website for a qualified prospect.
website-rebuild
Full website rebuild agent. Takes an existing website URL and rebuilds it from scratch into a world-class, SEO-optimized, WCAG AA accessible, visually stunning website using Astro + Tailwind CSS, deployed to Vercel via GitHub. Executes a rigorous 14-phase process: brand extraction, content scraping, SEO audit, design audit, rebuild planning, full build with design system, copy optimization, 3 QA rounds, competitive tools research, tools build, tools QA, pre-deploy checklist, and Vercel deployment. Produces 11+ documentation deliverables. Triggers on: "rebuild website", "redesign website", "rebuild site from URL", "website rebuild", "redo this website", "make this website better", "rebuild from scratch", "full site redesign", or any request to take an existing URL and create a new, professional website from it. Also triggers when the user provides a URL and asks to build/create/design a new version of that site.
triage
Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.