Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ln-624-code-quality-auditor

БесплатноБез исполняемых скриптовНе проверен

Checks cyclomatic complexity, nesting, long methods, god classes, method signatures, O(n²), N+1 queries, constants management. Returns findings.

tensologyот tensology★ 17 звёзд на GitHub

Об этом скилле

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.

Code Quality Auditor (L3 Worker)

Specialized worker auditing code complexity, method signatures, algorithms, and constants management.

Purpose & Scope

  • Worker in ln-620 coordinator pipeline - invoked by ln-620-codebase-auditor
  • Audit code quality (Categories 5+6+NEW: Medium Priority)
  • Check complexity metrics, method signature quality, algorithmic efficiency, constants management
  • Return structured findings with severity, location, effort, recommendations
  • Calculate compliance score (X/10) for Code Quality category

Inputs (from Coordinator)

MANDATORY READ: Load shared/references/audit_worker_core_contract.md.

Receives contextStore with: tech_stack, best_practices, principles, codebase_root, output_dir.

Domain-aware: Supports domain_mode + current_domain (see audit_output_schema.md#domain-aware-worker-output).

Workflow

MANDATORY READ: Load shared/references/two_layer_detection.md for detection methodology.

  1. Parse context — extract fields, determine scan_path (domain-aware if specified), extract output_dir
  2. Scan codebase for violations (Layer 1)
    • All Grep/Glob patterns use scan_path (not codebase_root)
    • Example: Grep(pattern="if.*if.*if", path=scan_path) for nesting detection
  3. Analyze context per candidate (Layer 2 — MANDATORY) Layer 1 finding without Layer 2 = NOT a valid finding. Before reporting, ask: "Is this violation intentional or justified by design?"
    • Cyclomatic complexity: is complexity from switch/case on enum (valid) or deeply nested conditions (bad)? Enum dispatch → downgrade to LOW or skip
    • O(n²): read context — what's n? If bounded (n < 100), downgrade severity
    • N+1: read ORM config — does it have eager loading configured elsewhere? Admin-only endpoint → downgrade severity
    • God class: is it a config/schema/builder class? → downgrade
    • Cascade depth: already traces calls (implicit Layer 2). Orchestrator function → SEB does NOT apply (see Conflict Resolution in ARCH-AI-SEB)
  4. Collect findings with severity, location, effort, recommendation
    • Tag each finding with domain: domain_name (if domain-aware)
  5. Calculate score using penalty algorithm
  6. Write Report: Build full markdown report in memory per shared/templates/audit_worker_report_template.md, write to {output_dir}/624-quality-{domain}.md (or 624-quality.md in global mode) in single Write call
  7. Return Summary: Return minimal summary to coordinator (see Output Format)

Audit Rules (Priority: MEDIUM)

1. Cyclomatic Complexity

What: Too many decision points in single function (> 10)

Detection:

  • Count if/else, switch/case, ternary, &&, ||, for, while
  • Use tools: eslint-plugin-complexity, radon (Python), gocyclo (Go)

Severity:

  • HIGH: Complexity > 20 (extremely hard to test)
  • MEDIUM: Complexity 11-20 (refactor recommended)
  • LOW: Complexity 8-10 (acceptable but monitor)
  • Downgrade when: Enum/switch dispatch, state machines, parser grammars → downgrade to LOW or skip

Recommendation: Split function, extract helper methods, use early returns

Effort: M-L (depends on complexity)

2. Deep Nesting (> 4 levels)

What: Nested if/for/while blocks too deep

Detection:

  • Count indentation levels
  • Pattern: if { if { if { if { if { ... } } } } }

Severity:

  • HIGH: > 6 levels (unreadable)
  • MEDIUM: 5-6 levels
  • LOW: 4 levels
  • Downgrade when: Nesting from early-return guard clauses (structurally deep but linear logic) → downgrade

Recommendation: Extract functions, use guard clauses, invert conditions

Effort: M (refactor structure)

3. Long Methods (> 50 lines)

What: Functions too long, doing too much

Detection:

  • Count lines between function start and end
  • Exclude comments, blank lines

Severity:

  • HIGH: > 100 lines
  • MEDIUM: 51-100 lines
  • LOW: 40-50 lines (borderline)
  • Downgrade when: Orchestrator functions with sequential delegation; data transformation pipelines → downgrade

Recommendation: Split into smaller functions, apply Single Responsibility

Effort: M (extract logic)

4. God Classes/Modules (> 500 lines)

What: Files with too many responsibilities

Detection:

  • Count lines in file (exclude comments)
  • Check number of public methods/functions

Severity:

  • HIGH: > 1000 lines
  • MEDIUM: 501-1000 lines
  • LOW: 400-500 lines
  • Downgrade when: Config/schema/migration files, generated code, barrel/index files → skip

Recommendation: Split into multiple files, apply separation of concerns

Effort: L (major refactor)

5. Too Many Parameters (> 5)

What: Functions with excessive parameters

Detection:

  • Count function parameters
  • Check const
Полный SKILL.md на GitHub

Установить ln-624-code-quality-auditor в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Bash

FAQ

Что делает скилл ln-624-code-quality-auditor?

Checks cyclomatic complexity, nesting, long methods, god classes, method signatures, O(n²), N+1 queries, constants management. Returns findings.

Как установить скилл ln-624-code-quality-auditor?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ln-624-code-quality-auditor запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить ln-624-code-quality-auditor с