[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FJJ13GBPJB80SRXHFAMDM5":3,"skill-same:01M6FJJ13GBPJB80SRXHFAMDM5":72},{"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":45,"linkOnly":46,"markdownContent":47,"markdownBody":48,"frontMatter":49,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":57,"install":58,"resources":71},"01M6FJJ13GBPJB80SRXHFAMDM5","ln-642-layer-boundary-auditor",null,"Checks layer boundary violations, transaction boundaries, session ownership, cross-layer consistency. Use when auditing architecture layers.","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-642-layer-boundary-auditor\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,41,42,43,44],"layer","auditor","boundary","ln","ln 642 layer boundary auditor","references","when","layers","inspect","consistency","paths","line","transaction","hex","outline","MCP","use","session","read","find","grep","analyze","Bash","file","graph","search","architecture","2026-11-10 10:12:30",false,"---\nname: ln-642-layer-boundary-auditor\ndescription: \"Checks layer boundary violations, transaction boundaries, session ownership, cross-layer consistency. Use when auditing architecture layers.\"\nallowed-tools: Read, Grep, Glob, Bash, mcp__hex-graph__find_references, mcp__hex-graph__trace_paths, mcp__hex-graph__inspect_symbol, 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# Layer Boundary Auditor\n\n**Type:** L3 Worker\n\nL3 Worker that audits architectural layer boundaries and detects violations.\n\n## Purpose & Scope\n\n- Read architecture.md to discover project's layer structure\n- Detect layer violations (I\u002FO code outside infrastructure layer)\n- **Detect cross-layer consistency issues:**\n  - Transaction boundaries (commit\u002Frollback ownership)\n  - Session ownership (DI vs local)\n- Check pattern coverage (all HTTP calls use client abstraction)\n- Detect error handling duplication\n- Return violations list to coordinator\n\n**Out of Scope** (owned by ln-628-concurrency-auditor):\n- Blocking I\u002FO in async functions (sync open\u002Fread in async def)\n- Fire-and-forget tasks (create_task without error handler)\n\n## Input (from ln-640)\n\n```\n- architecture_path: string    # Path to docs\u002Farchitecture.md\n- codebase_root: string        # Root directory to scan\n- skip_violations: string[]    # Files to skip (legacy)\n- output_dir: string           # e.g., \".hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Faudit-report\"\n\n# Domain-aware (optional, from coordinator)\n- domain_mode: \"global\" | \"domain-aware\"   # Default: \"global\"\n- current_domain: string                   # e.g., \"users\", \"billing\" (only if domain-aware)\n- scan_path: string                        # e.g., \"src\u002Fusers\u002F\" (only if domain-aware)\n```\n\n**When domain_mode=\"domain-aware\":** Use `scan_path` instead of `codebase_root` for all Grep\u002FGlob operations. Tag all findings with `domain` field.\n\n## Workflow\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Ftwo_layer_detection.md` for detection methodology.\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fmcp_tool_preferences.md` and `shared\u002Freferences\u002Fmcp_integration_patterns.md`\n\nUse `hex-graph` first when references, call paths, or architecture coupling materially improve the audit. Use `hex-line` first for local code and config 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### Phase 1: Discover Architecture\n\n**MANDATORY READ:** Load `..\u002Fln-640-pattern-evolution-auditor\u002Freferences\u002Flayer_rules.md` -- use Architecture Presets (fallback), I\u002FO Pattern Boundary Rules (Phase 2), Coverage Checks (Phase 4), Cross-Layer Consistency rules (Phase 3).\n\n```\nRead docs\u002Farchitecture.md\n\nExtract from Section 4.2 (Top-Level Decomposition):\n  - architecture_type: \"Layered\" | \"Hexagonal\" | \"Clean\" | \"MVC\" | etc.\n  - layers: [{name, directories[], purpose}]\n\nExtract from Section 5.3 (Infrastructure Layer Components):\n  - infrastructure_components: [{name, responsibility}]\n\nIF architecture.md not found:\n  Use fallback presets from layer_rules.md\n\nBuild ruleset:\n  FOR EACH layer:\n    allowed_deps = layers that can be imported\n    forbidden_deps = layers that cannot be imported\n```\n\n\n**Graph acceleration (if available):** IF `contextStore.graph_indexed` OR `.hex-skills\u002Fcodegraph\u002Findex.db` exists:\n- **Module coupling:** `analyze_architecture(path=scan_root, verbosity=\"full\")` -- use returned coupling metrics to identify tightly-coupled layers.\n- **Cross-layer calls:** `find_references(symbol)` for transaction\u002Fsession functions -- trace commit\u002Frollback ownership across layers.\n- **Orchestration depth:** `trace_paths(name=\"ServiceFn\", file=\"...\", path_kind=\"calls\", direction=\"forward\", depth=3, path=scan_root)` -- measure chain depth for flat orchestration check from a concrete service symbol.\n- Empty `trace_paths` from a coarse or module-level selector is not enough to clear a layer; fall back to `inspect_symbol` or grep\u002Fmanual review when the selector is broad.\n- Fall back to grep-based detection below if graph unavailable.\n### Phase 2: Detect Layer Violations\n\n```\nscan_root = scan_path IF domain_mode == \"domain-aware\" ELSE codebase_root\n\nFOR EACH violation_type IN layer_rules.md I\u002FO Pattern Boundary Rules:\n  grep_pattern = violation_type.detection_grep\n  forbidden_dirs = violation_type.forbidden_in\n\n  matches = Grep(grep_pattern, scan_root, include=\"*.py,*.ts,*.js\")\n\n  FOR EACH match IN matches:\n    IF match.path NOT IN skip_violations:\n      IF any(forbidden IN match.path FOR forbidden IN forbidden_dirs):\n        violations.append({\n          type: \"layer_violation\",\n          severity: \"HIGH\",\n          pattern: violation_type.name,\n          file: match.path,\n          line: match.line,\n          code: match.context,\n          allowed_in: violation_type.allowed_in,\n          suggestion: f\"Move to {violation_type.allowed_in}\"\n        })\n```\n\n### Phase 3: Cross-Layer Consistency Checks\n\n#### 3.1 Transaction Boundary Violations\n\n**What:** commit()\u002Frollback() called at inconsistent layers (repo + service + API)\n\n**Detection:**\n```\nrepo_commits = Grep(\"\\.commit\\(\\)|\\.rollback\\(\\)\", \"**\u002Frepositories\u002F**\u002F*.py\")\nservice_commits = Grep(\"\\.commit\\(\\)|\\.rollback\\(\\)\", \"**\u002Fservices\u002F**\u002F*.py\")\napi_commits = Grep(\"\\.commit\\(\\)|\\.rollback\\(\\)\", \"**\u002Fapi\u002F**\u002F*.py\")\n\nlayers_with_commits = count([repo_commits, service_commits, api_commits].filter(len > 0))\n```\n\n**Safe Patterns (ignore):**\n- Comment \"# best-effort telemetry\" in same context\n- File ends with `_callbacks.py` (progress notifiers)\n- Explicit `# UoW boundary` comment\n\n**Violation Rules:**\n\n| Condition | Severity | Issue |\n|-----------|----------|-------|\n| layers_with_commits >= 3 | CRITICAL | Mixed UoW ownership across all layers |\n| repo + api commits | HIGH | Transaction control bypasses service layer |\n| repo + service commits | HIGH | Ambiguous UoW owner (repo vs service) |\n| service + api commits | MEDIUM | Transaction control spans service + API |\n\n**Exception:** Saga pattern \u002F distributed transactions with explicit compensating actions -> downgrade CRITICAL to MEDIUM. UoW boundary documented with `\u002F\u002F architecture decision` or ADR -> skip.\n\n**Recommendation:** Choose single UoW owner (service layer recommended), remove commit() from other layers\n\n**Effort:** L (requires architectural decision + refactoring)\n\n#### 3.2 Session Ownership Violations\n\n**What:** Mixed DI-injected and locally-created sessions in same call chain\n\n**Detection:**\n```\ndi_session = Grep(\"Depends\\(get_session\\)|Depends\\(get_db\\)\", \"**\u002Fapi\u002F**\u002F*.py\")\nlocal_session = Grep(\"AsyncSessionLocal\\(\\)|async_sessionmaker\", \"**\u002Fservices\u002F**\u002F*.py\")\nlocal_in_repo = Grep(\"AsyncSessionLocal\\(\\)\", \"**\u002Frepositories\u002F**\u002F*.py\")\n```\n\n**Violation Rules:**\n\n| Condition | Severity | Issue |\n|-----------|----------|-------|\n| di_session AND local_in_repo in same module | HIGH | Repo creates own session while API injects different |\n| local_session in service calling DI-based repo | MEDIUM | Session mismatch in call chain |\n\n**Recommendation:** Use DI consistently OR use local sessions consistently. Document exceptions (e.g., telemetry)\n\n**Effort:** M\n\n#### 3.3 Flat Orchestration Violations\n\n**What:** Service-layer functions calling other services that call yet other services -- deep orchestration chains.\n\n**Detection:** **MANDATORY READ:** Load `shared\u002Freferences\u002Fai_ready_architecture.md` -- map service imports, find chain depth.\n\n**Violation Rules:**\n\n| Condition | Severity | Issue |\n|-----------|----------|-------|\n| Service chain >= 3 (A->B->C->D) | HIGH | Deep orchestration |\n| Service chain = 2 (A->B->C) | MEDIUM | Consider flattening |\n\n**Recommendation:** Extract orchestrator calling all services at same level. Each service becomes a sink.\n\n**Effort:** L\n\n---\n\n### Phase 4: Check Pattern Coverage\n\n```\n# HTTP Client Coverage\nall_http_calls = Grep(\"httpx\\\\.|aiohttp\\\\.|requests\\\\.\", codebase_root)\nabstracted_calls = Grep(\"client\\\\.(get|post|put|delete)\", infrastructure_dirs)\n\nIF len(all_http_calls) > 0:\n  coverage = len(abstracted_calls) \u002F len(all_http_calls) * 100\n  IF coverage \u003C 90%:\n    violations.append({\n      type: \"low_coverage\",\n      severity: \"MEDIUM\",\n      pattern: \"HTTP Client Abstraction\",\n      coverage: coverage,\n      uncovered_files: files with direct calls outside infrastructure\n    })\n\n# Error Handling Duplication\nhttp_error_handlers = Grep(\"except\\\\s+(httpx\\\\.|aiohttp\\\\.|requests\\\\.)\", codebase_root)\nunique_files = set(f.path for f in http_error_handlers)\n\nIF len(unique_files) > 2:\n  violations.append({\n    type: \"duplication\",\n    severity: \"MEDIUM\",\n    pattern: \"HTTP Error Handling\",\n    files: list(unique_files),\n    suggestion: \"Centralize in infrastructure layer\"\n  })\n```\n\n### Phase 5: Calculate Score\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md` and `shared\u002Freferences\u002Faudit_scoring.md`.\n\n### Phase 6: Write Report\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\n```\n# Build markdown report in memory with:\n# - AUDIT-META (standard penalty-based: score, counts)\n# - Checks table (io_isolation, http_abstraction, error_centralization, transaction_boundary, session_ownership)\n# - Findings table (violations sorted by severity)\n# - DATA-EXTENDED: {architecture, coverage}\n\nIF domain_mode == \"domain-aware\":\n  Write to {output_dir}\u002F642-layer-boundary-{current_domain}.md\nELSE:\n  Write to {output_dir}\u002F642-layer-boundary.md\n```\n\n### Phase 7: Return Summary\n\n```\nReport written: .hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Faudit-report\u002F642-layer-boundary-users.md\nScore: 4.5\u002F10 | Issues: 8 (C:1 H:3 M:4 L:0)\n```\n\n## Critical Rules\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- **Read architecture.md first** - never assume architecture type\n- **Skip violations list** - respect legacy files marked for gradual fix\n- **File + line + code** - always provide exact location with context\n- **Actionable suggestions** - always tell WHERE to move the code\n- **No false positives** - verify path contains forbidden dir, not just substring\n\n## Definition of Done\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- [ ] Architecture discovered from docs\u002Farchitecture.md (or fallback used)\n- [ ] All violation types from layer_rules.md checked\n- [ ] **Cross-layer consistency checked:**\n  - Transaction boundaries analyzed (commit\u002Frollback distribution)\n  - Session ownership analyzed (DI vs local)\n- [ ] Coverage calculated for HTTP abstraction + 2 consistency metrics\n- [ ] Violations list with severity, location, suggestion\n- [ ] If domain-aware: all Grep scoped to scan_path, findings tagged with domain\n- [ ] Report written to `{output_dir}\u002F642-layer-boundary[-{domain}].md` (atomic single Write call)\n- [ ] Summary written per contract\n\n## Reference Files\n\n- Layer rules: `..\u002Fln-640-pattern-evolution-auditor\u002Freferences\u002Flayer_rules.md`\n- Scoring impact: `..\u002Fln-640-pattern-evolution-auditor\u002Freferences\u002Fscoring_rules.md`\n\n---\n\n**Version:** 2.1.0\n**Last Updated:** 2026-02-08\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# Layer Boundary Auditor\n\n**Type:** L3 Worker\n\nL3 Worker that audits architectural layer boundaries and detects violations.\n\n## Purpose & Scope\n\n- Read architecture.md to discover project's layer structure\n- Detect layer violations (I\u002FO code outside infrastructure layer)\n- **Detect cross-layer consistency issues:**\n  - Transaction boundaries (commit\u002Frollback ownership)\n  - Session ownership (DI vs local)\n- Check pattern coverage (all HTTP calls use client abstraction)\n- Detect error handling duplication\n- Return violations list to coordinator\n\n**Out of Scope** (owned by ln-628-concurrency-auditor):\n- Blocking I\u002FO in async functions (sync open\u002Fread in async def)\n- Fire-and-forget tasks (create_task without error handler)\n\n## Input (from ln-640)\n\n```\n- architecture_path: string    # Path to docs\u002Farchitecture.md\n- codebase_root: string        # Root directory to scan\n- skip_violations: string[]    # Files to skip (legacy)\n- output_dir: string           # e.g., \".hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Faudit-report\"\n\n# Domain-aware (optional, from coordinator)\n- domain_mode: \"global\" | \"domain-aware\"   # Default: \"global\"\n- current_domain: string                   # e.g., \"users\", \"billing\" (only if domain-aware)\n- scan_path: string                        # e.g., \"src\u002Fusers\u002F\" (only if domain-aware)\n```\n\n**When domain_mode=\"domain-aware\":** Use `scan_path` instead of `codebase_root` for all Grep\u002FGlob operations. Tag all findings with `domain` field.\n\n## Workflow\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Ftwo_layer_detection.md` for detection methodology.\n**MANDATORY READ:** Load `shared\u002Freferences\u002Fmcp_tool_preferences.md` and `shared\u002Freferences\u002Fmcp_integration_patterns.md`\n\nUse `hex-graph` first when references, call paths, or architecture coupling materially improve the audit. Use `hex-line` first for local code and config 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### Phase 1: Discover Architecture\n\n**MANDATORY READ:** Load `..\u002Fln-640-pattern-evolution-auditor\u002Freferences\u002Flayer_rules.md` -- use Architecture Presets (fallback), I\u002FO Pattern Boundary Rules (Phase 2), Coverage Checks (Phase 4), Cross-Layer Consistency rules (Phase 3).\n\n```\nRead docs\u002Farchitecture.md\n\nExtract from Section 4.2 (Top-Level Decomposition):\n  - architecture_type: \"Layered\" | \"Hexagonal\" | \"Clean\" | \"MVC\" | etc.\n  - layers: [{name, directories[], purpose}]\n\nExtract from Section 5.3 (Infrastructure Layer Components):\n  - infrastructure_components: [{name, responsibility}]\n\nIF architecture.md not found:\n  Use fallback presets from layer_rules.md\n\nBuild ruleset:\n  FOR EACH layer:\n    allowed_deps = layers that can be imported\n    forbidden_deps = layers that cannot be imported\n```\n\n\n**Graph acceleration (if available):** IF `contextStore.graph_indexed` OR `.hex-skills\u002Fcodegraph\u002Findex.db` exists:\n- **Module coupling:** `analyze_architecture(path=scan_root, verbosity=\"full\")` -- use returned coupling metrics to identify tightly-coupled layers.\n- **Cross-layer calls:** `find_references(symbol)` for transaction\u002Fsession functions -- trace commit\u002Frollback ownership across layers.\n- **Orchestration depth:** `trace_paths(name=\"ServiceFn\", file=\"...\", path_kind=\"calls\", direction=\"forward\", depth=3, path=scan_root)` -- measure chain depth for flat orchestration check from a concrete service symbol.\n- Empty `trace_paths` from a coarse or module-level selector is not enough to clear a layer; fall back to `inspect_symbol` or grep\u002Fmanual review when the selector is broad.\n- Fall back to grep-based detection below if graph unavailable.\n### Phase 2: Detect Layer Violations\n\n```\nscan_root = scan_path IF domain_mode == \"domain-aware\" ELSE codebase_root\n\nFOR EACH violation_type IN layer_rules.md I\u002FO Pattern Boundary Rules:\n  grep_pattern = violation_type.detection_grep\n  forbidden_dirs = violation_type.forbidden_in\n\n  matches = Grep(grep_pattern, scan_root, include=\"*.py,*.ts,*.js\")\n\n  FOR EACH match IN matches:\n    IF match.path NOT IN skip_violations:\n      IF any(forbidden IN match.path FOR forbidden IN forbidden_dirs):\n        violations.append({\n          type: \"layer_violation\",\n          severity: \"HIGH\",\n          pattern: violation_type.name,\n          file: match.path,\n          line: match.line,\n          code: match.context,\n          allowed_in: violation_type.allowed_in,\n          suggestion: f\"Move to {violation_type.allowed_in}\"\n        })\n```\n\n### Phase 3: Cross-Layer Consistency Checks\n\n#### 3.1 Transaction Boundary Violations\n\n**What:** commit()\u002Frollback() called at inconsistent layers (repo + service + API)\n\n**Detection:**\n```\nrepo_commits = Grep(\"\\.commit\\(\\)|\\.rollback\\(\\)\", \"**\u002Frepositories\u002F**\u002F*.py\")\nservice_commits = Grep(\"\\.commit\\(\\)|\\.rollback\\(\\)\", \"**\u002Fservices\u002F**\u002F*.py\")\napi_commits = Grep(\"\\.commit\\(\\)|\\.rollback\\(\\)\", \"**\u002Fapi\u002F**\u002F*.py\")\n\nlayers_with_commits = count([repo_commits, service_commits, api_commits].filter(len > 0))\n```\n\n**Safe Patterns (ignore):**\n- Comment \"# best-effort telemetry\" in same context\n- File ends with `_callbacks.py` (progress notifiers)\n- Explicit `# UoW boundary` comment\n\n**Violation Rules:**\n\n| Condition | Severity | Issue |\n|-----------|----------|-------|\n| layers_with_commits >= 3 | CRITICAL | Mixed UoW ownership across all layers |\n| repo + api commits | HIGH | Transaction control bypasses service layer |\n| repo + service commits | HIGH | Ambiguous UoW owner (repo vs service) |\n| service + api commits | MEDIUM | Transaction control spans service + API |\n\n**Exception:** Saga pattern \u002F distributed transactions with explicit compensating actions -> downgrade CRITICAL to MEDIUM. UoW boundary documented with `\u002F\u002F architecture decision` or ADR -> skip.\n\n**Recommendation:** Choose single UoW owner (service layer recommended), remove commit() from other layers\n\n**Effort:** L (requires architectural decision + refactoring)\n\n#### 3.2 Session Ownership Violations\n\n**What:** Mixed DI-injected and locally-created sessions in same call chain\n\n**Detection:**\n```\ndi_session = Grep(\"Depends\\(get_session\\)|Depends\\(get_db\\)\", \"**\u002Fapi\u002F**\u002F*.py\")\nlocal_session = Grep(\"AsyncSessionLocal\\(\\)|async_sessionmaker\", \"**\u002Fservices\u002F**\u002F*.py\")\nlocal_in_repo = Grep(\"AsyncSessionLocal\\(\\)\", \"**\u002Frepositories\u002F**\u002F*.py\")\n```\n\n**Violation Rules:**\n\n| Condition | Severity | Issue |\n|-----------|----------|-------|\n| di_session AND local_in_repo in same module | HIGH | Repo creates own session while API injects different |\n| local_session in service calling DI-based repo | MEDIUM | Session mismatch in call chain |\n\n**Recommendation:** Use DI consistently OR use local sessions consistently. Document exceptions (e.g., telemetry)\n\n**Effort:** M\n\n#### 3.3 Flat Orchestration Violations\n\n**What:** Service-layer functions calling other services that call yet other services -- deep orchestration chains.\n\n**Detection:** **MANDATORY READ:** Load `shared\u002Freferences\u002Fai_ready_architecture.md` -- map service imports, find chain depth.\n\n**Violation Rules:**\n\n| Condition | Severity | Issue |\n|-----------|----------|-------|\n| Service chain >= 3 (A->B->C->D) | HIGH | Deep orchestration |\n| Service chain = 2 (A->B->C) | MEDIUM | Consider flattening |\n\n**Recommendation:** Extract orchestrator calling all services at same level. Each service becomes a sink.\n\n**Effort:** L\n\n---\n\n### Phase 4: Check Pattern Coverage\n\n```\n# HTTP Client Coverage\nall_http_calls = Grep(\"httpx\\\\.|aiohttp\\\\.|requests\\\\.\", codebase_root)\nabstracted_calls = Grep(\"client\\\\.(get|post|put|delete)\", infrastructure_dirs)\n\nIF len(all_http_calls) > 0:\n  coverage = len(abstracted_calls) \u002F len(all_http_calls) * 100\n  IF coverage \u003C 90%:\n    violations.append({\n      type: \"low_coverage\",\n      severity: \"MEDIUM\",\n      pattern: \"HTTP Client Abstraction\",\n      coverage: coverage,\n      uncovered_files: files with direct calls outside infrastructure\n    })\n\n# Error Handling Duplication\nhttp_error_handlers = Grep(\"except\\\\s+(httpx\\\\.|aiohttp\\\\.|requests\\\\.)\", codebase_root)\nunique_files = set(f.path for f in http_error_handlers)\n\nIF len(unique_files) > 2:\n  violations.append({\n    type: \"duplication\",\n    severity: \"MEDIUM\",\n    pattern: \"HTTP Error Handling\",\n    files: list(unique_files),\n    suggestion: \"Centralize in infrastructure layer\"\n  })\n```\n\n### Phase 5: Calculate Score\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md` and `shared\u002Freferences\u002Faudit_scoring.md`.\n\n### Phase 6: Write Report\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\n```\n# Build markdown report in memory with:\n# - AUDIT-META (standard penalty-based: score, counts)\n# - Checks table (io_isolation, http_abstraction, error_centralization, transaction_boundary, session_ownership)\n# - Findings table (violations sorted by severity)\n# - DATA-EXTENDED: {architecture, coverage}\n\nIF domain_mode == \"domain-aware\":\n  Write to {output_dir}\u002F642-layer-boundary-{current_domain}.md\nELSE:\n  Write to {output_dir}\u002F642-layer-boundary.md\n```\n\n### Phase 7: Return Summary\n\n```\nReport written: .hex-skills\u002Fruntime-artifacts\u002Fruns\u002F{run_id}\u002Faudit-report\u002F642-layer-boundary-users.md\nScore: 4.5\u002F10 | Issues: 8 (C:1 H:3 M:4 L:0)\n```\n\n## Critical Rules\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- **Read architecture.md first** - never assume architecture type\n- **Skip violations list** - respect legacy files marked for gradual fix\n- **File + line + code** - always provide exact location with context\n- **Actionable suggestions** - always tell WHERE to move the code\n- **No false positives** - verify path contains forbidden dir, not just substring\n\n## Definition of Done\n\n**MANDATORY READ:** Load `shared\u002Freferences\u002Faudit_worker_core_contract.md`.\n\n- [ ] Architecture discovered from docs\u002Farchitecture.md (or fallback used)\n- [ ] All violation types from layer_rules.md checked\n- [ ] **Cross-layer consistency checked:**\n  - Transaction boundaries analyzed (commit\u002Frollback distribution)\n  - Session ownership analyzed (DI vs local)\n- [ ] Coverage calculated for HTTP abstraction + 2 consistency metrics\n- [ ] Violations list with severity, location, suggestion\n- [ ] If domain-aware: all Grep scoped to scan_path, findings tagged with domain\n- [ ] Report written to `{output_dir}\u002F642-layer-boundary[-{domain}].md` (atomic single Write call)\n- [ ] Summary written per contract\n\n## Reference Files\n\n- Layer rules: `..\u002Fln-640-pattern-evolution-auditor\u002Freferences\u002Flayer_rules.md`\n- Scoring impact: `..\u002Fln-640-pattern-evolution-auditor\u002Freferences\u002Fscoring_rules.md`\n\n---\n\n**Version:** 2.1.0\n**Last Updated:** 2026-02-08\n",{"name":5,"license":14,"description":7,"allowed-tools":50},"Read, Grep, Glob, Bash, mcp__hex-graph__find_references, mcp__hex-graph__trace_paths, mcp__hex-graph__inspect_symbol, mcp__hex-graph__analyze_architecture, mcp__hex-line__read_file, mcp__hex-line__grep_search, mcp__hex-line__outline","main","7bf2279c8a65758319526a721d5c4b75683aec9c","skills\u002Flevn-ln-642-layer-boundary-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":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add boisenoise\u002Fskills-collections --skill ln-642-layer-boundary-auditor",{"tool":64,"command":65},"bunx","bunx skills add boisenoise\u002Fskills-collections --skill ln-642-layer-boundary-auditor",{"tool":67,"command":68},"pnpm","pnpm dlx skills add boisenoise\u002Fskills-collections --skill ln-642-layer-boundary-auditor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Flevn-ln-642-layer-boundary-auditor\u002FSKILL.md",true,[],[73,82,90,99,107,115],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":77,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":81},"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":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":86,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":81},"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":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":98},"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":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":103,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":98},"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":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":111,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":98},"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":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":119,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":98},"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",[],[]]