Chuyển đến nội dung
Skillpedia
Lập trình chung48k · #5047

lemmaly

Skill này làm gì

Lemmaly là công cụ giúp bạn suy nghĩ về hiệu quả của code trước khi viết. Nó đảm bảo bạn xác định độ phức tạp (code chạy nhanh đến mức nào), cấu trúc dữ liệu (dữ liệu được tổ chức ra sao) và loại thuật toán (chiến lược sử dụng) trước khi bắt đầu lập trình.

Khi nào nên dùng

  • ✓Khi bạn viết code mới có liên quan đến danh sách, tìm kiếm hoặc lặp.
  • ✓Khi bạn xem lại code có vẻ chậm hoặc kém hiệu quả.
  • ✓Khi bạn chưa chắc cách tổ chức dữ liệu và thuật toán tốt nhất.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/lemmaly/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi cần viết một hàm tìm phần tử xuất hiện nhiều nhất trong danh sách 1 triệu số. Tôi nên dùng độ phức tạp, cấu trúc dữ liệu và thuật toán nào trước khi bắt đầu?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Lemmaly yêu cầu bạn nêu rõ độ phức tạp thời gian và không gian, cấu trúc dữ liệu đã chọn kèm lý do, và họ thuật toán. Điều này buộc bạn phân tích trước để tránh các giải pháp kém hiệu quả.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.

…

Câu hỏi thường gặp

'Big-O' là gì?

Big-O (hay độ phức tạp) là cách mô tả tốc độ chạy của thuật toán khi dữ liệu đầu vào tăng lên. Ví dụ, O(n) nghĩa là thời gian chạy tăng tuyến tính theo kích thước dữ liệu.

Vì sao phải xác định cấu trúc dữ liệu trước?

Việc chọn cấu trúc dữ liệu (như danh sách, bản đồ hoặc tập hợp) ảnh hưởng trực tiếp đến hiệu quả. Xác định trước giúp bạn dùng đúng công cụ, chẳng hạn bản đồ để tra cứu nhanh.

'Họ thuật toán' (algorithm families) là gì?

Đây là các nhóm chiến lược chung để giải quyết vấn đề, như tìm kiếm nhị phân, sắp xếp hoặc quy hoạch động. Xác định họ thuật toán giúp bạn nghĩ đến các giải pháp đã biết và hiệu quả.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5047
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự