Skip to main content
Sekreton

← All recipes Every Monday

Untangle the worst coupling

An agent finds your most tangled code, and you get it untangled with measurements.

The agent measures coupling in your codebase, uses Axiomatic Design to give the costliest tangle one owner, and brings you the change and its before-and-after measurements.

The prompt

Paste it into the automation’s Instructions. Each run starts a task from it.

Find the most tangled part of this codebase and untangle it, using Axiomatic Design: each requirement the code meets should be delivered by its own part of the code, so changing one part never disturbs another requirement.

Start from measurements. Write a small script that measures coupling: state (a database column, field or status) written from several unrelated places, modules that depend on each other in a loop, and files that keep changing together in the last 90 days of git history. Rank each finding by how often that code changed and how many of those changes were bug fixes: the worst coupling is the one that costs the most, not the one that looks ugliest. Check the backlog and this automation's earlier runs, and skip any area already untangled.

For the worst one, name the requirements involved and the one requirement that has no single owner, then give it one owner and route every other caller through it. Change only structure: every existing test must pass without being edited. Add a test that fails if this coupling comes back, for example one that only the owner may write that state or call that function. If the full fix is too big to review as one change, make the first safe slice and file the rest as one backlog task.

If nothing is worth untangling, say so and change nothing.

Attach coupling-before-after.html, and don't commit it: the area's design matrix before and after (requirements as rows, the code that delivers them as columns, coupling above the diagonal highlighted), your script's measurements on the commit before and the commit after, and a short plain-language account of what was tangled and why the change helps.

Inspired by Axiomatic design (Nam P. Suh, MIT).

Set it up

Add it to a project in one click, or open Settings → Automations → New automation and start from this recipe.

Use this recipe
Trigger
Schedule: Every Mon at 09:00
Action
Create task
Start each task
One-shot
Skip while the previous task is still open
On

You’ve been promoted.

Set it up once and approve what it brings.

Start free trial

More recipes