Code Graph Mermaid Diagrams
trailofbits/skills
Generates Mermaid diagrams from Trailmark code graphs, including call graphs, class hierarchies, module dependency maps, complexity heatmaps and attack surface data flows.
Patterns for writing technical book chapters in Markdown with Mermaid diagrams, served via ProperDocs (a MkDocs fork).
$ npx skills add aospbooks/aosp-internal-book --skill book-writer -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install aospbooks/aosp-internal-book book-writer --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/aospbooks/aosp-internal-book.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/book-writer .claude/skills/book-writer && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "book-writer" agent skill from https://github.com/aospbooks/aosp-internal-book/tree/main/.claude/skills/book-writer into .claude/skills/book-writer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "book-writer", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/aospbooks/aosp-internal-book/tree/main/.claude/skills/book-writerType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add aospbooks/aosp-internal-book --skill book-writer -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install aospbooks/aosp-internal-book book-writer --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aospbooks/aosp-internal-book.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/book-writer .agents/skills/book-writer && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "book-writer" agent skill from https://github.com/aospbooks/aosp-internal-book/tree/main/.claude/skills/book-writer into .agents/skills/book-writer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "book-writer", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add aospbooks/aosp-internal-book --skill book-writer -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install aospbooks/aosp-internal-book book-writer --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aospbooks/aosp-internal-book.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/book-writer .cursor/skills/book-writer && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "book-writer" agent skill from https://github.com/aospbooks/aosp-internal-book/tree/main/.claude/skills/book-writer into .cursor/skills/book-writer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "book-writer", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/aospbooks/aosp-internal-book.git --path .claude/skills/book-writer--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add aospbooks/aosp-internal-book --skill book-writer -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install aospbooks/aosp-internal-book book-writer --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aospbooks/aosp-internal-book.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/book-writer .gemini/skills/book-writer && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "book-writer" agent skill from https://github.com/aospbooks/aosp-internal-book/tree/main/.claude/skills/book-writer into .gemini/skills/book-writer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "book-writer", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install aospbooks/aosp-internal-book book-writerInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add aospbooks/aosp-internal-book --skill book-writer -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/aospbooks/aosp-internal-book.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/book-writer .github/skills/book-writer && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "book-writer" agent skill from https://github.com/aospbooks/aosp-internal-book/tree/main/.claude/skills/book-writer into .github/skills/book-writer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "book-writer", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add aospbooks/aosp-internal-book --skill book-writer -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install aospbooks/aosp-internal-book book-writer --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aospbooks/aosp-internal-book.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/book-writer .opencode/skills/book-writer && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "book-writer" agent skill from https://github.com/aospbooks/aosp-internal-book/tree/main/.claude/skills/book-writer into .opencode/skills/book-writer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "book-writer", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
book-writerPatterns for writing technical book chapters in Markdown with Mermaid diagrams, served via ProperDocs (a MkDocs fork).
Book Writer is an agent skill from aospbooks/aosp-internal-book. Patterns for writing technical book chapters in Markdown with Mermaid diagrams, served via ProperDocs (a MkDocs fork). Use this skill whenever writing, editing, reviewing, adding, removing, or renaming book chapters, organizing multi-chapter content, fixing Mermaid rendering issues, or changing the book's structure. Also triggers when updating properdocs.yml, docs/ symlinks, or navigation — even if the user just says "add a chapter" or "reorganize sections" without mentioning MkDocs.
Its SKILL.md is about 3.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/mermaid-syntax.md`).
It sits in Development, covering Diagrams. It works with Mermaid and Python. The repository describes itself as: The book introduces the internal of AOSP. The licence is Apache-2.0.
6 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit fc0b48b. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
python3From the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
aospbooks.github.ioFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Book Writer loads about 3.1k tokens when it runs, and up to ~4.2k if it reads all its reference files. Until then it costs about 125 tokens; SKILL.md has 1,428 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from aospbooks/aosp-internal-book at commit fc0b48b, republished under its Apache-2.0 licence (© aospbooks). 1,428 words, ~3,091 tokens.
.claude/skills/book-writer/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.Write source-code-referenced technical books in Markdown with Mermaid diagrams, served as a ProperDocs website. Covers chapter structure, content flow, diagram syntax, and keeping the ProperDocs site in sync with content changes.
The book is served via ProperDocs (a MkDocs fork) with the Material theme. When chapter content changes, the site configuration must stay in sync. Forgetting this breaks navigation or hides new chapters from readers.
NN-slug.md with the chapter template belowproperdocs.yml in the correct Part section:- "N. Chapter Title": NN-slug.mddocs/:ln -sf "../NN-slug.md" "docs/NN-slug.md"llms.txt in the correct Part section, in chapter order:- [Chapter N: Title](https://aospbooks.github.io/aosp-internal-book/NN-slug/): one-line description of what the chapter coversproperdocs.yml entries and llms.txt URLs tooagents/_content/manifest.toml under the right Part (and create a new Part entry there + agents/_content/parts/<slug>/SKILL.md if the chapter belongs to a brand-new Part), then run python3 agents/build.py and commit the regenerated agents/<platform>/ trees..md fileproperdocs.yml navdocs/llms.txt entryproperdocs.yml, llms.txt, and section headings inside the files)agents/_content/manifest.toml, then run python3 agents/build.py and commit the regenerated agents/<platform>/ trees..md fileproperdocs.yml nav entry (both the label and the filename)docs/ symlinkllms.txt entry (label, URL slug, and the one-line description if scope changed)## N.x section headings inside the file to match the new chapter numberagents/_content/manifest.toml (and the relevant Part's SKILL.md description if scope shifted), then run python3 agents/build.py and commit the regenerated agents/<platform>/ trees.The nav groups chapters into Parts. Each Part is a collapsible section in the sidebar:
nav:
- Introduction: index.md
- "Part I: Getting Started":
- "Frontmatter": 00-frontmatter.md
- "1. Introduction": 01-introduction.md
- "Part II: Kernel & Boot":
- "4. Boot and Init": 04-boot-and-init.mdThe label format is "N. Short Title": NN-slug.md. Keep labels short — they appear in the sidebar.
ProperDocs reads from docs/ which contains symlinks to the actual chapter files in the repo root. This indirection exists because ProperDocs requires docs_dir to be a child directory, but chapters live at the repo root for simplicity.
When creating symlinks, always use relative paths (../filename.md) so they work regardless of absolute path. Also symlink any static assets the chapters reference.
Use this template for every chapter:
# Chapter N: Title
> *Optional opening quote*
Introduction paragraph (no heading).
---
## N.1 First Major Section
### N.1.1 Subsection
## N.X Try It
Hands-on exercises with real commands.
## Summary
Key takeaways as bullets.
### Key Source Files
| File | Purpose |Example:
# Chapter 9: Binder IPC
> *"Binder is the heart of Android's inter-process communication."*
Android's IPC mechanism enables type-safe, identity-aware communication...
---
## 9.1 Why Binder?
### 9.1.1 One-Copy Semantics
## 9.7 Try It
- Run `adb shell service list` to see all registered Binder services
## Summary
- Binder provides one-copy IPC with caller identityReference real source code. Every architectural claim should point to a specific file and line — this is what makes the book valuable beyond a generic overview.
// Source: frameworks/base/services/core/.../PowerManagerService.java:202
private static final int DIRTY_WAKE_LOCKS = 1 << 0;Match code block language to source file extension. AOSP has Go code (.go files in build/soong/) alongside Java. Use ```go for Go code, ```java for Java — never mark Go as Java. Key tells: Go uses :=, func (c *config), []string{}, no semicolons. Java uses ; line endings, public class, @Override.
// Source: build/soong/android/config.go:2402
func (c *config) UseHostMusl() bool {
return Bool(c.productVariables.HostMusl)
}Use manual section numbers matching the chapter (## 5.1 for chapter 5). ProperDocs doesn't auto-number, and if you ever generate PDF, Pandoc's auto-numbering doubles manual numbers.
Title format: # Chapter N: Title with colon separator. Not --, not — (em-dash) — those slip in from autocomplete and routine editing and have to be fixed in audit passes.
End every chapter with "Try It" (hands-on exercises) immediately followed by "Summary" (key takeaways). Summary is the last ## section, full stop. Don't append more sections after Summary — not "Appendix", not "Deep Dive", not a new feature you forgot about. If you have extra material, fold it into a numbered section before Try It, or extract it into the standalone appendix file. Reviewers found this drift in 5+ chapters during a single audit pass; it always starts as "just one more section" and degrades the chapter shape.
Watch for duplicate section numbers when inserting new content. Adding a new ## 9.10 between existing sections requires renumbering everything that follows — or you end up with two ## 9.11 headings later in the chapter (real bug found in chapter 9). Skim the full heading sequence after any insertion.
Bottom-to-top for system books — each layer builds on the one below:
Build system → Kernel/boot → Native foundation → HAL → Native services → Runtime → Framework core → Framework features → Connectivity → Security → UI → Apps → Infrastructure → Device support → Practical guide
Place a descriptive heading before every mermaid block — it helps readers navigate and becomes the figure caption if you ever generate PDF.
For syntax rules (quoting, special characters, parse errors), read references/mermaid-syntax.md. The short version: quote any node label containing (), <br/>, or |.
Parse-clean is not enough. Mermaid will happily render a diagram with text overflowing its rectangle, nodes overlapping, or arrows crossing into illegibility — and it will also render diagrams that are syntactically valid but factually wrong about the architecture (missing components, reversed arrow direction, made-up relationships). The build pipeline doesn't catch any of that.
After writing or editing any mermaid block, render it to PNG and look at the result:
./serve.sh png NN-slug.md # one chapter
./serve.sh png --all # every chapter (slow)PNGs land in .mermaid-png/<slug>/NN-<sha16>.png (one file per block, indexed in chapter order). The wrapper runs tools/render_mermaid_png.py inside the book-serve Docker image, reusing the same Playwright + Chromium that the SVG cache already uses. PNGs are content-addressed by the same hash as the SVG cache, so reruns skip unchanged diagrams.
The script also refreshes .mermaid-cache/<sha16>.svg for any block whose hash isn't there yet — that's the same cache the pdf/epub plugins read, so editing a diagram and running ./serve.sh png leaves the next serve.sh pdf or serve.sh epub build with full cache hits and no Mermaid re-render. One command keeps both caches in sync.
What to check on each PNG:
<br/> breaks (in quoted node labels — never in transition labels).system_server boxes only contain things that live in system_server). No invented relationships.Don't ship a chapter without re-rendering the diagrams you touched.
For 20+ chapters, launch 5 agents per batch. Review after each batch — then update properdocs.yml nav and docs/ symlinks for all new chapters before starting the next batch.
Markdown lists silently break when you forget the blank line before them — they render as inline text instead of a proper list. This is the single most common formatting issue in the book (we fixed 1,268 instances).
Always leave a blank line before any numbered or bullet list:
BAD — renders on one line:
Services are started in four phases:
1. Bootstrap services
2. Core services
GOOD — renders as proper list:
Services are started in four phases:
1. Bootstrap services
2. Core servicesMatch counts to list items. If you write "three phases:" make sure exactly three items follow. Readers notice when the prose says "three" but the list has four items — it undermines trust in the technical accuracy of the entire chapter.
| Do | Don't | Why |
|---|---|---|
| Blank line before every list | List right after text | Renders inline instead of as a list |
| "four phases:" with 4 items | "three phases:" with 4 items | Count mismatch erodes reader trust |
Update properdocs.yml when adding/removing chapters | Add a chapter file without a nav entry | Readers won't find it in the sidebar |
Create docs/ symlink for every new chapter | Forget the symlink | ProperDocs can't serve files outside docs/ |
## 5.1 Title in chapter 5 | ## 3.1 Title (wrong chapter) | Readers use the number to locate content |
# Chapter 5: Title | # Chapter 5 -- Title or # Chapter 5 — Title | Pick :, stick with it (em-dash creeps in from autocomplete) |
Summary as the last ## section | Any section after ## Summary | Readers stop at Summary; trailing sections get lost |
| Heading before each mermaid block | Two mermaid blocks in a row | Each diagram needs its own context |
```go for .go files | ```java for Go code | Wrong syntax highlighting, misleads readers |
NODE["text(stuff)"] | NODE[text(stuff)] | Unquoted parens break Mermaid parser |
Idle --> Running : start | Idle --> Running : start() | Parens in stateDiagram-v2 transition labels are a hard parse error — strip them, don't quote |
subgraph HS["Home Screen"] | subgraph Home Screen | Multi-word subgraph names need explicit IDs |
<br/> in stateDiagram/sequenceDiagram labels | \n in stateDiagram/sequenceDiagram labels | \n renders literally in those contexts (silently); flowchart labels are the exception |
{placeholder} in flowchart labels | <placeholder> in flowchart labels | SVG renderer strips angle-bracket placeholders as HTML tags — text vanishes silently |
| Source path + line number | "The framework does X" | Unverifiable claims undermine the book |
© aospbooks, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file (references) in .claude/skills/book-writer of aospbooks/aosp-internal-book.
Open the folder on GitHubat commit fc0b48b
Book Writer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Book Writer this skillaospbooks/aosp-internal-book | 139 | — | ~3.1k | Automated safety check: Pass | Apache-2.0 | |
| Code Graph Mermaid Diagramstrailofbits/skills | 7.5k | — | ~1.7k | Automated safety check: Pass | CC-BY-SA-4.0 | |
| Design Doc MermaidSpillwaveSolutions/design-doc-mermaid | 176 | 1 repos | ~5.6k | Automated safety check: Pass | None | |
| Markdown Mermaid Writingneflibata-feng/MyArxiv-Agent | 126 | 5 repos | ~3.8k | Automated safety check: Notes | Apache-2.0 | |
| Code To Diagramzebbern/claude-code-guide | 4.7k | — | ~972 | Automated safety check: Pass | MIT | |
| Generate Readmedivar-ir/ai-doc-gen | 767 | — | ~996 | Automated safety check: Pass | MIT |
trailofbits/skills
Generates Mermaid diagrams from Trailmark code graphs, including call graphs, class hierarchies, module dependency maps, complexity heatmaps and attack surface data flows.
SpillwaveSolutions/design-doc-mermaid
Create Mermaid diagrams (flowchart, sequence, class, ER, state, C4, architecture) from text or source code.
neflibata-feng/MyArxiv-Agent
Comprehensive markdown and Mermaid diagram writing skill that establishes text-based diagrams as the DEFAULT documentation standard.
zebbern/claude-code-guide
Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts.
divar-ir/ai-doc-gen
Generate or refresh a comprehensive, professional README.md for a repository, with architecture overview, mermaid and optional C4 diagrams, repository structure, dependencies, and API documentation.
jonathan-vella/apex
UTILITY SKILL — Python diagram generation for Azure architectures, WAF/cost/compliance charts, ERDs, swimlanes, timelines, and wireframes.
aospbooks/aosp-internal-book
Compare two AOSP releases (e.g. An agent skill from aospbooks/aosp-internal-book.
aospbooks/aosp-internal-book
AOSP Part XIV — Device Support. An agent skill from aospbooks/aosp-internal-book.
aospbooks/aosp-internal-book
AOSP Part VI — Framework Core. An agent skill from aospbooks/aosp-internal-book.
aospbooks/aosp-internal-book
AOSP Part VII — Framework Services. An agent skill from aospbooks/aosp-internal-book.
aospbooks/aosp-internal-book
AOSP Part IV — Native Services & Media. An agent skill from aospbooks/aosp-internal-book.
aospbooks/aosp-internal-book
AOSP Part XII — AI & Devices. An agent skill from aospbooks/aosp-internal-book.
Categories
Patterns for writing technical book chapters in Markdown with Mermaid diagrams, served via ProperDocs (a MkDocs fork). Book Writer is an agent skill from aospbooks/aosp-internal-book. Patterns for writing technical book chapters in Markdown with Mermaid diagrams, served via ProperDocs (a MkDocs fork).
Book Writer fits situations like: renaming book chapters; organizing multi-chapter content; fixing Mermaid rendering issues; changing the books structure.
Run `npx skills add aospbooks/aosp-internal-book --skill book-writer -a claude-code`. Or copy the skill folder (.claude/skills/book-writer in aospbooks/aosp-internal-book) into .claude/skills/book-writer in your project. Claude Code loads it when a task matches its description.
Run `npx skills add aospbooks/aosp-internal-book --skill book-writer -a codex`. Or copy the skill folder (.claude/skills/book-writer in aospbooks/aosp-internal-book) into .agents/skills/book-writer in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aospbooks/aosp-internal-book --skill book-writer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/book-writer, .gemini/skills/book-writer, .github/skills/book-writer and .opencode/skills/book-writer in your project.
Going by SKILL.md and its folder, Book Writer needs the command-line tools its instructions call (python3). Our summary lists: Python 3; Docker.
SKILL.md names 1 domain. In commands or code: aospbooks.github.io; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Book Writer is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.1k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Book Writer: Code Graph Mermaid Diagrams (trailofbits/skills, 7.5k stars), Design Doc Mermaid (SpillwaveSolutions/design-doc-mermaid, 176 stars), Markdown Mermaid Writing (neflibata-feng/MyArxiv-Agent, 126 stars) and Code To Diagram (zebbern/claude-code-guide, 4.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
aospbooks (a GitHub organization) maintains it in aospbooks/aosp-internal-book, which has 139 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 5, 2026.
Source: aospbooks/aosp-internal-book on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.