Source profileQuality 76/100Review permissions

affaan-m/ECC/docs/zh-CN/skills/plankton-code-quality/SKILL.md

plankton-code-quality

Use it for engineering tasks; the detail page covers purpose, installation, and practical steps.

Source repository stars
234,327
Declared platforms
1
Static risk flags
2
Last source update
2026-07-27
Source checked
2026-07-28

Decision brief

What it does—and where it fits

Plankton(作者:@alxfazio)的集成参考,这是一个用于 Claude Code 的编写时代码质量强制执行系统。Plankton 通过 PostToolUse 钩子在每次文件编辑时运行格式化程序和 linter,然后生成 Claude 子进程来修复代理未捕获的违规。

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeDeclaredSource recordInstall path and trigger
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/plankton-code-quality"
    Safe inspection promptEditorial

    Inspect the Agent Skill "plankton-code-quality" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/docs/zh-CN/skills/plankton-code-quality/SKILL.md at commit 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      何时使用

      你希望每次文件编辑时都自动格式化和检查(不仅仅是提交时) 你需要防御代理修改 linter 配置以通过检查,而不是修复代码 你想要针对修复的分层模型路由(简单样式用 Haiku,逻辑用 Sonnet,类型用 Opus) 你使用多种语言(Python、TypeScript、Shell、YAML、JSON、TOML、Markdown、Dockerfile)

      你希望每次文件编辑时都自动格式化和检查(不仅仅是提交时)你需要防御代理修改 linter 配置以通过检查,而不是修复代码你想要针对修复的分层模型路由(简单样式用 Haiku,逻辑用 Sonnet,类型用 Opus)
    2. 02

      工作原理

      每次 Claude Code 编辑或写入文件时,Plankton 的 multilinter.sh PostToolUse 钩子都会运行:

      PreToolUse 钩子 — protectlinterconfigs.sh 在编辑发生前阻止对所有 linter 配置的修改Stop 钩子 — stopconfigguardian.sh 在会话结束时通过 git diff 检测配置更改受保护文件列表 — .ruff.toml, biome.json, .shellcheckrc, .yamllint, .hadolint.yaml 等
    3. 03

      三阶段架构

      每次 Claude Code 编辑或写入文件时,Plankton 的 multilinter.sh PostToolUse 钩子都会运行:

      每次 Claude Code 编辑或写入文件时,Plankton 的 multilinter.sh PostToolUse 钩子都会运行:
    4. 04

      主代理看到的内容

      主代理只看到子进程无法修复的问题。大多数质量问题都是透明解决的。

      主代理只看到子进程无法修复的问题。大多数质量问题都是透明解决的。

    Permission review

    Static risk signals and limitations

    Network access

    medium · line 73

    The documentation includes network, browsing, or remote request actions.

    git clone https://github.com/alexfazio/plankton.git

    Runs scripts

    medium · line 73

    The documentation asks the agent to run terminal commands or scripts.

    git clone https://github.com/alexfazio/plankton.git

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score76/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars234,327SourceRepository attention, not individual Skill quality
    Compatibility1 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    affaan-m/ECC
    Skill path
    docs/zh-CN/skills/plankton-code-quality/SKILL.md
    Commit
    4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
    License
    MIT
    Collected
    2026-07-28
    Default branch
    main
    View the original SKILL.md

    Plankton 代码质量技能

    Plankton(作者:@alxfazio)的集成参考,这是一个用于 Claude Code 的编写时代码质量强制执行系统。Plankton 通过 PostToolUse 钩子在每次文件编辑时运行格式化程序和 linter,然后生成 Claude 子进程来修复代理未捕获的违规。

    何时使用

    • 你希望每次文件编辑时都自动格式化和检查(不仅仅是提交时)
    • 你需要防御代理修改 linter 配置以通过检查,而不是修复代码
    • 你想要针对修复的分层模型路由(简单样式用 Haiku,逻辑用 Sonnet,类型用 Opus)
    • 你使用多种语言(Python、TypeScript、Shell、YAML、JSON、TOML、Markdown、Dockerfile)

    工作原理

    三阶段架构

    每次 Claude Code 编辑或写入文件时,Plankton 的 multi_linter.sh PostToolUse 钩子都会运行:

    阶段 1:自动格式化(静默)
    ├─ 运行格式化工具(ruff format、biome、shfmt、taplo、markdownlint)
    ├─ 静默修复 40-50% 的问题
    └─ 无输出至主代理
    
    阶段 2:收集违规项(JSON)
    ├─ 运行 linter 并收集无法修复的违规项
    ├─ 返回结构化 JSON:{line, column, code, message, linter}
    └─ 仍无输出至主代理
    
    阶段 3:委托 + 验证
    ├─ 生成带有违规项 JSON 的 claude -p 子进程
    ├─ 根据违规项复杂度路由至模型层级:
    │   ├─ Haiku:格式化、导入、样式(E/W/F 代码)—— 120 秒超时
    │   ├─ Sonnet:复杂度、重构(C901、PLR 代码)—— 300 秒超时
    │   └─ Opus:类型系统、深度推理(unresolved-attribute)—— 600 秒超时
    ├─ 重新运行阶段 1+2 以验证修复
    └─ 若清理完毕则退出码 0,若违规项仍存在则退出码 2(报告至主代理)
    

    主代理看到的内容

    场景代理看到钩子退出码
    无违规0
    全部由子进程修复0
    子进程后仍存在违规[hook] N violation(s) remain2
    建议性警告(重复项、旧工具)[hook:advisory] ...0

    主代理只看到子进程无法修复的问题。大多数质量问题都是透明解决的。

    配置保护(防御规则博弈)

    LLM 会修改 .ruff.tomlbiome.json 来禁用规则,而不是修复代码。Plankton 通过三层防御阻止这种行为:

    1. PreToolUse 钩子protect_linter_configs.sh 在编辑发生前阻止对所有 linter 配置的修改
    2. Stop 钩子stop_config_guardian.sh 在会话结束时通过 git diff 检测配置更改
    3. 受保护文件列表.ruff.toml, biome.json, .shellcheckrc, .yamllint, .hadolint.yaml

    包管理器强制执行

    Bash 上的 PreToolUse 钩子会阻止遗留包管理器:

    • pip, pip3, poetry, pipenv → 被阻止(使用 uv
    • npm, yarn, pnpm → 被阻止(使用 bun
    • 允许的例外:npm audit, npm view, npm publish

    设置

    快速开始

    # Clone Plankton into your project (or a shared location)
    # Note: Plankton is by @alxfazio
    git clone https://github.com/alexfazio/plankton.git
    cd plankton
    
    # Install core dependencies
    brew install jaq ruff uv
    
    # Install Python linters
    uv sync --all-extras
    
    # Start Claude Code — hooks activate automatically
    claude
    

    无需安装命令,无需插件配置。当你运行 Claude Code 时,.claude/settings.json 中的钩子会在 Plankton 目录中被自动拾取。

    按项目集成

    要在你自己的项目中使用 Plankton 钩子:

    1. .claude/hooks/ 目录复制到你的项目
    2. 复制 .claude/settings.json 钩子配置
    3. 复制 linter 配置文件(.ruff.toml, biome.json 等)
    4. 为你使用的语言安装 linter

    语言特定依赖

    语言必需可选
    Pythonruff, uvty(类型), vulture(死代码), bandit(安全)
    TypeScript/JSbiomeoxlint, semgrep, knip(死导出)
    Shellshellcheck, shfmt
    YAMLyamllint
    Markdownmarkdownlint-cli2
    Dockerfilehadolint (>= 2.12.0)
    TOMLtaplo
    JSONjaq

    与 ECC 配对使用

    互补而非重叠

    关注点ECCPlankton
    代码质量强制执行PostToolUse 钩子 (Prettier, tsc)PostToolUse 钩子 (20+ linter + 子进程修复)
    安全扫描AgentShield, security-reviewer 代理Bandit (Python), Semgrep (TypeScript)
    配置保护PreToolUse 阻止 + Stop 钩子检测
    包管理器检测 + 设置强制执行(阻止遗留包管理器)
    CI 集成用于 git 的 pre-commit 钩子
    模型路由手动 (/model opus)自动(违规复杂度 → 层级)

    推荐组合

    1. 将 ECC 安装为你的插件(代理、技能、命令、规则)
    2. 添加 Plankton 钩子以实现编写时质量强制执行
    3. 使用 AgentShield 进行安全审计
    4. 在 PR 之前使用 ECC 的 verification-loop 作为最后一道关卡

    避免钩子冲突

    如果同时运行 ECC 和 Plankton 钩子:

    • ECC 的 Prettier 钩子和 Plankton 的 biome 格式化程序可能在 JS/TS 文件上冲突
    • 解决方案:使用 Plankton 时禁用 ECC 的 Prettier PostToolUse 钩子(Plankton 的 biome 更全面)
    • 两者可以在不同的文件类型上共存(ECC 处理 Plankton 未覆盖的内容)

    配置参考

    Plankton 的 .claude/hooks/config.json 控制所有行为:

    {
      "languages": {
        "python": true,
        "shell": true,
        "yaml": true,
        "json": true,
        "toml": true,
        "dockerfile": true,
        "markdown": true,
        "typescript": {
          "enabled": true,
          "js_runtime": "auto",
          "biome_nursery": "warn",
          "semgrep": true
        }
      },
      "phases": {
        "auto_format": true,
        "subprocess_delegation": true
      },
      "subprocess": {
        "tiers": {
          "haiku":  { "timeout": 120, "max_turns": 10 },
          "sonnet": { "timeout": 300, "max_turns": 10 },
          "opus":   { "timeout": 600, "max_turns": 15 }
        },
        "volume_threshold": 5
      }
    }
    

    关键设置:

    • 禁用你不使用的语言以加速钩子
    • volume_threshold — 违规数量超过此值自动升级到更高的模型层级
    • subprocess_delegation: false — 完全跳过第 3 阶段(仅报告违规)

    环境变量覆盖

    变量目的
    HOOK_SKIP_SUBPROCESS=1跳过第 3 阶段,直接报告违规
    HOOK_SUBPROCESS_TIMEOUT=N覆盖层级超时时间
    HOOK_DEBUG_MODEL=1记录模型选择决策
    HOOK_SKIP_PM=1绕过包管理器强制执行

    参考

    • Plankton(作者:@alxfazio)
    • Plankton REFERENCE.md — 完整的架构文档(作者:@alxfazio)
    • Plankton SETUP.md — 详细的安装指南(作者:@alxfazio)

    ECC v1.8 新增内容

    可复制的钩子配置文件

    设置严格的质量行为:

    export ECC_HOOK_PROFILE=strict
    export ECC_QUALITY_GATE_FIX=true
    export ECC_QUALITY_GATE_STRICT=true
    

    语言关卡表

    • TypeScript/JavaScript:首选 Biome,Prettier 作为后备
    • Python:Ruff 格式/检查
    • Go:gofmt

    配置篡改防护

    在质量强制执行期间,标记同一迭代中对配置文件的更改:

    • biome.json, .eslintrc*, prettier.config*, tsconfig.json, pyproject.toml

    如果配置被更改以抑制违规,则要求在合并前进行明确审查。

    CI 集成模式

    在 CI 中使用与本地钩子相同的命令:

    1. 运行格式化程序检查
    2. 运行 lint/类型检查
    3. 严格模式下快速失败
    4. 发布修复摘要

    健康指标

    跟踪:

    • 被关卡标记的编辑
    • 平均修复时间
    • 按类别重复违规
    • 因关卡失败导致的合并阻塞

    Alternatives

    Compare before choosing