lathe

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Lathe

Generate hands-on technical tutorials on demand, then read them in your browser with verified working code.

Lathe targets topics where good documentation is scarce — "build a digital synth in Zig", "build a 3D slicer from scratch", "build a database from scratch in Go". You get an expert guide that walks you through the work step by step, with each checkpoint independently runnable. Tutorials are generated by a Claude Code skill, then stored, served, and verified by a Go CLI.

How it works

Two layers with a clean boundary:

  • Claude Code skills — generate and work with tutorials, all run in your interactive Claude Code session: /lathe writes part-01.md, /lathe-extend adds the next part, /lathe-verify works through a tutorial to confirm it compiles and runs, /lathe-ask answers questions about a part you're reading, and /lathe-tag adds search tags to existing tutorials. Running them interactively keeps the work on your Claude subscription (headless claude -p is metered as of 2026-06-15; interactive use is not).
  • lathe CLI (Go) — copies tutorials into ~/.lathe/tutorials/, serves the rendered output at http://localhost:4242, and owns all durable state. It never calls claude itself: the web buttons and the lathe verify/lathe extend commands just hand you the skill command to paste into your session, and the skills call back into the CLI (lathe store, lathe verify-result, lathe extend-start/extend-commit, lathe voice add) to record results — and read the active writing voice via lathe voice show.
User: /lathe "build a digital synth in Zig"     (interactive Claude Code)
        │
        ▼
  [/lathe skill]                     generates part-01.md
        │
        ▼  lathe store /tmp/lathe-<slug>
  [lathe CLI]                        copies files (status: unverified)
        │
        ├── ~/.lathe/tutorials/<slug>/
        │       metadata.json        status: unverified
        │       part-01.md, part-02.md, …
        │
        └── lathe serve → "Verify"/"Add Part"/"Ask" buttons hand you a command
                │
                ▼  paste into your session: /lathe-verify <slug>
            [/lathe-verify skill, interactively]
                works through each step, runs every checkpoint command, then
                `lathe verify-result` updates metadata: verifying → verified | failed | skipped

User: lathe serve  →  http://localhost:4242  (browser opens automatically)

Install

Lathe is a single self-contained binary. All you need is lathe on your $PATH; the skills run in an interactive Claude Code (or Cursor) session — the binary never spawns claude itself.

Homebrew (macOS, recommended):

brew install devenjarvis/tap/lathe

Distributed as a cask (a pre-built binary), so it's macOS-only — on Linux use the install script or go install below.

Install script (curl | sh):

curl -sSf https://raw.githubusercontent.com/devenjarvis/lathe/main/install.sh | sh

Go (needs Go 1.25+):

go install github.com/devenjarvis/lathe@latest

From source:

git clone https://github.com/devenjarvis/lathe
cd lathe
go build -o lathe
Install the skills

The skills are bundled into the binary. After installing lathe, drop them into a project so Claude Code (or Cursor / Codex) can discover them:

lathe skills install                 # ./.claude/skills/<name>/SKILL.md (this project)
lathe skills install --user          # ~/.claude/skills/<name>/SKILL.md (all projects)
lathe skills install --agent cursor  # ./.cursor/commands/<slug>.md (Cursor slash commands)
lathe skills install --agent codex   # ./.agents/skills/<name>/SKILL.md (Codex Agent Skills)
lathe skills install --agent all     # Claude Code, Cursor, and Codex
lathe skills list                    # show the bundled skills

Codex uses the same SKILL.md format as Claude Code, so its skills ship verbatim (and --user installs to ~/.agents/skills/...). Cursor commands are slash-invoked as /<slug> (e.g. /lathe); the interactive handoff model is documented for Claude Code, so a few runtime details differ on Cursor and Codex.

Usage

Generate a tutorial inside any Claude Code session:

/lathe build a digital synth in Zig

Then open it:

lathe serve              # starts the web server, opens the browser

Other commands:

lathe list               # show all stored tutorials with status badges
lathe open <slug>        # open a specific tutorial (requires lathe serve)
lathe store <path>       # save a tutorial directory manually (status: unverified)
lathe store <path> --tag rust --tag audio   # save with search tags
lathe store <path> --verify   # save, then print the /lathe-verify command to run
lathe verify <slug>      # print the /lathe-verify <slug> command to run in your session
lathe extend <slug>      # print the /lathe-extend <slug> command to run in your session
lathe tag <slug> --set rust,audio   # set/--add/--remove a tutorial's tags
lathe voice list         # show available writing voices (built-in + custom)
lathe voice show [name]  # print a voice's spec (default voice if no name)
lathe rm <slug>          # delete a stored tutorial (prompts unless --force)

You can also delete tutorials from the web UI — each row on the list page has a × button that removes the tutorial after a confirmation.

Writing voices

Every tutorial is written in a voice — a tone/register preset. A voice controls how the prose sounds; it can never change accuracy, research, citation, verification, or structure, which are fixed. Two voices ship built in:

  • plainspoken (the default) — honest and precise, with no invented persona or fabricated first-person war stories. It's written to avoid anthropomorphizing the LLM that produced it.
  • companion — the original warm, wry, first-person "friend at the keyboard".

Pick one per run by naming it in your /lathe invocation ("…in the companion voice"), or change the global default:

lathe voice list                     # see what's available; * marks the default
lathe voice show companion           # print a voice's full spec
lathe voice set-default companion    # change the default for new tutorials

Custom voices. Author your own with /lathe-voice in a Claude Code session — it interviews you about register, person, and humor, drafts a spec, and (on your approval) saves it via lathe voice add <name> --file - into ~/.lathe/voices/. You can also add one from a file directly:

lathe voice add field-notes --file ./my-voice.md   # or --file - for stdin
lathe voice rm field-notes                          # remove a custom voice

Custom voices can't impersonate a real named person, fabricate credentials, or deny LLM authorship — /lathe-voice refuses those, and every voice is wrapped with a fixed preamble enforcing the same at generation time. The voice a tutorial was written in is recorded on it (so /lathe-extend continues in it) and disclosed in the reading page's footer alongside the LLM-authorship note.

Finding tutorials

As your library grows, the web list page (lathe serve) has a search box and filters to narrow it down — all client-side, so it stays fast and offline:

  • Search matches a tutorial's title, slug, topic, and tags.
  • Sort by newest, oldest, or title (A–Z).
  • Filter by status, by type (single vs. series), and by tag — each tutorial's tags also show as pills on its card.

Tags come from the tags field in metadata.json. New tutorials get them when /lathe passes --tag to lathe store; for tutorials made before tagging existed, run /lathe-tag <slug> in your session (or /lathe-tag to backfill every untagged one) — the skill reads the tutorial and records tags via lathe tag. Untagged tutorials still show up and stay searchable by title/topic.

Default port is 4242; override with --port.

Storage layout

Tutorials live globally in ~/.lathe/tutorials/, one directory per slug:

~/.lathe/tutorials/
  digital-synth-zig/
    metadata.json
    part-01.md
    part-02.md
    part-03.md
  database-from-scratch-go/
    metadata.json
    index.md

metadata.json:

{
  "slug": "digital-synth-zig",
  "title": "Build a Digital Synth in Zig",
  "topic": "build a digital synth in Zig",
  "created": "2026-05-03T19:00:00Z",
  "status": "unverified",
  "tags": ["zig", "audio", "dsp"],
  "parts": ["part-01.md", "part-02.md", "part-03.md"]
}

Status is one of unverified (the default after lathe store; renders no badge), verifying, verified, failed, or skipped. On failure, a verify-result.json is written alongside with the failed part, step number, and error output; the web UI renders it as a panel on the tutorial page.

Verification

Verification is opt-in and runs in your interactive Claude Code session. Storing a tutorial leaves it unverified — nothing runs until you ask. The lathe verify <slug> command, the --verify flag on lathe store, and the Verify this tutorial button in the web UI all just hand you the same command to paste into your session:

/lathe-verify <slug>

The /lathe-verify skill works through every step in the tutorial — creating files in a fresh mktemp -d scratch dir (never your repo), running commands, executing each ## Checkpoint block — then calls lathe verify-result to record the outcome in the tutorial's metadata.json. It marks the run verifying when it starts and a terminal verified / failed / skipped when it finishes; while a run is in flight the web page auto-refreshes every 5s, so the badge moves ⏳ → ✅ / ❌ / ⚠️ on its own.

Verification only makes sense where the tutorial's toolchain is installed. If a required tool is missing (e.g. no zig binary), the run is reported as skipped (⚠️) rather than failed — "couldn't verify here" is not the same as "broken."

Because verification now runs in your own interactive session, it executes under your normal Claude Code permission model — you see and approve the tool calls. The scratch-dir convention keeps build artifacts out of your repo, but treat it as soft isolation, not a security boundary.

Dependencies

  • spf13/cobra — CLI command structure
  • yuin/goldmark + goldmark-highlighting — markdown rendering with Chroma syntax highlighting
  • claude CLI — Claude Code, where the /lathe, /lathe-verify, /lathe-extend, /lathe-ask, and /lathe-tag skills run

Repository layout

cmd/                CLI commands (root, list, open, rm, serve, store, verify, extend,
                    verify-result, extend-start, extend-commit, tag, voice)
internal/config/    ~/.lathe paths (tutorials, voices) + config.json (default voice)
internal/store/     copy + metadata read/write, slug detection
internal/serve/     HTTP server, markdown renderer, embedded HTML templates, handoff endpoints
internal/voice/     embedded voice presets + custom-voice management + guardrail preamble
internal/frontmatter/ shared name:/description: frontmatter scanner
internal/extend/    NextPartFilename helper
.claude/skills/     lathe, lathe-verify, lathe-extend, lathe-ask, lathe-tag, lathe-voice skills (user-invoked, interactive)
internal/skills/    embedded copies of those skills (data/) + the skills install/catalog logic
internal/buildinfo/ version/commit/date stamped into the binary at build time
docs/superpowers/   design spec and bootstrap plan
main.go             cobra entrypoint

Releasing

Releases are cut by pushing a semver tag:

git tag v0.1.0
git push origin v0.1.0

The release workflow runs GoReleaser (config in .goreleaser.yaml): it builds darwin/linux × amd64/arm64 binaries, publishes a GitHub Release with checksums and a generated changelog, and updates the Homebrew cask in devenjarvis/homebrew-tap. The tap update needs a HOMEBREW_TAP_GITHUB_TOKEN repo secret (a PAT with contents:write on the tap repo).

Dry-run locally without tagging:

goreleaser check
goreleaser release --snapshot --clean

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd/list.go
cmd/list.go
internal
buildinfo
Package buildinfo carries the version metadata stamped into the lathe binary.
Package buildinfo carries the version metadata stamped into the lathe binary.
frontmatter
Package frontmatter parses the tiny leading YAML frontmatter block the Lathe skills and voice specs share: a "---"-delimited fence carrying only scalar name: and description: keys.
Package frontmatter parses the tiny leading YAML frontmatter block the Lathe skills and voice specs share: a "---"-delimited fence carrying only scalar name: and description: keys.
skills
Package skills bundles the Lathe Claude Code skills into the binary so `lathe skills install` can write them out with no repo clone.
Package skills bundles the Lathe Claude Code skills into the binary so `lathe skills install` can write them out with no repo clone.
voice
Package voice owns the selectable writing voices for generated tutorials.
Package voice owns the selectable writing voices for generated tutorials.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL