[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FJFZQ08C1Z6WHT3BR13H6D":3,"skill-same:01M6FJFZQ08C1Z6WHT3BR13H6D":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":55,"linkOnly":56,"markdownContent":57,"markdownBody":58,"frontMatter":59,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":6,"ownerHtmlUrl":66,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":67,"install":68,"resources":81},"01M6FJFZQ08C1Z6WHT3BR13H6D","ln-624-code-quality-auditor",null,"Checks cyclomatic complexity, nesting, long methods, god classes, O(n2), N+1 queries, constants management. Use when auditing code quality.","boisenoise\u002Fskills-collections","boisenoise","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F193180?v=4","01M6CDBDQK6BDN55ZMA6B6PKBM","01M6CDBDVSJ3JPTBYN26FZ7TZK",13,"MIT","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Flevn-ln-624-code-quality-auditor\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],"code quality","code","quality auditor","auditor","ln","ln 624 code quality auditor","quality","use","when","cyclomatic complexity","long","line","hex","outline","methods","queries","complexity","MCP","read","workspace","analyze","Bash","audit","file","graph","search","architecture","2026-11-10 10:12:30",false,"---\nname: ln-624-code-quality-auditor\ndescription: \"Checks cyclomatic complexity, nesting, long methods, god classes, O(n2), N+1 queries, constants management. Use when auditing code quality.\"\nallowed-tools: Read, Grep, Glob, Bash, mcp__hex-graph__audit_workspace, mcp__hex-graph__analyze_architecture, mcp__hex-line__read_file, mcp__hex-line__grep_search, mcp__hex-line__outline\nlicense: MIT\n---\n\n> **Paths:** File paths (`shared\u002F`, `references\u002F`, `..\u002Fln-*`) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If `shared\u002F` is missing, fetch files via WebFetch from `https:\u002F\u002Fraw.githubusercontent.com\u002Flevnikolaevich\u002Fclaude-code-skills\u002Fmaster\u002Fskills\u002F{path}`.\n\n# Code Quality Auditor (L3 Worker)\n\n**Type:** L3 Worker\n\nSpecialized worker auditing code complexity, method signatures, algorithms, and constants management.\n\n## Purpose & Scope\n\n- Audit **code quality** (Categories 5+6+NEW: Medium Priority)\n- Check complexity metrics, method signature quality, algorithmic efficiency, constants management\n- Return structured findings with severity, location, effort, recommendations\n- Calculate compliance score (X\u002F10) for Code Quality category\n\n## Inputs\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fmcp_tool_preferences.md` and `shared\u002Freferences\u002Fmcp_integration_patterns.md`\n\nReceives `contextStore` with: `tech_stack`, `best_practices`, `principles`, `codebase_root`, `output_dir`.\n\n**Domain-aware:** Supports `domain_mode` + `current_domain` (see `audit_output_schema.md#domain-aware-worker-output`).\n\nUse `hex-graph` first when hotspots, architecture coupling, or semantic relationships materially improve the audit. Use `hex-line` first for local code reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in `Read\u002FGrep\u002FGlob\u002FBash` and state the fallback in the report.\n\n## Workflow\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Ftwo_layer_detection.md` for detection methodology.\n\n1) **Parse context** -- extract fields, determine `scan_path` (domain-aware if specified), extract `output_dir`\n2) **Scan codebase for violations (Layer 1)**\n   - All Grep\u002FGlob patterns use `scan_path` (not codebase_root)\n   - **Graph acceleration (if available):** IF `contextStore.graph_indexed` OR `.hex-skills\u002Fcodegraph\u002Findex.db` exists:\n     - **Complexity + God classes:** `audit_workspace(path=scan_path, verbosity=\"minimal\", limit=5)` -- use returned hotspots to pre-identify complex functions and god classes. Raise `limit` only for deliberate drill-down.\n     - **Module metrics:** `analyze_architecture(path=scan_path, verbosity=\"full\")` -- use returned coupling metrics for cascade depth and coupling analysis.\n     - Fall back to grep patterns below if graph unavailable.\n     - **Outline-first read:** `outline(file_path)` before reading large source files -- understand function\u002Fclass structure for complexity analysis.\n   - Example: `Grep(pattern=\"if.*if.*if\", path=scan_path)` for nesting detection\n3) **Analyze context per candidate (Layer 2 -- MANDATORY)**\n   Layer 1 finding without Layer 2 = NOT a valid finding. Before reporting, ask: \"Is this violation intentional or justified by design?\"\n   - Cyclomatic complexity: is complexity from switch\u002Fcase on enum (valid) or deeply nested conditions (bad)? Enum dispatch -> downgrade to LOW or skip\n   - O(n^2): read context -- what's n? If bounded (n \u003C 100), downgrade severity\n   - N+1: read ORM config -- does it have eager loading configured elsewhere? Admin-only endpoint -> downgrade severity\n   - God class: is it a config\u002Fschema\u002Fbuilder class? -> downgrade\n   - Cascade depth: already traces calls (implicit Layer 2). Orchestrator function -> SEB does NOT apply (see Conflict Resolution in ARCH-AI-SEB)\n4) **Collect findings with severity, location, effort, recommendation**\n   - Tag each finding with `domain: domain_name` (if domain-aware)\n5) **Calculate score using penalty algorithm**\n6) **Write Report:** Build full markdown report in memory per `shared\u002Ftemplates\u002Faudit_worker_report_template.md`, write to `{output_dir}\u002Fln-624--{domain}.md` (or `624-quality.md` in global mode) in single Write call\n7) **Return Summary:** Return minimal summary to coordinator (see Output Format)\n\n## Audit Rules (Priority: MEDIUM)\n\n### 1. Cyclomatic Complexity\n**What:** Too many decision points in single function (> 10)\n\n**Detection:**\n- Count if\u002Felse, switch\u002Fcase, ternary, &&, ||, for, while\n- Use tools: `eslint-plugin-complexity`, `radon` (Python), `gocyclo` (Go)\n\n**Severity:**\n- **HIGH:** Complexity > 20 (extremely hard to test)\n- **MEDIUM:** Complexity 11-20 (refactor recommended)\n- **LOW:** Complexity 8-10 (acceptable but monitor)\n- **Downgrade when:** Enum\u002Fswitch dispatch, state machines, parser grammars -> downgrade to LOW or skip\n\n**Recommendation:** Split function, extract helper methods, use early returns\n\n**Effort:** M-L (depends on complexity)\n\n### 2. Deep Nesting (> 4 levels)\n**What:** Nested if\u002Ffor\u002Fwhile blocks too deep\n\n**Detection:**\n- Count indentation levels\n- Pattern: if { if { if { if { if { ... } } } } }\n\n**Severity:**\n- **HIGH:** > 6 levels (unreadable)\n- **MEDIUM:** 5-6 levels\n- **LOW:** 4 levels\n- **Downgrade when:** Nesting from early-return guard clauses (structurally deep but linear logic) -> downgrade\n\n**Recommendation:** Extract functions, use guard clauses, invert conditions\n\n**Effort:** M (refactor structure)\n\n### 3. Long Methods (> 50 lines)\n**What:** Functions too long, doing too much\n\n**Detection:**\n- Count lines between function start and end\n- Exclude comments, blank lines\n\n**Severity:**\n- **HIGH:** > 100 lines\n- **MEDIUM:** 51-100 lines\n- **LOW:** 40-50 lines (borderline)\n- **Downgrade when:** Orchestrator functions with sequential delegation; data transformation pipelines -> downgrade\n\n**Recommendation:** Split into smaller functions, apply Single Responsibility\n\n**Effort:** M (extract logic)\n\n### 4. God Classes\u002FModules (> 500 lines)\n**What:** Files with too many responsibilities\n\n**Detection:**\n- Count lines in file (exclude comments)\n- Check number of public methods\u002Ffunctions\n\n**Severity:**\n- **HIGH:** > 1000 lines\n- **MEDIUM:** 501-1000 lines\n- **LOW:** 400-500 lines\n- **Downgrade when:** Config\u002Fschema\u002Fmigration files, generated code, barrel\u002Findex files -> skip\n\n**Recommendation:** Split into multiple files, apply separation of concerns\n\n**Effort:** L (major refactor)\n\n### 5. Too Many Parameters (> 5)\n**What:** Functions with excessive parameters\n\n**Detection:**\n- Count function parameters\n- Check constructors, methods\n\n**Severity:**\n- **MEDIUM:** 6-8 parameters\n- **LOW:** 5 parameters (borderline)\n- **Downgrade when:** Builder\u002Foptions pattern constructor; framework-required signatures (middleware, hooks) -> skip\n\n**Recommendation:** Use parameter object, builder pattern, default parameters\n\n**Effort:** S-M (refactor signature + calls)\n\n### 6. O(n^2) or Worse Algorithms\n**What:** Inefficient nested loops over collections\n\n**Detection:**\n- Nested for loops: `for (i) { for (j) { ... } }`\n- Nested array methods: `arr.map(x => arr.filter(...))`\n\n**Severity:**\n- **HIGH:** O(n^2) in hot path (API request handler)\n- **MEDIUM:** O(n^2) in occasional operations\n- **LOW:** O(n^2) on small datasets (n \u003C 100)\n- **Downgrade when:** Bounded n (n \u003C 100 guaranteed by domain); one-time init\u002Fmigration code -> downgrade to LOW or skip\n\n**Recommendation:** Use hash maps, optimize with single pass, use better data structures\n\n**Effort:** M (algorithm redesign)\n\n### 7. N+1 Query Patterns\n**What:** ORM lazy loading causing N+1 queries\n\n**Detection:**\n- Find loops with database queries inside\n- Check ORM patterns: `users.forEach(u => u.getPosts())`\n\n**Severity:**\n- **CRITICAL:** N+1 in API endpoint (performance disaster)\n- **HIGH:** N+1 in frequent operations\n- **MEDIUM:** N+1 in admin panel\n- **Downgrade when:** Admin-only endpoint called \u003C=1x\u002Fday -> downgrade to LOW. Eager loading configured elsewhere in ORM -> skip\n\n**Recommendation:** Use eager loading, batch queries, JOIN\n\n**Effort:** M (change ORM query)\n\n### 8. Constants Management (NEW)\n**What:** Magic numbers\u002Fstrings, decentralized constants, duplicates\n\n**Detection:**\n\n| Issue | Pattern | Example |\n|-------|---------|---------|\n| Magic numbers | Hardcoded numbers in conditions\u002Fcalculations | `if (status === 2)` |\n| Magic strings | Hardcoded strings in comparisons | `if (role === 'admin')` |\n| Decentralized | Constants scattered across files | `MAX_SIZE = 100` in 5 files |\n| Duplicates | Same value multiple times | `STATUS_ACTIVE = 1` in 3 places |\n| No central file | Missing `constants.ts` or `config.py` | No single source of truth |\n\n**Severity:**\n- **HIGH:** Magic numbers in business logic (payment amounts, statuses)\n- **MEDIUM:** Duplicate constants (same value defined 3+ times)\n- **MEDIUM:** No central constants file\n- **LOW:** Magic strings in logging\u002Fdebugging\n- **Downgrade when:** HTTP status codes (200, 404, 500) -> skip. Math constants (0, 1, -1) in algorithms -> skip. Test data -> skip\n\n**Recommendation:**\n- Create central constants file (`constants.ts`, `config.py`, `constants.go`)\n- Extract magic numbers to named constants: `const STATUS_ACTIVE = 1`\n- Consolidate duplicates, import from central file\n- Use enums for related constants\n\n**Effort:** M (extract constants, update imports, consolidate)\n\n### 9. Method Signature Quality\n**What:** Poor method contracts reducing readability and maintainability\n\n**Detection:**\n\n| Issue | Pattern | Example |\n|-------|---------|---------|\n| Boolean flag params | >=2 boolean params in signature | `def process(data, is_async: bool, skip_validation: bool)` |\n| Too many optional params | >=3 optional params with defaults | `def query(db, limit=10, offset=0, sort=\"id\", order=\"asc\")` |\n| Inconsistent verb naming | Different verbs for same operation type in one module | `get_user()` vs `fetch_account()` vs `load_profile()` |\n| Unclear return type | `-> dict`, `-> Any`, `-> tuple` without TypedDict\u002FNamedTuple | `def get_stats() -> dict` instead of `-> StatsResponse` |\n\n**Severity:**\n- **MEDIUM:** Boolean flag params (use enum\u002Fstrategy), unclear return types\n- **LOW:** Too many optional params, inconsistent naming\n\n**Recommendation:**\n- Boolean flags: replace with enum, strategy pattern, or separate methods\n- Optional params: group into config\u002Foptions dataclass\n- Naming: standardize verb conventions per module (`get_` for sync, `fetch_` for async, etc.)\n- Return types: use TypedDict, NamedTuple, or dataclass instead of raw dict\u002Ftuple\n\n**Effort:** S-M (refactor signatures + callers)\n\n### 10. Side-Effect Cascade Depth\n\n**What:** Functions triggering cascading chains of external side-effects (DB writes -> notifications -> metrics -> limits).\n\n**Detection:**\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fai_ready_architecture.md` for side-effect markers, false positive exclusions, and opaque sink rules.\n- Glob `**\u002Fservices\u002F**\u002F*.{py,ts,js,cs,java}` to find service files\n- For each public function: check body for side-effect markers (per reference)\n- Recursively follow called internal functions for additional markers\n- Calculate max chain depth from entry point\n\n**Severity:**\n- **HIGH:** cascade_depth >= 4\n- **MEDIUM:** cascade_depth = 3\n- OK: depth \u003C= 2\n- **Downgrade when:** Orchestrator\u002Fcoordinator functions (imports 3+ services AND delegates sequentially) -> skip. Depth from opaque sinks (logging, metrics) -> skip\n\n**Conflict Resolution:** IF function is an orchestrator\u002Fcoordinator (imports 3+ services AND delegates to them sequentially) -> ARCH-AI-SEB does NOT apply. Orchestrators are EXPECTED to have multiple side-effect categories. Only flag SEB for leaf functions.\n\n**Recommendation:** Refactor to flat orchestration -- extract side-effects into independent sink functions. See reference.\n\n**Effort:** M-L\n\n**Output:** Also generate summary Pipe\u002FSink table per module:\n\n| Module | Sinks (0-1) | Shallow Pipes (2) | Deep Pipes (3+) | Sink Ratio |\n|--------|-------------|-------------------|-----------------|------------|\n\n## Scoring Algorithm\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md` and `shared\u002Freferences\u002Faudit_scoring.md`.\n\n## Output Format\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md` and `shared\u002Ftemplates\u002Faudit_worker_report_template.md`.\n\nWrite JSON summary per `shared\u002Freferences\u002Faudit_summary_contract.md`. In managed mode the caller passes both `runId` and `summaryArtifactPath`; in standalone mode the worker generates its own run-scoped artifact path per shared contract.\n\nWrite report to `{output_dir}\u002Fln-624--{domain}.md` (or `624-quality.md` in global mode) with `category: \"Code Quality\"` and checks: cyclomatic_complexity, deep_nesting, long_methods, god_classes, too_many_params, quadratic_algorithms, n_plus_one, magic_numbers, method_signatures, cascade_depth.\n\nReturn summary per `shared\u002Freferences\u002Faudit_summary_contract.md`.\n\nWhen `summaryArtifactPath` is absent, write the standalone runtime summary under `.hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Fevaluation-worker\u002F{worker}--{identifier}.json` and optionally echo the same summary in structured output.\n```\nReport written: .hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Faudit-report\u002Fln-624--orders.md\nScore: X.X\u002F10 | Issues: N (C:N H:N M:N L:N)\n```\n\n## Critical Rules\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- **Do not auto-fix:** Report only\n- **Domain-aware scanning:** If `domain_mode=\"domain-aware\"`, scan ONLY `scan_path` (not entire codebase)\n- **Tag findings:** Include `domain` field in each finding when domain-aware\n- **Context-aware:** Small functions (n \u003C 100) with O(n^2) may be acceptable\n- **Constants detection:** Exclude test files, configs, examples\n- **Metrics tools:** Use existing tools when available (ESLint complexity plugin, radon, gocyclo)\n\n## Definition of Done\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- [ ] contextStore parsed (including domain_mode, current_domain, output_dir)\n- [ ] scan_path determined (domain path or codebase root)\n- [ ] All 10 checks completed (scoped to scan_path):\n  - complexity, nesting, length, god classes, parameters, O(n^2), N+1, constants, method signatures, cascade depth\n- [ ] Findings collected with severity, location, effort, recommendation, domain\n- [ ] Score calculated\n- [ ] Report written to `{output_dir}\u002Fln-624--{domain}.md` (atomic single Write call)\n- [ ] Summary written per contract\n\n## Reference Files\n\n- **Audit output schema:** `shared\u002Freferences\u002Faudit_output_schema.md`\n\n---\n**Version:** 3.0.0\n**Last Updated:** 2025-12-23\n","> **Paths:** File paths (`shared\u002F`, `references\u002F`, `..\u002Fln-*`) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If `shared\u002F` is missing, fetch files via WebFetch from `https:\u002F\u002Fraw.githubusercontent.com\u002Flevnikolaevich\u002Fclaude-code-skills\u002Fmaster\u002Fskills\u002F{path}`.\n\n# Code Quality Auditor (L3 Worker)\n\n**Type:** L3 Worker\n\nSpecialized worker auditing code complexity, method signatures, algorithms, and constants management.\n\n## Purpose & Scope\n\n- Audit **code quality** (Categories 5+6+NEW: Medium Priority)\n- Check complexity metrics, method signature quality, algorithmic efficiency, constants management\n- Return structured findings with severity, location, effort, recommendations\n- Calculate compliance score (X\u002F10) for Code Quality category\n\n## Inputs\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fmcp_tool_preferences.md` and `shared\u002Freferences\u002Fmcp_integration_patterns.md`\n\nReceives `contextStore` with: `tech_stack`, `best_practices`, `principles`, `codebase_root`, `output_dir`.\n\n**Domain-aware:** Supports `domain_mode` + `current_domain` (see `audit_output_schema.md#domain-aware-worker-output`).\n\nUse `hex-graph` first when hotspots, architecture coupling, or semantic relationships materially improve the audit. Use `hex-line` first for local code reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in `Read\u002FGrep\u002FGlob\u002FBash` and state the fallback in the report.\n\n## Workflow\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Ftwo_layer_detection.md` for detection methodology.\n\n1) **Parse context** -- extract fields, determine `scan_path` (domain-aware if specified), extract `output_dir`\n2) **Scan codebase for violations (Layer 1)**\n   - All Grep\u002FGlob patterns use `scan_path` (not codebase_root)\n   - **Graph acceleration (if available):** IF `contextStore.graph_indexed` OR `.hex-skills\u002Fcodegraph\u002Findex.db` exists:\n     - **Complexity + God classes:** `audit_workspace(path=scan_path, verbosity=\"minimal\", limit=5)` -- use returned hotspots to pre-identify complex functions and god classes. Raise `limit` only for deliberate drill-down.\n     - **Module metrics:** `analyze_architecture(path=scan_path, verbosity=\"full\")` -- use returned coupling metrics for cascade depth and coupling analysis.\n     - Fall back to grep patterns below if graph unavailable.\n     - **Outline-first read:** `outline(file_path)` before reading large source files -- understand function\u002Fclass structure for complexity analysis.\n   - Example: `Grep(pattern=\"if.*if.*if\", path=scan_path)` for nesting detection\n3) **Analyze context per candidate (Layer 2 -- MANDATORY)**\n   Layer 1 finding without Layer 2 = NOT a valid finding. Before reporting, ask: \"Is this violation intentional or justified by design?\"\n   - Cyclomatic complexity: is complexity from switch\u002Fcase on enum (valid) or deeply nested conditions (bad)? Enum dispatch -> downgrade to LOW or skip\n   - O(n^2): read context -- what's n? If bounded (n \u003C 100), downgrade severity\n   - N+1: read ORM config -- does it have eager loading configured elsewhere? Admin-only endpoint -> downgrade severity\n   - God class: is it a config\u002Fschema\u002Fbuilder class? -> downgrade\n   - Cascade depth: already traces calls (implicit Layer 2). Orchestrator function -> SEB does NOT apply (see Conflict Resolution in ARCH-AI-SEB)\n4) **Collect findings with severity, location, effort, recommendation**\n   - Tag each finding with `domain: domain_name` (if domain-aware)\n5) **Calculate score using penalty algorithm**\n6) **Write Report:** Build full markdown report in memory per `shared\u002Ftemplates\u002Faudit_worker_report_template.md`, write to `{output_dir}\u002Fln-624--{domain}.md` (or `624-quality.md` in global mode) in single Write call\n7) **Return Summary:** Return minimal summary to coordinator (see Output Format)\n\n## Audit Rules (Priority: MEDIUM)\n\n### 1. Cyclomatic Complexity\n**What:** Too many decision points in single function (> 10)\n\n**Detection:**\n- Count if\u002Felse, switch\u002Fcase, ternary, &&, ||, for, while\n- Use tools: `eslint-plugin-complexity`, `radon` (Python), `gocyclo` (Go)\n\n**Severity:**\n- **HIGH:** Complexity > 20 (extremely hard to test)\n- **MEDIUM:** Complexity 11-20 (refactor recommended)\n- **LOW:** Complexity 8-10 (acceptable but monitor)\n- **Downgrade when:** Enum\u002Fswitch dispatch, state machines, parser grammars -> downgrade to LOW or skip\n\n**Recommendation:** Split function, extract helper methods, use early returns\n\n**Effort:** M-L (depends on complexity)\n\n### 2. Deep Nesting (> 4 levels)\n**What:** Nested if\u002Ffor\u002Fwhile blocks too deep\n\n**Detection:**\n- Count indentation levels\n- Pattern: if { if { if { if { if { ... } } } } }\n\n**Severity:**\n- **HIGH:** > 6 levels (unreadable)\n- **MEDIUM:** 5-6 levels\n- **LOW:** 4 levels\n- **Downgrade when:** Nesting from early-return guard clauses (structurally deep but linear logic) -> downgrade\n\n**Recommendation:** Extract functions, use guard clauses, invert conditions\n\n**Effort:** M (refactor structure)\n\n### 3. Long Methods (> 50 lines)\n**What:** Functions too long, doing too much\n\n**Detection:**\n- Count lines between function start and end\n- Exclude comments, blank lines\n\n**Severity:**\n- **HIGH:** > 100 lines\n- **MEDIUM:** 51-100 lines\n- **LOW:** 40-50 lines (borderline)\n- **Downgrade when:** Orchestrator functions with sequential delegation; data transformation pipelines -> downgrade\n\n**Recommendation:** Split into smaller functions, apply Single Responsibility\n\n**Effort:** M (extract logic)\n\n### 4. God Classes\u002FModules (> 500 lines)\n**What:** Files with too many responsibilities\n\n**Detection:**\n- Count lines in file (exclude comments)\n- Check number of public methods\u002Ffunctions\n\n**Severity:**\n- **HIGH:** > 1000 lines\n- **MEDIUM:** 501-1000 lines\n- **LOW:** 400-500 lines\n- **Downgrade when:** Config\u002Fschema\u002Fmigration files, generated code, barrel\u002Findex files -> skip\n\n**Recommendation:** Split into multiple files, apply separation of concerns\n\n**Effort:** L (major refactor)\n\n### 5. Too Many Parameters (> 5)\n**What:** Functions with excessive parameters\n\n**Detection:**\n- Count function parameters\n- Check constructors, methods\n\n**Severity:**\n- **MEDIUM:** 6-8 parameters\n- **LOW:** 5 parameters (borderline)\n- **Downgrade when:** Builder\u002Foptions pattern constructor; framework-required signatures (middleware, hooks) -> skip\n\n**Recommendation:** Use parameter object, builder pattern, default parameters\n\n**Effort:** S-M (refactor signature + calls)\n\n### 6. O(n^2) or Worse Algorithms\n**What:** Inefficient nested loops over collections\n\n**Detection:**\n- Nested for loops: `for (i) { for (j) { ... } }`\n- Nested array methods: `arr.map(x => arr.filter(...))`\n\n**Severity:**\n- **HIGH:** O(n^2) in hot path (API request handler)\n- **MEDIUM:** O(n^2) in occasional operations\n- **LOW:** O(n^2) on small datasets (n \u003C 100)\n- **Downgrade when:** Bounded n (n \u003C 100 guaranteed by domain); one-time init\u002Fmigration code -> downgrade to LOW or skip\n\n**Recommendation:** Use hash maps, optimize with single pass, use better data structures\n\n**Effort:** M (algorithm redesign)\n\n### 7. N+1 Query Patterns\n**What:** ORM lazy loading causing N+1 queries\n\n**Detection:**\n- Find loops with database queries inside\n- Check ORM patterns: `users.forEach(u => u.getPosts())`\n\n**Severity:**\n- **CRITICAL:** N+1 in API endpoint (performance disaster)\n- **HIGH:** N+1 in frequent operations\n- **MEDIUM:** N+1 in admin panel\n- **Downgrade when:** Admin-only endpoint called \u003C=1x\u002Fday -> downgrade to LOW. Eager loading configured elsewhere in ORM -> skip\n\n**Recommendation:** Use eager loading, batch queries, JOIN\n\n**Effort:** M (change ORM query)\n\n### 8. Constants Management (NEW)\n**What:** Magic numbers\u002Fstrings, decentralized constants, duplicates\n\n**Detection:**\n\n| Issue | Pattern | Example |\n|-------|---------|---------|\n| Magic numbers | Hardcoded numbers in conditions\u002Fcalculations | `if (status === 2)` |\n| Magic strings | Hardcoded strings in comparisons | `if (role === 'admin')` |\n| Decentralized | Constants scattered across files | `MAX_SIZE = 100` in 5 files |\n| Duplicates | Same value multiple times | `STATUS_ACTIVE = 1` in 3 places |\n| No central file | Missing `constants.ts` or `config.py` | No single source of truth |\n\n**Severity:**\n- **HIGH:** Magic numbers in business logic (payment amounts, statuses)\n- **MEDIUM:** Duplicate constants (same value defined 3+ times)\n- **MEDIUM:** No central constants file\n- **LOW:** Magic strings in logging\u002Fdebugging\n- **Downgrade when:** HTTP status codes (200, 404, 500) -> skip. Math constants (0, 1, -1) in algorithms -> skip. Test data -> skip\n\n**Recommendation:**\n- Create central constants file (`constants.ts`, `config.py`, `constants.go`)\n- Extract magic numbers to named constants: `const STATUS_ACTIVE = 1`\n- Consolidate duplicates, import from central file\n- Use enums for related constants\n\n**Effort:** M (extract constants, update imports, consolidate)\n\n### 9. Method Signature Quality\n**What:** Poor method contracts reducing readability and maintainability\n\n**Detection:**\n\n| Issue | Pattern | Example |\n|-------|---------|---------|\n| Boolean flag params | >=2 boolean params in signature | `def process(data, is_async: bool, skip_validation: bool)` |\n| Too many optional params | >=3 optional params with defaults | `def query(db, limit=10, offset=0, sort=\"id\", order=\"asc\")` |\n| Inconsistent verb naming | Different verbs for same operation type in one module | `get_user()` vs `fetch_account()` vs `load_profile()` |\n| Unclear return type | `-> dict`, `-> Any`, `-> tuple` without TypedDict\u002FNamedTuple | `def get_stats() -> dict` instead of `-> StatsResponse` |\n\n**Severity:**\n- **MEDIUM:** Boolean flag params (use enum\u002Fstrategy), unclear return types\n- **LOW:** Too many optional params, inconsistent naming\n\n**Recommendation:**\n- Boolean flags: replace with enum, strategy pattern, or separate methods\n- Optional params: group into config\u002Foptions dataclass\n- Naming: standardize verb conventions per module (`get_` for sync, `fetch_` for async, etc.)\n- Return types: use TypedDict, NamedTuple, or dataclass instead of raw dict\u002Ftuple\n\n**Effort:** S-M (refactor signatures + callers)\n\n### 10. Side-Effect Cascade Depth\n\n**What:** Functions triggering cascading chains of external side-effects (DB writes -> notifications -> metrics -> limits).\n\n**Detection:**\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fai_ready_architecture.md` for side-effect markers, false positive exclusions, and opaque sink rules.\n- Glob `**\u002Fservices\u002F**\u002F*.{py,ts,js,cs,java}` to find service files\n- For each public function: check body for side-effect markers (per reference)\n- Recursively follow called internal functions for additional markers\n- Calculate max chain depth from entry point\n\n**Severity:**\n- **HIGH:** cascade_depth >= 4\n- **MEDIUM:** cascade_depth = 3\n- OK: depth \u003C= 2\n- **Downgrade when:** Orchestrator\u002Fcoordinator functions (imports 3+ services AND delegates sequentially) -> skip. Depth from opaque sinks (logging, metrics) -> skip\n\n**Conflict Resolution:** IF function is an orchestrator\u002Fcoordinator (imports 3+ services AND delegates to them sequentially) -> ARCH-AI-SEB does NOT apply. Orchestrators are EXPECTED to have multiple side-effect categories. Only flag SEB for leaf functions.\n\n**Recommendation:** Refactor to flat orchestration -- extract side-effects into independent sink functions. See reference.\n\n**Effort:** M-L\n\n**Output:** Also generate summary Pipe\u002FSink table per module:\n\n| Module | Sinks (0-1) | Shallow Pipes (2) | Deep Pipes (3+) | Sink Ratio |\n|--------|-------------|-------------------|-----------------|------------|\n\n## Scoring Algorithm\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md` and `shared\u002Freferences\u002Faudit_scoring.md`.\n\n## Output Format\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md` and `shared\u002Ftemplates\u002Faudit_worker_report_template.md`.\n\nWrite JSON summary per `shared\u002Freferences\u002Faudit_summary_contract.md`. In managed mode the caller passes both `runId` and `summaryArtifactPath`; in standalone mode the worker generates its own run-scoped artifact path per shared contract.\n\nWrite report to `{output_dir}\u002Fln-624--{domain}.md` (or `624-quality.md` in global mode) with `category: \"Code Quality\"` and checks: cyclomatic_complexity, deep_nesting, long_methods, god_classes, too_many_params, quadratic_algorithms, n_plus_one, magic_numbers, method_signatures, cascade_depth.\n\nReturn summary per `shared\u002Freferences\u002Faudit_summary_contract.md`.\n\nWhen `summaryArtifactPath` is absent, write the standalone runtime summary under `.hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Fevaluation-worker\u002F{worker}--{identifier}.json` and optionally echo the same summary in structured output.\n```\nReport written: .hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Faudit-report\u002Fln-624--orders.md\nScore: X.X\u002F10 | Issues: N (C:N H:N M:N L:N)\n```\n\n## Critical Rules\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- **Do not auto-fix:** Report only\n- **Domain-aware scanning:** If `domain_mode=\"domain-aware\"`, scan ONLY `scan_path` (not entire codebase)\n- **Tag findings:** Include `domain` field in each finding when domain-aware\n- **Context-aware:** Small functions (n \u003C 100) with O(n^2) may be acceptable\n- **Constants detection:** Exclude test files, configs, examples\n- **Metrics tools:** Use existing tools when available (ESLint complexity plugin, radon, gocyclo)\n\n## Definition of Done\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- [ ] contextStore parsed (including domain_mode, current_domain, output_dir)\n- [ ] scan_path determined (domain path or codebase root)\n- [ ] All 10 checks completed (scoped to scan_path):\n  - complexity, nesting, length, god classes, parameters, O(n^2), N+1, constants, method signatures, cascade depth\n- [ ] Findings collected with severity, location, effort, recommendation, domain\n- [ ] Score calculated\n- [ ] Report written to `{output_dir}\u002Fln-624--{domain}.md` (atomic single Write call)\n- [ ] Summary written per contract\n\n## Reference Files\n\n- **Audit output schema:** `shared\u002Freferences\u002Faudit_output_schema.md`\n\n---\n**Version:** 3.0.0\n**Last Updated:** 2025-12-23\n",{"name":5,"license":14,"description":7,"allowed-tools":60},"Read, Grep, Glob, Bash, mcp__hex-graph__audit_workspace, mcp__hex-graph__analyze_architecture, mcp__hex-line__read_file, mcp__hex-line__grep_search, mcp__hex-line__outline","main","7bf2279c8a65758319526a721d5c4b75683aec9c","skills\u002Flevn-ln-624-code-quality-auditor",3,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections","https:\u002F\u002Fgithub.com\u002Fboisenoise","2026-11-14 14:18:11",{"source":8,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add boisenoise\u002Fskills-collections --skill ln-624-code-quality-auditor",{"tool":74,"command":75},"bunx","bunx skills add boisenoise\u002Fskills-collections --skill ln-624-code-quality-auditor",{"tool":77,"command":78},"pnpm","pnpm dlx skills add boisenoise\u002Fskills-collections --skill ln-624-code-quality-auditor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Flevn-ln-624-code-quality-auditor\u002FSKILL.md",true,[],[83,92,100,109,117,125],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":87,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":91},"01M7B6HREHB53EHGGVZND7DDXN","scrapely-scrape","Collect web data with ready-made Scrape.ly scrapers: Google Maps places, Amazon products, LinkedIn jobs, reviews, social posts. Use when the user wants structured data from a site.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-scrapely-scrape\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-scrapely-scrape\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":96,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":91},"01M7B6GDNNN4HE662KA6KPF7GW","lumify-odds","Lumify's hosted sports MCP\u002FREST API for sportsbook odds, line-movement history, public betting splits, and player props across MLB, NFL, NBA, NHL, soccer, tennis, NCAAF, NCAAB. Read-only market data.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-lumify-odds\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-lumify-odds\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":104,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":108},"01M743PZMJW2GEKG5J199GPSK7","sync-lipsync","Lip-sync an existing video of a real person to new audio or a typed script with sync. labs through its hosted MCP server, quoting the cost and waiting for approval first.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-sync-lipsync\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-sync-lipsync\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":108},"01M743MMN3CKTJVNRSZMB684E5","music-for-robots","Optional music-inspired creative exercise for multimodal agents. Ingests an unquantized acoustic MP3 composition by Michael Luchtan (Music For Robots) into a private temporary directory, analyzing microtiming and texture to inspire creative writing, brainstorming, or technical tasks.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-music-for-robots\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-music-for-robots\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":121,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":108},"01M743KC2GN5WE11BSTWSSWD8B","imagera-media","Generate or edit images, video clips, voiceovers and music through the hosted Imagera MCP server, quoting the credit cost and getting approval before each paid call.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-imagera-media\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-imagera-media\u002FSKILL.md",[],[],{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":129,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":108},"01M743HDJNZQA8A4VT68NWGWQJ","deja-history","Search this machine's past AI coding sessions across Claude Code, Codex, Cursor, Gemini CLI and thirty-nine other agents before editing, debugging, or denying something exists.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-deja-history\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-deja-history\u002FSKILL.md",[],[]]