lemmaly
Makes your agent think about efficiency before coding. It defines the data structure and algorithm type first. This avoids slow and repetitive code, making programs faster.
What it does
Lemmaly is a tool that helps you think about your code's efficiency before you write it. It ensures you define the complexity (how fast the code runs), the data structure (how data is organized), and the algorithm type (the strategy used) before you start programming.
When to use it
- ✓When writing new code involving lists, searches, or repetitions.
- ✓When reviewing code that seems slow or inefficient.
- ✓When you're unsure about the best way to organize your data and algorithms.
Example of what to ask your AI
“I need to write a function to find the most frequent item in a list of 1 million numbers. What complexity, data structure, and algorithm should I use before I start?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
Lemmaly works by requiring you to state the time and space complexity, the chosen data structure with a justification, and the algorithm family. This forces upfront analysis to avoid inefficient solutions.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill lemmalyOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/lemmaly/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
lemmaly — Algorithm-First Proof
The model already knows Big-O, hash tables, divide-and-conquer, dynamic programming, sorting, graph algorithms, and amortized analysis. It just does not apply them spontaneously. lemmaly fixes the behavior, not the knowledge.
This skill is the gateway for an algorithm-discipline suite of four skills (lemmaly, mathguard, invariant-guard, complexity-cuts). It enforces the hard rules that every other guard in the suite assumes.
Violating the letter of these rules is violating the spirit of the skill. "Just this once" is how O(n²) ships to production.
When to Use This Skill
Use lemmaly when:
- Writing, editing, or reviewing code that involves loops, collections, lookups, searches, joins, recursion, graphs, queries, or any computation over more than a handful of items.
- About to write a
forinside afor,.find/.includes/.indexOfinside a loop,awaitinsidefor/map/forEachover independent items, or one query per item in a collection. - Auditing a codebase / PR for known anti-patterns (await-in-loop,
.includesinside.filter, string-concat in loop,SELECT *, N+1, etc.). - Reviewing AI-generated code that "looks idiomatic" but might hide O(n²) or N+1.
When in doubt, start at lemmaly — it is the gateway and will tell you when to escalate to its three sibling skills.
| If you are about to… | Use | Why |
|---|---|---|
| Write new code that loops, queries, joins, recurses, or processes a collection | lemmaly | Forces complexity + data structure + algorithm family before code is written. |
| Refactor existing code that is already slow, OOMs, times out, or has nested loops / N+1 / repeated work | complexity-cuts | Corrective playbook for code that already shipped with bad Big-O. |
| Implement an algorithm where the obvious version is subtly wrong (binary search variants, in-place dedup, Boyer–Moore, QuickSelect partition, recursion with accumulators, fixed-point / termination concerns) | invariant-guard | Forces writing the function contract + loop invariant before code. The trap is in the contract, not the loop body. |
| Work with n ≥ 10⁶, similarity search, dedup at scale, top-K, streaming analytics, cardinality estimation, embeddings, FFT/NTT, dimensionality reduction, computational geometry, randomized algorithms | mathguard | Classical algorithms have hit their lower bound; an approximate or math-heavy technique (Bloom, HLL, Count-Min, MinHash/LSH, FFT, JL projection, sweep line, kd-tree) gives the asymptotic win. |
Routing flow
Are you writing new code?
├── yes → lemmaly (state complexity, structure, family BEFORE coding)
│ ├── classical algorithm at its lower bound AND n is large? → mathguard
│ └── subtle correctness trap (invariant, base case, off-by-one)? → invariant-guard
└── no, refactoring existing slow / OOM / timed-out code → complexity-cuts
└── still slow after classical fixes? → mathguard
One-line mental model
- lemmaly = think first (prevention).
- complexity-cuts = clean up bad Big-O (correction).
- invariant-guard = prove it's correct (verification).
- mathguard = beat the classical floor (acceleration).
The Iron Law
NO NON-TRIVIAL CODE WITHOUT STATED COMPLEXITY, DATA STRUCTURE, AND ALGORITHM FAMILY
Before you write a loop, a recursion, a query, or any computation over more than a handful of items, three things must appear in your message — in this order:
time = O(?),space = O(?), with the dominant input dimension named.- The data structure you will use, with a one-phrase reason.
- The algorithm family (one of: linear scan, two-pointer, sliding window, binary search, sort+sweep, hash join, BFS/DFS, topo sort, Dijkstra/A*, union-find, DP, greedy, recursion+memo, prefix sum, segment tree, monoid reduction).
If you cannot state all three, you do not understand the problem yet. Ask, or read more code. Do not write code.
Non-negotiable rules
- State complexity before writing any non-trivial code. In one line:
time = O(?),space = O(?)- Dominant input dimension:
n = what, with realistic magnitude (e.g.n ~ 10^6 rows) - If you cannot state these, you do not yet understand the problem. Ask, or read more code.
…
FAQ
What is 'Big-O'?
Big-O (or complexity) is a way to describe how fast an algorithm runs as the input data size grows. For example, O(n) means the runtime grows linearly with the data size.
Why define the data structure first?
The choice of data structure (like lists, maps, or sets) directly impacts efficiency. Defining this beforehand helps ensure you're using the right tool for the job, such as a map for fast lookups.
What are 'algorithm families'?
These are general categories of strategies for solving problems, like binary search, sorting, or dynamic programming. Identifying the family helps you think about known, efficient solutions.
Details
Original description by the author
Algorithm-first discipline: state Big-O, data structure, and algorithm family BEFORE writing loops, queries, or recursion. Catches O(n^2), N+1, and brute-force defaults.
Popularity
- GitHub stars
- 48k
- Ranking position
- #3433
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
benchmark-optimization-loop
Has your agent improve something's speed in a measured way. It tests multiple versions and chooses the fastest one that still works correctly.
affaan-m/ECC
change-impact
Helps your agent analyze the impact of code changes before making them. It compares the planned vs. actual results afterward, covering paths, data, tests, and documentation. Useful for risky or system-wide changes.
affaan-m/ECC
click-path-audit
Lets your agent trace all user buttons and interactions to find bugs. It finds issues where functions seem to work alone but fail together. Useful when bugs persist even after debugging.
affaan-m/ECC