templates/skills/core/dag/SKILL.md
Maintain a clean dependency graph (DAG) to prevent circular dependencies and ensure maintainable architecture.
npx skillsauth add hivellm/rulebook DAG WorkflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CRITICAL: Maintain a clean dependency graph (DAG) to prevent circular dependencies and ensure maintainable architecture.
Layer 1: Foundation
Layer 2: Core
Layer 3: Features
Layer 4: Presentation
Foundation → Core → Features → Presentation
Rules:
Core
├── Utils
├── Types
└── Config
Features
├── Feature A
│ └── Core
└── Feature B
├── Core
└── Feature A
Presentation
├── CLI
│ └── Features
└── API
└── Features
❌ Feature A → Feature B → Feature A
❌ Core → Feature → Core
❌ Utils → Core → Utils
MANDATORY: Verify dependency structure:
# Check for circular dependencies
# Add your dependency check command here
# Examples:
# - TypeScript: tsc --noEmit (catches import cycles)
# - Rust: cargo check (catches circular dependencies)
# - Python: pylint --disable=all --enable=import-error
# - Go: go vet ./...
TypeScript/JavaScript:
# Use madge to detect circular dependencies
npx madge --circular src/
# Use dependency-cruiser
npx dependency-cruiser --validate src/
Rust:
# Cargo automatically detects circular dependencies
cargo check
Python:
# Use vulture or pylint
pylint --disable=all --enable=import-error src/
Go:
# Use go vet
go vet ./...
In code:
// Component: UserService
// Dependencies:
// - UserRepository (Core layer)
// - Logger (Foundation layer)
// - Config (Foundation layer)
// Does NOT depend on:
// - UserController (Presentation layer)
// - UserAPI (Presentation layer)
In documentation:
docs/DAG.md with component dependency graphBefore (Circular):
Feature A → Feature B → Feature A
After (Fixed):
Core
└── SharedService
Feature A → Core
Feature B → Core
CRITICAL: Include dependency validation in AGENT_AUTOMATION workflow:
# Step 1.5: Dependency Validation (before implementation)
# Check for circular dependencies
npm run check-deps # or equivalent for your language
# If circular dependencies detected:
# ❌ STOP - Fix architecture first
# ✅ Refactor to remove cycles
# ✅ Re-validate before proceeding
madge or dependency-cruiser for validationcargo tree to visualize dependenciespylint or vulture for import analysis__init__.py to control exportsgo vet for dependency validationsrc/
├── foundation/
│ ├── utils/
│ ├── types/
│ └── config/
├── core/
│ ├── models/
│ ├── services/
│ └── repositories/
├── features/
│ ├── auth/
│ │ └── (depends on core, foundation)
│ └── payments/
│ └── (depends on core, foundation)
└── presentation/
├── cli/
│ └── (depends on features, core, foundation)
└── api/
└── (depends on features, core, foundation)
src/
├── features/
│ └── auth/
│ └── (depends on presentation) # ❌ Wrong direction
├── core/
│ └── (depends on features) # ❌ Wrong direction
└── presentation/
└── (depends on foundation only) # ❌ Missing dependencies
Add dependency checks to:
research
Author a rulebook task spec interactively — research, draft, ask the user clarifying questions, confirm, then create the tasks in rulebook ready for /rulebook-driver. Use when the user wants to plan/spec a feature before implementing.
development
Behavioral guidelines to reduce common LLM coding mistakes — overcomplication, sloppy refactors, hidden assumptions, weak goals. Use when writing, reviewing, or refactoring code. Auto-applies; invoke explicitly via /karpathy-guidelines or 'follow karpathy discipline'.
data-ai
Autonomous AI agent loop for iterative task implementation (@hivehub/rulebook ralph)
data-ai
Use SQL Server for enterprise relational data storage with advanced features, high availability, and Windows integration.