fibonacci-helper
Use when the user asks to optimize, explain, test, or rewrite the Fibonacci function in app.js — or asks about Fibonacci implementations in general (recursive vs iterative vs memoized, time complexity, edge cases).
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- fibonacci-helper
- description
- Use when the user asks to optimize, explain, test, or rewrite the Fibonacci function in app.js — or asks about Fibonacci implementations in general (recursive vs iterative vs memoized, time complexity, edge cases).
02 资源文件 1
- 参考文档REFERENCE.md1.1 KB
03 SKILL.md 正文
Fibonacci helper
This sample skill demonstrates how OpenCode skills work in OpenCode Chat /
Ollama Code. When the model decides this skill is relevant (based on the
description above), it loads this body into context to guide its work.
What this skill knows
The sample workspace's app.js contains a naive recursive fib(n):
function fib(n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
This is O(2ⁿ) — it recomputes the same subproblems exponentially. For any
n above ~35 it becomes painfully slow.
How to help
When asked to improve it, prefer these in order:
- Memoized (top-down) — keep the recursive shape, cache results. O(n).
- Iterative (bottom-up) — a simple loop with two rolling values. O(n) time, O(1) space. This is usually the best default.
- Closed-form (Binet's formula) — O(1) but loses precision for large
n; only suggest it when the user explicitly wants constant time and accepts floating-point limits.
For the full set of ready-to-paste implementations and their trade-offs, read
the bundled REFERENCE.md in this skill's directory.
Guidance
- Always preserve the existing
fibname and call signature unless asked. - Add a brief comment noting the complexity of whatever you write.
- If you change
app.js, verify it still runs (node app.js) when practical.
04 同仓库更多 Skills
codeword
Use when asked for the project codeword. Explains where the codeword lives.
claude-codeword
A Claude Code skill (from .claude/skills) used by the e2e suite to prove Claude Code skills are discovered.
publish
Cut and ship a new versioned release of this VS Code extension — bump the version, write release notes, run a mandatory safety review of what actually gets packaged, then tag so the GitHub Action packages the VSIX and publishes to the Marketplace. Use when asked to publish, release, deploy, ship a new version, or cut a release of this extension.