Enforces code size and complexity rules (SIZE-1 through SIZE-6). Loaded by the conductor for write, review, and refactor operations. Detects oversized functions, files, deep nesting, long parameter lists, flag arguments, and God classes. Size thresholds are language-agnostic — no language reference files needed.
From clean-code-codexnpx claudepluginhub mikecubed/agent-orchestration --plugin clean-code-codexThis skill uses the workspace's default tool permissions.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
Size thresholds are language-agnostic — no language reference files are required. Count lines and parameters directly.
Hook coverage check (run first): Before analysing function sizes, check whether the hook already flagged SIZE-1 violations in this session for the file(s) in scope:
cat "$COVERAGE_FILE" 2>/dev/null # COVERAGE_FILE = /tmp/codex-hook-coverage-<PROJECT_HASH>.jsonl
For each JSON line where "rule" is "SIZE-1", extract file, line, and
function. When scanning, skip any function where file+line+function
matches an existing coverage record.
Log: "Skipping SIZE-1 for '{function}' at {file}:{line} — already reported by hook this session."
If no coverage file exists, proceed with the full SIZE-1 analysis.
Precedence in the overall system: SEC → TDD → ARCH/TYPE → NAME/SIZE/DEAD → quality BLOCK.
| Rule | Metric | WARN threshold | BLOCK threshold | Severity |
|---|---|---|---|---|
| SIZE-1 | Function lines | ≥ 40 lines | ≥ 80 lines | WARN/BLOCK |
| SIZE-2 | File lines | ≥ 351 lines | ≥ 500 lines | WARN/BLOCK |
| SIZE-3 | Nesting depth | ≥ 4 levels | — | WARN |
| SIZE-4 | Parameter count | > 3 params | — | WARN |
| SIZE-5 | Flag arguments | any flag arg | — | BLOCK |
| SIZE-6 | God class (methods) | > 10 methods | — | INFO |
end inclusive. Exclude blank lines and comment-only lines from the
count. If a language does not use braces (Python), count from def/async def
to the last non-blank line before the next def/class at the same indent.Severity: WARN (≥40 lines) / BLOCK (≥80 lines) | Languages: * | Source: CCC
What it prohibits: Functions or methods that exceed the line thresholds above. Long functions typically have multiple responsibilities — they violate the Single Responsibility Principle and are hard to test.
Detection:
agent_action:
SIZE-1 (WARN|BLOCK): Function '{name}' is {n} lines at {file}:{line}.--fix and severity is WARN: extract sub-functions with agent assistance
(requires human confirmation for BLOCK — the refactor is non-trivial)Bypass prohibition: "it's fine, it's all related logic" → Refuse. Cite SIZE-1. Long functions are an SRP violation regardless of topical cohesion.
Severity: WARN (351–499 lines) / BLOCK (≥ 500 lines) | Languages: * | Source: CCC
What it prohibits: Source files exceeding the line thresholds. A file with hundreds of functions is a module with too many concerns.
Detection:
agent_action:
SIZE-2 (WARN|BLOCK): File '{file}' is {n} lines.--fix and WARN: perform the split with updated importsSeverity: WARN | Languages: * | Source: CCC
What it prohibits: Code blocks nested more than 4 levels deep. Deep nesting
indicates missing abstractions — nested if/for/try chains should be
flattened using early returns, extracted functions, or guard clauses.
Counting nesting:
if, else if, for, while, do, try, catch, switch block adds
one level. Function body starts at level 1.Example: 4-level violation:
function process(orders) { // level 0 (function body)
for (const order of orders) { // level 1
if (order.isValid()) { // level 2
for (const item of order.items) { // level 3
if (item.hasDiscount()) { // level 4 ← WARN
if (item.discount > 0.5) { // level 5 ← VIOLATION
agent_action:
SIZE-3 (WARN): Nesting depth {n} at {file}:{line}:{col}.filter().map() over nested loopsSeverity: WARN | Languages: * | Source: CCC
What it prohibits: Functions or constructors with more than 3 parameters. Long parameter lists indicate the function has too many concerns, or that a parameter object should be introduced.
Counting:
options: object counts as 1 — see mitigation)name?: string),
Python kwargs (**kwargs), Go variadic (...opts), Rust builder patternMitigation patterns:
// ❌ 5 parameters
function createUser(name: string, email: string, role: Role, plan: Plan, isActive: boolean) { }
// ✅ Parameter object
interface CreateUserInput {
name: string;
email: string;
role: Role;
plan: Plan;
isActive: boolean;
}
function createUser(input: CreateUserInput) { }
agent_action:
SIZE-4 (WARN): Function '{name}' has {n} parameters at {file}:{line}.OptionsSeverity: BLOCK | Languages: * | Source: CCC
What it prohibits: Boolean parameters passed to a function to control which of two behaviours it executes. A flag argument is a sign that the function violates the Single Responsibility Principle.
Detection:
boolean / bool parametersis, has, should, can,
will, did, enable, disable, use, include, excludemode: string with 2 possible values, type: string used in
an if/switch to select behaviourExamples:
// ❌ Flag argument
function renderUser(user: User, isAdmin: boolean) {
if (isAdmin) { /* admin view */ } else { /* normal view */ }
}
// ✅ Two functions
function renderUserView(user: User) { ... }
function renderAdminUserView(user: User) { ... }
agent_action:
SIZE-5 (BLOCK): Flag argument '{paramName}' in '{fnName}' at {file}:{line}.Bypass prohibition: "it's cleaner to have one function" → Refuse. Cite SIZE-5. One function controlled by a flag is two functions pretending to be one.
Severity: INFO | Languages: * | Source: CCC
What it prohibits: Classes with more than 10 public methods or more than 20 total methods. God classes accumulate responsibilities and become impossible to test in isolation.
Detection:
agent_action:
SIZE-6 (INFO): Class '{name}' has {n} methods at {file}:{line}. Consider splitting.--fix explicitly requested)Report schema: see skills/conductor/shared-contracts.md.