auto-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Auto Setup

自动设置

Detect project type and configure pro-workflow quality gates automatically.
检测项目类型并自动配置专业工作流质量门禁。

Trigger

触发条件

Use when:
  • Starting work on a new project
  • Onboarding to an unfamiliar codebase
  • Setting up CI integration
在以下情况下使用:
  • 开始处理新项目
  • 接入不熟悉的代码库
  • 设置 CI 集成

Detection

检测

Step 1: Identify Project Type

第 1 步:识别项目类型

bash
ls package.json pyproject.toml Cargo.toml go.mod Gemfile pom.xml build.gradle 2>/dev/null
bash
ls package.json pyproject.toml Cargo.toml go.mod Gemfile pom.xml build.gradle 2>/dev/null

Step 2: Configure Quality Gates

第 2 步:配置质量门禁

Node.js/TypeScript:
json
{
  "lint": "npm run lint",
  "typecheck": "npx tsc --noEmit",
  "test": "npm test -- --changed --passWithNoTests",
  "format": "npx prettier --check ."
}
Python:
json
{
  "lint": "ruff check .",
  "typecheck": "mypy .",
  "test": "pytest --tb=short -q",
  "format": "ruff format --check ."
}
Rust:
json
{
  "lint": "cargo clippy -- -D warnings",
  "typecheck": "cargo check",
  "test": "cargo test --quiet",
  "format": "cargo fmt --check"
}
Go:
json
{
  "lint": "golangci-lint run",
  "typecheck": "go vet ./...",
  "test": "go test ./... -count=1",
  "format": "gofmt -l ."
}
Node.js/TypeScript:
json
{
  "lint": "npm run lint",
  "typecheck": "npx tsc --noEmit",
  "test": "npm test -- --changed --passWithNoTests",
  "format": "npx prettier --check ."
}
Python:
json
{
  "lint": "ruff check .",
  "typecheck": "mypy .",
  "test": "pytest --tb=short -q",
  "format": "ruff format --check ."
}
Rust:
json
{
  "lint": "cargo clippy -- -D warnings",
  "typecheck": "cargo check",
  "test": "cargo test --quiet",
  "format": "cargo fmt --check"
}
Go:
json
{
  "lint": "golangci-lint run",
  "typecheck": "go vet ./...",
  "test": "go test ./... -count=1",
  "format": "gofmt -l ."
}

Step 3: Verify Tools Are Installed

第 3 步:验证工具是否已安装

Run each command with
--version
or
--help
to confirm availability. Report missing tools.
使用
--version
或
--help
运行每个命令,以确认其可用性。报告缺失的工具。

Step 4: Create Configuration

第 4 步:创建配置

Generate a
.claude/settings.json
with:
  • Quality gate commands for the detected project type
  • Suggested permission rules (user reviews and approves)
  • Hook configuration for the project
生成一个
.claude/settings.json
,其中包含:
  • 针对检测到的项目类型的质量门禁命令
  • 建议的权限规则(由用户审阅和批准)
  • 项目的 Hook 配置

Output

输出

text
AUTO SETUP
  Project type: [Node.js/Python/Rust/Go/Mixed]
  Package manager: [npm/pnpm/yarn/pip/cargo]

  Quality gates configured:
    lint:      [command] ✓
    typecheck: [command] ✓
    test:      [command] ✓
    format:    [command] ✓

  Missing tools:
    - [tool] — install with: [command]

  Settings written to: .claude/settings.json
text
自动设置
  项目类型:[Node.js/Python/Rust/Go/混合]
  包管理器:[npm/pnpm/yarn/pip/cargo]

  已配置质量门禁:
    lint:      [命令] ✓
    typecheck: [命令] ✓
    test:      [命令] ✓
    format:    [命令] ✓

  缺失工具:
    - [工具] — 使用以下命令安装:[命令]

  设置已写入:.claude/settings.json

Rules

规则

  • Never overwrite existing settings without asking
  • Detect, don't assume — check for tool presence
  • Support monorepos (check for workspaces config)
  • Report missing tools with install commands
  • 未经询问,绝不覆盖现有设置
  • 进行检测而非假设——检查工具是否存在
  • 支持 monorepo(检查 workspaces 配置)
  • 报告缺失工具及其安装命令