mcpField
C
configure-claude-plugins

configure-claude-plugins

github.com/laurigatesAgent 工作流5957 次安装1 天前更新
代码仓库

关于 configure-claude-plugins

configure-claude-plugins 是为项目接入 `laurigates/claude-plugins` Claude Code 插件市场的 Skill,适用于项目初始化和插件设置。它配置 `.claude/settings.json`,并创建预先设置该市场的 GitHub Actions 工作流。

主要功能

  1. 01检测项目类型并选择推荐插件
  2. 02创建或合并 Claude Code 设置
  3. 03配置插件市场及权限
  4. 04创建 Claude Code 与代码审查工作流
  5. 05支持检查状态和自动配置

适用场景

  1. 01为新项目配置 Claude Code 插件
  2. 02将插件市场加入现有设置
  3. 03配置 Claude Code GitHub Actions 工作流
  4. 04按项目技术栈选择插件

安装

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

$npx skills add https://github.com/laurigates/claude-plugins --skill configure-claude-plugins

安装后在 Claude Code 中输入/configure-claude-plugins确认已加载。

详细介绍

/configure:claude-plugins

配置项目以使用 laurigates/claude-plugins Claude Code 插件市场。设置 .claude/settings.json,添加权限、市场注册和 enabledPlugins;并创建预先配置好该市场的 GitHub Actions 工作流(claude.yml、claude-code-review.yml)。

何时使用此技能

在以下情况下使用此技能……在以下情况下使用其他方法……
为新项目启用 Claude Code 插件配置与插件无关的 Claude Code 设置
设置 claude.yml 和 claude-code-review.yml 工作流创建通用 GitHub Actions 工作流(/configure:workflows)
将 laurigates/claude-plugins 市场添加到仓库手动安装单个插件
将插件权限合并到现有的 .claude/settings.json调试 Claude Code 操作失败(查看 GitHub Actions 日志)
根据项目类型选择推荐插件开发新插件(参见 CLAUDE.md 插件生命周期)

上下文

  • 设置文件是否存在:!find . -maxdepth 3 -name 'settings.json' -path '*/.claude/*'
  • 工作流:!find .github/workflows -maxdepth 1 -name 'claude*.yml'
  • Git 远程仓库:!git remote -v
  • 项目类型指标:!find . -maxdepth 1 \( -name 'package.json' -o -name 'pyproject.toml' -o -name 'Cargo.toml' -o -name 'go.mod' -o -name 'Dockerfile' -o -name 'justfile' -o -name 'Justfile' \)
  • ESP/嵌入式项目指标:!find . -maxdepth 2 \( -name 'idf_component.yml' -o -name 'sdkconfig' -o -name 'CMakeLists.txt' \)
  • ESPHome 指标:!find . -maxdepth 2 -name '*.yaml' -path '*/esphome/*'

参数

从命令参数中解析:

参数说明
--check-only报告当前配置状态,不做更改
--fix自动应用配置
--plugins要安装的插件逗号分隔列表(默认:全部推荐插件)

执行

执行此 Claude 插件配置工作流:

第 1 步:检测当前状态和项目技术栈
  1. 检查是否存在 .claude/settings.json
  2. 检查是否存在 .github/workflows/claude.yml
  3. 检查是否存在 .github/workflows/claude-code-review.yml
  4. 根据文件指标检测项目类型(语言、框架)
第 2 步:选择插件

如果未指定 --plugins,则根据检测到的项目类型选择推荐插件:

项目指标推荐插件
package.jsongit-plugin、typescript-plugin、testing-plugin、code-quality-plugin
pyproject.toml / setup.pygit-plugin、python-plugin、testing-plugin、code-quality-plugin
Cargo.tomlgit-plugin、rust-plugin、testing-plugin、code-quality-plugin
Dockerfile以上插件 + container-plugin
.github/workflows/以上插件 + github-actions-plugin
idf_component.yml / sdkconfiggit-plugin、code-quality-plugin、testing-plugin、container-plugin
ESPHome yamlgit-plugin、python-plugin、code-quality-plugin
默认(任意项目)git-plugin、code-quality-plugin、testing-plugin、tools-plugin

始终包含:configure-plugin、health-plugin、hooks-plugin。

第 3 步:配置 .claude/settings.json

创建或合并到 .claude/settings.json。权限基线包含常见条目以及根据技术栈扩展的条目。该配置段还会注册市场,确保 Web 会话仍可使用插件。

面向技术栈的 permissions.allow 基线

始终包含以下常见条目:

"Bash(git:*)", "Bash(gh:*)", "Bash(pre-commit:*)", "Bash(gitleaks:*)", "Bash(python3:*)"

根据检测到的项目类型添加特定于技术栈的条目:

技术栈额外的允许条目
Python(uv + ruff + ty)"Bash(uv:*)", "Bash(uvx:*)", "Bash(ruff:*)", "Bash(ty:*)", "Bash(pytest:*)"
Node / TypeScript"Bash(npm:*)", "Bash(pnpm:*)", "Bash(bun:*)", "Bash(tsc:*)", "Bash(eslint:*)", "Bash(prettier:*)", "Bash(vitest:*)"
Go"Bash(go:*)", "Bash(gofmt:*)", "Bash(golangci-lint:*)"
Rust"Bash(cargo:*)", "Bash(rustc:*)", "Bash(clippy:*)", "Bash(rustfmt:*)"
ESP-IDF / 嵌入式"Bash(idf.py:*)", "Bash(esptool:*)", "Bash(clang-format:*)", "Bash(cppcheck:*)", "Bash(docker:*)", "Bash(docker compose:*)", "Bash(just:*)", "Bash(make:*)"
ESPHome"Bash(esphome:*)", "Bash(uv:*)", "Bash(uvx:*)"

仅使用细粒度模式——不要为命令行工具添加 Bash(bash *)。

要合并的完整 settings.json 代码段
{
  "permissions": {
    "allow": [
      "Bash(git:*)",
      "Bash(gh:*)",
      "Bash(pre-commit:*)",
      "Bash(gitleaks:*)",
      "Bash(python3:*)"
      // ... plus stack-specific entries from the table above
    ]
  },
  "extraKnownMarketplaces": {
    "claude-plugins": {
      "source": { "source": "github", "repo": "laurigates/claude-plugins" },
      "autoUpdate": true
    }
  },
  "enabledPlugins": {
    "<selected-plugin-1>@claude-plugins": true,
    "<selected-plugin-2>@claude-plugins": true
  }
}

将 <selected-plugin-N> 替换为第 2 步中选定的插件名称。

如果 .claude/settings.json 已存在,请合并而不要重复添加条目。保留现有的 hooks、env 或其他字段。

第 4 步:配置 .github/workflows/claude.yml

创建 .github/workflows/claude.yml,配置 Claude Code 操作以使用插件市场:

name: Claude Code

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned]

permissions:
  contents: write
  pull-requests: write
  issues: write
  id-token: write

jobs:
  claude:
    if: |
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Run Claude Code
        uses: anthropics/claude-code-action@v1
        with:
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          plugin_marketplaces: |
            https://github.com/laurigates/claude-plugins.git
          plugins: |
            PLUGINS_LIST

将 PLUGINS_LIST 替换为选定的插件,格式为 plugin-name@laurigates-claude-plugins,每行一个。

第 5 步:配置 .github/workflows/claude-code-review.yml

创建 .github/workflows/claude-code-review.yml,用于自动 PR 审查:

name: Claude Code Review

on:
  pull_request:
    types: [opened, synchronize, reopened]

permissions:
  contents: read
  pull-requests: write
  issues: write

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Claude Code Review
        uses: anthropics/claude-code-action@v1
        with:
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          prompt: |
            Review this pull request. Focus on:
            - Code quality and best practices
            - Potential bugs or security issues
            - Test coverage gaps
            - Documentation needs
          claude_args: "--max-turns 5"
          plugin_marketplaces: |
            https://github.com/laurigates/claude-plugins.git
          plugins: |
            code-quality-plugin@laurigates-claude-plugins
            testing-plugin@laurigates-claude-plugins
第 6 步:报告结果

打印状态报告:

Claude Plugins Configuration Report
=====================================
Repository: <repo-name>

.claude/settings.json:
  Status:              <CREATED|UPDATED|EXISTS>
  Permissions:         <N> allowed patterns configured
  Marketplace:         laurigates/claude-plugins (extraKnownMarketplaces)
  Enabled plugins:     <list>

.github/workflows/claude.yml:
  Status:              <CREATED|UPDATED|EXISTS>
  Marketplace:         laurigates/claude-plugins
  Plugins:             <list>

.github/workflows/claude-code-review.yml:
  Status:              <CREATED|UPDATED|EXISTS>
  Trigger:             PR opened/synchronize/reopened

Next Steps:
  1. Add CLAUDE_CODE_OAUTH_TOKEN to repository secrets
     Settings > Secrets and variables > Actions > New repository secret
  2. Commit and push the new/updated files
  3. Test by mentioning @claude in a PR comment

Agentic 优化

场景命令
快速检查状态/configure:claude-plugins --check-only
自动配置全部内容/configure:claude-plugins --fix
仅指定插件/configure:claude-plugins --fix --plugins git-plugin,testing-plugin
验证设置是否存在find .claude -maxdepth 1 -name 'settings.json'
列出 Claude 工作流find .github/workflows -name 'claude*.yml'

标志

标志说明
--check-only报告当前状态,不做任何更改
--fix自动应用所有配置
--plugins覆盖自动插件选择

重要说明

  • 必须手动将 CLAUDE_CODE_OAUTH_TOKEN 密钥添加到代码仓库
  • .claude/settings.json 中的 extraKnownMarketplaces 是在临时 Web 会话中保持配置的关键——没有它,插件市场只会通过 CI 注册
  • enabledPlugins 条目使用 plugin-name@claude-plugins 格式(来自 extraKnownMarketplaces 代码段的市场键)
  • 工作流中引用插件时使用 <plugin-name>@laurigates-claude-plugins(来自 marketplace.json 的市场 name)

另请参阅

  • /configure:repo - 完整的端到端驱动程序(运行此技能 + web-session + 健康检查)
  • /configure:web-session - 用于基础设施工具的 SessionStart 钩子
  • /configure:all - 运行所有合规性检查
  • claude-security-settings 技能 - Claude Code 安全设置

评论

支持 Markdown