add-bead
免费Capture free-text work as a tracked Beads issue. Use when the user runs /add-bead or wants to quickly file a Beads issue.
中文简介正在准备中。当前显示原文说明。
Set up repository-local Husky pre-commit hooks with lint-staged, Prettier, and optional typecheck/test gates. Use when a user asks to add pre-commit hooks, configure lint-staged, enforce staged formatting, or add commit-time checks.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Guides a safe, repo-aware pre-commit setup. This skill is guidance-first: inspect the target repository, explain the planned changes, and only mutate dependency, hook, package, lint-staged, or Prettier files after the user approves that setup.
.husky/pre-commit hooktypecheck and test commands only when the target package.json already defines those scriptsWork from the target repo root, then inspect existing package and config state before proposing commands:
git status --short
node -e "const fs=require('fs'); const p=JSON.parse(fs.readFileSync('package.json','utf8')); process.stdout.write(JSON.stringify({packageManager:p.packageManager||null,scripts:p.scripts||{}}, null, 2)+'\n');"
node -e "const fs=require('fs'); const files=['bun.lock','bun.lockb','pnpm-lock.yaml','yarn.lock','package-lock.json','.lintstagedrc','.lintstagedrc.json','.lintstagedrc.js','lint-staged.config.js','.prettierrc','.prettierrc.json','.prettierrc.js','prettier.config.js','prettier.config.cjs','prettier.config.mjs']; process.stdout.write(files.filter((f)=>fs.existsSync(f)).join('\n')+'\n');"
Stop and ask before editing if the repo has unrelated dirty changes, multiple package managers, or an existing hook/config whose intent is unclear.
Prefer the packageManager field in package.json, then lockfiles:
| Signal | Package manager |
|---|---|
packageManager starts with bun or bun.lock / bun.lockb exists | Bun |
packageManager starts with pnpm or pnpm-lock.yaml exists | pnpm |
packageManager starts with yarn or yarn.lock exists | Yarn |
packageManager starts with npm or package-lock.json exists | npm |
If there is no clear signal, default to npm only after telling the user that no lockfile or package-manager pin was found.
Use exactly one command for the detected package manager:
| Package manager | Command |
|---|---|
| Bun | bun add --dev husky lint-staged prettier |
| pnpm | pnpm add --save-dev husky lint-staged prettier |
| Yarn | yarn add --dev husky lint-staged prettier --non-interactive |
| npm | npm install --save-dev husky lint-staged prettier --yes |
Do not run these commands while porting this skill. Run them only when applying the skill to a target repo with user approval.
After dependencies are installed, initialize Husky with the detected package manager:
| Package manager | Command |
|---|---|
| Bun | bunx --bun husky init |
| pnpm | pnpm exec husky init |
| Yarn | yarn exec husky init |
| npm | npx --yes husky init |
Husky v9+ creates .husky/pre-commit and usually adds prepare: "husky" to package.json. Preserve an existing prepare script by combining commands only if the user approves the exact package script change.
.husky/pre-commitThe hook must run lint-staged first, then only the package scripts that already exist. Do not add failing placeholder lines for missing scripts.
| Package manager | lint-staged line | Existing typecheck script | Existing test script |
|---|---|---|---|
| Bun | bunx --bun lint-staged | bun run typecheck | bun run test |
| pnpm | pnpm exec lint-staged | pnpm run typecheck | pnpm run test |
| Yarn | yarn exec lint-staged | yarn run typecheck | yarn run test |
| npm | npx --no-install lint-staged | npm run typecheck | npm run test |
Example for a Bun repo that has both scripts:
bunx --bun lint-staged
bun run typecheck
bun run test
If the repo lacks typecheck or test, omit that line and tell the user which check was skipped.
Respect existing config:
package.json config style if the repo already keeps tool config there; otherwise use .lintstagedrc.json.{
"*": "prettier --ignore-unknown --write"
}
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
prettier --ignore-unknown lets staged binary or unsupported files pass without parse failures.
Run only commands that match the detected package manager and existing scripts:
git status --short
.husky/pre-commit exists and contains the selected lint-staged line.package.json has a valid Husky prepare script without clobbering previous behavior.When the user is ready to commit the setup, use the normal commit as the smoke test:
git add package.json .husky/pre-commit .lintstagedrc.json .prettierrc
git commit -m "chore: add pre-commit checks"
Adjust the git add paths to the files actually changed. Do not create an empty or throwaway commit just to test the hook, and do not run a commit smoke test unless the user explicitly wants the setup committed.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Capture free-text work as a tracked Beads issue. Use when the user runs /add-bead or wants to quickly file a Beads issue.
中文简介正在准备中。当前显示原文说明。
Register a new sub-repo in the knowledge base.
中文简介正在准备中。当前显示原文说明。
Add focused Bun unit tests for mission-critical behavior and edge cases — not blanket coverage.
中文简介正在准备中。当前显示原文说明。
Answer questions about the codebase from knowledge files. Use when the user runs /ask or asks a domain/knowledge question about the repos.
中文简介正在准备中。当前显示原文说明。
Meta-skill for creating Agent Forge skills under .claude/skills/ with SKILL.md, optional references/ and scripts/, and Bun scaffolds. Use when the user wants to add or author a skill, scaffold a new skill folder, or align skill docs with harness conventions (JSON script output, Beads for tasks).
中文简介正在准备中。当前显示原文说明。
Choose Beads issue priority (P0–P4, numeric, or named) from urgency, impact, and risk when creating or triaging work.
中文简介正在准备中。当前显示原文说明。