mcpField
A
auto-setup

auto-setup

github.com/rohitg00测试与质量2.9k149 次安装4 周前更新
代码仓库

关于 auto-setup

用于检测项目类型并为 Claude Code 配置质量检查项的技能。它会检查工具是否可用,且未经确认不会覆盖现有设置。

主要功能

  1. 01检测项目类型和工作区
  2. 02配置 lint、类型检查、测试与格式化命令
  3. 03检查工具是否已安装
  4. 04生成 .claude/settings.json 建议配置

适用场景

  1. 01初始化新项目
  2. 02熟悉陌生代码库
  3. 03准备 CI 质量检查

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/rohitg00/pro-workflow --skill auto-setup

安装后在 Claude Code 中输入/auto-setup确认已加载。

详细介绍

自动设置

检测项目类型并自动配置专业工作流质量门禁。

触发条件

适用于:

  • 开始处理新项目
  • 熟悉陌生代码库
  • 设置 CI 集成

检测

步骤 1:识别项目类型
ls package.json pyproject.toml Cargo.toml go.mod Gemfile pom.xml build.gradle 2>/dev/null
步骤 2:配置质量门禁

Node.js/TypeScript:

{
  "lint": "npm run lint",
  "typecheck": "npx tsc --noEmit",
  "test": "npm test -- --changed --passWithNoTests",
  "format": "npx prettier --check ."
}

Python:

{
  "lint": "ruff check .",
  "typecheck": "mypy .",
  "test": "pytest --tb=short -q",
  "format": "ruff format --check ."
}

Rust:

{
  "lint": "cargo clippy -- -D warnings",
  "typecheck": "cargo check",
  "test": "cargo test --quiet",
  "format": "cargo fmt --check"
}

Go:

{
  "lint": "golangci-lint run",
  "typecheck": "go vet ./...",
  "test": "go test ./... -count=1",
  "format": "gofmt -l ."
}
步骤 3:验证工具是否已安装

使用 --version 或 --help 运行每条命令,以确认工具可用。报告缺少的工具。

步骤 4:创建配置

生成 .claude/settings.json,其中包含:

  • 检测到的项目类型对应的质量门禁命令
  • 建议的权限规则(由用户审核并批准)
  • 项目的钩子配置

输出

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

规则

  • 未经询问,绝不覆盖现有设置
  • 检测实际情况,不要想当然——检查工具是否存在
  • 支持 monorepo(检查 workspace 配置)
  • 报告缺少的工具及其安装命令

评论

支持 Markdown