Skip to content

tejvirmann/token-saving-skills

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token-Saving Skills for OpenCode

Lightweight OpenCode skills that reduce token usage, improve context efficiency, and keep sessions sharp.

Each skill is a single SKILL.md file. Drop it in and use it — no build step, no dependencies.

graphify prerequisite: the graphify skill shells out to the graphify CLI (pip install graphifyy). All other skills are purely prompt-based with zero extra installs.


Skills

Skill Trigger What it does How it saves tokens Source
caveman /caveman Switches the agent to terse, fragment-based output for the session Strips filler, preamble, and trailing summaries — ~75% output reduction JuliusBrussee/caveman · mattpocock/skills
handoff /handoff Compresses the current session into a structured <300 word doc to resume in a new session Eliminates re-reading long conversation history — one doc replaces the entire context window mattpocock/skills · video
graphify /graphify Builds a persistent knowledge graph via AST parsing (graphify CLI, zero LLM tokens). Agent answers structural questions with graphify query/explain/path/affected instead of grepping. Build once — graph persists across sessions. Every follow-up question is an instant local graph lookup at zero LLM cost. safishamsi/graphify (pip install graphifyy)
printing-press /printing-press <name> Scaffolds a minimal agent-native CLI with --json output and typed exit codes One-time cost: the LLM writes the tool once, then deterministic code does the work on every future call — no re-reasoning, just JSON in/out printingpress.dev · mvanhorn/cli-printing-press (upstream skill is named printing-press)
hermes (proposed) /hermes, /hermes super Watches for a workflow that just worked and that the user is happy with, then offers (or in super mode, auto-creates) a new skill for it Turns one-off successful reasoning into a reusable SKILL.md — future sessions invoke the skill directly instead of re-deriving the same steps

How to use each skill

caveman

/caveman          # terse mode on
/caveman ultra    # telegraphic — absolute minimum words
/caveman off      # back to normal

Before: "Sure! I'd be happy to help. Let me take a look at the code. The issue is that the function returns undefined because the async call isn't awaited." After: "Missing await. Add before the async call."


handoff

/handoff

Generates a structured doc: Goal → Where we are → Next step → Key files → Open questions → Context that would be lost. Offers to save as HANDOFF.md. Paste it at the top of your next session.


graphify

Prerequisite: uv tool install graphifyy (or pipx install graphifyy / pip install graphifyy)

/graphify .              # build graph for the full project
/graphify src/auth/      # build graph for a specific directory

Shells out to the graphify CLI — AST parsing, zero LLM tokens during build. Writes three files:

  • graphify-out/GRAPH_REPORT.md — overview: key concepts, connections, suggested questions; read once after building
  • graphify-out/graph.json — full graph, used by the query commands below
  • graphify-out/graph.html — open in any browser for an interactive visualization

The mental model — build once, query forever: Run /graphify . once. The graph is saved to disk and survives session restarts. On every future structural question, the agent runs a CLI lookup against graph.json instead of grepping or reading files — instant, local, zero LLM cost:

  • graphify query "<question>" — natural-language structural question, returns the relevant subgraph
  • graphify explain "<name>" — what a node is and what's connected to it
  • graphify path "<A>" "<B>" — how (or whether) two things are connected
  • graphify affected "<name>" — what depends on / breaks if this changes

Re-run /graphify . only when the codebase changes (the tool handles its own incremental cache — only re-processes files that changed).


printing-press

/printing-press notes                        # interactive scaffolding
/printing-press notes from https://api.example.com/docs   # reverse-engineer from API docs
/printing-press notes --dry-run              # preview plan only

Produces a bash or Python CLI with --help, --json, and typed exit codes so agents can parse output efficiently in future turns.

The mental model — build once, run forever: Normally an agent re-derives the same answer every time you ask (parsing, searching, analysis — tokens spent on reasoning each call). This skill flips that: the LLM is invoked once to write a small deterministic program that does that work. After that, the agent just runs the CLI and reads its --json output — no re-reasoning, no re-explaining, just a fast, cheap, repeatable call. The skill is the blueprint generator; the CLI it produces is the artifact that actually does the work going forward.


hermes (proposed — not yet built)

/hermes          # ask before saving a finished workflow as a skill
/hermes super    # auto-save when warranted, no asking
/hermes off      # disable

After finishing a multi-step task that went well — and the user signals they're happy with it ("perfect", "exactly", moving on without correction) — hermes mode asks: "That worked well — want me to save it as a skill?"

/hermes super skips the question: it creates the skill itself the moment it judges the workflow reusable, but always reports what it added (name, trigger, file path, one-line description) so nothing lands silently.

In either mode, any skill hermes writes follows this repo's format — minimal frontmatter (name + one-line description with trigger), terse rules/workflow, no padding — so new skills stay as efficient as the ones above.


Testing

Each skill gets one cheap, single-purpose test — designed so anyone with OpenCode can run it, see the result for themselves, and be convinced without burning many tokens. No multi-run suites; one comparison or one live invocation is enough to "see the power."

Tests live next to the skills they cover, in skills/tests/<name>/SKILL.md. Results are written to skills/tests/results/<name>.md (generated, gitignored — not committed).

Fastest path — type it and get a self-report

Each skill under test has a paired self-test command — type it into OpenCode's (or Claude Code's) prompt line and the agent first explains in 1-2 sentences what's being measured and where the proof will land, then runs the whole procedure itself, reports a before/after table inline, and saves it to skills/tests/results/<name>.md:

/test-caveman            # runs the A/B itself, reports the word-count delta
/test-handoff            # plants a fake secret, generates the doc, self-checks redaction
/test-graphify           # maps the CURRENT directory — run it from any code repo, not just this one
/test-printing-press     # scaffolds a CLI, then actually executes it and checks --help/--json/exit codes

The full procedures and checklists live in skills/tests/<name>/SKILL.md if you want to verify a step yourself or understand exactly what "convincing" means for each skill.

caveman — automated before/after (skills/tests/caveman/SKILL.md)

Measures word-count reduction across 2 prompts (in-session A/B), or run the standalone script for a multi-session comparison via opencode run (plain vs /caveman <prompt>), no API key needed:

python3 skills/tests/caveman/caveman_test.py

# If your default OpenCode model doesn't support tool use (needed to load skills):
OPENCODE_TEST_MODEL=openrouter/anthropic/claude-sonnet-4.6 python3 skills/tests/caveman/caveman_test.py
[1/2] Explain what a React hook is...
  normal... 283 words
  caveman... 120 words
  saved=58%
...
Total: 549 → 196 words  (64% reduction)

Results saved to skills/tests/results/caveman.md

skills/tests/results/caveman.md contains the full word-count table plus the actual response text for each side — read them side by side and judge for yourself.

handoff — size comparison + checklist (skills/tests/handoff/SKILL.md)

Plant a fake secret in conversation, run /handoff, and measure the generated doc's size against the scenario it replaces (before/after table). Then check: did it save outside the project, redact the secret, and include a "suggested skills" section? Open the doc in a fresh session and confirm it resumes the work with zero re-explaining.

graphify — build + before/after query cost (skills/tests/graphify/SKILL.md)

Run /graphify . in any code repo. Confirm graphify-out/GRAPH_REPORT.md, graph.json, and graph.html were all written. Then run graphify explain/query/path against the saved graph and compare the output size to the source files you'd otherwise have to read/grep — all local, instant, zero LLM cost. Open graph.html in a browser for the visual proof.

printing-press — single invocation + run-it (skills/tests/printing-press/SKILL.md)

Scaffolds a skills-list CLI, then actually executes it: --help, --json (pipe through jq/json.tool to confirm it parses), and exit codes. Also reports a before/after token-cost table and breakeven point. The proof is running and measuring the output, not reading it.


Install

Per-project

mkdir -p .opencode/skills/<skill-name>
cp skills/<skill-name>/SKILL.md .opencode/skills/<skill-name>/SKILL.md

Global

mkdir -p ~/.config/opencode/skills/<skill-name>
cp skills/<skill-name>/SKILL.md ~/.config/opencode/skills/<skill-name>/SKILL.md

Replace <skill-name> with caveman, handoff, graphify, or printing-press.

graphify extra step

After installing the skill file, install the graphify CLI itself (required — the skill shells out to it):

uv tool install graphifyy    # recommended
# or: pipx install graphifyy
# or: pip install graphifyy

Tip: graphify install --platform opencode generates an official SKILL.md with a references/ sidecar for deeper graph queries — use that for production installs instead of the SKILL.md from this repo.

About

Lets save some tokens!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages