agentleFS
mguttmannmguttmann/code-audit-suite/skills/architecture-analysis/SKILL.md

architecture-analysis

Skill0 starsChanged 5 months agoMITView on GitHub

This skill should be used when the user asks to "check architecture", "Architektur prüfen", "find circular dependencies", "zirkuläre Abhängigkeiten", "run dependency-cruiser", "enforce layer/import rules", "module boundaries", "Abhängigkeitsgraph", or wants to validate the dependency structure of a JS/TS codebase. Runs dependency-cruiser in Docker and drives violations to zero, processed directly in Claude Code.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the project has no .dependency-cruiser.{cjs,js,json}, the scan uses a bundled default ruleset (no-circular = error, no-orphans = warn) …

    line 28
  2. Distinctive:

    Orphan: delete dead code or wire the module in.

    line 34
  3. Very specific:

    Add forbidden/allowed/required rules.

    line 50

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Architecture Analysis

Purpose

Enforce the intended dependency structure of a JS/TS codebase — circular dependencies, orphan modules, and declared layer/import boundaries (e.g. "the UI layer must not import from the data layer directly"). This is structural analysis SonarQube does not do for JS/TS.

Scope / no double coverage: this skill targets JS/TS via dependency-cruiser. JVM/architecture-level analysis is intentionally not duplicated here — SonarQube Server's built-in Architecture feature (the former Structure101 engine, acquired by Sonar) already covers that, so use the sonarqube-quality skill for JVM architecture.

Core Workflow (drive to zero)

  1. Analyze:
    ~/.claude/skills/architecture-analysis/scripts/scan.sh [TARGET_DIR]
    If the project has no .dependency-cruiser.{cjs,js,json}, the scan uses a bundled default ruleset (no-circular = error, no-orphans = warn) mounted read-only into the container — it is never written into your repo.
  2. Fix violations:
    • Circular dependency: break the cycle — extract a shared module, invert a dependency, or introduce an interface.
    • Orphan: delete dead code or wire the module in.
    • Layer/import rule: route the dependency through the allowed boundary.
  3. Re-run until RESULT: PASS.

Defining real architecture rules

The bundled default ruleset is only a starting point. To enforce real layering, create your own .dependency-cruiser.cjs in the project root (it is used instead of the default when present), e.g.:

{ name: 'ui-not-to-db', severity: 'error',
  from: { path: '^src/ui' },
  to:   { path: '^src/data' } }

Add forbidden/allowed/required rules; dependency-cruiser fails the run on any error-severity match.

Notes

  • The npm cache is persisted in the depcruise-npm Docker volume; the first run downloads dependency-cruiser + typescript, later runs are fast.
  • Source directories are auto-detected (src, lib, app, source, packages); falls back to the whole project.
  • For a visual graph, set DEPCRUISE_OUTPUT_TYPE=dot (or mermaid/json). This is review-only, printed in addition to the gate — the pass/fail verdict is ALWAYS derived from an internal err-long run (the graph reporters exit 0 even when there are violations, so they must never be the gate signal).

Resources

  • scripts/scan.sh — runs dependency-cruiser against a JS/TS project (source tree mounted read-only); uses a bundled read-only default ruleset (never written into the repo) unless the project ships its own; exit 1 on violations. Skips cleanly when there is no real JS/TS source.
  • scripts/default.dependency-cruiser.cjs — the bundled default ruleset.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.