Tw complexity mitigator

From SDiamante13/dotfiles · View interactive version

Tw complexity mitigator is an AI agent skill from the GitHub repository SDiamante13/dotfiles. Mitigate incidental code complexity when control flow is tangled, nesting is deep, names are hard to parse, or reasoning requires cross-file hops. Use when a review stalls on readability, you need an analysis-first refactor plan before edits, or you want essential-vs-incidental verdicts, ranked simp

How to use this skill

Skill file

Complexity Mitigator

Intent

Reduce incidental complexity (understanding cost) while preserving essential domain meaning.

Core Mindset

Epistemic Status (Heuristics, Not Laws)

Definitions (Essential vs Incidental)

Brooks Lens (No Silver Bullet)

Engage When

Guardrails

Quick Scan (Cognitive Heat Read)

Workflow

  1. Choose the slice: entrypoint, inputs, outputs, state.
  2. Heat read: name hotspots and what makes them hard.
  3. Trace behavior (if meaning is unclear): happy path + key failure paths; call out mutations/IO.
  4. Verdict: separate essential domain logic, external conformity/change burden, and incidental implementation noise.
  5. Simplify in order (default): flatten -> rename -> extract (do not extract until flatten/rename reveals stable shapes).
  6. Options: rank by effort vs impact and state the smallest viable cut.
  7. Sketch: show the improved structure (types + flow), not the full implementation.
  8. TRACE: cite which letters are satisfied and which are currently violated.

Standard Playbook (Flatten -> Rename -> Extract)

Option Ranking Rubric

What Counts as Evidence (Local, Not Global)

Output Format

0) Slice

1) Heat Read (hotspots)

1.5) Behavior Trace (optional)

2) Essential vs Incidental

3) Options (ranked by effort vs impact)

  1. Smallest viable cut: ...
  2. ...
  3. ...

4) Sketch

// minimal illustrative snippet

5) TRACE

Why TRACE Is Part of Complexity Mitigation

TRACE Quick Reference

Invariant Guidance

Use when missing invariants block simplification.

Footgun Checklist

Use when confusing APIs or naming cause misuse.

Escalation

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.