Skip to content
Back to skills

Module Layering

ASecurity

Know and enforce your module dependency graph — derive inter-module edges from the canonical dependency signal, catch circular dependencies, and enforce intended layering with tooling. Use when a codebase has many modules or packages and layering is a real concern.

  • 4 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 6, 2026
ai-agents

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add arch3rPro/dsh-skills --skill module-layering --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Module Layering?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Module Layering
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/arch3rpro-module-layering/badge)](https://www.skillsdirectory.com/skills/arch3rpro-module-layering)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: module-layering
status: beta
description: "Know and enforce your module dependency graph — derive inter-module edges from the canonical dependency signal, catch circular dependencies, and enforce intended layering with tooling. Use when a codebase has many modules or packages and layering is a real concern."
---

# Module Layering

A discipline for **knowing and enforcing the dependency graph** of a multi-module or multi-package codebase. It keeps the intended layering explicit, surfaces circular dependencies, and makes a violation fail instead of silently drifting.

**The defining constraint:** derive the graph from the **canonical dependency signal** — the single authoritative statement of what each module depends on (a package manifest's peer dependencies, a module's declared imports) — rather than from ad hoc inspection. Enforce intended direction with tooling, not memory.

## Know the graph

- **Identify the canonical dependency signal** for each module: the declared peer/regular dependency for packages, or the module imports for in-repo modules.
- **Derive the inter-module edges** from that signal, grouped by the package or module hierarchy, so the graph is reproducible rather than hand-maintained.
- **Keep the graph as a documented artifact** (a module-graph page or generated report) so it is the single home for dependency facts.

## Enforce layering

- **Decide the intended layering** — which modules may depend on which. State it explicitly (a layering rule per layer), not implicitly.
- **Detect circular dependencies** — a cycle means no clear layer boundary and is a signal to re-examine ownership.
- **Enforce with tooling** (e.g. a dependency-cruiser or graph analyzer), running in the check gate so a new edge that violates the intended direction fails rather than silently drifting.

## When it applies

Reach for this when a codebase has enough modules or packages that dependency relationships are non-trivial — multiple packages, a plugin ecosystem, or a layered architecture where the direction of dependencies matters. A single small module does not need a graph.

## Workflow

1. **Confirm the concern** — enough modules that layering matters; if not, skip.
2. **Identify the canonical dependency signal** and derive the edges.
3. **State the intended layering** explicitly, per layer.
4. **Enforce with tooling** in the check gate; treat a circular dependency or an edge against the intended direction as a failure.
5. **Keep the graph as a documented artifact**, updated with the code.

## Completion criteria

- Edges are derived from the canonical dependency signal, not ad hoc inspection.
- Intended layering is explicit; circular dependencies are surfaced.
- Layering is enforced by tooling in the check gate, so violations fail.
- The graph is a documented artifact and the single home for dependency facts.

Files in this skill

  • SKILL.md2.8 KB
  • agents/openai.yaml305 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.