Agent skill · software engineering · sickn33

complexity-cuts

Lower Big-O on existing code via a one-transformation-at-a-time playbook with verify-revert-stop. For new code use lemmaly; for math-level wins escalate to mathguard.

Why this skill is useful

Provides a structured playbook for optimizing code complexity that includes specific transformation guidelines and testing protocols not commonly found in standard practices.

What it needs

Requires lemmaly installed locally. About 10k tokens when loaded. Last updated 2026-08-07. 44,571 stars on the source repository.

What this skill does

complexity-cuts — Lower Big-O on Existing Code lemmaly prevents bad complexity before code is written. complexity-cuts fixes it after the fact: code already exists, it works, but its time or space complexity is worse than necessary. Violating the letter of these rules is violating the spirit of the skill. Adapting "just a little" is how a faster-but-wrong rewrite ships. When to Use This Skill Use complexity-cuts when refactoring existing code that has poor Big-O: Nested loops, O(n²) or worse scans, repeated work, redundant allocations, blown memory. Stated symptoms: "this is slow on large inputs", "times out", "OOM", "too much memory", "reduce complexity", "optimize this algorithm". N+1 query patterns in ORMs (Prisma, Drizzle, SQLAlchemy, Django, ActiveRecord). await inside for over independent items causing serial latency. For preventing bad complexity before code is written, use lemmaly. For math-level optimizations (Bloom, HLL, FFT, JL projection), escalate to mathguard. The Iron Law If the code has no tests, you write a characterization test first (golden input → current output). Then transform. Then verify the test still passes. If you skip this, the optimization can silently break callers — and faster-but-wrong is worse than slow-and-right. Non-negotiable rules 1. State current and target Big-O before touching code. In one line: Current: time = O(?), space = O(?) Target: time = O(?), space = O(?) Dominant input dimension (n = what, how large in practice) If you cannot state current Big-O, you do not yet understand the code. Read more. 2. Identify the bottleneck, do not guess. Point to the exact line(s) responsible for the dominant term. Nested loop? Repeated linear scan? Recomputation? Allocation inside a hot loop? The fix lives there, not elsewhere. 3. One transformation at a time, with a verify-revert-stop loop. The loop is: 1. Apply exactly one transformation from the playbook. 2. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills sickn33/complexity-cuts

View the source on GitHub

Browse the @skills marketplace