Skip to content
Back to skills

Ape Explain

ASecurity

Writes or explains a substantial document as one polished, self-contained HTML page (not Markdown). Use when the user wants a page to read or share - a design doc, RFC, ADR or system design drafted from notes or a brief; an explainer of a paper, blog post, spec, codebase, architecture or postmortem; or a guide that helps reviewers read a PR. Puts each point in the medium that carries it (figures for structure and sequence, prose for reasoning, tables and code for exactness), keeps sourced fac...

  • 57 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
documentationpythongobashgitapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add arpitbbhayani/ape-skills --skill ape-explain --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ape Explain?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ape Explain
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/arpitbbhayani-ape-explain/badge)](https://www.skillsdirectory.com/skills/arpitbbhayani-ape-explain)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ape-explain
description: Writes or explains a substantial document as one polished, self-contained HTML page (not Markdown). Use when the user wants a page to read or share - a design doc, RFC, ADR or system design drafted from notes or a brief; an explainer of a paper, blog post, spec, codebase, architecture or postmortem; or a guide that helps reviewers read a PR. Puts each point in the medium that carries it (figures for structure and sequence, prose for reasoning, tables and code for exactness), keeps sourced facts apart from assumptions and unknowns, and publishes to Slashdocs or as an Artifact. Trigger on "ape explain", "/ape-explain", "write a design doc / RFC / ADR", "system design", "migration plan", "PR walkthrough", "explain this PR/paper/blog/spec/postmortem/codebase", "turn these notes into a doc", "write pseudocode". Not for Markdown or plain-text docs, slide decks, or finding bugs in a PR (it guides reviewers, it does not review). Requires the `reference/` directory next to this file.
---

# Explain

Produce **one HTML file** that a smart reader understands on a cold read. It works for documents that teach (explainers) and documents that ask for a decision (design docs).

**Pseudocode only.** If the ask is just pseudocode ("write pseudocode", "sketch this algorithm"), follow `reference/pseudocode.md`, answer in chat with a fenced code block, and skip the rest of this file.

Open with one line that starts "Ape is" and says what you are about to do for this source, for example "Ape is turning the retry PR into a review guide."

## Principles

1. **Right medium for each point.** A figure for what has shape, sequence, quantity or contrast. Paragraphs for reasoning, argument, rationale and nuance. A table for several things compared on the same dimensions. Code for anything exact. Neither figures nor prose is the default: an essay may have one figure or none, a mechanism-heavy post may have ten. A figure that restates the paragraph beside it is decoration; a mechanism told in three paragraphs where a stepper would do under-uses the page.
2. **Shape follows the source.** There is no fixed section list. Choose the structure from what this source is, and never copy another page's headings or order. A short source gets a short page.
3. **Draw the mechanism, not the name.** Show what moves, in what order, and what it triggers. Arrows carry verbs. One idea per figure. Carry one concrete example (one request, one key, one sentence) through every figure and code block, so each continues the last.
4. **State in shape, not colour alone.** Solid, dashed, crossed, hollow. Colour backs it up.
5. **Honest.** Facts trace to a source. Assumptions, proposals, toy models and estimates are said to be so, in plain words, where they are stated. Unknowns are left blank or called not decided. The page carries no label chips for any of this (no "TBD", "assumption", "drafter"); the gaps report in chat lists them. Nothing is invented to make a page look complete: no numbers, owners, dates or benchmarks.
6. **Never claim more than the source.** Each heading, dek and caption is backed by a source sentence. Counts, scope ("every", "all"), completion and causes are the usual overreach. Derived numbers are said to be derived. Your own grouping, naming, counting and inference is not the source: say once that it is this page's.
7. **Prerequisites are first-class.** What a newcomer needs and the source assumes is defined at the point of use: a term links to its glossary entry and shows the definition on hover, and a concept that needs a picture gets a concept card early.
8. **Readable without clicking.** Printed or skimmed, the full story is there. Interaction adds depth; it never holds the only copy of a step or result. A hover card only repeats text that is on the page.
11. **One line of thought.** The page reads in the order a person comes to understand the thing: why it matters, what it is in one concrete case, how it works, what follows from it, what is still open. Each section opens by picking up what the last one left, and anything defined or argued elsewhere on the page is one link away.
9. **Decision first, for documents that ask for one.** A reviewer who reads only the top knows what is being asked. When you explain someone else's piece to a reader who has a decision to make, the author's argument still leads; what it means for the reader's decision comes last and is said to be your reading.
10. **Quiet labels.** The top bar is the only eyebrow: one small-caps line with type, subject and context. No kicker above the title, no label or number above a heading, no tag above a card. Every other label is sentence case. Number only where order is real: steps, phases, a ranked list.

## Pick the type from what you were given

| You were given | Type (`ape-type`) | Recipe in `reference/recipes/` | How to read it |
|---|---|---|---|
| a topic, a system, a codebase, a function | `explainer` | `explainer.md` | search the web, or read the code and cite `path:line` |
| a PR URL or number, a branch, a diff | `pr` | `pr.md` | `gh pr view` and `gh pr diff`, then read changed files in full |
| a paper: arXiv link, PDF, pasted text | `paper` | `paper.md` | Read tool on the PDF in page chunks, or `pdftotext -layout` |
| a blog post, article, docs page, README, spec, RFC, thread | `article` | `article.md` | fetch the page, strip navigation, note author, date, version |
| an incident writeup or postmortem | `postmortem` | `postmortem.md` | fetch it, build the facts ledger |
| rough notes, a ticket, a PRD, "write a design doc / RFC / ADR" | `design` | `design-doc.md` | use what is given; unknowns stay blank |
| a system-design brief, an architecture change, a migration, "explain how this architecture works" | `sysdesign` | `system-design.md` (+ `design-doc.md` when proposing) | requirements and notes as given; existing systems from code or the source's own write-up |
| an existing design doc to explain or review | `article`, with the design-doc page shape | `article.md` + `design-doc.md` | read it all; gaps become open questions |

Infer the type from the input and the verbs ("explain" versus "propose, decide, approve"). A mixed ask ("explain this PR and the design behind it") uses the primary type and borrows a section from the other. Several unrelated inputs get one page each; say which you chose. Ask one consolidated question only when the central decision or subject is missing and the answer would change the page.

**Decide who the reader is** before anything else, from what the user said or from where the page is going: a reviewer who must decide, a teammate new to the system, a newcomer to the field. The reader sets which terms need defining, how deep the mechanism goes and how long the page is. If nothing tells you, assume an engineer outside the team, and say so in the report.

## Reference files

Read the recipe for your type and `components.md` every time. Read the others when the page needs them.

| File in `reference/` | Read it when |
|---|---|
| `recipes/<type>.md` | always: what to extract and the usual ingredients for this type |
| `components.md` | always: markup for every component, plus fonts, colour, spacing and motion |
| `figures.md` | drawing any figure: grammar, vocabulary, architecture levels |
| `patterns/README.md`, then one file in `patterns/` | you are drawing one of: `stepper`, `live` figure, `charts` (bars, dot plot, line via `chart.py`), annotated `code` and diffs, `small-multiples` and wrong-next-to-right, `token-row`, `pipeline`, `sequence`, `tree`, `memory-layout`, `flowchart`, `state-machine`, `timeline`, `schema`, `motion`, `wireframe`, `event-strip` |
| `system-diagrams.md` | any architecture or system diagram: the six components, the lane layout, the `diagram.py` generator |
| `claim-ledger.md` | the page has numbers, results, timestamps or comparisons |
| `pseudocode.md` | showing algorithm or request-path logic that is not real code, or the user asks only for pseudocode |
| `poke-holes.md` | before delivering, every page |
| `cold-reader.md` | before delivering, every page: the brief for an independent reader |
| `writing.md` | before writing, every page: the prose rules with examples |
| `tighten.md` | after writing, on all prose |
| `check-yourself.md` | a teaching page should let the reader test their understanding |

### Examples

Sources live in `reference/examples/*.src.html`. Read the one nearest your task for markup and density, then write your own headings. Read the `.src.html`, never a built page: a built page carries about 200 KB of embedded fonts. To see one rendered, build it to a temp path with `build.py`. The four with a `.ledger.md` beside them show what a claim ledger looks like.

| Example | Type | Shows |
|---|---|---|
| `explainer-gravity-weaker` | explainer | a concept, with prose and figures balanced |
| `simpledb-outage` | postmortem | a causal-chain incident with a live figure; figure-heavy because the source is, not a default density |
| `postmortem-gitlab-database` | postmortem | a decisions incident: tables and prose, two figures, lessons said to be this page's reading |
| `paper-attention` | paper | a paper for a reader outside the field; numbers carried from its tables |
| `explainer-bloom-filter` | explainer | a live figure built on a sourced formula, with snapshots and a checked model |
| `pr-review` | pr | a review guide built from a real commit, short |
| `blog-distributed-locking` | article | a technical argument: the failure drawn once, the fix drawn once |
| `blog-online-migrations` | article | a process post: one stepper carries it |
| `blog-do-things-that-dont-scale` | article | an opinion essay: mostly prose, one figure |
| `rate-limiter-design` | design | a full design doc with status, decision, options, rollout, honest blanks |
| `design-api-key-expiry` | design | a design the reviewer has not seen: a wireframe, a worked example with its cases, who is affected, one choice with an event strip, then the mechanism |
| `sysdesign-notification-service` | sysdesign | designed from a brief; much left open |
| `sysdesign-discord-storage` | sysdesign | a published architecture explained |
| `system-components` | reference sheet | the six system-diagram components |

## Workflow

### 1. Get the material
- **URL:** fetch the exact text, not a summary. WebFetch returns a model-written summary that loses wording and numbers, so use it only to find the right page. Then `curl -sL <url>` and strip tags, for example `python3 -c "import sys,re,html;print(html.unescape(re.sub(r'<(script|style).*?</\\1>|<[^>]+>',' ',sys.stdin.read(),flags=re.S)))"`. The strip keeps site navigation and footers and drops link targets and list numbering, so trim the result to the article body and re-check any list or link you rely on against the raw HTML. For Wikipedia, `?action=raw` gives clean text. If you can only get a summary, say so on the page and in the report.
- **File, pasted text, notes, code:** read all of it.
- **Bare topic:** search the web for 2 to 3 authoritative sources first and cite them.
- Never fill a gap from imagination. Collect the gaps; they are reported at the end.

### 2. Build the ledger (scratch, not on the page)
Before writing, list six things from the source in `<name>.ledger.md`, the file that will sit beside `<name>.src.html`. They decide the sections and they are what the honesty rules are checked against.

- **Claims:** each with its exact number and where it comes from, as the table in `claim-ledger.md`. `verify.sh` checks every number on the page against the table's value column. A page with no numbers needs no table.
- **Terms** a newcomer will not know.
- **Sequence:** what causes what, in order.
- **Decisions** and the reasons given for them.
- **Assumptions** you are making that the source does not state.
- **Unknowns** the reader will ask about and the source does not answer.

### 3. Print the spine
Write it in your reply before you write any HTML, so the plan is visible and can be corrected. Repeat the final version in the report.
```
Reader:   <who this is for and what they already know>
Type:     explainer | postmortem | pr | paper | article | design | sysdesign
Answer:   <one sentence a reader can repeat, or the decision being asked for>
Shape:    <why this source wants this structure; which common ingredients you are skipping and why>
Example:  <the one concrete input carried through the figures and code, or "none: no mechanism to trace">
Sections: <takeaway heading> -> <what carries it: prose | table | code | quote | figure type>
Gaps:     <blanks and assumptions so far>
```
Headings state the takeaway ("Recovery needed the thing that was down"), not the topic ("Deadlock"). Section N+1 answers what N leaves open. Order them as one line of thought: why, the thing in one concrete case, how it works, what follows, what is open. Write the first sentence of each section as the hand-off from the one before ("That is the rule. This is where it runs."), and plan the links: which terms get a glossary entry, and where a later section should point back to an earlier one.

Count the figures against the sections. Most pages want a figure in a third to a half of their sections. Above two thirds, justify each one or cut it; `verify.sh` prints a note above 70 percent. Zero figures is right for an essay or a pure argument.

| The content is | Carry it with |
|---|---|
| a sequence of causes or a request flow | **Stepper** |
| a parameter that decides the outcome | **Live figure** plus frozen snapshots |
| durations | **Timeline** with dimension lines |
| structure, parts, architecture | **Diagram** (system components, boundaries, verbs on arrows) |
| options compared | **Options matrix** (same criteria for every option) |
| a screen a person will use, not built yet | **Wireframe** (layout and content; the caption names the calls behind it) |
| a risk or rule understood only by following events, with and without the fix | **Event strip** (the same three or four events told twice) |
| where a claim comes from, or what was assumed, beside the paragraph | **Margin note** (one or two lines in the gutter) |
| how one rule plays out for different inputs | **Cases table** (who, when, inputs, result, why) on the running example |
| before versus after | **Before/after rows** |
| phases of a plan | **Phases** with exit gates |
| risks | **Risk table** with mitigations |
| a number that matters | **Fact strip** plus a picture of what it measures |
| several measured values | **Chart** from `chart.py`: bars for size, a dot plot for close values, a line for a trend |
| the same thing in several cases | **Small multiples** |
| a common wrong belief | **Wrong picture next to right** |
| the few lines of code that matter | **Annotated code**, or a short **diff** for a change |
| an unfamiliar term | **Term link** with a hover definition and a glossary entry; a **concept card** if it needs a picture |
| something already explained elsewhere on the page | **Link** to its section or figure (the hover card previews it) |
| an argument, opinion or story | prose, a claims table or a short quote; usually no figure |
| a procedure with exact commands | **Code block**, kept verbatim |

### 4. Write
1. Copy `reference/skeleton.html` to `<name>.src.html`. Set `ape-type`. Leave `{{BASE_CSS}}` and `{{RUNTIME_JS}}` untouched. The fact strip and lead figure are commented out: enable them only if the page needs them. Delete every other comment in the skeleton when you are done; they are instructions to you. Keep `<title>` short (it names the tab) and let the H1 state the claim. `<nav class="contents">` becomes a list of your section headings on pages with four or more sections.
2. Fill it with the components in `components.md`. Draw SVG per `figures.md`; generate architecture diagrams with `diagram.py` and charts with `chart.py`. Keep any generator script next to the page so a later edit regenerates the figure.
3. A throwaway script is fine for repetitive SVG. The final file is plain static HTML with authored words in the HTML, not in strings that scripts build. The status line of a live figure is the one exception.

Every page has a top bar line (type · subject · context), an H1 that states the claim, a dek that says why it matters and to whom, and a Sources section that credits and links. Everything else is chosen for this source.

### 5. Build and verify
```bash
python3 <skill>/reference/build.py page.src.html     # writes page.html next to it
bash    <skill>/reference/verify.sh page.html        # must end with OK
```
`verify.sh` prints a note, never a failure, for a `<style>` block of your own and for a status-block value that runs long. It exits non-zero on: a number on the page that is missing from the ledger's value column, marked dropped, or carrying a different unit (when `page.ledger.md` exists); leftover placeholders; missing alt text or captions; eyebrow labels; em or en dashes; literal hex colours; duplicate ids; a stepper with no visible step list; a live figure without its rules and snapshots; unembedded fonts; and more than 4,500 words of prose (6,500 for `design` and `sysdesign`; figure labels are not counted). Over the limit means split the document, not trim the caveats; for a design doc, split it into a decision doc and a linked reference doc as `recipes/design-doc.md` describes. Everything about shape prints as a `note:` for you to judge and is never a failure.

A passing `verify.sh` means the page is well formed. It does not mean the page is right: in test runs it passed pages whose cold read then found wrong statements. The review below is where those are caught.

### 6. Review the page (all four, in this order)
1. **Poke holes.** Run `poke-holes.md`: name 8 to 12 holes a sceptical reviewer would find. Fix what the source answers, surface the rest as risks or open questions, and list what you did not fill.
2. **Tighten.** Run `tighten.md` over all prose. Cut hedges, throat-clearing and restatement; never numbers, caveats or attributions.
3. **Cold read, by someone else.** `python3 -I <skill>/reference/readthrough.py page.html > read.txt` saves what a reader gets without clicking. Give that file, the source and the reader to a fresh subagent with the brief in `cold-reader.md`. It first retells the page in three sentences without the source, then checks it against the source. Compare the retelling with your spine's `Answer`: if they differ, the page did not land, and the first screen is the usual cause. Then fix what the check found. With no subagent available, do both parts yourself and say in the report that the cold read was not independent.
4. **Look.** `bash <skill>/reference/look.sh page.html <outdir>` writes numbered slices for three views: `light-NN.png`, `dark-NN.png` and `phone-NN.png` (a 390px page at the left of a 500px image). Start it while the cold reader is working; the two do not depend on each other.
   - First pass: read every dark and phone slice. Look for clipping, overlap, dead gaps, text under about 12px and anything cut off at the right edge.
   - A stepper shows step 1 only: add `FILM=1` to shoot every step side by side, and read that.
   - After a fix, do not re-read everything: `ONLY=figures` keeps the slices that hold a figure, table, code block or live panel, and `VIEWS=phone` or `VIEWS=dark` limits the view. Check light once at the end with `ONLY=figures VIEWS=light`.
   - A live figure or other interaction: `SCRIPT=move.js` runs your script in the page before shooting (see `patterns/live.md`).
   - On a phone, wide figures and the options matrix scroll sideways, so a phone slice shows their left part; judge the whole figure in the dark view.
   - A page going to Slashdocs: also run `SLASHDOCS=1 VIEWS="mid wide"` and read the slices that hold headings. `mid` is the reader with a comment pane open; `SLASHDOCS=1` adds the `#` link Slashdocs puts in every heading, which must sit in the left gutter beside the first line.
   - If no Chromium-based browser is available, say that the visual check was skipped.

Rebuild and re-verify after every fix. Expect two or more rounds.

### Revising an existing page
Edit the `.src.html`, never the built file, then run steps 5 and 6 again for the parts that changed.

- **Source is gone**, or the page came back from Slashdocs with reviewer edits: `python3 <skill>/reference/unbuild.py page.html` recovers `page.src.html` with the reviewers' words intact.
- **The underlying source changed** (new commits on the PR, a revised paper): re-read it, update the ledger first, then the page. Numbers that moved are the usual casualty; the ledger check catches them.
- **Keep ids stable.** Section and figure ids anchor review comments, so do not rename them when rewording.
- Say in the report what changed and what you left alone.

### 7. Share (optional)
The default output, `page.html`, is a complete single file with fonts, CSS and JS inlined. Publish it only where the user asks.

- **Slashdocs.** Use the `slashdocs` skill and its `slashdocs guidelines`; it owns the commands. What this skill adds: never create at the root (ask for the folder if unknown), figures carry stable ids so reviewers can pin comments, and the reader sets the theme, so the page follows `data-slashdocs-theme` unless the person picks Light or Dark in the page's own theme selector. Slashdocs also adds a `#` link to every heading and slides the page when a comment pane opens; `base.css` already handles both, so do not restyle headings, the page width or the page background (see Look in `components.md`).
- **Artifact tool.** Build a body-only copy with `python3 <skill>/reference/build.py page.src.html out.html --artifact "Short Name"` (a 2 to 4 word title) and publish that. Artifacts start private; say who can open them.
- **Anywhere else** (a repo, a wiki, email): the same `page.html`; say that it is HTML.

### 8. Report
Close with: the output path, the final spine, who you wrote it for, the cold reader's three-sentence retelling, what is sourced versus assumed versus left blank, any review step you skipped, and the **gaps report**: holes you found and did not fill, what the claim ledger dropped or downgraded, and for design docs what was left blank, the assumptions to confirm and the decisions the author must make. The gaps report is a deliverable, not an afterthought.

## Writing

Read `reference/writing.md` before you write; it has the rules with examples. In short:

- Plain words, active voice, present tense. One term per concept. Numbers over adjectives. **No em dashes or en dashes in page text.**
- Prose is a first-class medium: reasoning goes in paragraphs of 2 to 5 sentences, never in bullet fragments. Bullets are for parallel items.
- The dek or first paragraph says why it matters, and to whom.
- Say it in plain words first, then name the term.
- Short sentences that each state one fact, especially around a risk or a rule.
- Headings are full claims with the consequence in them.
- Say what the thing is not, where the wrong guess is likely.
- Restate anything formal in words ("In words: ...") on the running example.
- Name people, things and times in examples, and keep the names for the whole page.
- State what is undecided and unmeasured as plainly as what is decided.
- Analogies map mechanisms, not vocabulary, and say where they break.

## Never

Gradients, shadows, glow, background shapes or tinted bands of your own (the header wash and grey geometry, card lift, section rules and decision tint in `base.css` are the page's only ones, and the inside of a figure stays flat), glassmorphism, emoji or clip-art markers, mascots, violet or fuchsia accents, accent bars on rounded cards, nested cards, numbered topics, centred-everything layouts, fixed or floating elements over content, a TL;DR that restates the dek, takeaways that repeat the body, an empty section heading, a heading reused from an example.

## Before you deliver

`verify.sh` covers the mechanical rules. These it cannot check:

- [ ] The first screen says what this is and why it matters, at the depth the stated reader needs
- [ ] Headings are takeaways, specific to this source
- [ ] Every figure shows shape, sequence, quantity or contrast that prose could not; reasoning is in paragraphs, not bullets or labels
- [ ] Every number is sourced, derived or proposed; assumptions are said in a sentence; unknowns are blank or "not decided"; no tag or chip such as TBD, assumption or drafter is on the page
- [ ] Architecture diagrams use the system components, not plain boxes
- [ ] A design doc shows the thing in use (worked example, cases, screens) before it explains the mechanism, and every choice states its cost
- [ ] One concrete example runs through the figures and code, where there is a mechanism to trace
- [ ] Everything that is your inference, grouping or count is said to be yours, not presented as the source's
- [ ] Holes poked, prose tightened, screenshot slices read, every stepper checked with `FILM=1`
- [ ] The cold reader's retelling matches the spine's Answer, and its findings are fixed or listed
- [ ] Gaps report delivered

Files in this skill

  • SKILL.md21.7 KB
  • evals/README.md2.9 KB
  • evals/baseline/RESULTS.md4.2 KB
  • evals/baseline/design/page.ledger.md912 B
  • evals/baseline/design/page.src.html33.2 KB
  • evals/baseline/essay/page.ledger.md2.8 KB
  • evals/baseline/essay/page.src.html14.4 KB
  • evals/baseline/live/page.ledger.md7.5 KB
  • evals/baseline/live/page.src.html53.1 KB
  • evals/baseline/paper/page.ledger.md8.5 KB
  • evals/baseline/paper/page.src.html44.7 KB
  • evals/baseline/postmortem/page.ledger.md3.5 KB
  • evals/baseline/postmortem/page.src.html29.7 KB
  • evals/baseline/pr/page.ledger.md5.7 KB
  • evals/baseline/pr/page.src.html33.8 KB
  • evals/inputs/design-brief.md1.4 KB
  • reference/base.css33.9 KB
  • reference/build.py4.7 KB
  • reference/chart.py10 KB
  • reference/check-yourself.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in documentation →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.