boundary-bbcr-fallback
Execute automatic BBCR (Collapse-Rebirth Correction) when knowledge boundaries are exceeded or reasoning fails.
Deep-dive audit of dependency direction ensuring the Dependency Rule is followed in Rust projects
$ npx -y skills add qdhenry/Claude-Command-Suite --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/audit-dependenciesContext preview
What this command does when you run it.
Deep-dive audit of dependency direction ensuring the Dependency Rule is followed in Rust projects
name: rust:audit-dependencies description: Deep-dive audit of dependency direction ensuring the Dependency Rule is followed in Rust projects allowed-tools: Read, Grep, Glob, Bash author: Quintin Henry (https://github.com/qdhenry/)
Deep-dive audit of dependency flow in a Rust codebase, ensuring the Dependency Rule is followed: dependencies must only point inward toward the domain layer.
Audit dependency direction in the codebase: **$ARGUMENTS**
> **Note:** `$ARGUMENTS` can specify a path or module to focus on. > Examples: > - `/rust:audit-dependencies` - Audit all dependencies > - `/rust:audit-dependencies src/application/` - Focus on application layer
---
OUTER → INNER (Allowed)
INNER → OUTER (VIOLATION!)
Infrastructure → Adapters → Application → Domain
↓ ↓ ↓ ↓
May use May use May use Uses NOTHING
anything App+Domain Domain external**Control flow vs Dependency direction:**
---
# Extract all crate-internal imports grep -rhn "^use crate::" src/ --include="*.rs" | sort # Extract all external imports grep -rhn "^use [a-z]" src/ --include="*.rs" | grep -v "use crate::" | grep -v "use std::" | grep -v "use self::" | grep -v "use super::" | sort
Create a matrix showing what each layer imports:
## Dependency Matrix | | Domain | Application | Adapters | Infrastructure | External | |--------------|--------|-------------|----------|----------------|----------| | **Domain** | ✓ | VIOLATION | VIOLATION | VIOLATION | minimal | | **Application** | ✓ | ✓ | VIOLATION | VIOLATION | limited | | **Adapters** | ✓ | ✓ | ✓ | aware | yes | | **Infrastructure** | ✓ | ✓ | ✓ | ✓ | yes |
---
The domain layer should have near-zero external dependencies.
# Find domain directory (common names) DOMAIN_DIR=$(find src -type d \( -name "domain" -o -name "entities" -o -name "core" \) | head -1) # All imports in domain grep -rhn "^use " $DOMAIN_DIR --include="*.rs" 2>/dev/null
// ACCEPTABLE in domain layer
use std::{...}; // Standard library
use uuid::Uuid; // Value types
use chrono::{...}; // Date/time types
use thiserror::Error; // Error derives
use derive_more::{...}; // Derive macros
// NEVER ACCEPTABLE in domain layer
use axum::{...}; // Web frameworks
use sqlx::{...}; // Database
use serde::{...}; // Serialization (debatable)
use crate::adapters::{...}; // Outer layers
use crate::infrastructure::{...};# CRITICAL: Domain importing outer layers grep -rn "use crate::adapters\|use crate::infrastructure\|use crate::application" src/domain/ 2>/dev/null # CRITICAL: Domain importing frameworks grep -rn "use axum\|use actix\|use rocket\|use warp" src/domain/ 2>/dev/null # CRITICAL: Domain importing database grep -rn "use sqlx\|use diesel\|use sea_orm\|use rusqlite" src/domain/ 2>/dev/null # WARNING: Domain importing serialization grep -rn "use serde" src/domain/ 2>/dev/null
---
The application layer should only depend on the domain layer.
# Find application directory APP_DIR=$(find src -type d \( -name "application" -o -name "use_cases" -o -name "usecases" -o -name "services" \) | head -1) # All crate imports in application grep -rhn "^use crate::" $APP_DIR --include="*.rs" 2>/dev/null
// ACCEPTABLE in application layer
use crate::domain::{...}; // Domain types
use std::{...}; // Standard library
use async_trait::async_trait; // Async traits for ports
use thiserror::Error; // Error types
// NEVER ACCEPTABLE in application layer
use crate::adapters::{...}; // Adapter implementations
use crate::infrastructure::{...}; // Infrastructure
use axum::{...}; // Web framework
use sqlx::{...}; // Database# HIGH: Application importing adapters grep -rn "use crate::adapters" src/application/ 2>/dev/null # HIGH: Application importing infrastructure grep -rn "use crate::infrastructure" src/application/ 2>/dev/null # HIGH: Application importing frameworks grep -rn "use axum\|use actix\|use rocket" src/application/ 2>/dev/null # HIGH: Application importing DB directly grep -rn "use sqlx\|use diesel\|use sea_orm" src/application/ 2>/dev/null
---
Adapters should depend on the application layer (implementing its ports) and can use external frameworks.
# Find adapter directory ADAPTER_DIR=$(find src -type d \( -name "adapters" -o -name "handlers" -o -name "api" -o -name "controllers" \) | head -1) # All crate imports in adapters grep -rhn "^use crate::" $ADAPTER_DIR --include="*.rs" 2>/dev/null
// ACCEPTABLE in adapters layer
use crate::application::{...}; // Ports, use cases, app errors
use crate::domain::{...}; // Domain types (for conversion)
use axum::{...}; // Web framework
use sqlx::{...}; // Database
use serde::{...}; // Serialization
// PATTERN: Adapters implement application ports
impl UserRepository for PostgresUserRepository { ... }# Find trait implementations in adapters grep -rn "i
A comprehensive development toolkit designed following Anthropic's Claude Code Best Practices for AI-assisted software development.
Repo: qdhenry/Claude-Command-Suite
Execute automatic BBCR (Collapse-Rebirth Correction) when knowledge boundaries are exceeded or reasoning fails.
Analyze semantic position relative to knowledge boundaries to prevent hallucination and identify uncertainty zones.
Generate a visual heatmap of knowledge boundaries showing safe zones, risk areas, and semantic coverage.
Evaluate the current risk level and provide detailed analysis of potential hallucination or reasoning failure.
Find and construct semantic bridges to safely navigate from current position to target concept without crossing dangerous boundaries.
Takes an input prompt and returns ONLY a token-optimized version that preserves meaning while minimizing token count. Based on LLM tokenization principles:…