About this skill
The `plankton-code-quality` skill integrates Plankton, a sophisticated system by @alxfazio, into your Claude Code development environment. It provides real-time code quality enforcement by leveraging `PostToolUse` hooks that trigger on every file edit. This three-stage process ensures high-quality code without interrupting the main agent's workflow: 1. **Silent Auto-formatting:** Runs various formatters (e.g., ruff format, biome, shfmt, taplo, markdownlint) to silently fix common issues, resolving a significant portion of problems without direct agent interaction. 2. **Violation Collection:** Gathers remaining, unfixable violations from linters in a structured JSON format (containing line, column, code, message, and linter details), still without outputting to the main agent. 3. **Claude-driven Delegation:** For violations that cannot be automatically fixed, the system delegates to specialized Claude sub-processes for targeted repairs. This allows for hierarchical model routing, using different Claude models (Haiku for simple styles, Sonnet for logic, Opus for complex types) to address specific types of code issues efficiently. This skill supports a wide range of languages including Python, TypeScript, Shell, YAML, JSON, TOML, Markdown, and Dockerfile.
Best use case
This skill is ideal for AI agents and developers who need to maintain consistently high code quality across diverse projects and languages. It's particularly useful for preventing code quality regressions, standardizing code style, and offloading repetitive formatting and linting tasks from the AI agent's primary focus. It also addresses the challenge of AI agents potentially bypassing linter configurations by enforcing quality at a lower, foundational level.
使用Plankton进行编写时代码质量强制执行——通过钩子在每次文件编辑时自动格式化、代码检查和Claude驱动的修复。
Users can expect cleaner, more consistent, and higher-quality code across all supported languages. The skill significantly reduces the need for manual code reviews related to style and common errors, provides immediate feedback on code quality issues, and ultimately leads to more robust and maintainable software developed by Claude agents. Files will be automatically formatted and corrected, ensuring adherence to best practices without direct intervention from the main AI agent.
Practical example
Example input
The `plankton-code-quality` skill is triggered implicitly by the Claude agent's file modification activities. For instance, if the agent is instructed to 'Implement a new Python function to calculate Fibonacci numbers' and subsequently writes code to a `.py` file, the skill will automatically engage post-write to format and lint the new code.
Example output
While the skill itself operates silently in its initial stages, its ultimate output is a clean, formatted, and lint-compliant code file. For example, if the agent writes a Python file with inconsistent indentation and a minor linting error, the skill will process it and the file will be updated to:
```python
# Original (hypothetical) agent-written code:
# def my_func():
# print("hello") # missing space around print
# After plankton-code-quality:
def my_func():
print("hello") # Corrected indentation and spacing
```
The user or main agent will simply observe the corrected file, without direct messages from the skill about each individual fix.When to use this skill
- When you require automatic formatting and linting on every file edit, rather than just at commit time.
- When you need to ensure robust code quality enforcement and prevent AI agents from modifying linter configurations to bypass checks.
- When you benefit from a layered model routing approach for code fixes, utilizing different Claude models optimized for specific issue types (e.g., style, logic, typing).
- When working with multiple supported languages such as Python, TypeScript, Shell, YAML, JSON, TOML, Markdown, and Dockerfile, and desiring consistent quality checks across them.
When not to use this skill
- If you prefer to manually control code formatting and linting, or only require checks at the commit stage.
- If the overhead of running checks on every file edit is undesirable for your specific workflow or very small-scale projects.
- If your primary development languages are not among those currently supported by Plankton (e.g., Java, C#, Go).
- If you have a highly customized or non-standard code quality setup that might conflict with Plankton's automated enforcement.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/plankton-code-quality/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How plankton-code-quality Compares
| Feature / Agent | plankton-code-quality | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | medium | N/A |
Frequently Asked Questions
What does this skill do?
使用Plankton进行编写时代码质量强制执行——通过钩子在每次文件编辑时自动格式化、代码检查和Claude驱动的修复。
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as medium. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# 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) remain` | 2 |
| 建议性警告(重复项、旧工具) | `[hook:advisory] ...` | 0 |
主代理只看到子进程无法修复的问题。大多数质量问题都是透明解决的。
### 配置保护(防御规则博弈)
LLM 会修改 `.ruff.toml` 或 `biome.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`
## 设置
### 快速开始
```bash
# 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
### 语言特定依赖
| 语言 | 必需 | 可选 |
|----------|----------|----------|
| Python | `ruff`, `uv` | `ty`(类型), `vulture`(死代码), `bandit`(安全) |
| TypeScript/JS | `biome` | `oxlint`, `semgrep`, `knip`(死导出) |
| Shell | `shellcheck`, `shfmt` | — |
| YAML | `yamllint` | — |
| Markdown | `markdownlint-cli2` | — |
| Dockerfile | `hadolint` (>= 2.12.0) | — |
| TOML | `taplo` | — |
| JSON | `jaq` | — |
## 与 ECC 配对使用
### 互补而非重叠
| 关注点 | ECC | Plankton |
|---------|-----|----------|
| 代码质量强制执行 | 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` 控制所有行为:
```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 新增内容
### 可复制的钩子配置文件
设置严格的质量行为:
```bash
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. 发布修复摘要
### 健康指标
跟踪:
* 被关卡标记的编辑
* 平均修复时间
* 按类别重复违规
* 因关卡失败导致的合并阻塞Related Skills
workspace-surface-audit
Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup, then recommend the highest-value ECC-native skills, hooks, agents, and operator workflows. Use when the user wants help setting up Claude Code or understanding what capabilities are actually available in their environment.
safety-guard
Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
repo-scan
Cross-stack source code asset audit — classifies every file, detects embedded third-party libraries, and delivers actionable four-level verdicts per module with interactive HTML reports.
project-flow-ops
Operate execution flow across GitHub and Linear by triaging issues and pull requests, linking active work, and keeping GitHub public-facing while Linear remains the internal execution layer. Use when the user wants backlog control, PR triage, or GitHub-to-Linear coordination.
manim-video
Build reusable Manim explainers for technical concepts, graphs, system diagrams, and product walkthroughs, then hand off to the wider ECC video stack if needed. Use when the user wants a clean animated explainer rather than a generic talking-head script.
laravel-plugin-discovery
Discover and evaluate Laravel packages via LaraPlugins.io MCP. Use when the user wants to find plugins, check package health, or assess Laravel/PHP compatibility.
design-system
Use this skill to generate or audit design systems, check visual consistency, and review PRs that touch styling.
click-path-audit
Trace every user-facing button/touchpoint through its full state change sequence to find bugs where functions individually work but cancel each other out, produce wrong final state, or leave the UI in an inconsistent state. Use when: systematic debugging found no bugs but users report broken buttons, or after any major refactor touching shared state stores.
ck
Persistent per-project memory for Claude Code. Auto-loads project context on session start, tracks sessions with git activity, and writes to native memory. Commands run deterministic Node.js scripts — behavior is consistent across model versions.
canary-watch
Use this skill to monitor a deployed URL for regressions after deploys, merges, or dependency upgrades.
benchmark
Use this skill to measure performance baselines, detect regressions before/after PRs, and compare stack alternatives.
swiftui-patterns
SwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合,导航,性能优化,以及现代 iOS/macOS UI 最佳实践。