本文へスキップ
Skillpedia
一般的なプログラミング48k · #5047

lemmaly

できること

Lemmalyは、コードを書く前に、その効率について考えるのを助けるツールです。プログラミングを始める前に、計算量(コードの実行速度)、データ構造(データの整理方法)、アルゴリズムの種類(使用する戦略)を必ず決めるように促します。

使う場面

  • ✓リスト、検索、繰り返し処理を含む新しいコードを書くとき。
  • ✓処理が遅い、または非効率に見えるコードをレビューするとき。
  • ✓データやアルゴリズムの最適な整理方法がわからないとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/lemmaly/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/lemmaly/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“100万個の数値が入ったリストの中で、最も出現回数が多い要素を見つける関数を書きたいです。プログラミングを始める前に、どの計算量、データ構造、アルゴリズムを使うべきですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

Lemmalyは、計算時間と메모리使用量(空間計算量)、選んだデータ構造とその理由、アルゴリズムの系統を明示するよう求めます。これにより、事前に分析を行い、非効率な解決策を避けられます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)を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 for inside a for, .find / .includes / .indexOf inside a loop, await inside for / map / forEach over independent items, or one query per item in a collection.
  • Auditing a codebase / PR for known anti-patterns (await-in-loop, .includes inside .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:

  1. time = O(?), space = O(?), with the dominant input dimension named.
  2. The data structure you will use, with a one-phrase reason.
  3. 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

  1. 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.

…

よくある質問

「Big-O」とは何ですか?

Big-O(または計算量)は、入力データのサイズが大きくなるにつれて、アルゴリズムの実行時間がどのように増えるかを表す方法です。たとえば、O(n)は、実行時間がデータサイズに比例して増えることを意味します。

なぜ最初にデータ構造を決めるのですか?

リスト、マップ、セットなどのデータ構造の選択は、効率に直接影響します。事前に決めておくことで、作業に適したツールを使えます。たとえば、高速な検索が必要な場合はマップを使うといった判断ができます。

「アルゴリズムの系統」とは何ですか?

二分探索、ソート、動的計画法など、問題を解決するための戦略の大まかな分類です。系統を特定することで、既知の効率的な解法を検討しやすくなります。

詳細

作者による元の説明

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.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5047
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル