setup-project
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSetup Project
项目搭建配置
Skill for auto-configuring new projects with standardized scripts and detecting available CLI tools.
Ver para tabla completa de CLIs y comandos de instalación.
references/cli-detection.md用于通过标准化脚本自动配置新项目并检测可用CLI工具的Skill。
查看获取完整的CLI列表及安装命令。
references/cli-detection.mdWhen 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
undefinedCheck 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 and analyze existing scripts:
package.jsonbash
cat package.json | grep -A 50 '"scripts"'Build the check script based on available scripts:
| Script Exists | Include in check |
|---|---|
| |
| |
| |
| |
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.jsonbash
cat package.json | grep -A 50 '"scripts"'根据现有脚本构建check脚本:
| 脚本是否存在 | 是否包含在check中 |
|---|---|
| |
| |
| |
| |
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:
| CLI | Installation Command |
|---|---|
| gh | |
| supabase | |
| vercel | |
| wrangler | |
| turso | |
| bun | |
| pnpm | |
| docker | |
Only show commands for missing CLIs.
如果存在未安装的CLI,询问用户:
"是否需要安装缺失的CLI?我可以为你展示安装命令。"
如果用户同意,展示安装命令表格:
| CLI | 安装命令 |
|---|---|
| gh | |
| supabase | |
| vercel | |
| wrangler | |
| turso | |
| bun | |
| pnpm | |
| 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:
- Suggest running skill
/github-actions - 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?"
如果用户同意:
- 建议运行Skill
/github-actions - 或者根据检测到的技术栈创建基础CI工作流
如果已存在工作流:
报告现有工作流:
GitHub Actions
==============
✓ 检测到工作流:
- ci.yml
- deploy.ymlPhase 6: Update/Create Project CLAUDE.md
阶段6:更新/创建项目CLAUDE.md
Check if CLAUDE.md exists in the project root:
bash
ls CLAUDE.md 2>/dev/nullIf 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
undefinedAvailable CLIs
可用CLI
The following CLI tools are available in this environment:
| CLI | Purpose |
|---|---|
| gh | GitHub operations (issues, PRs, releases) |
| bun | Fast JavaScript runtime and package manager |
| pnpm | Efficient package manager |
Only include CLIs that are installed.当前环境中可用的CLI工具如下:
| CLI | 用途 |
|---|---|
| gh | GitHub操作(issues、PRs、发布) |
| bun | 快速JavaScript运行时及包管理器 |
| pnpm | 高效包管理器 |
仅包含已安装的CLI。CLI Descriptions Reference
CLI描述参考
| CLI | Full Description |
|---|---|
| gh | GitHub CLI for issues, PRs, releases, and repo management |
| supabase | Supabase local development and database management |
| vercel | Vercel deployment and serverless functions |
| wrangler | Cloudflare Workers development and deployment |
| turso | Turso edge database CLI |
| bun | Fast JavaScript runtime, bundler, and package manager |
| pnpm | Fast, disk-efficient package manager |
| docker | Container runtime for development and deployment |
| CLI | 完整描述 |
|---|---|
| gh | 用于issues、PRs、发布及仓库管理的GitHub CLI |
| supabase | Supabase本地开发及数据库管理工具 |
| vercel | Vercel部署及无服务器函数管理工具 |
| wrangler | Cloudflare Workers开发及部署工具 |
| turso | Turso边缘数据库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信息