layer-audit

Detects layered architecture import violations using ESLint no-restricted-paths rules.

2.0k|679|Updated Jun 13, 2024
One-click install
npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill layer-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: layer-audit
Source: https://github.com/Comfy-Org/ComfyUI_frontend/tree/main/.claude/skills/layer-audit
Command: npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill layer-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Codebases organized into layered architectures (base, platform, workbench, renderer) degrade over time as developers accidentally add imports that cross layer boundaries. This Skill finds those violations automatically so architectural integrity can be enforced before code is merged.

Core Features & Use Cases

  • Violation Detection: Runs ESLint with the import-x/no-restricted-paths rule to surface every import that crosses a layer boundary in the wrong direction.
  • Grouped Reporting: Collects violations across src/base/, src/platform/, and src/workbench/ and groups them by layer pair (e.g., base -> platform) for systematic remediation planning.
  • Fix Guidance: Provides concrete strategies for resolving violations, such as moving modules down a layer, introducing interfaces with dependency injection, or extracting shared logic.
  • Use Case: Before opening a PR that touches src/base/ or src/platform/, run the audit to confirm no new upward imports were introduced, then group existing violations to plan a migration.

Quick Start

Audit the repository for layered architecture import violations and group the results by layer pair.

Frequently Asked Questions about layer-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find layer boundary violations in a layered architecture?

Run ESLint filtered for the import-x/no-restricted-paths rule against the layer directories. The audit collects every import crossing a boundary and groups results by layer pair such as base to platform or platform to renderer.

How to enforce import restrictions between folders with ESLint?

Use the import-x/no-restricted-paths rule defined in eslint.config.ts to declare which directories may not import from each other. Running ESLint with this rule reports each forbidden cross-layer import as a violation.

When should I run a layer architecture audit?

Run it before creating a PR that adds imports between src/base/, src/platform/, src/workbench/, or src/renderer/, when auditing the codebase to plan violation migration, and after moving files between layers.

How do I fix a layer import violation?

Common fixes include moving the imported module to a lower layer, defining an interface in the lower layer with dependency injection, relocating the importing file to a higher layer, or extracting shared logic into base.

What are the limitations of ESLint-based layer boundary checks?

The rule only catches static import statements, so dynamic requires or runtime indirection can bypass detection. It also reports violations without auto-fixing them, so remediation requires manual refactoring decisions.