Skip to content
Back to skills

Untie

ASecurity

Fix structural findings reported by unknot (module-cycle, import-cycle, tangle, field-leak, shared-state, shallow-module, wide-injection, forward-ref, prop-drilling, wide-component, duplicate-type, wide-directory, long-file) from first principles. Use when the unknot Stop hook blocks the turn, when `npx --yes unknot@0.2.1` prints findings, or when asked to untie a knot, break an import cycle, or clean up the architecture of a TypeScript or JavaScript project.

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 28, 2026
developmentjavascripttypescriptgojava

Security analysis

A100/100

Scanned December 1, 2026

npx -y skills add PatternVoid/unknot --skill untie --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Untie?

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

Security grade badge for Untie
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/patternvoid-untie/badge)](https://www.skillsdirectory.com/skills/patternvoid-untie)

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: untie
description: Fix structural findings reported by unknot (module-cycle, import-cycle, tangle, field-leak, shared-state, shallow-module, wide-injection, forward-ref, prop-drilling, wide-component, duplicate-type, wide-directory, long-file) from first principles. Use when the unknot Stop hook blocks the turn, when `npx --yes unknot@0.2.1` prints findings, or when asked to untie a knot, break an import cycle, or clean up the architecture of a TypeScript or JavaScript project.
---

# Untie a knot

unknot reports places where the structure of the code works against the next change. A finding is real: fix the structure, do not hide the finding.

## Rules that always hold

- Never add entries to `.unknot.allow` and never run `--update-allow` to make a new finding go away. The allow file records debt that existed before; new knots are fixed.
- Do not move code around until the finding disappears. Decide what the right structure is, then make the smallest change that gets there.
- Fix all findings of one class or one cycle together. Half a fix leaves a new knot.
- After the change run `npx --yes unknot@0.2.1` again and the project's own checks (types, tests).

## How to read a finding

```text
error[module-cycle]: 2 modules import each other; 1 import goes against the layers
  --> src/orders/orders.service.ts
  = note: upward import: src/orders/orders.service.ts -> src/payments/refunds.ts
    layers, lowest first: src/orders ◀ src/payments
```

The title says what is wrong, the notes name the exact files and lines, the last line shows the shape. `npx --yes unknot@0.2.1 --explain <rule>` prints what a rule means and how to fix it.

## The fix for each knot

| Finding | Ask | Fix |
|---|---|---|
| `module-cycle` | Which folder is the lower layer? The finding lists them lowest first and names the imports that go upward. | Remove the named upward imports: move the piece both sides share into the lower layer, or invert the call (the lower side takes a callback, emits an event, or receives the value as an argument). |
| `import-cycle` | Which file should not know the other? | Same as above at file level. If the loop runs through a barrel (`index.ts`), import the sibling file directly. |
| `tangle` | Which of the two classes owns the relationship? | One owner calls both; the other side receives a callback, an event or a narrow interface and stops knowing its partner. When one class is tangled with many, it is a hub: split it by the jobs it serves or pass each collaborator only what it needs. |
| `field-leak` | What is the outsider trying to do? | Give the class a method that says it (`pause()` instead of `paused = true`), keep the field private. Fix every leaked field of the class in one change. |
| `shared-state` | What are the other files trying to do with this state? | Keep the variable private to its module and export functions that say it (`register(listener)` instead of `listeners.add(listener)`). |
| `shallow-module` | What does this wrapper add? | Nothing: call the target directly and delete the wrapper. Something: put that real work into it. |
| `wide-injection` | Which jobs does this class do? | Group the collaborators by job and split the class along those jobs. Do not hide them behind a facade. |
| `forward-ref` | Which side is lower? | Move what both need into a third provider, or let the lower side emit an event the upper side handles. Then delete `forwardRef`. |
| `prop-drilling` | Who owns the value and who needs it? | Let the owner render the consumer and pass it as `children`, or let the consumer read a context or a store. The components in between stop taking the prop. |
| `wide-component` | Which features share this component? | Group the state by feature and move each group with its effects into its own hook or child component. |
| `duplicate-type` | Which module owns this concept? | Keep one declaration there and import it everywhere else. |
| `wide-directory` | What two or three things is this folder about? | Give each its own folder with a narrow entry point. |
| `long-file` | Which separate concepts live in this file? | Move each behind its own small interface. Do not cut the file at arbitrary lines. |

The idea behind every rule: deep modules with narrow interfaces. A fix is right when the next reader needs to know less, not when the linter is quiet.

## When a finding looks wrong

Check the cited lines first. If the code is generated, vendored or a fixture, add its folder to `ignore` in `.unknot.json` and tell the user. If the finding is correct but the user wants to keep the structure, say so and let them decide: the choice to record debt belongs to the user, not to you.

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.