setup-project

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Setup Project

项目搭建配置

Skill for auto-configuring new projects with standardized scripts and detecting available CLI tools.
Ver
references/cli-detection.md
para tabla completa de CLIs y comandos de instalación.
用于通过标准化脚本自动配置新项目并检测可用CLI工具的Skill。
查看
references/cli-detection.md
获取完整的CLI列表及安装命令。

When to Use

使用场景

  • Starting work on a new project
  • User asks to "setup", "configurar", or "initialize" a project
  • User wants to check available CLI tools
  • User wants to add a "check" script to package.json
  • 开始处理新项目时
  • 用户要求“setup”、“配置”或“初始化”项目时
  • 用户想要检查可用的CLI工具时
  • 用户想要在package.json中添加“check”脚本时

Workflow

工作流程

Phase 1: Detect Project Type

阶段1:检测项目类型

Check for project indicators:
bash
undefined
检查项目标识文件:
bash
undefined

Check for Node/Bun project

检测Node/Bun项目

ls package.json 2>/dev/null && echo "Node/Bun project detected"
ls package.json 2>/dev/null && echo "Node/Bun project detected"

Check for Python project

检测Python项目

ls pyproject.toml 2>/dev/null && echo "Python project (pyproject.toml)" ls requirements.txt 2>/dev/null && echo "Python project (requirements.txt)"

| File Found | Project Type |
|------------|--------------|
| `package.json` | Node.js / Bun |
| `pyproject.toml` | Python (modern) |
| `requirements.txt` | Python (legacy) |
| None of above | Other (inform user) |

If no project type detected, inform the user:
> "No package.json, pyproject.toml, or requirements.txt found. This skill currently supports Node.js and Python projects."
ls pyproject.toml 2>/dev/null && echo "Python project (pyproject.toml)" ls requirements.txt 2>/dev/null && echo "Python project (requirements.txt)"

| 检测到的文件 | 项目类型 |
|------------|--------------|
| `package.json` | Node.js / Bun |
| `pyproject.toml` | Python(现代版) |
| `requirements.txt` | Python(旧版) |
| 无上述文件 | 其他类型(告知用户) |

如果未检测到项目类型,告知用户:
> "未找到package.json、pyproject.toml或requirements.txt文件。该Skill目前支持Node.js和Python项目。"

Phase 2: Add Check Script (Node.js only)

阶段2:添加Check脚本(仅Node.js项目)

For Node.js projects, read
package.json
and analyze existing scripts:
bash
cat package.json | grep -A 50 '"scripts"'
Build the check script based on available scripts:
Script ExistsInclude in check
lint
npm run lint
typecheck
npm run typecheck
test
npm run test
build
npm run build
Example check script compositions:
If all exist:
json
"check": "npm run lint && npm run typecheck && npm run test && npm run build"
If only lint and test exist:
json
"check": "npm run lint && npm run test"
If only build exists:
json
"check": "npm run build"
Add the check script to package.json using Edit tool.
对于Node.js项目,读取
package.json
并分析现有脚本:
bash
cat package.json | grep -A 50 '"scripts"'
根据现有脚本构建check脚本:
脚本是否存在是否包含在check中
lint
npm run lint
typecheck
npm run typecheck
test
npm run test
build
npm run build
Check脚本组合示例:
如果所有脚本都存在:
json
"check": "npm run lint && npm run typecheck && npm run test && npm run build"
如果仅存在lint和test:
json
"check": "npm run lint && npm run test"
如果仅存在build:
json
"check": "npm run build"
使用编辑工具将check脚本添加到package.json中。

Phase 3: Detect Installed CLIs

阶段3:检测已安装的CLI

Run detection for each CLI:
bash
which gh && echo "installed" || echo "not installed"
which supabase && echo "installed" || echo "not installed"
which vercel && echo "installed" || echo "not installed"
which wrangler && echo "installed" || echo "not installed"
which turso && echo "installed" || echo "not installed"
which bun && echo "installed" || echo "not installed"
which pnpm && echo "installed" || echo "not installed"
which docker && echo "installed" || echo "not installed"
Display results as a table:
CLI Detection Results
=====================

| Status | CLI | Description |
|--------|-----|-------------|
| ✓ | gh | GitHub CLI |
| ✓ | bun | Bun runtime |
| ✓ | pnpm | Fast package manager |
| ✗ | supabase | Supabase CLI |
| ✗ | vercel | Vercel CLI |
| ✗ | wrangler | Cloudflare Workers CLI |
| ✗ | turso | Turso database CLI |
| ✗ | docker | Docker container runtime |
运行以下命令检测每个CLI:
bash
which gh && echo "installed" || echo "not installed"
which supabase && echo "installed" || echo "not installed"
which vercel && echo "installed" || echo "not installed"
which wrangler && echo "installed" || echo "not installed"
which turso && echo "installed" || echo "not installed"
which bun && echo "installed" || echo "not installed"
which pnpm && echo "installed" || echo "not installed"
which docker && echo "installed" || echo "not installed"
以表格形式展示结果:
CLI检测结果
=====================

| 状态 | CLI | 描述 |
|--------|-----|-------------|
| ✓ | gh | GitHub CLI |
| ✓ | bun | Bun runtime |
| ✓ | pnpm | Fast package manager |
| ✗ | supabase | Supabase CLI |
| ✗ | vercel | Vercel CLI |
| ✗ | wrangler | Cloudflare Workers CLI |
| ✗ | turso | Turso database CLI |
| ✗ | docker | Docker container runtime |

Phase 4: Offer to Install Missing CLIs

阶段4:提供缺失CLI的安装选项

If any CLIs are missing, ask the user:
"Would you like to install the missing CLIs? I can show you the installation commands."
If user agrees, display installation table:
CLIInstallation Command
gh
brew install gh
supabase
brew install supabase/tap/supabase
vercel
npm i -g vercel
wrangler
npm i -g wrangler
turso
brew install tursodatabase/tap/turso
bun
curl -fsSL https://bun.sh/install | bash
pnpm
npm i -g pnpm
docker
brew install --cask docker
Only show commands for missing CLIs.
如果存在未安装的CLI,询问用户:
"是否需要安装缺失的CLI?我可以为你展示安装命令。"
如果用户同意,展示安装命令表格:
CLI安装命令
gh
brew install gh
supabase
brew install supabase/tap/supabase
vercel
npm i -g vercel
wrangler
npm i -g wrangler
turso
brew install tursodatabase/tap/turso
bun
curl -fsSL https://bun.sh/install | bash
pnpm
npm i -g pnpm
docker
brew install --cask docker
仅展示缺失CLI的安装命令。

Phase 5: Detect CI/CD Workflows

阶段5:检测CI/CD工作流

Check if GitHub Actions workflows exist:
bash
ls .github/workflows/*.yml 2>/dev/null || echo "NO_WORKFLOWS"
If no workflows found:
Ask the user:
"No hay workflows de GitHub Actions configurados. ¿Querés que configure CI básico para este proyecto?"
If user agrees:
  1. Suggest running
    /github-actions
    skill
  2. Or offer to create a basic CI workflow based on detected stack
If workflows exist:
Report existing workflows:
GitHub Actions
==============
✓ Workflows detected:
  - ci.yml
  - deploy.yml
检查是否存在GitHub Actions工作流:
bash
ls .github/workflows/*.yml 2>/dev/null || echo "NO_WORKFLOWS"
如果未找到工作流:
询问用户:
"未配置GitHub Actions工作流。是否需要为该项目配置基础CI?"
如果用户同意:
  1. 建议运行
    /github-actions
    Skill
  2. 或者根据检测到的技术栈创建基础CI工作流
如果已存在工作流:
报告现有工作流:
GitHub Actions
==============
✓ 检测到工作流:
  - ci.yml
  - deploy.yml

Phase 6: Update/Create Project CLAUDE.md

阶段6:更新/创建项目CLAUDE.md

Check if CLAUDE.md exists in the project root:
bash
ls CLAUDE.md 2>/dev/null
If CLAUDE.md exists:
  • Read it and add/update a "## Available CLIs" section with detected tools
  • Preserve existing content
If CLAUDE.md doesn't exist:
  • Create a minimal CLAUDE.md with:
    • Repository overview (ask user or infer from package.json/pyproject.toml)
    • Available CLIs section
    • Quick start commands
Available CLIs section template:
markdown
undefined
检查项目根目录是否存在CLAUDE.md:
bash
ls CLAUDE.md 2>/dev/null
如果CLAUDE.md已存在:
  • 读取文件并添加/更新“## 可用CLI”章节,填入检测到的工具
  • 保留现有内容
如果CLAUDE.md不存在:
  • 创建一个基础的CLAUDE.md,包含:
    • 仓库概述(询问用户或从package.json/pyproject.toml推断)
    • 可用CLI章节
    • 快速启动命令
可用CLI章节模板:
markdown
undefined

Available CLIs

可用CLI

The following CLI tools are available in this environment:
CLIPurpose
ghGitHub operations (issues, PRs, releases)
bunFast JavaScript runtime and package manager
pnpmEfficient package manager

Only include CLIs that are installed.
当前环境中可用的CLI工具如下:
CLI用途
ghGitHub操作(issues、PRs、发布)
bun快速JavaScript运行时及包管理器
pnpm高效包管理器

仅包含已安装的CLI。

CLI Descriptions Reference

CLI描述参考

CLIFull Description
ghGitHub CLI for issues, PRs, releases, and repo management
supabaseSupabase local development and database management
vercelVercel deployment and serverless functions
wranglerCloudflare Workers development and deployment
tursoTurso edge database CLI
bunFast JavaScript runtime, bundler, and package manager
pnpmFast, disk-efficient package manager
dockerContainer runtime for development and deployment
CLI完整描述
gh用于issues、PRs、发布及仓库管理的GitHub CLI
supabaseSupabase本地开发及数据库管理工具
vercelVercel部署及无服务器函数管理工具
wranglerCloudflare Workers开发及部署工具
tursoTurso边缘数据库CLI
bun快速JavaScript运行时、打包器及包管理器
pnpm快速、磁盘高效的包管理器
docker用于开发及部署的容器运行时

Output Summary

输出总结

At the end, provide a summary:
Setup Complete
==============

Project Type: Node.js
Check Script: Added to package.json
  - Includes: lint, typecheck, test, build

Available CLIs: 5/8
  - Installed: gh, bun, pnpm, docker, vercel
  - Missing: supabase, wrangler, turso

GitHub Actions: ✓ ci.yml detected
  (or: ✗ No workflows - run /github-actions to configure)

CLAUDE.md: Updated with available CLIs
最后,提供总结信息:
配置完成
==============

项目类型:Node.js
Check脚本:已添加至package.json
  - 包含:lint、typecheck、test、build

可用CLI:5/8
  - 已安装:gh、bun、pnpm、docker、vercel
  - 未安装:supabase、wrangler、turso

GitHub Actions:✓ 检测到ci.yml
  (或:✗ 无工作流 - 运行/github-actions进行配置)

CLAUDE.md:已更新可用CLI信息