SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Objective-Arts/lens-dist --skill algorithms명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | algorithms |
| description | Literate programming |
| allowed-tools | [] |
Donald Knuth's core belief: Programs should be written for humans to read, and only incidentally for machines to execute. Code is literature. Treat it as such.
"Premature optimization is the root of all evil."
The full quote: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%."
Don't optimize until you've measured. But when the 3% matters, optimize with precision.
Knuth invented literate programming with WEB (for Pascal) and CWEB (for C). The idea: write programs as essays that happen to be executable.
Code and documentation are not separate. They are one work, written for a human reader, that happens to also compile.
Traditional approach:
// Calculate factorial
int factorial(int n) {
if (n <= 1) return 1;
return n * factorial(n - 1);
}
Literate approach:
@ The factorial function computes $n!$, the product of all positive
integers up to $n$. We use the recursive definition: $0! = 1$, and
$n! = n \cdot (n-1)!$ for $n > 0$.
This recursive formulation directly mirrors the mathematical definition,
making correctness verification straightforward.
@<Calculate factorial@>=
int factorial(int n) {
if (n <= 1) return 1;
return n * factorial(n - 1);
}
Weaving: Extract the documentation (produces a readable document) Tangling: Extract the code (produces a compilable program)
The source is one file. Two outputs: one for humans, one for machines.
You don't need WEB/CWEB. Apply the principle:
Knuth wrote The Art of Computer Programming to bring mathematical rigor to algorithms.
Don't just know an algorithm works. Know:
For critical code, informal reasoning isn't enough:
Example:
// Precondition: arr is sorted, 0 <= lo <= hi <= len(arr)
// Postcondition: returns index of target, or -1 if not found
// Invariant: if target exists, it's in arr[lo..hi]
int binary_search(int arr[], int lo, int hi, int target) {
while (lo <= hi) {
int mid = lo + (hi - lo) / 2; // Avoids overflow
if (arr[mid] == target) return mid;
if (arr[mid] < target) lo = mid + 1;
else hi = mid - 1;
}
return -1;
}
Knuth famously offers reward checks for errors in TAOCP. Be paranoid about edge cases:
Knuth wrote TeX because existing typesetting was inadequate. Principles from TeX:
TeX development took 10 years. The result: software that's been stable for decades.
"I've spent my whole life trying to get something right. I don't want to waste time getting it almost right."
TeX versions converge to π (3.14159...). Each release adds one digit. The message: asymptotically approaching perfection, never claiming to be there.
TeX has been frozen since 1989. No new features. Bug fixes only. The lesson: done can be better than evolving.
"Beware of bugs in the above code; I have only proved it correct, not tried it."
Even Knuth acknowledges fallibility. Test even when you've proved correctness.
Before committing code, ask:
Apply these checks:
Use a different skill when:
correctness (invariants, weakest preconditions)optimization (profiling, cache behavior)design-patterns (23 classic patterns)java (Effective Java idioms)clarity (readability, naming)Knuth is the algorithmic documentation skill—use it when code should read as literature and algorithms need precise explanation.
"The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly." — Donald Knuth