Agent skill

Plankton Code Quality

by xu-xiang in xu-xiang/everything-claude-code-zh

使用 Plankton 实现编写时代码质量强制执行 —— 通过钩子在每次文件编辑时进行自动格式化、代码检查,并由 Claude 驱动自动修复。

MITAuto-check passedDevelopment

Install Plankton Code Quality

skills CLI
$ npx skills add xu-xiang/everything-claude-code-zh --skill plankton-code-quality -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install xu-xiang/everything-claude-code-zh plankton-code-quality --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/plankton-code-quality .claude/skills/plankton-code-quality && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
plankton-code-quality
GitHub stars
2k
Token cost
~1.2k tokens
SKILL.md length
317 words
Files
1
Skills in repo
78
Repo updated
First seen
Licence
MIT

At a glance

使用 Plankton 实现编写时代码质量强制执行 —— 通过钩子在每次文件编辑时进行自动格式化、代码检查,并由 Claude 驱动自动修复。

  • Works in 3 steps: 工具调用前钩子(PreToolUse hook) —… → 停止钩子(Stop hook) —… → 受保护文件列表 — 包括 .ruff.toml, biome.json,…
  • Tasks that involve Code quality
  • SKILL.md covers 适用场景, 工作原理, 设置 and 与 ECC 配合使用, plus 3 more sections
  • Calls npm, git and brew; reaches github.com

What it does

Plankton Code Quality is an agent skill from xu-xiang/everything-claude-code-zh. 使用 Plankton 实现编写时代码质量强制执行 —— 通过钩子在每次文件编辑时进行自动格式化、代码检查,并由 Claude 驱动自动修复。

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Code quality and Linting and formatting. It works with Ruff and npm. The repository describes itself as: everything-claude-code 中文翻译项目:完整的 Claude Code 配置集合(agents, skills, hooks, commands, rules, MCPs)。源自 Anthropic 黑客松获胜者的实战配置,助力中文工程师高效理解与使用 Claude Code。 The licence is MIT.

When your agent uses it

  • Tasks that involve Code quality
  • Tasks that involve Linting and formatting

Example prompts

  • “/plankton-code-quality”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. 工具调用前钩子(PreToolUse hook) — protect_linter_configs.sh 在修改发生前阻止对所有 Linter 配置的编辑。
  2. 停止钩子(Stop hook) — stop_config_guardian.sh 在会话结束时通过 git diff 检测配置更改。
  3. 受保护文件列表 — 包括 .ruff.toml, biome.json, .shellcheckrc, .yamllint, .hadolint.yaml 等。

What it can do on your machine

Read from SKILL.md and the folder at commit dfbf946. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • git
    • brew
    • uv
    • claude

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Plankton Code Quality loads about 1.2k tokens when it runs. Until then it costs about 23 tokens; SKILL.md has 317 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~23
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from xu-xiang/everything-claude-code-zh at commit dfbf946, republished under its MIT licence (© xu-xiang). 317 words, ~1,219 tokens.

Download SKILL.mdSave it as .claude/skills/plankton-code-quality/SKILL.md (or your agent's skills folder).
name
plankton-code-quality
description
使用 Plankton 实现编写时代码质量强制执行 —— 通过钩子在每次文件编辑时进行自动格式化、代码检查,并由 Claude 驱动自动修复。
origin
community

Plankton 代码质量技能(Plankton Code Quality Skill)

Plankton(感谢 @alxfazio)的集成参考,这是一个针对 Claude Code 的编写时(Write-time)代码质量强制执行系统。Plankton 通过工具调用后钩子(PostToolUse hooks)在每次文件编辑时运行格式化程序和 Linter,然后启动 Claude 子进程(Subprocess)来修复智能体(Agent)未捕捉到的违规项。

适用场景

  • 你希望在每次文件编辑时(而不只是提交时)自动进行格式化和代码检查。
  • 你需要防御智能体通过修改 Linter 配置来绕过检查,而不是真正修复代码。
  • 你希望针对修复任务进行分级模型路由(Haiku 用于简单样式,Sonnet 用于逻辑,Opus 用于类型)。
  • 你使用多种语言进行开发(Python, TypeScript, Shell, YAML, JSON, TOML, Markdown, Dockerfile)。

工作原理

三阶段架构

每当 Claude Code 编辑或写入文件时,Plankton 的 multi_linter.sh 工具调用后钩子(PostToolUse hook)就会运行:

阶段 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 代码) — 120s 超时
│   ├─ Sonnet: 复杂性、重构 (C901, PLR 代码) — 300s 超时
│   └─ Opus: 类型系统、深度推理 (unresolved-attribute) — 600s 超时
├─ 重新运行阶段 1+2 以验证修复结果
└─ 如果清理完成则 Exit 0,如果仍存在违规项则 Exit 2(报告给主智能体)
主智能体看到的内容
场景智能体看到的内容钩子退出码
无违规项无0
子进程修复了所有问题无0
子进程处理后仍存在违规[hook] N violation(s) remain2
建议性信息 (重复、旧工具)[hook:advisory] ...0

主智能体只看到子进程无法修复的问题。大多数质量问题都会被透明地解决。

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

LLM 有时会尝试修改 .ruff.toml 或 biome.json 来禁用规则,而不是修复代码。Plankton 通过三层防护来阻止这种情况:

  1. 工具调用前钩子(PreToolUse hook) — protect_linter_configs.sh 在修改发生前阻止对所有 Linter 配置的编辑。
  2. 停止钩子(Stop hook) — stop_config_guardian.sh 在会话结束时通过 git diff 检测配置更改。
  3. 受保护文件列表 — 包括 .ruff.toml, biome.json, .shellcheckrc, .yamllint, .hadolint.yaml 等。
包管理器强制执行

Bash 上的工具调用前钩子(PreToolUse hook)会阻止使用旧版包管理器:

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

设置

快速开始
bash
# 将 Plankton 克隆到你的项目(或共享位置)
# 注: Plankton 由 @alxfazio 开发
git clone https://github.com/alexfazio/plankton.git
cd plankton

# 安装核心依赖
brew install jaq ruff uv

# 安装 Python linter
uv sync --all-extras

# 启动 Claude Code — 钩子将自动激活
claude

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

针对单个项目的集成

要在你自己的项目中使用 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
代码质量强制执行工具调用后钩子 (Prettier, tsc)工具调用后钩子 (20+ Linter + 子进程修复)
安全扫描AgentShield, security-reviewer 智能体Bandit (Python), Semgrep (TypeScript)
配置保护—工具调用前钩子阻止 + 停止钩子检测
包管理器检测 + 设置强制执行 (阻止旧版包管理器)
CI 集成—用于 git 的 Pre-commit 钩子
模型路由手动 (/model opus)自动 (违规复杂性 → 相应层级)
推荐组合
  1. 安装 ECC 作为你的插件(智能体、技能、命令、规则)。
  2. 添加 Plankton 钩子用于编写时质量强制执行。
  3. 使用 AgentShield 进行安全审计。
  4. 使用 ECC 的验证循环(verification-loop)作为 PR 前的最终门控。
避免钩子冲突

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

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

配置参考

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

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)

© xu-xiang, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/plankton-code-quality of xu-xiang/everything-claude-code-zh.

Open the folder on GitHubat commit dfbf946

Compare with similar skills

Plankton Code Quality next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Plankton Code Quality compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Plankton Code Quality this skillxu-xiang/everything-claude-code-zh2k—~1.2kAutomated safety check: PassMIT
Plankton Code Qualityaffaan-m/ECC275k2 repos~1.3kAutomated safety check: PassMIT
Install Anti-Slop Oxlint Rulesdmmulroy/anti-slop5.3k1 repos~2.2kAutomated safety check: PassMIT
Experiment Iterative CoderEvoScientist/EvoSkills4753 repos~2.5kAutomated safety check: PassApache-2.0
DevAutomattic/wordpress-activitypub582—~1.1kAutomated safety check: PassMIT
Align Recipe pyproject.tomlgoogle/adk-recipes10k—~4.6kAutomated safety check: PassApache-2.0

Similar skills

  • 使用Plankton进行编写时代码质量强制执行——通过钩子在每次文件编辑时自动格式化、代码检查和Claude驱动的修复。

    275k GitHub starsUsed in 2 repos~1.3k tokens
    DevelopmentAuto-check passed
  • Installs, updates or migrates the vendored anti-slop Oxlint plugin in a repository, keeping local rule changes and the plugin's license and provenance files.

    5.3k GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • Experiment Iterative Coder

    EvoScientist/EvoSkills

    Iterative code refinement through plan → code → evaluate → refine cycles.

    475 GitHub starsUsed in 3 repos~2.5k tokens
    DevelopmentAuto-check passed
  • Dev

    Automattic/wordpress-activitypub

    Development workflows for WordPress ActivityPub plugin including wp-env setup, testing commands, linting, and build processes.

    582 GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Align Recipe pyproject.toml

    google/adk-recipes

    Official

    Brings a Python recipe's pyproject.toml in line with the repo's CI rules, either as a read-only dry run or by rewriting the file while keeping comments.

    10k GitHub stars~4.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Cb Code Quality

    BlkLeg/CircuitBreaker

    Circuit Breaker code conventions and the quality gates that actually block a push — ruff, mypy, eslint, the pytest coverage ratchet, and the make verify tiers.

    201 GitHub stars~1.9k tokensUpdated 3 days ago
    DevelopmentAuto-check passed

More from xu-xiang/everything-claude-code-zh

All 78 skills in this repo
  • Configure Ecc

    xu-xiang/everything-claude-code-zh

    Everything Claude Code 的交互式安装程序 — 引导用户选择并安装技能和规则到用户级或项目级目录,验证路径,并可选择优化已安装文件。

    2k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Continuous Learning V2

    xu-xiang/everything-claude-code-zh

    基于本能(Instinct)的学习系统,通过钩子(hooks)观察会话,创建带有置信度评分的原子本能,并将其演化为技能(Skills)、命令(Commands)或智能体(Agents)。v2.1 版本增加了项目作用域(project-scoped)的本能,以防止跨项目污染。

    2k GitHub stars~2.1k tokensUpdated 7 mo ago
    Auto-check passed
  • API Design

    xu-xiang/everything-claude-code-zh

    生产级 API 的 REST API 设计模式,包括资源命名、状态码、分页、过滤、错误响应、版本控制和速率限制. An agent skill from xu-xiang/everything-claude-code-zh.

    2k GitHub stars~2.7k tokensUpdated 7 mo ago
    Auto-check passed
  • Backend Patterns

    xu-xiang/everything-claude-code-zh

    后端架构模式、API 设计、数据库优化以及适用于 Node.js、Express 和 Next.js API 路由的服务端最佳实践。

    2k GitHub stars~3.2k tokensUpdated 7 mo ago
    Auto-check passed
  • Backend Patterns

    xu-xiang/everything-claude-code-zh

    后端架构模式、API 设计、数据库优化以及 Node.js、Express 和 Next.js API 路由的服务端最佳实践。

    2k GitHub stars~3.1k tokensUpdated 7 mo ago
    Auto-check passed
  • Backend Patterns

    xu-xiang/everything-claude-code-zh

    后端架构模式、API 设计、数据库优化以及针对 Node.js、Express 和 Next.js API 路由的服务端最佳实践。

    2k GitHub stars~3.2k tokensUpdated 7 mo ago
    Auto-check passed

Works with

Categories

Questions about Plankton Code Quality

What does Plankton Code Quality do?

使用 Plankton 实现编写时代码质量强制执行 —— 通过钩子在每次文件编辑时进行自动格式化、代码检查,并由 Claude 驱动自动修复。. Plankton Code Quality is an agent skill from xu-xiang/everything-claude-code-zh.

When should I use Plankton Code Quality?

Plankton Code Quality fits situations like: tasks that involve Code quality; tasks that involve Linting and formatting.

How do I install Plankton Code Quality in Claude Code?

Run `npx skills add xu-xiang/everything-claude-code-zh --skill plankton-code-quality -a claude-code`. Or copy the skill folder (skills/plankton-code-quality in xu-xiang/everything-claude-code-zh) into .claude/skills/plankton-code-quality in your project. Claude Code loads it when a task matches its description.

How do I install Plankton Code Quality in Codex?

Run `npx skills add xu-xiang/everything-claude-code-zh --skill plankton-code-quality -a codex`. Or copy the skill folder (skills/plankton-code-quality in xu-xiang/everything-claude-code-zh) into .agents/skills/plankton-code-quality in your project. Codex loads it when a task matches its description.

Can I use Plankton Code Quality in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add xu-xiang/everything-claude-code-zh --skill plankton-code-quality -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/plankton-code-quality, .gemini/skills/plankton-code-quality, .github/skills/plankton-code-quality and .opencode/skills/plankton-code-quality in your project.

What does Plankton Code Quality need to run?

Going by SKILL.md and its folder, Plankton Code Quality needs the command-line tools its instructions call (npm, git, brew, uv and claude). Our summary lists: Python 3.

Does Plankton Code Quality access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Plankton Code Quality safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Plankton Code Quality use?

Plankton Code Quality is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Plankton Code Quality use?

About 1.2k tokens (SKILL.md is roughly 4.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Plankton Code Quality?

Skills that share tags, products or a category with Plankton Code Quality: Plankton Code Quality (affaan-m/ECC, 275k stars), Install Anti-Slop Oxlint Rules (dmmulroy/anti-slop, 5.3k stars), Experiment Iterative Coder (EvoScientist/EvoSkills, 475 stars) and Dev (Automattic/wordpress-activitypub, 582 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Plankton Code Quality?

xu-xiang (a GitHub user) maintains it in xu-xiang/everything-claude-code-zh, which has 1,973 GitHub stars. The repository holds 78 skills in this directory. The repository was last updated on March 5, 2026.

Source: xu-xiang/everything-claude-code-zh on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.