A Claude Code skill that transforms codebases into literate programs.
$ npx -y skills add tlehman/litprog-skill --agent claude-code
A Claude Code skill that transforms codebases into literate programs. These are documents written for human comprehension that also generate the original source code.
Literate programming was invented by Donald Knuth in 1984. Knuth is the author of The Art of Computer Programming, creator of TeX, and winner of the 1974 Turing Award. He introduced literate programming as a paradigm where programs are written as essays for human readers, with code embedded in a narrative.
A literate program produces two outputs:
The key insight: present code in psychological order. That is, the order that makes it easiest to understand, not the order the compiler needs.
SKILL.md).lit.md file.lit.md file weaves prose, Mermaid diagrams, LaTeX math, and syntax-highlighted code into a narrativescripts/tangle.ts) that extracts source files back from the .lit.mdscripts/untangle.ts) that updates the .lit.md when source files are edited directlyscripts/hook-reverse-sync.ts) for automatic reverse-sync in Claude Code/literate-programming on an existing .lit.md just weaves + tangles (idempotent)Copy SKILL.md into your project's .claude/skills/ directory:
git clone https://github.com/tlehman/litprog-skill.git
mkdir -p your-project/.claude/skills/
cp litprog-skill/SKILL.md your-project/.claude/skills/literate-programming.md
Claude Code automatically discovers skills from .claude/skills/ in your project root. After copying, the /literate-programming slash command will be available in any Claude Code session within that project.
Ask Claude to create a literate program from your codebase:
/literate-programming
Claude will analyze your code, determine the best narrative order, and produce a .lit.md file with prose, diagrams, and named code chunks.
If a .lit.md already exists, running /literate-programming will just tangle and weave the existing file without recreating it.
After creation, a PostToolUse hook is configured so that when you edit a source file directly, the changes are automatically synced back into the .lit.md and re-tangled. This keeps the .lit.md as the single source of truth.
The hook does NOT regenerate the PDF on every edit. To regenerate the PDF, run /literate-programming again.
bun run scripts/tangle.ts project.lit.md --output-dir ./src/
This expands all root chunks and writes the source files. Verify by diffing against the original source.
pandoc project.lit.md \
-o project.pdf \
--pdf-engine=xelatex \
--filter mermaid-filter \
--toc \
--number-sections
Prerequisites for weave: pandoc, xelatex, mermaid-filter
For setup instructions, see references/pandoc-setup.md.
litprog-skill is a Claude Code plugin with 1 hand-picked skill, indexed on Flowy in the Documentation category. Install it with the command on its page. It includes litprog-skill. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it