一键导入
compose-small-helpers
For complex behavior: build from tiny functions, chain transformations, make code read like a pipeline of operations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
For complex behavior: build from tiny functions, chain transformations, make code read like a pipeline of operations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | compose-small-helpers |
| description | For complex behavior: build from tiny functions, chain transformations, make code read like a pipeline of operations. |
Build complex operations from tiny, single-purpose functions.
# Instead of one complex function:
def process(text):
words = text.lower().split()
words = [w for w in words if len(w) > 2]
words = [w for w in words if w not in stopwords]
counts = {}
for w in words:
counts[w] = counts.get(w, 0) + 1
return sorted(counts.items(), key=lambda x: -x[1])[:10]
# Compose small helpers:
def process(text):
return top_n(10, count(remove_stopwords(filter_short(tokenize(text)))))
def tokenize(text):
return text.lower().split()
def filter_short(words, min_len=3):
return [w for w in words if len(w) >= min_len]
def remove_stopwords(words):
return [w for w in words if w not in STOPWORDS]
def count(items):
from collections import Counter
return Counter(items)
def top_n(n, counter):
return counter.most_common(n)
# Spell correction (spell.py)
def correction(word):
return max(candidates(word), key=P)
def candidates(word):
return known([word]) or known(edits1(word)) or known(edits2(word)) or [word]
def known(words):
return set(w for w in words if w in WORDS)
def P(word, N=sum(WORDS.values())):
return WORDS[word] / N
# Each function is tiny but composable!
# Rainfall problem (DocstringFixpoint.ipynb)
def rainfall(numbers):
return mean(non_negative(upto(-999, numbers)))
# Sudoku (sudoku.py)
def solve(grid):
return search(parse_grid(grid))
# Lisp interpreter (lis.py)
def repl():
while True:
print(lispstr(eval(parse(input('> ')))))
# Each layer does one thing, composes naturally
tokenize, count, filter_shortConducts iterative deep research on any topic using web search, progressive exploration, and structured synthesis. Use when asked for comprehensive research, deep investigation, thorough analysis, or multi-source exploration of any topic. Triggers: research, investigate, deep dive, comprehensive analysis, explore thoroughly, find everything about.
For cross-cutting concerns: add behavior without modifying functions, caching, timing, logging, validation wrappers.
For performance work: measure before changing, profile to find bottlenecks, compare before and after.
For symbolic computation: ASTs, mathematical expressions, code that manipulates code structure, expression transformations.
For ordered processing: A* search, Dijkstra, event simulation, task scheduling. Efficient min/max extraction with heap-based queue.
For dynamic programming: overlapping subproblems, recursive solutions with repeated computations, memoization to avoid redundant work.