AgentSkillsCN

bootstrap-project

通过 CI/CD、预提交钩子以及框架最佳实践,为项目奠定坚实基础。当您新建项目、添加 CI 管道、配置 husky/lint-staged,或践行 Vercel 最佳实践时,可使用此技能。当您启动一个需要完善基础设施的新代码库时,也可触发“启动项目”、“设置 CI”、“添加预提交钩子”、“添加 husky”、“设置代码风格检查”、“添加代码覆盖率”、“项目搭建”等操作。

SKILL.md
--- frontmatter
name: bootstrap-project
description: Bootstrap a project with CI/CD, pre-commit hooks, and framework best practices. Use when setting up a new project, adding CI pipelines, configuring husky/lint-staged, or applying Vercel best practices. Triggers on "bootstrap project", "setup CI", "add pre-commit hooks", "add husky", "setup linting", "add code coverage", "project setup", or when starting a new codebase that needs infrastructure.

Project Bootstrap

Ensure a project has CI, pre-commit hooks, and framework best practices configured. Detect what exists, add what's missing.

Workflow

1. Detect Project State

Read package.json to determine:

  • Package manager (check for pnpm-lock.yaml, yarn.lock, bun.lockb/bun.lock, package-lock.json)
  • Existing scripts (lint, test, build, typecheck, format)
  • Existing devDependencies (husky, lint-staged, eslint, prettier, vitest, jest)
  • Framework (next, react, vue, svelte)

Check for existing config:

  • .github/workflows/ci.yml — CI already configured?
  • .husky/ — Husky already initialized?
  • Vercel skills already installed?

Report findings to user before making changes.

2. GitHub CI Workflow

Ensure .github/workflows/ci.yml exists with jobs for lint, typecheck, test with coverage, and build.

Read references/ci-workflow.md for the template and adaptation guide.

If a CI workflow already exists, diff it against requirements and only add missing steps. Do not overwrite existing workflows — merge into them.

Configure coverage thresholds in the test runner config (e.g., vitest.config.ts, jest.config.ts). LLM coding agents generate tests alongside code, so enforce high thresholds:

MetricThreshold
Statements80%
Branches80%
Functions80%
Lines80%

CI must fail if coverage drops below these thresholds. See references/ci-workflow.md for configuration examples.

3. Husky Pre-commit

Ensure husky and lint-staged are installed and configured with checks for lint, format, and typecheck.

Read references/husky-precommit.md for setup instructions.

Key decisions:

  • Include tests in pre-commit only if they run in <30s; otherwise CI-only
  • Typecheck runs as a separate hook step (not inside lint-staged)
  • lint-staged handles per-file lint + format

4. Vercel Best Practices

Install Vercel's agent skills for framework-specific guidance.

Read references/vercel-best-practices.md for details.

Skip if the project doesn't use Vercel or a Vercel-supported framework.

5. Verify

After setup, verify everything works:

bash
# Pre-commit hook fires correctly
git add -A && git commit --dry-run

# CI workflow is valid YAML
cat .github/workflows/ci.yml | python3 -c "import sys, yaml; yaml.safe_load(sys.stdin)"

# Scripts exist and run
<run-command> lint
<run-command> test
<run-command> build

Report results to user.

Missing Tooling

If the project lacks lint/format/test tooling, suggest and install sensible defaults:

ToolDefaultWhen
LintereslintNo linter configured
FormatterprettierNo formatter configured
Test runnervitestNo test runner configured
Typechecktsc --noEmitTypeScript project, no typecheck script

Ask the user before installing new tooling — do not assume.