Analyze code coupling using Vlad Khononov's Balanced Coupling framework. Generates interactive HTML reports with D3.js dependency graphs. Use when analyzing architecture health, identifying risky dependencies, or preparing for refactoring decisions. Language-agnostic design.
View on GitHubFebruary 1, 2026
Select agents to install to:
npx add-skill https://github.com/kazuph/dotfiles/blob/main/plugins/kazuph-dotfiles/skills/code-coupling-analysis/SKILL.md -a claude-code --skill code-coupling-analysisInstallation paths:
.claude/skills/code-coupling-analysis/# Coupling Analysis Skill Analyze code coupling across three dimensions and generate actionable HTML reports. ## Framework: Balanced Coupling (Vlad Khononov) Three key dimensions determine coupling risk: ### 1. Integration Strength (How tightly modules connect) | Level | Score | Detection Pattern | |-------|-------|-------------------| | Intrusive | 1.00 | Direct property access, internal state manipulation | | Functional | 0.75 | Function/component usage, hooks, methods | | Model | 0.50 | Data type imports, interfaces used as data | | Contract | 0.25 | Pure interface/type imports | ### 2. Distance (Where dependencies live) | Level | Score | Detection Pattern | |-------|-------|-------------------| | Same Module | 0.25 | Same directory (`./Component`) | | Sibling Module | 0.50 | Sibling directory (`../utils`) | | Distant Module | 0.75 | Different top-level (`@/contexts`, `~/lib`) | | External | 1.00 | External packages (`react`, `lodash`) | ### 3. Volatility (Change frequency from Git history) | Level | Score | Changes (6 months) | |-------|-------|-------------------| | Low | 0.00 | 0-2 changes | | Medium | 0.50 | 3-10 changes | | High | 1.00 | 11+ changes | ### Balance Score Formula ``` balance = (strength × volatility) × 0.6 + |strength - (1 - distance)| × 0.4 ``` **Interpretation:** - 0.0 - 0.2: Well balanced (ideal) - 0.2 - 0.4: Acceptable - 0.4 - 0.6: Needs attention - 0.6+: Risky, consider refactoring ## Execution Steps ### Step 1: Identify Target Directory and Language Determine the primary language by checking for: - `tsconfig.json` or `*.ts`/`*.tsx` → TypeScript - `pyproject.toml` or `*.py` → Python - `go.mod` or `*.go` → Go - `Cargo.toml` or `*.rs` → Rust - `package.json` with `*.js`/`*.jsx` → JavaScript ### Step 2: Gather File List ```bash # TypeScript/JavaScript find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) \ -not -path "*/node_modules/*" \ -not -path "*/.git/*" \ -not -name "*.d.ts" \ -not -nam