mathguard
하는 일
이 도구는 특히 대량의 데이터를 다룰 때 복잡한 계산 문제를 풀기 위한 고급 수학 방법을 고르도록 돕습니다. 기존 방법보다 더 효율적인 대안을 제안하며, 약간의 오차를 감수해야 할 수도 있습니다.
사용하는 경우
- ✓수백만 개의 데이터 포인트에서 비슷한 항목을 빠르게 찾아야 할 때.
- ✓신호나 이미지를 처리하며 빠른 계산이 필요할 때.
- ✓일반 알고리즘도 이미 빠르지만 더 나은 해결책이 필요하고 작은 오차를 감수할 수 있을 때.
스킬 링크
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/mathguard/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“1,000만 개의 이미지 데이터셋에서 중복을 찾아야 합니다. 거짓 양성은 어느 정도 허용할 수 있습니다. 어떤 수학 기법을 쓸 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
도구는 문제를 대용량 데이터에 더 효율적인 것으로 알려진 수학 기법들과 비교합니다. 정확한 해답이 필요한지, 아니면 알려진 오차가 있는 근사값이 허용되는지 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
mathguard — Math-Heavy Optimization for AI Code
lemmaly makes you pick the right classical algorithm. mathguard kicks in when the classical algorithm is already optimal but mathematics gives a better bound — usually by accepting bounded approximation, exploiting structure, or moving to a smarter algebraic space.
The model knows these techniques. It almost never proposes them spontaneously. mathguard fixes that.
Violating the letter of these rules is violating the spirit of the skill. A Bloom filter where the caller assumed exact answers is a production incident, not an optimization.
When to Use This Skill
Use mathguard when:
- Working with large-scale data (
n ≥ 10⁶): similarity search, deduplication, top-K / heavy-hitters, streaming analytics, cardinality estimation, embeddings, recommender systems. - Doing signal/image processing, polynomial or big-integer arithmetic, convolution, graph distance, computational geometry, randomized algorithms.
- The classical O(n log n) is already the floor and you need an asymptotic win (Bloom filter, HyperLogLog, Count-Min Sketch, MinHash/LSH, FFT/NTT, Johnson-Lindenstrauss projection, sweep line, kd-tree/BVH, fast exponentiation, monoid parallel reduction, amortized potential method).
- Loaded after
lemmalyhas confirmed the classical answer is not enough.
Do not use mathguard when:
- The caller needs exact answers (auth, billing, dedup-for-correctness, primary keys).
nis small (n < 10⁴) and the path is not hot.- The bottleneck is I/O, not CPU/memory.
The Iron Law
NO APPROXIMATE STRUCTURE WITHOUT WRITTEN ε/δ AND EXPLICIT CALLER ACCEPTANCE
Probabilistic data structures (Bloom, HyperLogLog, Count-Min, MinHash/LSH, t-digest), randomized projections (JL), and lossy transforms (floating FFT) all change the answer's meaning. Before proposing one:
- Write the error parameter the caller will see (false-positive rate, relative error, distortion bound).
- Identify the caller and state, in one sentence, that they tolerate this kind of wrong answer.
- If you cannot identify the caller, or they need exact (auth checks, billing, dedup keys, deduplication for correctness, anything that flows into a primary key), DO NOT propose the approximate structure. Keep classical, or escalate to a sharded/streaming exact design.
This rule has saved more incidents than any other in this skill. Do not soften it.
Non-negotiable rules
Declare exact vs approximate up front. Before suggesting a math-level technique, state:
mode: exactormode: approximate- If approximate: the error parameter (ε, δ, false-positive rate) and a sentence on whether the caller can tolerate it.
- If the caller needs exact and there is no exact win, say so and stop — do not silently degrade to approximate.
Cite the technique by name. Never describe a probabilistic or numerical trick in vague terms. Name it:
Bloom filter,HyperLogLog,Count-Min Sketch,MinHash + LSH,Johnson–Lindenstrauss projection,FFT,NTT,fast exponentiation,Karatsuba,Strassen,sweep line,kd-tree,BVH,union-find with path compression,Floyd's cycle detection,Boyer-Moore majority,reservoir sampling,Knuth shuffle,Aho-Corasick,suffix automaton,segment tree with lazy propagation,Fenwick tree,monoid scan / parallel prefix. A named technique is auditable; "a smart approximation" is not.State the trade you are making. Every math-level optimization buys something at a cost. In one line:
- Buys:
space,time,wall-clock,parallelism. - Costs:
accuracy ε=?,code complexity,dependency,non-determinism,numerical stability. - If the cost is invisible to the caller, write "callers see no change".
- Buys:
Justify the asymptotic win. Do not propose a math technique without a one-line bound argument:
- "HyperLogLog: count uniques in O(log log n) bits at standard error 1.04/√m."
- "FFT: polynomial multiplication O(n log n) vs schoolbook O(n²)."
- "JL projection: preserves pairwise distances within (1±ε) using O(log n / ε²) dimensions."
- "Sweep line: rectangle overlap from O(n²) pair checks to O(n log n) events." No bound, no proposal.
Forbid math cargo-culting. Do not introduce these techniques when:
- n is small enough that a linear scan finishes in microseconds (n < ~10⁴ unless it is a hot path).
…
자주 묻는 질문
「알려진 오차를 가진 근사값」은 무엇을 뜻하나요?
답이 100% 정확하지 않을 수 있지만, 오차가 작고 예측 가능하다는 뜻입니다(예: 틀릴 확률이 1%). 이렇게 하면 계산을 훨씬 빠르게 할 수 있습니다.
이 도구를 언제 쓰지 말아야 하나요?
금융 거래처럼 정확도가 매우 중요할 때, 또는 데이터가 적어(1만 개 미만) 간단한 방법으로 이미 잘 작동할 때는 사용하지 마세요.
어떤 기법을 제안할 수 있나요?
문제에 따라 Bloom Filter, HyperLogLog, Count-Min Sketch, MinHash, FFT(고속 푸리에 변환) 등을 제안할 수 있습니다.
상세 정보
작성자의 원본 설명
Math-heavy escalation for n >= 10^6 — Bloom, HyperLogLog, Count-Min, MinHash/LSH, FFT, JL projection, sweep line. Use when classical O(n log n) is the floor and approximate or math wins.
인기도
- GitHub 스타
- 48k
- 순위
- #5180
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
00-andruia-consultant
48k에이전트가 AI 프로젝트를 시작하거나 개선할 수 있도록 코드를 분석하고 스페인어로 실행 계획을 세워 줍니다.
007
48k에이전트가 보안 감사와 위협 모델링을 수행해 공격과 취약점으로부터 프로젝트를 보호하도록 돕습니다.
10-andruia-skill-smith
48k에이전트가 AI 도구의 작동 방식을 정의하고 문서를 쓰며 구조를 검증하도록 돕습니다.
20-andruia-niche-intelligence
48k에이전트가 신뢰할 수 있는 자료를 바탕으로 특정 산업의 맥락, 규칙, 사용 패턴, 위험을 정리한 요약을 만들도록 돕습니다.