Skip to content
Back to skills

Collection

ASecurity

Architecture dependency analysis to ensure proper feature isolation and composition root pattern.

  • 24 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
businessbashnodeapi

Works with

  • cli
  • api

Security analysis

A100/100

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

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

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

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-bdcdb6ca/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-bdcdb6ca)

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: arch-audit
description: Architecture dependency analysis to ensure proper feature isolation and composition root pattern.
---

# Purpose

Enforce **architectural boundaries** and **dependency rules** across the codebase.

**What it checks (8 checks, each with its own script):**
1. Core → Domain dependencies (core features cannot depend on domain features)
2. Service imports (services only imported in composition root)
3. Service boundaries (services can only import interfaces/types/config from features)
4. Pages boundaries (pages can only import components/hooks/hocs from features)
5. Model internals encapsulation (cross-feature cannot import model internals)
6. Slice imports (slice.ts only imported in composition root)
7. Sagas imports (sagas.ts only imported in composition root)
8. Circular dependencies (A ↔ B or A → B → C → A)

**What it doesn't check:**
- Code quality patterns (relative imports, exports, etc.) - see `code-audit` skill

# Architecture Context

This template uses **core/domain separation** and **composition root pattern**:

**Composition Root** (`src/config/`)
- Top-level wiring layer (NOT a feature)
- Imports services, registers features, defines routes
- ALL architecture rules suspended here

**Core Features** (`src/core/features/`)
- Infrastructure: app, auth, components, i18n, layout, router, slice-manager
- Auto-discovered by scanning directory

**Domain Features** (`src/domain/features/`)
- Business logic: wallet, oauth, blog-demo, ai-assistant, site
- Auto-discovered by scanning directory
- Users create their own (products, orders, inventory, etc.)

# Running Checks

**All checks:**
```bash
node ./.claude/skills/arch-audit/scripts/run_all_checks.mjs
```

**Generate report:**
```bash
node ./.claude/skills/arch-audit/scripts/generate_report.mjs
```

**Individual checks:**
```bash
node ./.claude/skills/arch-audit/scripts/check_core_to_domain.mjs
node ./.claude/skills/arch-audit/scripts/check_service_imports.mjs
node ./.claude/skills/arch-audit/scripts/check_service_boundaries.mjs
node ./.claude/skills/arch-audit/scripts/check_pages_boundaries.mjs
node ./.claude/skills/arch-audit/scripts/check_model_internals.mjs
node ./.claude/skills/arch-audit/scripts/check_slice_imports.mjs
node ./.claude/skills/arch-audit/scripts/check_sagas_imports.mjs
node ./.claude/skills/arch-audit/scripts/check_circular_deps.mjs
```

# Architecture Rules

## 1. Core → Domain Dependencies

**RULE**: Core features (infrastructure) MUST NOT depend on domain features (business logic).

**Allowed:**
- ✅ Core → Core (infrastructure can use infrastructure)
- ✅ Domain → Core (business can use infrastructure)

**Violations:**
- ❌ Core → Domain (infrastructure cannot know about business)

**Exception:**
- `src/config/` is composition root, can import anything

**Check:** `check_core_to_domain.mjs`

---

## 2. Service Imports (Dependency Injection)

**RULE**: Services (`@/services/*`) MUST ONLY be imported in composition root (`src/config/`).

**Allowed:**
- ✅ `src/config/services.ts` (root services)
- ✅ `src/config/{feature}/services.ts` (feature-specific services)

**Violations:**
- ❌ Any file OUTSIDE `src/config/` importing `@/services/*`

**Why:** Enforces dependency injection pattern - features receive services through interfaces.

**Check:** `check_service_imports.mjs`

---

## 3. Service Boundaries

**RULE**: Services can ONLY import interfaces, types, and config from features.

**Allowed:**
- ✅ `@/(core|domain)/features/{feature}/I{Feature}Api.ts` (interfaces)
- ✅ `@/(core|domain)/features/{feature}/types/*` (feature types)
- ✅ `@/(core|domain)/features/{feature}/models/{model}/types/*` (model types)
- ✅ `@/(core|domain)/features/{feature}/config` (feature config)
- ✅ `@/services/*` (other services)
- ✅ External libraries

**Violations:**
- ❌ `@/pages/*`
- ❌ `@/hooks/*`
- ❌ `@/(core|domain)/features/{feature}/models/{model}/actions.ts`
- ❌ `@/(core|domain)/features/{feature}/models/{model}/slice.ts`
- ❌ `@/(core|domain)/features/{feature}/models/{model}/actionEffects/*`
- ❌ `@/(core|domain)/features/{feature}/hooks/*`
- ❌ `@/(core|domain)/features/{feature}/components/*`

**Why:** Services implement interfaces - they work with data contracts (interfaces + types + config), not implementation details.

**Check:** `check_service_boundaries.mjs`

---

## 4. Pages Boundaries

**RULE**: Pages can ONLY import presentation layer (components, hooks, hocs) from features.

**Allowed:**
- ✅ `@/(core|domain)/features/{feature}/components/*`
- ✅ `@/(core|domain)/features/{feature}/hooks/*`
- ✅ `@/(core|domain)/features/{feature}/hocs/*`
- ✅ `@/(core|domain)/features/{feature}/config`
- ✅ `@/hooks/*` (root hooks)
- ✅ External libraries

**Violations:**
- ❌ `@/services/*`
- ❌ `@/(core|domain)/features/{feature}/models/*`
- ❌ `@/(core|domain)/features/{feature}/types/*`
- ❌ `@/(core|domain)/features/{feature}/slice.ts`
- ❌ `@/(core|domain)/features/{feature}/sagas.ts`
- ❌ `@/(core|domain)/features/{feature}/I{Feature}Api.ts`

**Why:** Pages are presentation layer - they orchestrate UI, not business logic. All business logic should be in feature hooks.

**Check:** `check_pages_boundaries.mjs`

---

## 5. Model Internals Encapsulation

**RULE**: Cross-feature imports CANNOT access model internals (actions, slice, actionEffects).

**Allowed (cross-feature):**
- ✅ `@/(core|domain)/features/{feature}/models/{model}/types/*` (types only)
- ✅ `@/(core|domain)/features/{feature}/hooks/*` (feature hooks)
- ✅ `@/(core|domain)/features/{feature}/components/*`
- ✅ `@/(core|domain)/features/{feature}/hocs/*`

**Violations (cross-feature):**
- ❌ `@/(core|domain)/features/{feature}/models/{model}/actions.ts`
- ❌ `@/(core|domain)/features/{feature}/models/{model}/slice.ts`
- ❌ `@/(core|domain)/features/{feature}/models/{model}/actionEffects/*`
- ❌ `@/(core|domain)/features/{feature}/models/{model}/IModelApi.ts`

**Why:** Models are private implementation details. Features expose APIs through hooks, not direct model access.

**Note:** Within same feature, you can import model internals freely.

**Check:** `check_model_internals.mjs`

---

## 6. Slice Import Restriction

**RULE**: Feature `slice.ts` files MUST ONLY be imported in `src/config/features.ts`.

**Allowed:**
- ✅ `src/config/features.ts`

**Violations:**
- ❌ Any other file importing `@/(core|domain)/features/{feature}/slice`

**Why:** Slices are registered in composition root for Redux store setup.

**Check:** `check_slice_imports.mjs`

---

## 7. Sagas Import Restriction

**RULE**: Feature `sagas.ts` files MUST ONLY be imported in `src/config/features.ts`.

**Allowed:**
- ✅ `src/config/features.ts`

**Violations:**
- ❌ Any other file importing `@/(core|domain)/features/{feature}/sagas`

**Why:** Sagas are registered in composition root for Redux Saga middleware setup.

**Check:** `check_sagas_imports.mjs`

---

## 8. Circular Dependencies

**RULE**: Module dependencies must form a DAG (Directed Acyclic Graph). No circular imports.

**Detected:**
- Direct cycles: A ↔ B
- Deep cycles: A → B → C → A

**Why:** Circular dependencies cause bundling issues, hard to understand, difficult to test.

**Check:** `check_circular_deps.mjs`

---

# Architecture Layers

```
┌──────────────────────────────────────────┐
│  Composition Root (src/config/)          │ ← Wires everything together
├──────────────────────────────────────────┤
│  Core Features (src/core/features/)      │ ← Infrastructure
│  Domain Features (src/domain/features/)  │ ← Business Logic
├──────────────────────────────────────────┤
│  Service Layer (src/services/)           │ ← External integrations
└──────────────────────────────────────────┘
```

**Benefits:**
- Clear separation of concerns
- Core infrastructure doesn't know about business domains
- Easy to swap implementations (dependency injection)
- Features properly encapsulated

# Output Format

Each check reports:
- File paths and line numbers of violations
- What's wrong
- How to fix it
- Violation count
- Exit code 0 (success) or 1 (failures)

Reports are saved to `reports/{date}/arch-audit-report.md` when using `generate_report.mjs`.

# Tools

- **Bash**: Run Node.js scripts
- **Read**: Inspect source files
- **Write**: Generate reports (optional)

# Safety

- Read-only operation (unless generating reports)
- No source file modifications
- No external network calls
- Comprehensive dependency analysis

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

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 business →

Comments

Loading comments…

Newsletter

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