Skip to content
Back to skills

Coupling Cohesion

ASecurity

Assesses existing code for module cohesion and LCOM, codebase-wide coupling metrics and zones, or the balance of one dependency (Khononov). Use when measuring cohesion, coupling, or dependency balance.

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 11, 2026
developmentpythongojavabashexpress

Security analysis

A100/100

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

Scanned December 4, 2026

npx -y skills add fabiandistler/agents --skill coupling-cohesion --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coupling Cohesion?

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

Security grade badge for Coupling Cohesion
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/fabiandistler-coupling-cohesion/badge)](https://www.skillsdirectory.com/skills/fabiandistler-coupling-cohesion)

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: coupling-cohesion
category: architecture
environments: coding
description: Assesses existing code for module cohesion and LCOM, codebase-wide coupling metrics and zones, or the balance of one dependency (Khononov). Use when measuring cohesion, coupling, or dependency balance.
compatibility: The bundled scripts are stdlib-only Python 3.9+. LCOM analyzes Python (precise, via AST), R, and Bash (heuristic); the coupling and balance checks are language-agnostic. Dependency-graph extraction uses whatever tool fits the ecosystem (examples in the Mode B file for Python, JS/TS, Java, .NET, Go).
---

# Coupling & Cohesion

## When to use

- "Is this `utils.py` a grab-bag — split it or leave it?"
- "Which of our packages sit in the Zone of Pain?"
- "Is it OK that the billing module reads the shared customer entity?"

**Not for:** a single function's cyclomatic complexity, first-time topology
choices (route to `members/architecture-pattern-advisor/SKILL.md`), or
greenfield component decomposition (route to
`members/logical-component-design/SKILL.md`). Read both via the `architecture` router.

## Choose a mode

| Mode | The question | Open |
|---|---|---|
| **A. Cohesion** | Do this module/class/file's parts belong together — split, merge, or leave? | [references/mode-a-cohesion.md](references/mode-a-cohesion.md) |
| **B. Codebase coupling** | How coupled / brittle / over-abstracted is the codebase, by the numbers? | [references/mode-b-coupling-metrics.md](references/mode-b-coupling-metrics.md) |
| **C. Balanced coupling** | Is this *one specific* dependency the right kind of coupling for its boundary? | [references/mode-c-balanced-coupling.md](references/mode-c-balanced-coupling.md) |

Pick the mode from the question, then open only that mode's file: it holds
the workflow, the output template, and the common mistakes. Open a second
mode file only when the answer needs it — for example, a Mode B hotspot
whose one suspicious dependency you then weigh with Mode C. Script paths in
the mode files are relative to this skill's directory.

Open the relevant reference when its condition applies:

- [references/metrics.md](references/metrics.md) — how each Mode B number is
  derived, and the limits that make a flagged zone a prompt, not a verdict.
- [references/remediation.md](references/remediation.md) — once Mode B has
  flagged a component off the Main Sequence and you need the fix per zone.
- [references/balanced-coupling-model.md](references/balanced-coupling-model.md)
  — the strength, distance and volatility scales behind Mode C's balance rule.
- [references/rebalancing.md](references/rebalancing.md) — once Mode C has
  flagged a dependency as imbalanced and you need one of the three exits.

Modes B and C are complementary halves of a coupling audit: the metrics (B) find
the hotspots, the balance model (C) explains and fixes a specific relationship.
Mode A is the cohesion half of the same law. The per-scale expressions and the
classic failure shapes live in
[references/cohesion-taxonomy.md](references/cohesion-taxonomy.md#the-same-law-at-every-scale).

## Output contract (all modes)

Every answer uses the same shape — verdict first, evidence second, concrete
next step third — with a per-mode template in each mode file. Report at most the top 3
findings with seam and fix; summarize the remainder in one line. Leaving the
code alone, with the reason, is a first-class verdict, not a non-answer. Keep it proportional: a clean module needs a
sentence, not a report.

`scripts/test_*.py` are the bundled scripts' own tests; they are not part of
any mode's workflow.

## Related skills

Sibling sub-skills, each read via the `architecture` router:
- `members/logical-component-design/SKILL.md` — *creates* a
  decomposition for a new system; this skill *measures* one that already exists.
- `members/architecture-pattern-advisor/SKILL.md` — use when the concern is the system topology.
- `members/ddd/SKILL.md` — subdomain classification feeds the volatility judgment in Mode C;
  aggregates are, among other things, a cohesion boundary.

Files in this skill

  • SKILL.md3.8 KB
  • evals.json568 B
  • references/balanced-coupling-model.md9.2 KB
  • references/cohesion-taxonomy.md11.2 KB
  • references/metrics.md7.3 KB
  • references/mode-a-cohesion.md6.5 KB
  • references/mode-b-coupling-metrics.md6.1 KB
  • references/mode-c-balanced-coupling.md6.7 KB
  • references/rebalancing.md5.3 KB
  • references/remediation.md3.7 KB
  • scripts/balance_check.example.json1.4 KB
  • scripts/balance_check.py8 KB
  • scripts/coupling_metrics.example.json923 B
  • scripts/coupling_metrics.py6.7 KB
  • scripts/lcom.py18.8 KB
  • scripts/test_balance_check.py2.8 KB
  • scripts/test_coupling_metrics.py2.7 KB
  • scripts/test_lcom.py4.6 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 development →

Comments

Loading comments…

Newsletter

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