[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EGGRA3WQRE0DD0B3WSX2QE":3,"skill-same:01M6EGGRA3WQRE0DD0B3WSX2QE":123},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6EGGRA3WQRE0DD0B3WSX2QE","ln-624-code-quality-auditor",null,"Checks cyclomatic complexity, nesting, long methods, god classes, method signatures, O(n²), N+1 queries, constants management. Returns findings.","levalencia\u002Fagent-god-mode","levalencia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6962857?v=4","01M6EB0FZZ4BPQPC4HET4QY6NM","Luis Valencia ","01M6EB0G4HWHPWW0H9X7QKSAHP",3,"MIT","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fln-624-code-quality-auditor\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[24,25,26,27,28,29,30,31,32,33,34,35,36,37],"code quality","code","quality","ln 624 code quality auditor","Bash","returns","grep","read","management","complexity","queries","methods","signatures","long","2026-11-10 10:12:30",false,"---\nname: ln-624-code-quality-auditor\ndescription: \"Checks cyclomatic complexity, nesting, long methods, god classes, method signatures, O(n²), N+1 queries, constants management. Returns findings.\"\nallowed-tools: Read, Grep, Glob, Bash\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.\n\n# Code Quality Auditor (L3 Worker)\n\nSpecialized worker auditing code complexity, method signatures, algorithms, and constants management.\n\n## Purpose & Scope\n\n- **Worker in ln-620 coordinator pipeline** - invoked by ln-620-codebase-auditor\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 (from Coordinator)\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.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\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   - 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²): 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}\u002F624-quality-{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²) 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²) in hot path (API request handler)\n- **MEDIUM:** O(n²) in occasional operations\n- **LOW:** O(n²) 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 ≤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:** `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 report to `{output_dir}\u002F624-quality-{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 to coordinator:\n```\nReport written: docs\u002Fproject\u002F.audit\u002Fln-620\u002F{YYYY-MM-DD}\u002F624-quality-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²) 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²), 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}\u002F624-quality-{domain}.md` (atomic single Write call)\n- Summary returned to coordinator\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.\n\n# Code Quality Auditor (L3 Worker)\n\nSpecialized worker auditing code complexity, method signatures, algorithms, and constants management.\n\n## Purpose & Scope\n\n- **Worker in ln-620 coordinator pipeline** - invoked by ln-620-codebase-auditor\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 (from Coordinator)\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.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\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   - 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²): 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}\u002F624-quality-{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²) 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²) in hot path (API request handler)\n- **MEDIUM:** O(n²) in occasional operations\n- **LOW:** O(n²) 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 ≤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:** `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 report to `{output_dir}\u002F624-quality-{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 to coordinator:\n```\nReport written: docs\u002Fproject\u002F.audit\u002Fln-620\u002F{YYYY-MM-DD}\u002F624-quality-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²) 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²), 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}\u002F624-quality-{domain}.md` (atomic single Write call)\n- Summary returned to coordinator\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":15,"description":7,"allowed-tools":43},"Read, Grep, Glob, Bash","main","fa638b97a18ff6d9f26cf0eaf3dfa123531bcc87","organized-skills\u002Fln-624-code-quality-auditor",1,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode","https:\u002F\u002Fgithub.com\u002Flevalencia","https:\u002F\u002Fmedium.com\u002F@luisevalencia","Microsoft MVP - Artificial Intelligence\r\nMachine Learning Enthusiast\r\n","2026-05-02 06:55:36",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add levalencia\u002Fagent-god-mode --skill ln-624-code-quality-auditor",{"tool":59,"command":60},"bunx","bunx skills add levalencia\u002Fagent-god-mode --skill ln-624-code-quality-auditor",{"tool":62,"command":63},"pnpm","pnpm dlx skills add levalencia\u002Fagent-god-mode --skill ln-624-code-quality-auditor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fln-624-code-quality-auditor\u002FSKILL.md",true,[67,73,79,83,87,91,95,99,103,107,111,115,119],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"architecture-decision-template.md","REFERENCE","参考文档",337,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Farchitecture-decision-template.md",{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"data\u002Fdomain-complexity.csv","ASSET","资产文件",2187,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fdata\u002Fdomain-complexity.csv",{"path":80,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":81,"sourceHtmlUrl":82},"data\u002Fproject-types.csv",758,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fdata\u002Fproject-types.csv",{"path":84,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":85,"sourceHtmlUrl":86},"steps\u002Fstep-01-init.md",6584,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-01-init.md",{"path":88,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":89,"sourceHtmlUrl":90},"steps\u002Fstep-01b-continue.md",6232,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-01b-continue.md",{"path":92,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":93,"sourceHtmlUrl":94},"steps\u002Fstep-02-context.md",8621,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-02-context.md",{"path":96,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":97,"sourceHtmlUrl":98},"steps\u002Fstep-03-starter.md",11976,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-03-starter.md",{"path":100,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":101,"sourceHtmlUrl":102},"steps\u002Fstep-04-decisions.md",10269,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-04-decisions.md",{"path":104,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":105,"sourceHtmlUrl":106},"steps\u002Fstep-05-patterns.md",10918,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-05-patterns.md",{"path":108,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":109,"sourceHtmlUrl":110},"steps\u002Fstep-06-structure.md",11177,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-06-structure.md",{"path":112,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":113,"sourceHtmlUrl":114},"steps\u002Fstep-07-validation.md",11636,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-07-validation.md",{"path":116,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":117,"sourceHtmlUrl":118},"steps\u002Fstep-08-complete.md",3133,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fsteps\u002Fstep-08-complete.md",{"path":120,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":121,"sourceHtmlUrl":122},"workflow.md",1498,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.roo\u002Fskills\u002Fbmad-create-architecture\u002Fworkflow.md",[124,146,180,207,233,260],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":38},"01M6EM8ES5M9J4S8N78NJST0YC","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fzarr-python\u002FSKILL.md",[],[131,132,133,134,135,136,137,138,139,140,141,142,143,144,145],"python","zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":161,"publishedAt":38},"01M6EM8AR6ZFKZ9YVW8TTG850Z","zabbix","Zabbix monitoring system automation via API and Python. Use when: (1) Managing hosts, templates, items, triggers, or host groups, (2) Automating monitoring configuration, (3) Sending data via Zabbix trapper\u002Fsender, (4) Querying historical data or events, (5) Bulk operations on Zabbix objects, (6) Maintenance window management, (7) User\u002Fpermission management","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fzabbix-api-skill\u002FSKILL.md",[152,157,160],{"categoryNo":153,"categoryName":154,"taxonomyType":155,"taxonomyTypeDesc":156},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":158,"categoryName":159,"taxonomyType":155,"taxonomyTypeDesc":156},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[148,131,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179],"automation","window management","monitoring","data","templates","api","system","operations","use","maintenance","objects","permission","bulk operations","triggers","host","events","via","bulk",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":38},"01M6EM6Q9JG846ECQY9A210A26","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fx-twitter-growth\u002FSKILL.md",[],[187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206],"twitter","x twitter growth","growth","competitive intelligence","search","analyzing","plan","marketing","web search","competitors","analyze","write","optimize","social","intelligence","viral","growth engine","mechanics","grow","competitive",{"skillNo":208,"name":209,"nameZh":6,"description":210,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":211,"categories":212,"keywords":213,"publishedAt":38},"01M6EM3FQNPYNKPC4CV9TCVNGD","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fwhat-if-oracle\u002FSKILL.md",[],[214,215,216,217,218,219,220,221,222,223,224,225,170,226,227,228,229,230,231,232],"oracle","what if oracle","test","planning","ux","futures","risk","analysis","explore","decision","branch","question","exploration","options","stress-test","strategies","trigger","case","multi",{"skillNo":234,"name":235,"nameZh":6,"description":236,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":237,"categories":238,"keywords":242,"publishedAt":38},"01M6EM08C06RGDYCJ86HAPK0FF","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fvercel-react-best-practices\u002FSKILL.md",[239],{"categoryNo":240,"categoryName":241,"taxonomyType":155,"taxonomyTypeDesc":156},"01JBSEEDCAT000000000000009","前端开发",[243,244,245,246,247,248,249,250,251,252,253,25,254,165,255,256,257,258,259,175],"react","vercel react best practices","best practices","react best practices","vercel","writing","performance","components","react components","guidelines","tasks","Optimization","Next.js","refactoring","performance optimization","next","pages",{"skillNo":261,"name":262,"nameZh":6,"description":263,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":264,"categories":265,"keywords":276,"publishedAt":38},"01M6EM00S13326QM08DTM94J6Z","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fvenue-templates\u002FSKILL.md",[266,269,272,273],{"categoryNo":267,"categoryName":268,"taxonomyType":155,"taxonomyTypeDesc":156},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":270,"categoryName":271,"taxonomyType":155,"taxonomyTypeDesc":156},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":158,"categoryName":159,"taxonomyType":155,"taxonomyTypeDesc":156},{"categoryNo":274,"categoryName":275,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000036","内容创作者",[166,277,278,252,279,280,281,282,28,283,31,198,284,285,286,287,288,289,145,290],"venue templates","research","NeurIPS","ICML","LaTeX","science","access","edit","proposals","Academic","requirements","formatting","journal","chi"]