[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FJCJ1PTX3DEMW0XDJYET5F":3,"skill-same:01M6FJCJ1PTX3DEMW0XDJYET5F":78},{"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":17,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M6FJCJ1PTX3DEMW0XDJYET5F","ln-511-code-quality-checker",null,"Checks DRY\u002FKISS\u002FYAGNI\u002Farchitecture compliance with quantitative Code Quality Score. Use when implementation tasks are Done and need quality scoring.","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-511-code-quality-checker\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"code quality","checker","code","ln","quality","ln 511 code quality checker","quality checker","context7","when","with","quality scoring","dry","hex","outline","done","scoring","MCP","yagni","use","analyze","Bash","tasks","architecture","2026-11-10 10:12:30",false,"---\nname: ln-511-code-quality-checker\ndescription: \"Checks DRY\u002FKISS\u002FYAGNI\u002Farchitecture compliance with quantitative Code Quality Score. Use when implementation tasks are Done and need quality scoring.\"\nallowed-tools: Read, Grep, Glob, Bash, WebFetch, mcp__Ref, mcp__context7, mcp__hex-line__outline, mcp__hex-graph__audit_workspace, mcp__hex-graph__analyze_architecture\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 Checker\n\n**Type:** L3 Worker\n**Category:** 5XX Quality\n\nAnalyzes Done implementation tasks with quantitative Code Quality Score based on metrics, MCP Ref validation, and issue penalties.\n\n## Inputs\n\n| Input | Required | Source | Description |\n|-------|----------|--------|-------------|\n| `storyId` | Yes | args, git branch, kanban, user | Story to process |\n\n**Resolution:** Story Resolution Chain.\n**Status filter:** In Progress, To Review\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fmcp_tool_preferences.md` and `shared\u002Freferences\u002Fmcp_integration_patterns.md` - use `hex-graph` as the primary path for clone, architecture, and semantic quality evidence when the project is indexed. Fall back to Grep\u002FRead only when graph is unavailable or unsupported.\n\n## Purpose & Scope\n- Load Story and Done implementation tasks (exclude test tasks)\n- Calculate Code Quality Score using metrics and issue penalties\n- **MCP Ref validation:** Verify optimality, best practices, and performance via external sources\n- Check for DRY\u002FKISS\u002FYAGNI violations, architecture boundary breaks, security issues\n- Produce quantitative verdict with structured issue list; never edits Linear or kanban\n\n## Code Metrics\n\n| Metric | Threshold | Penalty |\n|--------|-----------|---------|\n| **Cyclomatic Complexity** | ≤10 OK, 11-20 warning, >20 fail | -5 (warning), -10 (fail) per function |\n| **Function size** | ≤50 lines OK, >50 warning | -3 per function |\n| **File size** | ≤500 lines OK, >500 warning | -5 per file |\n| **Nesting depth** | ≤3 OK, >3 warning | -3 per instance |\n| **Parameter count** | ≤4 OK, >4 warning | -2 per function |\n\n## Code Quality Score\n\nFormula: `Code Quality Score = 100 - metric_penalties - issue_penalties`\n\n**Issue penalties by severity:**\n\n| Severity | Penalty | Examples |\n|----------|---------|----------|\n| **high** | -20 | Security vulnerability, O(n²)+ algorithm, N+1 query |\n| **medium** | -10 | DRY violation, suboptimal approach, missing config |\n| **low** | -3 | Naming convention, minor code smell |\n\n**Score interpretation:**\n\n| Score | Status | Verdict |\n|-------|--------|---------|\n| 90-100 | Excellent | PASS |\n| 70-89 | Acceptable | CONCERNS |\n| \u003C70 | Below threshold | ISSUES_FOUND |\n\n## Issue Prefixes\n\n| Prefix | Category | Default Severity | MCP Ref |\n|--------|----------|------------------|---------|\n| SEC- | Security (auth, validation, secrets) | high | — |\n| SEC-DESTR- | Destructive ops (guards: DB, FS, MIG, ENV, FORCE) | high\u002Fmedium | — |\n| PERF- | Performance (algorithms, configs, bottlenecks) | medium\u002Fhigh | ✓ Required |\n| MNT- | Maintainability (DRY, SOLID, complexity, dead code) | medium | — |\n| ARCH- | Architecture (layers, boundaries, patterns, contracts) | medium | — |\n| BP- | Best Practices (implementation differs from recommended) | medium | ✓ Required |\n| OPT- | Optimality (better approach exists for this goal) | medium | ✓ Required |\n\n**OPT- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| OPT-OSS- | Open-source replacement available | medium (high if >200 LOC) |\n\n**ARCH- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| ARCH-LB- | Layer Boundary: I\u002FO outside infra, HTTP in domain | high |\n| ARCH-TX- | Transaction Boundaries: commit() in 3+ layers, mixed UoW ownership | high (CRITICAL if auth\u002Fpayment) |\n| ARCH-DTO- | Missing DTO (4+ params without DTO), Entity Leakage (ORM entity in API response) | medium (high if auth\u002Fpayment) |\n| ARCH-DI- | Dependency Injection: dependencies not replaceable for testing (direct instantiation, no injection mechanism). Exception: small scripts\u002FCLIs where params\u002Fclosures suffice → skip | medium |\n| ARCH-CEH- | Centralized Error Handling: errors silently swallowed, stack traces leak to prod, no consistent error logging. Exception: 50-line scripts → downgrade to LOW | medium (high if no handler at all) |\n| ARCH-SES- | Session Ownership: DI session + local session in same module | medium |\n| ARCH-AI-SEB | Side-Effect Breadth: 3+ side-effect categories in one **leaf** function. **Conflict Resolution:** orchestrator\u002Fcoordinator functions (imports 3+ services AND delegates sequentially) are EXPECTED to have multiple categories — do NOT flag SEB | medium |\n| ARCH-AI-AH | Architectural Honesty: read-named function with write side-effects | medium |\n| ARCH-AI-FO | Flat Orchestration: **leaf** service imports 3+ other services. Orchestrator imports are expected — do NOT flag | medium |\n| ARCH-EVENT- | Event Channel Consistency: publisher\u002Fsubscriber name mismatch (MISMATCH), orphaned channel with no counterpart (ORPHAN) | high (mismatch), medium (orphan) |\n\n**PERF- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| PERF-ALG- | Algorithm complexity (Big O) | high if O(n²)+ |\n| PERF-CFG- | Package\u002Flibrary configuration | medium |\n| PERF-PTN- | Architectural pattern performance | high |\n| PERF-DB- | Database queries, indexes | high |\n\n**MNT- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| MNT-DC- | Dead code: replaced implementations, unused exports\u002Fre-exports, backward-compat wrappers, unsupported aliases | medium (high if public API) |\n| MNT-DRY- | DRY violations: duplicate logic across files | medium |\n| MNT-GOD- | God Classes: class with >15 methods or >500 lines (not just file size) | medium (high if >1000 lines) |\n| MNT-SIG- | Method Signature Quality: boolean flag params, unclear return types, inconsistent naming, >5 optional params | low |\n| MNT-ERR- | Error Contract inconsistency: mixed raise + return None in same service | medium |\n\n## When to Use\n- All implementation tasks in Story status = Done\n- Before tech debt cleanup and inline agent review\n\n## Workflow (concise)\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Finput_resolution_pattern.md`\n\n1) **Resolve storyId:** Run Story Resolution Chain per guide (status filter: [In Progress, To Review]).\n2) Load Story (full) and Done implementation tasks (full descriptions) via Linear; skip tasks with label \"tests\".\n3) **Collect changed files** (`changed_files[]`):\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Fgit_scope_detection.md`\n   - IF invoked by ln-510: use `changed_files[]` from coordinator context → proceed to Enrich step in guide\n   - IF invoked standalone: run full algorithm from guide\n4) **Two-Layer Detection (MANDATORY):**\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Ftwo_layer_detection.md`\n   All threshold-based findings require Layer 2 context analysis. Layer 1 finding without Layer 2 = NOT a valid finding. Before reporting any metric violation, ask: \"Is this violation intentional or justified by design?\" See Exception column in metrics below.\n\n5) **Calculate code metrics:**\n   - Cyclomatic Complexity per function (target ≤10; Exception: enum\u002Fswitch dispatch, state machines, parser grammars → downgrade to LOW)\n   - Function size (target ≤50 lines; Exception: orchestrator functions with sequential delegation)\n   - File size (target ≤500 lines; Exception: config\u002Fschema\u002Fmigration files, generated code)\n   - Nesting depth (target ≤3)\n   - Parameter count (target ≤4; Exception: builder\u002Foptions patterns)\n\n6) **MCP Ref Validation (MANDATORY for code changes — SKIP if `--skip-mcp-ref` flag passed):**\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Fresearch_tool_fallback.md`\n\n   > **Fast-track mode:** When invoked with `--skip-mcp-ref`, skip this entire step (no OPT-, BP-, PERF- checks). Proceed directly to step 6 (static analysis). This reduces cost from ~5000 to ~800 tokens while preserving metrics + static analysis coverage.\n\n   **Level 1 — OPTIMALITY (OPT-):**\n   - Extract goal from task (e.g., \"user authentication\", \"caching\", \"API rate limiting\")\n   - Research alternatives: `ref_search_documentation(\"{goal} approaches comparison {tech_stack} 2026\")`\n   - Compare chosen approach vs alternatives for project context\n   - Flag suboptimal choices as OPT- issues\n\n   **Level 2 — BEST PRACTICES (BP-):**\n   - Research: `ref_search_documentation(\"{chosen_approach} best practices {tech_stack} 2026\")`\n   - For libraries: `query-docs(library_id, \"best practices implementation patterns\")`\n   - Flag deviations from recommended patterns as BP- issues\n\n   **Level 3 — PERFORMANCE (PERF-):**\n   - **PERF-ALG:** Analyze algorithm complexity (detect O(n²)+, research optimal via MCP Ref)\n   - **PERF-CFG:** Check library configs (connection pooling, batch sizes, timeouts) via `query-docs`\n   - **PERF-PTN:** Research pattern pitfalls: `ref_search_documentation(\"{pattern} performance bottlenecks\")`\n   - **PERF-DB:** Check for N+1, missing indexes via `query-docs(orm_library_id, \"query optimization\")`\n\n   **Triggers for MCP Ref validation:**\n   - New dependency added (package.json\u002Frequirements.txt changed)\n   - New pattern\u002Flibrary used\n   - API\u002Fdatabase changes\n   - Loops\u002Frecursion in critical paths\n   - ORM queries added\n\n7) **Analyze code for static issues (assign prefixes):**\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Fclean_code_checklist.md`, `shared\u002Freferences\u002Fdestructive_operation_safety.md`\n   - For large code files, use `outline(file_path)` before targeted reads.\n   - SEC-: hardcoded creds, unvalidated input, SQL injection, race conditions\n   - SEC-DESTR-: unguarded destructive operations — use code-level guards table from destructive_operation_safety.md (loaded above). Check all 5 guard categories (DB, FS, MIG, ENV, FORCE).\n   - MNT-: DRY violations (MNT-DRY-: duplicate logic), dead code (MNT-DC-: per checklist), complex conditionals, poor naming\n   - **MNT-DRY- cross-story hotspot scan:** Grep for common pattern signatures (error handlers: `catch.*Error|handleError`, validators: `validate|isValid`, config access: `getSettings|getConfig`) across ALL `src\u002F` files (count mode). If any pattern appears in 5+ files, sample 3 files (Read 50 lines each) and check structural similarity. If >80% similar → MNT-DRY-CROSS (medium, -10 points): `Pattern X duplicated in N files — extract to shared module.`\n   - **MNT-DRY- preferred (hex-graph):** If hex-graph indexed, use `audit_workspace(path=scan_path, verbosity=\"minimal\", limit=5, clone_member_limit=3)`. Each clone group with 2+ members in different files = MNT-DRY-CROSS. Raise limits only when the bounded preview is insufficient. Use returned hotspot and clone context for priority. Fall back to Grep pattern scan above if hex-graph unavailable.\n   - **MNT-DC- cross-story unused export scan:** For each file modified by Story, count `export` declarations. Then Grep across ALL `src\u002F` for import references to those exports. Exports with 0 import references → MNT-DC-CROSS (medium, -10 points): `{export} in {file} exported but never imported — remove or mark internal.`\n   - **OPT-OSS- cross-reference ln-645 (static, fast-track safe):** IF `docs\u002Fproject\u002F.audit\u002Fln-640\u002F*\u002F645-open-source-replacer*.md` exists (glob across dates, take latest), check if any HIGH-confidence replacement matches files changed in current Story. IF match found → create OPT-OSS-{N} issue with module path, goal, recommended package, confidence, stars, license from ln-645 report. Severity: high if >200 LOC, medium otherwise. This check reads local files only — no MCP calls — runs even with `--skip-mcp-ref`.\n   - ARCH-: layer violations, circular dependencies, guide non-compliance\n   - ARCH-LB-: layer boundary violations (HTTP\u002FDB\u002FFS calls outside infrastructure layer)\n   - ARCH-TX-: transaction boundary violations (commit() across multiple layers)\n   - ARCH-DTO-: missing DTOs (4+ repeated params), entity leakage (ORM entities returned from API)\n   - ARCH-DI-: direct instantiation in business logic (no DI container or mixed patterns)\n   - ARCH-CEH-: centralized error handling absent or bypassed\n   - ARCH-SES-: session ownership conflicts (DI + local session in same module)\n   - ARCH-AI-SEB: side-effect breadth (3+ categories in one **leaf** function; orchestrator functions exempt — see Conflict Resolution in table above)\n   - ARCH-AI-AH: architectural honesty (read-named function with hidden writes)\n   - ARCH-AI-FO: flat orchestration (**leaf** service importing 3+ services; orchestrator imports exempt)\n   - ARCH-EVENT-: event channel mismatch — Grep for `NOTIFY|pg_notify|\\.publish\\(|\\.emit\\(` (publishers) and `LISTEN|\\.subscribe\\(|\\.on\\(` (subscribers) in changed_files[]. Cross-reference channel name strings. \u003C!-- Defense-in-depth: also checked by ln-652 Rule 6 -->\n   - MNT-GOD-: god classes (>15 methods or >500 lines per class)\n   - MNT-SIG-: method signature quality (boolean flags, unclear returns)\n   - MNT-ERR-: error contract inconsistency (mixed raise\u002Freturn patterns in same service)\n\n8) **Calculate Code Quality Score:**\n   - Start with 100\n   - Subtract metric penalties (see Code Metrics table)\n   - Subtract issue penalties (see Issue penalties table)\n\n9) **Output verdict with score and structured issues.**\n   **MANDATORY READ:** Load `references\u002Foutput_schema.md`\n   Format output per schema. Add Linear comment with findings.\n\n## Critical Rules\n- Read guides mentioned in Story\u002FTasks before judging compliance.\n- **MCP Ref validation:** For ANY architectural change, MUST verify via ref_search_documentation before judging.\n- **Context7 for libraries:** When reviewing library usage, query-docs to verify correct patterns.\n- Language preservation in comments (EN\u002FRU).\n- Do not create tasks or change statuses; caller decides next actions.\n\n## Runtime Summary Artifact\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fquality_summary_contract.md`, `shared\u002Freferences\u002Fquality_worker_runtime_contract.md`\n\nRuntime profile:\n- family: `quality-worker`\n- worker: `ln-511`\n- summary kind: `quality-worker`\n- payload fields used by coordinators: `worker`, `status`, `verdict`, `score`, `issues`, `warnings`\n\nInvocation rules:\n- standalone: omit `runId` and `summaryArtifactPath`\n- managed: pass both `runId` and exact `summaryArtifactPath`\n- always write the validated summary before terminal outcome\n\n## Definition of Done\n\n- [ ] Story and Done implementation tasks loaded (test tasks excluded)\n- [ ] Code metrics calculated (Cyclomatic Complexity, function\u002Ffile sizes)\n- [ ] MCP Ref validation completed (OPT-, BP-, PERF- categories)\n- [ ] ARCH- subcategories checked (LB, TX, DTO, DI, CEH, SES, EVENT); MNT- subcategories checked (DC, DRY, GOD, SIG, ERR)\n- [ ] Issues identified with prefixes and severity, sources from MCP Ref\u002FContext7\n- [ ] Code Quality Score calculated\n- [ ] Output formatted per `references\u002Foutput_schema.md`\n- [ ] Linear comment posted with findings\n\n## Reference Files\n- Git scope detection: `shared\u002Freferences\u002Fgit_scope_detection.md`\n- Code metrics: `references\u002Fcode_metrics.md` (thresholds and penalties)\n- Guides: `docs\u002Fguides\u002F`\n- Templates for context: `shared\u002Ftemplates\u002Ftask_template_implementation.md`\n- **Clean code checklist:** `shared\u002Freferences\u002Fclean_code_checklist.md`\n- Research tool fallback: `shared\u002Freferences\u002Fresearch_tool_fallback.md`\n\n---\n**Version:** 5.1.0\n**Last Updated:** 2026-03-15\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 Checker\n\n**Type:** L3 Worker\n**Category:** 5XX Quality\n\nAnalyzes Done implementation tasks with quantitative Code Quality Score based on metrics, MCP Ref validation, and issue penalties.\n\n## Inputs\n\n| Input | Required | Source | Description |\n|-------|----------|--------|-------------|\n| `storyId` | Yes | args, git branch, kanban, user | Story to process |\n\n**Resolution:** Story Resolution Chain.\n**Status filter:** In Progress, To Review\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fmcp_tool_preferences.md` and `shared\u002Freferences\u002Fmcp_integration_patterns.md` - use `hex-graph` as the primary path for clone, architecture, and semantic quality evidence when the project is indexed. Fall back to Grep\u002FRead only when graph is unavailable or unsupported.\n\n## Purpose & Scope\n- Load Story and Done implementation tasks (exclude test tasks)\n- Calculate Code Quality Score using metrics and issue penalties\n- **MCP Ref validation:** Verify optimality, best practices, and performance via external sources\n- Check for DRY\u002FKISS\u002FYAGNI violations, architecture boundary breaks, security issues\n- Produce quantitative verdict with structured issue list; never edits Linear or kanban\n\n## Code Metrics\n\n| Metric | Threshold | Penalty |\n|--------|-----------|---------|\n| **Cyclomatic Complexity** | ≤10 OK, 11-20 warning, >20 fail | -5 (warning), -10 (fail) per function |\n| **Function size** | ≤50 lines OK, >50 warning | -3 per function |\n| **File size** | ≤500 lines OK, >500 warning | -5 per file |\n| **Nesting depth** | ≤3 OK, >3 warning | -3 per instance |\n| **Parameter count** | ≤4 OK, >4 warning | -2 per function |\n\n## Code Quality Score\n\nFormula: `Code Quality Score = 100 - metric_penalties - issue_penalties`\n\n**Issue penalties by severity:**\n\n| Severity | Penalty | Examples |\n|----------|---------|----------|\n| **high** | -20 | Security vulnerability, O(n²)+ algorithm, N+1 query |\n| **medium** | -10 | DRY violation, suboptimal approach, missing config |\n| **low** | -3 | Naming convention, minor code smell |\n\n**Score interpretation:**\n\n| Score | Status | Verdict |\n|-------|--------|---------|\n| 90-100 | Excellent | PASS |\n| 70-89 | Acceptable | CONCERNS |\n| \u003C70 | Below threshold | ISSUES_FOUND |\n\n## Issue Prefixes\n\n| Prefix | Category | Default Severity | MCP Ref |\n|--------|----------|------------------|---------|\n| SEC- | Security (auth, validation, secrets) | high | — |\n| SEC-DESTR- | Destructive ops (guards: DB, FS, MIG, ENV, FORCE) | high\u002Fmedium | — |\n| PERF- | Performance (algorithms, configs, bottlenecks) | medium\u002Fhigh | ✓ Required |\n| MNT- | Maintainability (DRY, SOLID, complexity, dead code) | medium | — |\n| ARCH- | Architecture (layers, boundaries, patterns, contracts) | medium | — |\n| BP- | Best Practices (implementation differs from recommended) | medium | ✓ Required |\n| OPT- | Optimality (better approach exists for this goal) | medium | ✓ Required |\n\n**OPT- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| OPT-OSS- | Open-source replacement available | medium (high if >200 LOC) |\n\n**ARCH- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| ARCH-LB- | Layer Boundary: I\u002FO outside infra, HTTP in domain | high |\n| ARCH-TX- | Transaction Boundaries: commit() in 3+ layers, mixed UoW ownership | high (CRITICAL if auth\u002Fpayment) |\n| ARCH-DTO- | Missing DTO (4+ params without DTO), Entity Leakage (ORM entity in API response) | medium (high if auth\u002Fpayment) |\n| ARCH-DI- | Dependency Injection: dependencies not replaceable for testing (direct instantiation, no injection mechanism). Exception: small scripts\u002FCLIs where params\u002Fclosures suffice → skip | medium |\n| ARCH-CEH- | Centralized Error Handling: errors silently swallowed, stack traces leak to prod, no consistent error logging. Exception: 50-line scripts → downgrade to LOW | medium (high if no handler at all) |\n| ARCH-SES- | Session Ownership: DI session + local session in same module | medium |\n| ARCH-AI-SEB | Side-Effect Breadth: 3+ side-effect categories in one **leaf** function. **Conflict Resolution:** orchestrator\u002Fcoordinator functions (imports 3+ services AND delegates sequentially) are EXPECTED to have multiple categories — do NOT flag SEB | medium |\n| ARCH-AI-AH | Architectural Honesty: read-named function with write side-effects | medium |\n| ARCH-AI-FO | Flat Orchestration: **leaf** service imports 3+ other services. Orchestrator imports are expected — do NOT flag | medium |\n| ARCH-EVENT- | Event Channel Consistency: publisher\u002Fsubscriber name mismatch (MISMATCH), orphaned channel with no counterpart (ORPHAN) | high (mismatch), medium (orphan) |\n\n**PERF- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| PERF-ALG- | Algorithm complexity (Big O) | high if O(n²)+ |\n| PERF-CFG- | Package\u002Flibrary configuration | medium |\n| PERF-PTN- | Architectural pattern performance | high |\n| PERF-DB- | Database queries, indexes | high |\n\n**MNT- subcategories:**\n\n| Prefix | Category | Severity |\n|--------|----------|----------|\n| MNT-DC- | Dead code: replaced implementations, unused exports\u002Fre-exports, backward-compat wrappers, unsupported aliases | medium (high if public API) |\n| MNT-DRY- | DRY violations: duplicate logic across files | medium |\n| MNT-GOD- | God Classes: class with >15 methods or >500 lines (not just file size) | medium (high if >1000 lines) |\n| MNT-SIG- | Method Signature Quality: boolean flag params, unclear return types, inconsistent naming, >5 optional params | low |\n| MNT-ERR- | Error Contract inconsistency: mixed raise + return None in same service | medium |\n\n## When to Use\n- All implementation tasks in Story status = Done\n- Before tech debt cleanup and inline agent review\n\n## Workflow (concise)\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Finput_resolution_pattern.md`\n\n1) **Resolve storyId:** Run Story Resolution Chain per guide (status filter: [In Progress, To Review]).\n2) Load Story (full) and Done implementation tasks (full descriptions) via Linear; skip tasks with label \"tests\".\n3) **Collect changed files** (`changed_files[]`):\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Fgit_scope_detection.md`\n   - IF invoked by ln-510: use `changed_files[]` from coordinator context → proceed to Enrich step in guide\n   - IF invoked standalone: run full algorithm from guide\n4) **Two-Layer Detection (MANDATORY):**\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Ftwo_layer_detection.md`\n   All threshold-based findings require Layer 2 context analysis. Layer 1 finding without Layer 2 = NOT a valid finding. Before reporting any metric violation, ask: \"Is this violation intentional or justified by design?\" See Exception column in metrics below.\n\n5) **Calculate code metrics:**\n   - Cyclomatic Complexity per function (target ≤10; Exception: enum\u002Fswitch dispatch, state machines, parser grammars → downgrade to LOW)\n   - Function size (target ≤50 lines; Exception: orchestrator functions with sequential delegation)\n   - File size (target ≤500 lines; Exception: config\u002Fschema\u002Fmigration files, generated code)\n   - Nesting depth (target ≤3)\n   - Parameter count (target ≤4; Exception: builder\u002Foptions patterns)\n\n6) **MCP Ref Validation (MANDATORY for code changes — SKIP if `--skip-mcp-ref` flag passed):**\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Fresearch_tool_fallback.md`\n\n   > **Fast-track mode:** When invoked with `--skip-mcp-ref`, skip this entire step (no OPT-, BP-, PERF- checks). Proceed directly to step 6 (static analysis). This reduces cost from ~5000 to ~800 tokens while preserving metrics + static analysis coverage.\n\n   **Level 1 — OPTIMALITY (OPT-):**\n   - Extract goal from task (e.g., \"user authentication\", \"caching\", \"API rate limiting\")\n   - Research alternatives: `ref_search_documentation(\"{goal} approaches comparison {tech_stack} 2026\")`\n   - Compare chosen approach vs alternatives for project context\n   - Flag suboptimal choices as OPT- issues\n\n   **Level 2 — BEST PRACTICES (BP-):**\n   - Research: `ref_search_documentation(\"{chosen_approach} best practices {tech_stack} 2026\")`\n   - For libraries: `query-docs(library_id, \"best practices implementation patterns\")`\n   - Flag deviations from recommended patterns as BP- issues\n\n   **Level 3 — PERFORMANCE (PERF-):**\n   - **PERF-ALG:** Analyze algorithm complexity (detect O(n²)+, research optimal via MCP Ref)\n   - **PERF-CFG:** Check library configs (connection pooling, batch sizes, timeouts) via `query-docs`\n   - **PERF-PTN:** Research pattern pitfalls: `ref_search_documentation(\"{pattern} performance bottlenecks\")`\n   - **PERF-DB:** Check for N+1, missing indexes via `query-docs(orm_library_id, \"query optimization\")`\n\n   **Triggers for MCP Ref validation:**\n   - New dependency added (package.json\u002Frequirements.txt changed)\n   - New pattern\u002Flibrary used\n   - API\u002Fdatabase changes\n   - Loops\u002Frecursion in critical paths\n   - ORM queries added\n\n7) **Analyze code for static issues (assign prefixes):**\n   **MANDATORY READ:** Load `shared\u002Freferences\u002Fclean_code_checklist.md`, `shared\u002Freferences\u002Fdestructive_operation_safety.md`\n   - For large code files, use `outline(file_path)` before targeted reads.\n   - SEC-: hardcoded creds, unvalidated input, SQL injection, race conditions\n   - SEC-DESTR-: unguarded destructive operations — use code-level guards table from destructive_operation_safety.md (loaded above). Check all 5 guard categories (DB, FS, MIG, ENV, FORCE).\n   - MNT-: DRY violations (MNT-DRY-: duplicate logic), dead code (MNT-DC-: per checklist), complex conditionals, poor naming\n   - **MNT-DRY- cross-story hotspot scan:** Grep for common pattern signatures (error handlers: `catch.*Error|handleError`, validators: `validate|isValid`, config access: `getSettings|getConfig`) across ALL `src\u002F` files (count mode). If any pattern appears in 5+ files, sample 3 files (Read 50 lines each) and check structural similarity. If >80% similar → MNT-DRY-CROSS (medium, -10 points): `Pattern X duplicated in N files — extract to shared module.`\n   - **MNT-DRY- preferred (hex-graph):** If hex-graph indexed, use `audit_workspace(path=scan_path, verbosity=\"minimal\", limit=5, clone_member_limit=3)`. Each clone group with 2+ members in different files = MNT-DRY-CROSS. Raise limits only when the bounded preview is insufficient. Use returned hotspot and clone context for priority. Fall back to Grep pattern scan above if hex-graph unavailable.\n   - **MNT-DC- cross-story unused export scan:** For each file modified by Story, count `export` declarations. Then Grep across ALL `src\u002F` for import references to those exports. Exports with 0 import references → MNT-DC-CROSS (medium, -10 points): `{export} in {file} exported but never imported — remove or mark internal.`\n   - **OPT-OSS- cross-reference ln-645 (static, fast-track safe):** IF `docs\u002Fproject\u002F.audit\u002Fln-640\u002F*\u002F645-open-source-replacer*.md` exists (glob across dates, take latest), check if any HIGH-confidence replacement matches files changed in current Story. IF match found → create OPT-OSS-{N} issue with module path, goal, recommended package, confidence, stars, license from ln-645 report. Severity: high if >200 LOC, medium otherwise. This check reads local files only — no MCP calls — runs even with `--skip-mcp-ref`.\n   - ARCH-: layer violations, circular dependencies, guide non-compliance\n   - ARCH-LB-: layer boundary violations (HTTP\u002FDB\u002FFS calls outside infrastructure layer)\n   - ARCH-TX-: transaction boundary violations (commit() across multiple layers)\n   - ARCH-DTO-: missing DTOs (4+ repeated params), entity leakage (ORM entities returned from API)\n   - ARCH-DI-: direct instantiation in business logic (no DI container or mixed patterns)\n   - ARCH-CEH-: centralized error handling absent or bypassed\n   - ARCH-SES-: session ownership conflicts (DI + local session in same module)\n   - ARCH-AI-SEB: side-effect breadth (3+ categories in one **leaf** function; orchestrator functions exempt — see Conflict Resolution in table above)\n   - ARCH-AI-AH: architectural honesty (read-named function with hidden writes)\n   - ARCH-AI-FO: flat orchestration (**leaf** service importing 3+ services; orchestrator imports exempt)\n   - ARCH-EVENT-: event channel mismatch — Grep for `NOTIFY|pg_notify|\\.publish\\(|\\.emit\\(` (publishers) and `LISTEN|\\.subscribe\\(|\\.on\\(` (subscribers) in changed_files[]. Cross-reference channel name strings. \u003C!-- Defense-in-depth: also checked by ln-652 Rule 6 -->\n   - MNT-GOD-: god classes (>15 methods or >500 lines per class)\n   - MNT-SIG-: method signature quality (boolean flags, unclear returns)\n   - MNT-ERR-: error contract inconsistency (mixed raise\u002Freturn patterns in same service)\n\n8) **Calculate Code Quality Score:**\n   - Start with 100\n   - Subtract metric penalties (see Code Metrics table)\n   - Subtract issue penalties (see Issue penalties table)\n\n9) **Output verdict with score and structured issues.**\n   **MANDATORY READ:** Load `references\u002Foutput_schema.md`\n   Format output per schema. Add Linear comment with findings.\n\n## Critical Rules\n- Read guides mentioned in Story\u002FTasks before judging compliance.\n- **MCP Ref validation:** For ANY architectural change, MUST verify via ref_search_documentation before judging.\n- **Context7 for libraries:** When reviewing library usage, query-docs to verify correct patterns.\n- Language preservation in comments (EN\u002FRU).\n- Do not create tasks or change statuses; caller decides next actions.\n\n## Runtime Summary Artifact\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fquality_summary_contract.md`, `shared\u002Freferences\u002Fquality_worker_runtime_contract.md`\n\nRuntime profile:\n- family: `quality-worker`\n- worker: `ln-511`\n- summary kind: `quality-worker`\n- payload fields used by coordinators: `worker`, `status`, `verdict`, `score`, `issues`, `warnings`\n\nInvocation rules:\n- standalone: omit `runId` and `summaryArtifactPath`\n- managed: pass both `runId` and exact `summaryArtifactPath`\n- always write the validated summary before terminal outcome\n\n## Definition of Done\n\n- [ ] Story and Done implementation tasks loaded (test tasks excluded)\n- [ ] Code metrics calculated (Cyclomatic Complexity, function\u002Ffile sizes)\n- [ ] MCP Ref validation completed (OPT-, BP-, PERF- categories)\n- [ ] ARCH- subcategories checked (LB, TX, DTO, DI, CEH, SES, EVENT); MNT- subcategories checked (DC, DRY, GOD, SIG, ERR)\n- [ ] Issues identified with prefixes and severity, sources from MCP Ref\u002FContext7\n- [ ] Code Quality Score calculated\n- [ ] Output formatted per `references\u002Foutput_schema.md`\n- [ ] Linear comment posted with findings\n\n## Reference Files\n- Git scope detection: `shared\u002Freferences\u002Fgit_scope_detection.md`\n- Code metrics: `references\u002Fcode_metrics.md` (thresholds and penalties)\n- Guides: `docs\u002Fguides\u002F`\n- Templates for context: `shared\u002Ftemplates\u002Ftask_template_implementation.md`\n- **Clean code checklist:** `shared\u002Freferences\u002Fclean_code_checklist.md`\n- Research tool fallback: `shared\u002Freferences\u002Fresearch_tool_fallback.md`\n\n---\n**Version:** 5.1.0\n**Last Updated:** 2026-03-15\n",{"name":5,"license":14,"description":7,"allowed-tools":46},"Read, Grep, Glob, Bash, WebFetch, mcp__Ref, mcp__context7, mcp__hex-line__outline, mcp__hex-graph__audit_workspace, mcp__hex-graph__analyze_architecture","main","7bf2279c8a65758319526a721d5c4b75683aec9c","skills\u002Flevn-ln-511-code-quality-checker",3,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections","https:\u002F\u002Fgithub.com\u002Fboisenoise","2026-11-14 14:18:11",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add boisenoise\u002Fskills-collections --skill ln-511-code-quality-checker",{"tool":60,"command":61},"bunx","bunx skills add boisenoise\u002Fskills-collections --skill ln-511-code-quality-checker",{"tool":63,"command":64},"pnpm","pnpm dlx skills add boisenoise\u002Fskills-collections --skill ln-511-code-quality-checker","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Flevn-ln-511-code-quality-checker\u002FSKILL.md",true,[68,74],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fcode_metrics.md","REFERENCE","参考文档",4201,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Flevn-ln-511-code-quality-checker\u002Freferences\u002Fcode_metrics.md",{"path":75,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Foutput_schema.md",1112,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Flevn-ln-511-code-quality-checker\u002Freferences\u002Foutput_schema.md",[79,88,96,105,113,121],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":83,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":87},"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":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":87},"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":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":104},"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":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":109,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":104},"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":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":117,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":104},"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":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":125,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":104},"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",[],[]]