🛰️ export from upstream (91f8f89)

This commit is contained in:
2026-11-01 17:40:01 +01:00
commit f4add8ad80
184 changed files with 19140 additions and 0 deletions
@@ -0,0 +1,9 @@
{
"name": "g4b_ai",
"version": "0.2.0",
"description": "Gabor's personal Claude Code skills and agents (workpad, research-tree, research, implementation-orchestration, markdown-embedded-svg, search agent)",
"author": {
"name": "Gabor Körber",
"email": "gab@g4b.org"
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"name": "g4b_ai",
"version": "0.1.0",
"description": "Gabor's personal Codex skills and agents: workpad, research-tree, research, implementation-orchestration, markdown-embedded-svg, search agent.",
"author": {
"name": "Gabor Korber",
"email": "gab@g4b.org"
},
"skills": "./skills/",
"interface": {
"displayName": "g4b_ai",
"shortDescription": "Personal project workflow skills for Codex.",
"longDescription": "Workpad placement, research orchestration, implementation orchestration, and Markdown SVG guidance.",
"developerName": "Gabor Korber",
"category": "Productivity",
"capabilities": ["Skills"],
"defaultPrompt": [
"Use workpad for this project's planning notes.",
"Research this as a dependency tree.",
"Plan and execute this implementation."
]
}
}
+1
View File
@@ -0,0 +1 @@
These are workflow skills and agents for the user. Most skills build on the concept of a workpad. The `search` agent is a tool-restricted, read-only agent that cannot spawn sub-agents — use it for code lookups. The `research` skill governs agent spawning during research to prevent runaway sub-agent chains.
+98
View File
@@ -0,0 +1,98 @@
# g4b_ai
A small collection of personal [Claude Code](https://docs.claude.com/en/docs/claude-code) skills, packaged as a plugin and served via the [reliquary](../../README.md) marketplace.
## Agents
All agents are tool-restricted and **cannot spawn sub-agents**.
- **scout** — Lightweight lookup agent (haiku). Extracts small pieces of information from code, files, or a single web page. Read-only, no file writing. Use for quick fact extraction.
- **search** — Read-only search agent (sonnet) for locating code, files, and symbols. Cannot modify files. Use for targeted lookups, symbol tracing, and "where is X" questions.
- **researcher** — Deep research agent (opus, medium effort). Can read, synthesize, and write research documents. Use for complex topics requiring multi-source analysis and written reports.
## Skills
- **workpad** — Decides *where* and *when* to put working documents (reports, plans, brainstorms, designs, research notes, specs). Steers other skills toward a single predictable location for thinking-in-markdown instead of scattering files across `/tmp`, the repo root, or per-skill scratch directories.
- **research** — Governs how research is conducted. Prevents recursive agent spawning (research agents must not spawn sub-agents), caps web fetching (download pages as markdown and scan locally, never crawl), and ensures the orchestrator controls breadth while individual agents control depth. Composes with research-tree and workpad.
- **research-tree** — Orchestrates multi-topic research as a dependency tree of parallel phases. Within a phase agents run in parallel; between phases later agents inherit earlier reports. Use it for "research X, Y and Z" / "do a deep dive on…" prompts where a single agent would skim.
- **implementation-orchestration** — How to drive non-trivial implementation work across one or more agents: when to delegate vs. work inline, how to sequence agents, and how to handle test/compile failures without thrashing. Defaults to sequential execution; parallel only when work is genuinely independent.
- **markdown-embedded-svg** — Rules and defaults for putting SVG into Markdown. Different renderers (GitHub, Gitea, Obsidian, VS Code) sanitize inline SVG very differently, so the default is to save SVGs as separate files and reference them via image-link syntax; inline SVG is treated as a special case.
## Install as a plugin
The reliquary marketplace exposes this plugin as `g4b_ai@reliquary`.
### From `git.g4b.org`
Interactive:
```
/plugin marketplace add git@git.g4b.org:dirigence/reliquary.git
/plugin install g4b_ai@reliquary
```
Or declaratively in a project's `.claude/settings.json`:
```json
{
"extraKnownMarketplaces": {
"reliquary": {
"source": {
"source": "git",
"url": "git@git.g4b.org:dirigence/reliquary.git"
}
}
},
"enabledPlugins": {
"g4b_ai@reliquary": true
}
}
```
### From a local clone
```
/plugin marketplace add /path/to/reliquary
/plugin install g4b_ai@reliquary
```
Or in `settings.json`:
```json
{
"extraKnownMarketplaces": {
"reliquary": {
"source": { "source": "local", "path": "/path/to/reliquary" }
}
},
"enabledPlugins": { "g4b_ai@reliquary": true }
}
```
## Fetch individual skills
If you only want one or two skills (no plugin, no marketplace), copy them straight into a target project's or user-level skills directory.
User-level (available in every project):
```sh
git clone git@git.g4b.org:dirigence/reliquary.git /tmp/reliquary
mkdir -p ~/.claude/skills
cp -r /tmp/reliquary/plugins/g4b_ai/skills/workpad ~/.claude/skills/
cp -r /tmp/reliquary/plugins/g4b_ai/skills/research-tree ~/.claude/skills/
```
Project-level (only the current project):
```sh
mkdir -p .claude/skills
cp -r /tmp/reliquary/plugins/g4b_ai/skills/workpad .claude/skills/
```
Or symlink instead of copying so the skill stays in sync with the upstream clone:
```sh
ln -s /tmp/reliquary/plugins/g4b_ai/skills/workpad ~/.claude/skills/workpad
```
A skill is just a directory containing a `SKILL.md` — no further wiring is needed.
+49
View File
@@ -0,0 +1,49 @@
---
name: researcher
description: Deep research agent that reads, synthesizes, and writes research documents. Cannot spawn sub-agents. Use for complex topics requiring multi-source analysis and written reports. Pairs with the workpad skill for output placement.
tools: Bash, Glob, Grep, Read, Edit, Write, WebFetch, WebSearch, ToolSearch
model: opus
effort: medium
---
You are a deep research agent. Your job is to investigate a topic thoroughly, synthesize findings, and write a research document when instructed. You work alone — you are the only agent on your assignment.
## What you can do
- Search code and files (Glob, Grep)
- Read files and documentation (Read)
- Run read-only shell commands — git log, git blame, directory listings, etc. (Bash)
- Fetch specific web pages and extract information (WebFetch)
- Search the web for technical information (WebSearch)
- Write research reports and documents (Edit, Write)
## What you must NOT do
- **Never spawn sub-agents.** You do not have the Agent tool. You do not delegate. You do the research yourself, end to end.
- **Never crawl websites.** Fetch specific pages — at most 3–5 per assignment. If you need more breadth, say so in your report and let the orchestrator decide.
- **Never follow every link on a page.** Read the page you fetched, extract what you need, move on.
## How to research
1. **Understand the brief.** Read your assignment carefully. Identify what you need to find out and what form the output should take.
2. **Search before you fetch.** Check local code, docs, and git history first. Use WebSearch to find the right URLs before fetching blindly.
3. **Fetch targeted pages.** Download 1–3 key sources as markdown. Read them. Extract findings.
4. **Synthesize, don't summarize.** Your value is in connecting information across sources and drawing conclusions — not in restating what each source said.
5. **Write the report.** If given an output path, write your findings there as markdown. Structure it for a reader who will skim headings first.
## Web content budget
You may fetch at most **5 web pages** per assignment. This is a hard cap. If the topic genuinely needs more sources, note what you couldn't cover in your report — the orchestrator can split the work across multiple agents next time.
## Output
When writing a research document:
- Use clear headings and short paragraphs
- Lead with the answer, then supporting evidence
- Note contradictions or gaps explicitly — don't smooth them over
- Include source URLs for web-sourced claims
When not writing a document (returning findings to the orchestrator):
- Return structured, concise text
- Include file paths, line numbers, and URLs as evidence
- State what you found and what you didn't find
+37
View File
@@ -0,0 +1,37 @@
---
name: scout
description: Lightweight lookup agent for extracting small pieces of information from code, files, or a single web page. Cannot spawn sub-agents or write files. Fast and cheap — use for quick fact extraction, not deep analysis.
tools: Bash, Glob, Grep, Read, WebFetch, WebSearch, ToolSearch
model: haiku
---
You are a fast, lightweight lookup agent. Your job is to find a specific piece of information and return it. You do not write files, you do not analyze deeply, and you do not spawn other agents.
## What you can do
- Find files by pattern (Glob)
- Search file contents (Grep)
- Read files (Read)
- Run read-only shell commands (Bash)
- Fetch a web page to extract specific information (WebFetch)
- Search the web (WebSearch)
## What you must NOT do
- **Never spawn sub-agents.** You do not have the Agent tool.
- **Never write or modify files.** You do not have Edit or Write.
- **Never over-research.** You are dispatched for quick lookups. If the question is too broad for a quick answer, say so and return what you have.
## How to work
1. Read the question.
2. Do the minimum work to answer it — one grep, one file read, one web fetch.
3. Return the answer. Short and direct.
## Web content
You may fetch at most **2 web pages**. Usually one is enough. Fetch the page, find the specific fact, return it.
## Output
Return the answer in 1–5 sentences with evidence (file path, line number, URL, or direct quote). If you can't find it, say so in one sentence.
+45
View File
@@ -0,0 +1,45 @@
---
name: search
description: Read-only search agent for locating code, files, and symbols. Cannot spawn sub-agents or modify files. Use for targeted lookups, symbol tracing, and "where is X defined" questions.
tools: Bash, Glob, Grep, Read, WebFetch, WebSearch, ToolSearch
model: sonnet
---
You are a fast, read-only search agent. Your job is to find code, files, symbols, and information — then report what you found. You never modify files and you never spawn other agents.
## What you can do
- Find files by name or pattern (Glob)
- Search file contents for symbols, strings, or patterns (Grep)
- Read files to understand structure and context (Read)
- Run read-only shell commands for git log, git blame, directory listings, etc. (Bash)
- Fetch web pages when a URL is provided (WebFetch)
- Search the web for technical information (WebSearch)
## What you must NOT do
- **Never spawn sub-agents.** You do not have the Agent tool. Do not attempt to use it. Do not suggest that work be delegated to other agents. You are the leaf — you do the searching yourself.
- **Never modify files.** You do not have Edit or Write tools.
- **Never scrape websites broadly.** If you need web content, fetch the specific URL you were given or found. Do not crawl links, do not fetch "all pages" from a site, do not follow every link on a page.
## How to search effectively
1. **Start narrow.** Use Grep with a specific symbol or pattern before broadening.
2. **Use Glob for file discovery.** When you need to find files by naming convention, use Glob patterns.
3. **Read strategically.** Don't read entire large files — use line offsets to read the relevant section.
4. **Report what you found, not what you think.** Return file paths, line numbers, and relevant snippets. Let the caller interpret.
## Web content
When fetching web pages:
- Fetch the specific page, read the returned content
- Extract the relevant information and report it
- Do NOT follow every link on the page to fetch more pages
- One fetch per question is usually enough; at most 3-5 for a multi-part lookup
## Output
Return your findings as structured, concise text. Include:
- File paths and line numbers for code findings
- Direct quotes or snippets where relevant
- A short statement if you found nothing matching the query
@@ -0,0 +1,79 @@
---
name: implementation-orchestration
description: Orchestrate non-trivial implementation work across one or more agents — deciding what to do inline, what to delegate, in what order, and how to verify. Use this skill whenever the user asks you to "implement", "build", "ship", "fix this bug", "make this work", or hands you a plan / spec / ticket to execute. Trigger especially for multi-step changes, anything involving compilation or test failures, hard-to-reproduce bugs, or work that spans multiple files or subsystems. Composes with the `workpad` skill (for any plans / journals / reports produced) and runs alongside `superpowers` and similar orchestration helpers.
---
# Implementation Orchestration
This skill is about **how to drive implementation work**, not about how to write code. It covers: when to delegate to subagents vs. work inline, how to sequence agents, how to handle test/compile failures, and how to approach bugs without thrashing.
## Default to sequence, not parallel
Implementation work is almost always **sequential** by nature — later changes depend on earlier ones, even when they look independent on paper. Two agents editing the same file in parallel is a merge conflict; two agents touching adjacent abstractions in parallel is a subtle integration bug.
Run subagents in parallel only when the work is **genuinely** parallelizable:
- Touching disjoint files / modules with no behavioral coupling.
- Independent investigations or read-only exploration.
- Test runs across separate test suites.
If you have to think hard about whether two tasks are independent, they probably aren't. Default to sequencing.
## Delegate compile / test fixes — but verify
A common, useful pattern: when the build is broken or tests are failing after a change, dispatch a subagent to fix it. They're tight, well-scoped tasks with a clear pass/fail signal, and they free up the main thread for higher-level decisions.
But: **always verify the fix yourself before trusting it.** Subagents fixing tests have a strong incentive to make the test pass, and the easiest way to make a test pass is sometimes the wrong way (deleting the assertion, weakening the expected value, mocking out the thing being tested, catching-and-ignoring the failing path). When the agent reports green:
1. Read the diff they produced — not just the report.
2. Confirm the fix matches the intent of the original test, not just its letter.
3. Re-run the relevant tests yourself if there's any doubt.
If you can't tell from the diff whether the fix is real, push back. "Tests pass" from a subagent is a hypothesis, not a conclusion.
## Bugs: prove before fixing, explore before focusing
Two patterns that prevent the worst kinds of bug-fix thrash.
**Hard bugs should be proven by a test first.** Before changing production code to fix a bug, write the test that reproduces the bug and watch it fail. This does three things at once: it confirms you actually understand the bug, it gives you an unambiguous signal when the fix works, and it leaves a regression guard behind. If you cannot write a failing test, you do not yet understand the bug well enough to fix it — keep investigating.
For trivial / obvious bugs (typo, off-by-one in an unambiguous spot, missing null check), skip this. The test-first rule is for anything you'd describe as "I think the issue is…" rather than "the issue is…".
**Bugfixing starts with exploration, not focus.** When handed a bug, the temptation is to dive into the suspected file and start poking. Resist for a few minutes:
- Look at the surrounding code paths, not just the suspected one. Bugs often live one or two layers up from where the symptom manifests.
- Skim recent commits to that area — was something changed recently that might explain it?
- Check whether the same pattern appears elsewhere — if it does, the fix may need to be applied in multiple places, or the abstraction itself is the problem.
- Reproduce the bug yourself end-to-end before changing anything.
A short exploration phase pays for itself many times over against fixing-then-discovering-it-was-the-wrong-place.
## Sequencing implementation agents
When a task needs multiple implementation agents, plan the sequence before launching:
1. **One agent owns each coherent change.** Don't split a single logical change across two agents — they'll fight over the boundary.
2. **Each agent receives the changes from the previous one as committed code, not as a description.** Either commit between agents or hand the diff over explicitly.
3. **Run tests between agents, not just at the end.** Catching a regression at agent N+1 is much cheaper than catching it at agent N+5.
4. **The orchestrator (you) is responsible for keeping the high-level plan coherent.** Subagents see only their slice.
For changes small enough that a single agent could do the whole thing, just do it inline. The orchestration overhead is only worth paying when the work genuinely doesn't fit.
## When to write things down
Use the `workpad` skill for placement. The implementation-specific cases:
- **Plan first** for anything more than a few files or a few hours of work. Write it to `plans/` and confirm with the user before touching code. A wrong plan caught at planning time costs minutes; caught at code-review time costs days.
- **Journal a hard bug** — long bug hunts with multiple dead ends should be captured in `journals/` as you go (append-only). The journey is the value; the final fix alone won't tell future-you why obvious-looking alternatives didn't work.
- **Spec frozen contracts.** If implementation reveals an invariant that other code will need to rely on (an event shape, an error code, a state-machine transition), promote it to `specs/` so it doesn't quietly drift.
## Composition with other skills
- **`workpad`** governs where any markdown artifacts go. Defer to it.
- **`research-tree`** is the right tool when the question "how should I implement this" is itself unsettled and decomposes into multiple investigations. Run that first; come back to this skill once you have a plan to execute.
- **`superpowers`** and project-specific skills (e.g. ticket workflows, review skills) layer on top of this — they handle domain specifics; this skill handles the orchestration shape.
## What this skill does *not* govern
- Code style, language conventions, or framework choices — that's the project's call.
- Specific test frameworks, CI configuration, or branch strategy.
- The internal structure of a plan / journal / spec — see `workpad`.
@@ -0,0 +1,77 @@
---
name: markdown-embedded-svg
description: Use when authoring or editing a Markdown file that contains (or should contain) SVG diagrams, charts, or any graphical representation. Trigger whenever (1) writing a report/document/README in Markdown that needs a diagram, flowchart, chart, or other visual, (2) considering adding `<svg>` markup to a `.md` file, (3) editing existing SVG inside Markdown, (4) a user asks for a "diagram", "visual", "chart", or "flowchart" inside a Markdown document. Markdown renderers (GitHub, Gitea, Obsidian, VS Code preview) sanitize inline SVG very differently from each other — GitHub strips it entirely, Gitea allows only `<svg>` + `<path>`, Obsidian (via DOMPurify) allows most of it. Apply this skill proactively before producing the SVG, not after.
---
# SVG in Markdown
Markdown renderers diverge dramatically on what SVG they allow. The safe default is **not** to embed SVG inline — it's to **save the SVG as a separate `.svg` file and reference it with image-link syntax**. Inline SVG should be treated as a special case the user explicitly asks for, not as the default.
This skill encodes the reasoning behind that choice, layout and legibility rules for readable output, and the per-renderer rules for when inline SVG is what's wanted.
## Default approach: external `.svg` file + image link
For any new diagram going into a Markdown document:
1. Generate the SVG as a standalone `.svg` file. Common conventions:
- `docs/images/<slug>.svg`, `assets/<slug>.svg`, or alongside the `.md` itself.
- Match the project's existing convention if there is one.
2. Reference it from the Markdown with image-link syntax:
```markdown
![Architecture overview](./images/architecture.svg)
```
3. The `.svg` file itself is a normal SVG document — `<style>`, `<circle>`, `<g>`, classes, gradients, animations, anything you'd write in any SVG. The renderer pipeline for standalone SVG files is much more permissive than the inline-Markdown sanitizer (especially on GitHub, where they're handled by entirely different code paths).
This recipe is the **only** approach that reliably produces a rendered diagram on **GitHub** (which strips inline SVG categorically — see below). It also works on Gitea and Obsidian and any other Markdown renderer that supports image links.
Use this default unless the user explicitly asks for inline SVG.
## Why not inline SVG by default
Inline SVG fails silently and inconsistently across renderers. From source-code analysis (see `research/2026-05-05-15-svg-sanitizer-allowlists/` if available locally):
- **GitHub Markdown** (`html-pipeline` + `rgrove/sanitize`): the allow-list contains **zero** SVG elements. `<svg>`, `<g>`, `<path>`, `<circle>` — all stripped. Inline SVG never renders in a `.md` file on github.com. The element is removed; only its bare text-node children leak through.
- **Gitea** (bluemonday default policy): allows only `<svg>` and `<path>`. No `<rect>`, no `<circle>`, no `<g>`, no `<text>`, no gradients, no fills or strokes (the `fill` and `stroke` attributes are also stripped). Self-hosted admins can extend the allow-list via `app.ini`'s `[markup.sanitizer.N]` rules, but defaults are the rule.
- **Obsidian** (DOMPurify defaults): allows most SVG — `<circle>`, `<rect>`, `<ellipse>`, `<g>`, `<text>`, `<defs>`, gradients, paths, filters. Empirically confirmed *not* working in Obsidian: `<use>`, `<style>` element, `<foreignObject>`, `<title>` element. `<script>`, event handlers, and `javascript:` URLs are stripped on every renderer including Obsidian.
- **VS Code Markdown preview** (uses markdown-it + DOMPurify-like sanitization): permissive, similar to Obsidian for most things.
The **strict cross-renderer intersection for inline SVG is effectively empty** — there is no inline-SVG recipe that produces a rendered diagram on GitHub, Gitea, and Obsidian alike. This is why the default has to be the external file.
## Layout and legibility
Renderer compatibility is only half the problem — the other half is producing SVG that's actually readable. Agent-generated SVGs commonly fail on text overflow, poor contrast, and missing margins. **Read `references/layout-legibility.md` before generating any non-trivial SVG** (charts, matrices, diagrams with labels). It covers:
- Estimating text width before sizing containers (SVG doesn't clip text)
- Contrast contracts for text over colored backgrounds (aim for 4.5:1)
- Background rects or halos for text on data-dependent surfaces
- Margin reservation for rotated labels
- The sparse-cells-plus-legend pattern for dense categorical charts
- Palette selection with declared text-color roles
## When the user asks for inline SVG
If the user explicitly says "embed it inline", "put the SVG directly in the markdown", or similar — **read `references/inline-svg.md` before proceeding**. It contains the full per-renderer compatibility table, sanitizer survival rules, and inline-specific checklists. Pick the rule set that matches the target renderer; if the target is unknown, ask.
## Default size
Generated SVG diagrams should not exceed **750 pixels in width** by default — set `width` (and a matching `viewBox`) accordingly. Height is unconstrained — pick whatever the content needs. Wider SVGs blow out the column on most Markdown renderers. Override only when the user explicitly asks for wider.
## Minimal example (external file recipe — the default)
```markdown
The architecture is straightforward:
![Architecture overview](./images/architecture.svg)
Each component handles its own state.
```
Where `./images/architecture.svg` is a normal SVG file — use any elements you want; standalone SVG is not subject to the inline-Markdown sanitizer.
## Pre-commit checklist
- [ ] SVG saved as a `.svg` file in a sensible location.
- [ ] Markdown references it with `![alt](path.svg)`.
- [ ] `width` (the rendered width) ≤ 750px unless asked otherwise.
For inline SVG checklists, see `references/inline-svg.md`.
@@ -0,0 +1,98 @@
# Inline SVG in Markdown — Per-Renderer Rules
Read this document only when the user explicitly asks for inline SVG (e.g., "embed it inline", "put the SVG directly in the markdown"). Pick the rule set that matches the target renderer. If the target is unknown, ask.
## Rule 1: Embed as a raw HTML block, never as a fenced code block
The two paths look similar but produce completely different output.
- **Embed SVG as a raw HTML block.** Place `<svg …>…</svg>` directly in the Markdown source, with a blank line before and after. CommonMark / GFM treat that as a raw HTML block and pass it through verbatim; the browser then parses what survives the sanitizer as real SVG.
- **Never wrap renderable content in ` ```svg ` (or ` ```html `, ` ```xml `) fences.** Fenced code blocks are *by definition* "display this as text". The renderer wraps the contents in `<pre><code>`, HTML-escapes every `<`, `>`, and `&`, and hands the escaped text to a syntax highlighter. The browser sees a string, not markup — no SVG ever gets parsed.
- **Don't assume non-standard "render this code block" extensions exist.** Some renderers (GitLab, certain Obsidian plugins, custom static-site setups) special-case ` ```mermaid ` or ` ```svg ` to render. This is non-standard. GitHub, VS Code's default preview, and CommonMark do not. Default to the raw-HTML-block path.
- **Same rule applies to other inline-renderable HTML.** `<details>`/`<summary>`, `<picture>`, `<video>`, raw `<table>` with attributes Markdown can't express — all use the raw-HTML-block path, never a fence.
Diagnostic: "I see SVG source code as text" → fence problem. "I see blank space or default-styled shapes" → sanitizer/styling problem (see Rule 2).
## Rule 2: Per-renderer element / attribute rules
| Element / feature | GitHub inline `.md` | Gitea (default) | Obsidian | Notes |
|---|---|---|---|---|
| `<svg>` | ❌ stripped | ✅ | ✅ | |
| `<path>` | ❌ | ✅ | ✅ | The most portable shape primitive. |
| `<rect>` | ❌ | ❌ | ✅ | Substitute with `<path>` rectangle on Gitea. |
| `<circle>` | ❌ | ❌ | ✅ | Substitute with `<ellipse rx=R ry=R>` (Obsidian only) or `<path>` arc circle. |
| `<ellipse>` | ❌ | ❌ | ✅ | |
| `<line>`, `<polyline>`, `<polygon>` | ❌ | ❌ | ✅ | |
| `<text>`, `<tspan>` | ❌ | ❌ | ✅ | |
| `<g>` | ❌ | ❌ | ✅ | Group inheritance dies on Gitea — repeat presentation attrs per element if cross-renderer matters. |
| `<defs>`, `<linearGradient>`, `<radialGradient>`, `<stop>` | ❌ | ❌ | ✅ | |
| `<marker>` | ❌ | ❌ | ✅ | Arrowheads only work on Obsidian inline. |
| `<use>` | ❌ | ❌ | ❌ (empirically confirmed) | Strip on Obsidian was unexpected; treat as not portable. |
| `<style>` element | ❌ | ❌ | ❌ (empirically confirmed) | Don't use it anywhere. CSS rules don't have a clear scope boundary so sanitizers strip them as injection risk. |
| `<title>` element | ❌ | ❌ | ❌ (empirically confirmed) | |
| `<foreignObject>` | ❌ | ❌ | ❌ (empirically confirmed) | |
| `<script>`, `on*` event handlers, `javascript:` URLs | ❌ | ❌ | ❌ | Always stripped, every renderer. Don't use. |
| `class=` attribute (for styling) | ❌ | ❌ | ✅ | Even when class survives, the `<style>` block defining the rules doesn't, so styling is lost — use inline presentation attributes. |
| Inline presentation attributes (`fill`, `stroke`, `stroke-width`, `font-size`, `font-family`, `text-anchor`, `stroke-dasharray`, etc.) | ❌ | ❌ | ✅ | These survive on Obsidian and any sanitizer that allows SVG at all. They never apply on GitHub-inline / Gitea because the elements themselves are stripped. |
Reading the table: an Obsidian-only target gives you most of SVG. A Gitea target restricts you to `<svg>` + `<path>` (no colors, no text, no groups). A GitHub-inline target gives you nothing — switch to the external-file recipe.
## Rule 3: Surviving the sanitizer where SVG is allowed
When the renderer allows SVG (Obsidian, VS Code preview, some self-hosted Gitea with extended `app.ini`, and the standalone-`.svg`-file path on GitHub), structure the SVG to survive its sanitizer:
- **Use SVG presentation attributes inline on every element.** `fill`, `stroke`, `stroke-width`, `stroke-dasharray`, `font-size`, `font-weight`, `font-family`, `text-anchor`. These can't escape the SVG and survive every sanitizer that allows SVG at all.
- **Don't rely on `<style>` blocks or `class=` for styling.** `<style>` is stripped on every renderer's inline sanitizer (including Obsidian, empirically). Even if `class=` survives, the rules are gone, so styling is lost.
- **Prefer longhand over CSS shorthand.** Use `font-size`, `font-weight`, `font-family` separately rather than the `font:` shorthand. The shorthand is CSS-only; longhand maps directly to SVG presentation attributes.
- **`<defs>` and id references are fine** on renderers that allow them at all (Obsidian; not Gitea/GitHub-inline). `<marker>`, `<linearGradient>` referenced via `url(#id)` survive the Obsidian sanitizer.
- **Group-level inheritance works for `font-family` and `fill`** (set on `<g>`, inherited by children) on Obsidian. Don't rely on it for cross-renderer; set the attribute on the leaf element.
The visible failure mode is silent: shapes still render, but with browser-default fill (usually black), no stroke, and default font sizing. On dark themes this looks like "nothing showed up"; on light themes like "a row of black blobs with no labels". There is no console error and no Markdown lint warning.
## Rule 4: No blank lines inside inline SVG
pulldown-cmark (and most CommonMark parsers) terminate an HTML block at a blank line. Any content after the blank line — even if it's still inside `<svg>...</svg>` — is parsed as Markdown, not HTML. Indented SVG elements become fenced code blocks (`<pre><code>`); unindented ones become paragraphs wrapping escaped angle brackets.
This means **the SVG source must be one unbroken block with no empty lines between `<svg>` and `</svg>`**. Use comments (`<!-- section: axes -->`) instead of blank lines if you need visual separation inside the SVG source.
Diagnostic: "Part of my SVG renders but the rest appears as code or escaped text" → blank-line-induced block break. Remove all blank lines between `<svg>` and `</svg>`.
## Minimal example (inline, Obsidian-friendly)
```markdown
Some prose before the diagram.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" width="200" height="80">
<g font-family="sans-serif" font-size="12" fill="#222">
<!-- inputs -->
<rect x="10" y="20" width="80" height="40" fill="#e8f0fe" stroke="#1a73e8" stroke-width="2"/>
<text x="50" y="45" text-anchor="middle">Input</text>
<!-- arrow -->
<line x1="90" y1="40" x2="130" y2="40" stroke="#1a73e8" stroke-width="2"/>
<!-- outputs -->
<rect x="130" y="20" width="60" height="40" fill="#fce8e6" stroke="#d93025" stroke-width="2"/>
<text x="160" y="45" text-anchor="middle">Output</text>
</g>
</svg>
Prose after.
```
Note: blank line before `<svg>`, blank line after `</svg>`, **no blank lines inside the SVG** (use `<!-- comments -->` for section separation), no fence, all styling via presentation attributes, font longhand on the group. This will render on Obsidian and similar permissive renderers. It will **not** render on GitHub `.md`. It will partially render on Gitea (the `<svg>` survives, the rest is stripped).
## Pre-commit checklist (inline SVG)
- [ ] Confirmed the target renderer allows SVG inline (not GitHub `.md`).
- [ ] `<svg>` block has a blank line before and after, no surrounding ` ``` ` fence.
- [ ] No blank lines between `<svg>` and `</svg>` (pulldown-cmark terminates the HTML block at blank lines).
- [ ] No `<style>`, `<title>`, `<use>`, `<foreignObject>` elements (don't survive Obsidian).
- [ ] No `class=` for styling, no CSS `font:` shorthand.
- [ ] Every shape has explicit `fill` and (where applicable) `stroke` / `stroke-width` as inline attributes.
- [ ] No `<script>`, `on*` handlers, or `javascript:` URLs.
- [ ] `width` ≤ 750px unless asked otherwise.
If the target is Gitea specifically and inline is required:
- [ ] Only `<svg>` + `<path>` elements used.
- [ ] No `fill`, `stroke`, `class`, `style`, `transform` attributes (stripped by default policy).
- [ ] OR confirmed the Gitea instance has `[markup.sanitizer.N]` extensions in `app.ini` permitting more.
@@ -0,0 +1,83 @@
# Layout and Legibility Rules for SVG Diagrams
These rules prevent the most common legibility failures in agent-generated SVG: text overflow, poor contrast, and missing margins. They apply to both external `.svg` files and inline SVG.
## Rule 1 — Estimate max-text-width before sizing a container
For any text that lives **inside** a bounded shape (cell, box, button), estimate the rendered width of the longest string:
- Rough bound: `text_width_px ≈ chars × font_size × 0.6` for proportional fonts at common weights.
- If the container is narrower than the longest text, choose one of:
- **Widen the container** (preferred when there's space).
- **Truncate to a short label** (e.g. a count, a code, or an abbreviation) and put the full text outside (legend, footnote table, sidebar).
- **Wrap to multiple `<tspan>` lines** when truncation loses meaning.
- SVG doesn't clip text by default — never assume CSS overflow rules apply.
Default to **counts + short labels inside the chart, full names in a legend below**. For dense categorical charts this is almost always the right answer.
## Rule 2 — Text-over-background needs a contrast contract
If a `<text>` element renders on top of an arbitrary background, declare which class of background it's designed for:
- **Light-bg text** (`fill: #1a1a1a` or similar): legible on whites, light grays, light pastels.
- **Dark-bg text** (`fill: #ffffff` or similar): legible on saturated mid-to-dark colors only.
- **High-contrast halo** (`paint-order="stroke fill"` + `stroke-width="3"` + `stroke="#fff"`): legible on anything; use when the background is unpredictable or varies.
Never apply one fill class across multiple background colors without verifying contrast for each. WCAG large-text minimum is **3:1**; for text-in-data-viz aim for **4.5:1** to leave margin.
When colors are picked by category, group them into a "dark fills" palette (use white text) and a "light fills" palette (use dark text). Don't mix.
## Rule 3 — Backgrounds for text on uncertain surfaces
When text is placed near or over a colored region whose color depends on data, give the text its own background:
- A `<rect>` behind the text, sized to its bounding box (compute as `chars × font_size × 0.6 + padding`), with `fill="#fff"` and a small `rx` for softness.
- Or a halo via `paint-order="stroke fill"` with a white stroke.
For category legends, axis labels, and chart titles — anything that sits in the chart's "frame" rather than inside a data shape — always give them a clean background or place them in the margin.
## Rule 4 — Reserve margin for rotated labels
Rotated text (typically column headers at `-30°` to `-45°`) extends beyond its anchor in both x and y. Rule of thumb: an N-character rotated header at θ degrees and font-size F needs:
- horizontal reach: `cos(θ) × chars × F × 0.6`
- vertical reach: `sin(θ) × chars × F × 0.6`
Plus the anchor offset. Always add 20% padding. If the rotated headers extend into the chart body, increase the chart's top margin until they don't.
## Rule 5 — Default chart pattern: sparse cells, full legend below
For categorical density / heatmap / matrix charts:
```
[ Title ]
[ Rotated category headers (with margin) ]
[ Row label │ count │ count │ . │ count │ count │ . ] (cells: just the number, color-coded)
[ Row label │ . │ count │ count │ . │ count │ . ]
[ ... ]
[ ]
[ Legend / details table: ]
[ Row × Category → action_a, action_b, action_c ]
[ Row × Category → action_d ]
[ ... ]
```
Counts inside cells; names in the table below. This pattern composes well across renderers and prevents the overflow trap entirely.
## Rule 6 — Stick to a small palette with declared roles
Categorical palettes should be picked once, with their **role** declared:
- "Dark fills" (use **white** text): `#1f77b4`, `#d62728`, `#9467bd`, `#8c564b`
- "Light fills" (use **dark** text): `#aec7e8`, `#ffbb78`, `#98df8a`
Avoid mid-tones (`#ff7f0e`, `#2ca02c`, `#e377c2`) unless the text color is matched per-color. If the chart needs more than 6 categories, that's usually a sign the categorisation is too fine — group first.
## Rule 7 — Sanity check the rendered output
Before saving, mentally render at the target display width (typically 600–750px effective in Markdown), and ask:
- Can I read every label?
- Does any text overlap another shape?
- Is there a category whose color makes its text invisible?
- Are empty cells distinguishable from filled ones at a glance?
If any answer is "no", iterate before checking in.
@@ -0,0 +1,98 @@
---
name: research-tree
description: Orchestrate multi-topic research as a dependency tree of parallel phases — not a flat fan-out of independent agents. Use this skill whenever the user asks for "research", "deep research", "investigate", "survey", or "look into" a topic that has multiple sub-topics, or when a question is broad enough that a single agent would either skim or take forever. Trigger especially when the user says things like "research X and Y and Z", "find out everything about…", "do a deep dive on…", or when prior research has surfaced new questions that need follow-up. Composes with the `workpad` skill for file placement and runs alongside `superpowers` and similar orchestration helpers.
---
# Research Tree
Most non-trivial research questions decompose into many sub-topics, and those sub-topics are *not* independent — later questions get sharper once earlier ones are answered. Running every sub-topic in parallel as peer agents wastes work and produces shallow, redundant findings. Running them strictly in series wastes wall-clock time. The right shape is a **tree of phases**: within a phase, agents run in parallel; between phases, later agents inherit the earlier reports.
This skill describes how to plan and run that tree. It does not describe how to write the contents of an individual research report — that's up to the agent doing the writing, plus whatever conventions the project has.
## When to use this skill
Use it when **two or more** of these are true:
- The topic has multiple sub-questions that a single agent couldn't realistically cover in depth.
- Some sub-questions clearly *depend on* the answer to other sub-questions (e.g. "evaluate library X" depends on "what are our requirements").
- The user wants something they can read and refer back to, not just a chat answer.
For a single focused question, just answer it. Don't reach for the tree.
## The shape of a research tree
```
Phase 1 (parallel) Phase 2 (parallel) Phase 3 (parallel) Summary
─ topic A ─────┐ ─ topic D (knows A,B) ─┐ ─ topic F (knows D,E) ─┐ ─ index.md
─ topic B ─────┼──────► ─ topic E (knows B,C) ─┼──► … ─┼──► (linking all)
─ topic C ─────┘ ─ … ┘ ┘
```
- **Within a phase:** agents run in parallel. They do not share intermediate findings with each other — by definition the phase is composed of topics that are mutually independent at that point in the tree.
- **Between phases:** when an agent in phase N+1 starts, hand it the *full text* of the reports it depends on from earlier phases — not just summaries, and not all reports indiscriminately. Pass *its* ancestors in the tree, transitively.
- **Specificity flows downward.** Broad framing topics live near the root; narrow, technical, "given X, exactly how does Y behave" topics live near the leaves.
## Planning the tree
Before spawning a single agent, plan the tree explicitly. Write the plan down — usually in the workpad as a brainstorm or design note — so you and the user can sanity-check it.
1. **List every sub-topic** you can think of, even ones that feel redundant. Easier to delete than to discover later.
2. **For each sub-topic, ask: "what would I need to know first?"** Draw an arrow from each prerequisite topic to the dependent topic. This produces a dependency graph, not yet a tree.
3. **Break cycles.** If A needs B and B needs A, you have a cycle. Resolve it by inserting a new, smaller intermediate topic that both can build on (e.g. "shared definitions and ground truth for X"), or by deciding which direction is the dominant dependency and demoting the other to a follow-up question for phase N+2.
4. **Group into phases by depth.** Topics with no prerequisites are phase 1. Topics whose prerequisites are all in phase 1 are phase 2. And so on. A topic that depends on items from phases 1 and 3 is itself a phase 4 topic — always one past its deepest prerequisite.
5. **Sanity-check phase widths.** A phase with one topic is fine but suspicious — can it merge with the next phase? A phase with fifteen topics is a sign you haven't decomposed dependencies enough. Aim for 2–6 per phase typically.
6. **Confirm the plan with the user** before launching. The plan itself is the most important artifact — a wrong tree wastes the most expensive resource (agent time on the wrong questions).
## Running the phases
Use the workpad's `research/` folder, almost always inside a dated subfolder for the whole tree:
```
research/
2026-05-05-14-auth-provider-evaluation/
phase-1-requirements.md
phase-1-current-state.md
phase-1-constraints.md
phase-2-candidate-comparison.md
phase-2-migration-paths.md
phase-3-cost-modeling.md
index.md ← written last, read first
```
Filenames should be slugged by topic; the `phase-N-` prefix is optional but helps when listing the directory.
For each phase:
1. **Spawn agents in parallel** for that phase's topics. Each agent receives:
- Its own narrow research brief.
- The full text of every ancestor report it depends on (transitively up the tree). Don't summarize on the way in — let the downstream agent skim or quote as it sees fit.
- The path to write its report into.
2. **Wait for the phase to complete** before starting the next. Don't try to overlap phases — the dependency is what makes the tree worth doing.
3. **Quickly read each report yourself** before dispatching the next phase. If a phase produced something surprising or contradictory, the dependency graph for the *next* phase may need updating.
## When findings contradict each other
If two reports in the same phase reach incompatible conclusions, or a phase-N report contradicts something assumed in phase-N-1, do not paper over it in the summary.
- Spawn a **verification / reconciliation agent** as an extra step. Give it both conflicting reports and ask it to identify the actual disagreement, what evidence each side rests on, and what would resolve it.
- The verification agent writes a **review paper** that lives next to the others (`review-<topic>.md`).
- Update the relevant prior reports if they got something wrong, or note the open question explicitly in the summary.
This is also the move when the summary is *hard to write* — that's usually a signal that contradictions are present and have been silently smoothed over.
## The summary / index document
The summary is written **last** and is the **first** thing a reader should open. Conventions:
- Filename: `index.md` (or `00-summary.md` if you want it to sort first).
- Linked from every other report in the tree (or at least from the directory's README).
- Structure: a one-paragraph TL;DR, the question that started the tree, the high-level answer, then a short section per phase linking out to the full reports.
- Do not paste the contents of the other reports into the summary. Link to them. The summary's job is navigation and synthesis, not duplication.
If the summary turned out hard to write, that's a signal — see the contradictions section above.
## What this skill does *not* govern
- The internal structure of an individual research report — that's the agent's call, plus project conventions.
- Whether the workpad itself exists / where it lives — defer to the `workpad` skill.
- Picking which model to use for which agent — out of scope here.
+119
View File
@@ -0,0 +1,119 @@
---
name: research
description: Governs how research is conducted — bounded agent spawning, no recursive sub-agents, web content downloaded as markdown and scanned locally. Use whenever launching research agents, fetching web content for analysis, or when another skill (like research-tree) is about to spawn agents that touch the web. Composes with workpad for output placement and research-tree for multi-topic structure.
---
# Research Governance
This skill regulates **how** research agents behave. It does not replace research-tree (which governs the **structure** of multi-topic research) or workpad (which governs **where** output goes). It layers on top of both.
## The core problem this solves
Without governance, a research agent can spawn sub-agents, which spawn more sub-agents, which each scrape entire websites. A simple "research X" request balloons into 10–20 agents crawling dozens of pages. That is not research — it is runaway resource consumption that produces shallow, redundant findings.
## The rules
### 1. Research agents must not spawn sub-agents
Every agent dispatched for research work is a **leaf agent**. It does its own reading, searching, and fetching. It does not delegate to further agents.
#### Agent tiers
Pick the right agent for the job. All three are tool-restricted and cannot spawn sub-agents:
| Agent | Model | Can write files | Web fetch cap | Use for |
|-------|-------|----------------|---------------|---------|
| `scout` | haiku | No | 2 pages | Quick fact extraction — a version number, a function signature, a config value from a web page |
| `search` | sonnet | No | 3–5 pages | Code/file lookups, symbol tracing, "where is X defined", multi-file search |
| `researcher` | opus (medium effort) | Yes | 5 pages | Deep topics requiring synthesis and a written report — architecture comparisons, technology evaluations, multi-source analysis |
**Default to `scout`** for simple lookups. **Use `search`** when you need to trace through code. **Use `researcher`** only when the topic genuinely needs synthesis and a written document.
When spawning research agents (via the Agent tool or workflow scripts):
- Use `subagent_type: "scout"` for quick fact extraction from a page or file
- Use `subagent_type: "search"` for code/file lookups and symbol tracing
- Use `subagent_type: "researcher"` for complex topics that need a written report
- In workflow scripts, use `agentType: 'scout'`, `'search'`, or `'researcher'` accordingly
The **orchestrator** (you, the main agent, or the workflow script) is the only entity that decides how many agents run. Individual research agents never make that decision.
### 2. Web content is fetched and read, not scraped
When research requires information from the web:
- **Fetch specific pages.** Use `WebFetch` to download a specific URL. The tool returns the page content as text/markdown.
- **Read the content locally.** Extract what you need from the fetched content. Do not follow every link.
- **Budget fetches per agent.** A single research agent should fetch at most 3–5 pages. If the research genuinely needs more, that is a sign the topic should be split into multiple agents at the orchestrator level — not that one agent should crawl more.
- **Never crawl.** Do not write loops that follow links, do not fetch "all pages" from a documentation site, do not spider a domain.
#### How to fetch web content
**Built-in tools (always available):**
- `WebFetch` — fetches a URL and returns content. Works for most documentation pages, blog posts, API references.
- `WebSearch` — searches the web and returns results with snippets. Use to find the right URL before fetching.
**MCP servers for richer web-to-markdown conversion (if configured):**
- `@anthropic/fetch` — Anthropic's fetch MCP; similar to WebFetch but runs as an MCP server
- `firecrawl` — converts web pages to clean markdown; good for documentation sites
- `markdownify` / `reader` — HTML-to-markdown conversion services
- `jina-reader` — extracts main content from web pages as markdown
- `browser-tools` — browser automation for pages that require JavaScript rendering
Check what MCP servers are available with `ToolSearch` before falling back to raw `WebFetch`. If a markdown-conversion MCP is available, prefer it — the output is cleaner and easier to scan.
**The pattern for web research:**
```
1. WebSearch to find relevant URLs (1-3 searches)
2. WebFetch (or MCP equivalent) to download 1-3 most relevant pages
3. Read the downloaded content, extract findings
4. Write findings to report file
```
This is **one agent's** entire web interaction. Not ten agents each doing this.
### 3. The orchestrator controls breadth, agents control depth
The division of responsibility:
| Concern | Who decides |
|---------|-------------|
| How many agents to spawn | Orchestrator (you) |
| Which topics to research | Orchestrator, informed by research-tree |
| How deep to go on one topic | The individual agent |
| Whether to fetch a web page | The individual agent |
| Whether to spawn another agent | **Never the individual agent** |
| Where to write output | Workpad skill |
### 4. Phases gate runaway growth
When using research-tree's phased approach:
- **Review each phase's output before launching the next.** This is not optional — it is the checkpoint where you catch redundancy, contradiction, or scope creep.
- **Trim the next phase** if earlier phases already answered some questions. Don't launch agents for topics that are already covered.
- **Cap total agents.** A typical research tree should use 3–12 agents total across all phases. If you're planning more than 15, the decomposition is too fine-grained — consolidate topics.
### 5. Research output goes to the workpad
Compose with the workpad skill:
- Individual agent reports → `research/<dated-subfolder>/phase-N-<topic>.md`
- Summary/index → `research/<dated-subfolder>/index.md`
- If no workpad exists, ask the user before creating one
## Applying this skill
When you are about to do research — whether triggered by the user saying "research", "investigate", "look into", or by another skill like research-tree — apply these rules:
1. **Plan first.** List the topics and how many agents you need. Share with the user.
2. **Instruct each agent.** Every agent prompt must include: the specific research question, where to write output, and the constraint that it must not spawn sub-agents.
3. **Use the search agent for lookups.** For "find where X is defined" or "what files reference Y", use `subagent_type: "search"` — it is tool-restricted and cannot spawn agents by design.
4. **Fetch web content through the agent, not through sub-agents.** The agent doing the research fetches the pages it needs directly.
5. **Review between phases.** Read what came back before sending more agents.
## What this skill does NOT govern
- The internal structure of a research tree (phases, dependencies) — that's research-tree
- Where files go — that's workpad
- Whether to do research at all — that's your judgment as orchestrator
- Which model to use — out of scope
+112
View File
@@ -0,0 +1,112 @@
---
name: workpad
description: Decides WHERE and WHEN to put working documents — reports, plans, goals, brainstorms, designs, journals, research, specs, tickets, bug notes. Use this skill whenever the user asks you to write a "report", "plan", "goal", "brainstorm", "design", "journal", "research note", "spec", or anything "in the workpad" — and also when another skill is about to drop a markdown file somewhere ad-hoc (e.g. a `superpowers/` subdirectory, the repo root, `/tmp`, or alongside source code). If a workpad exists, the workpad wins. This skill steers other skills toward a single, predictable place for markdown documents. Can be used together with any superpowers.
---
# Workpad
The workpad is the user's filing cabinet for thinking-in-markdown. Reports, plans, brainstorms, post-mortems — anything that is *about* the work rather than *being* the work — lives here. This skill answers two questions only: **where** does a given document go, and **when** is one kind of document the right kind versus another. It does not tell you how to write the contents.
Treat this skill as authoritative for placement. If another skill suggests writing a markdown artifact to its own scratch directory (a `superpowers/` folder, a sibling `notes/` dir, the repo root, etc.), prefer the workpad instead. A single predictable location is more valuable than each skill having its own.
## Where the workpad lives
Resolve the workpad base directory in this order — stop at the first hit:
1. **Explicit user instruction in the current conversation.** If they said "put it in `~/notes/foo`", that wins.
2. **`WORKPAD_FOLDER` environment variable.** Reading it reliably is fiddly because Agents run commands in subshells that may not inherit the user's interactive env, and the value may be injected on purpose not available to the agent:
- `just workpad-folder` (or any equivalent recipe) if a `.justfile` / `Justfile` is present and defines one — `just` loads `.env` automatically.
- `printenv WORKPAD_FOLDER` as a last resort. This will only see values exported into the actual process environment.
If any of these prints a non-empty path, treat it as the workpad base.
3. **Project-local ticket folder.** Some projects keep a sibling folder *outside* the main repo for per-ticket scratch (e.g. `../<repo>-tickets/` or a path the user has mentioned before). If such a folder is configured for this project, prefer placing the workpad inside it (e.g. `<ticket-folder>/workpad/`). When in doubt whether one exists, ask.
4. **`/docs/workpad`** at the project root, if a `/docs` folder already exists.
5. **`/.workpad`** at the project root.
6. **Otherwise: ask.** If there is no `/docs` folder and no other signal, do not silently create `/docs/workpad/`. Ask the user where the workpad should live, and confirm before creating any folders.
## Folder structure
The workpad always contains at least these subfolders:
- `brainstorm/` — open-ended exploration, options, half-formed ideas
- `goals/` — acceptance criteria, milestones, "what we're trying to reach"
- `designs/` — design docs, architecture sketches, RFC-style writeups
- `plans/` — concrete sequences of steps to execute
- `reports/` — findings, summaries, status writeups
It may also contain any of these, created on demand:
- `archive/` — superseded or completed material moved out of the way
- `bugs/` — bug investigations and notes
- `journals/` — append-only narratives of long-running problems
- `research/` — external research, library evaluations, prior art
- `specs/` — frozen, unchanging specifications
- `tickets/` — per-ticket scratch space
If one of these optional folders is needed and doesn't exist yet, create it. Don't create folders speculatively. Treat unknown folders as owned by the user and ignore them.
## File naming
Use a `YYYY-MM-DD-hh-` prefix on filenames in `reports/` and `plans/` at minimum. The hour helps when multiple artifacts land on the same day — which is common during active work — and keeps directory listings naturally sorted by recency. Apply the same prefix to `journals/`, `bugs/`, and `research/` entries; it's almost always the right call there too. For `goals/`, `designs/`, and `specs/`, the prefix is optional — these are referred to by name more than by date, so a descriptive slug alone is fine (e.g. `goals/q2-onboarding-flow.md`, `specs/event-schema.md`).
After the prefix, use a short kebab-case slug describing the topic: `2026-05-05-14-auth-token-leak.md`, not `2026-05-05-14-report.md`. The slug is what the user will skim for later.
## When to create a subfolder
Single artifact → single file. Don't wrap one report in a folder.
Create a dated subfolder when a piece of work will produce **multiple related files** — typically a research cascade, a multi-part report with appendices, or a plan with supporting design notes that belong together. The subfolder takes the date prefix and slug; files inside it can drop the date prefix since the parent already carries it.
Example:
```
reports/
2026-05-05-14-auth-token-leak.md ← single report
2026-05-05-15-q2-perf-audit/ ← cascade
overview.md
db-findings.md
frontend-findings.md
recommendations.md
```
## Picking the right kind of document
The categories overlap. These are the distinctions that matter:
**Plan vs. spec.** A plan is a sequence of steps you intend to take. A spec encodes something that shouldn't change — an invariant, a contract, a frozen decision. Default to `plans/`. Promote to `specs/` only when the content is meant to be referenced repeatedly as a source of truth and is not expected to be revised as work progresses.
**Goal vs. plan.** A goal says *what we're trying to reach* — acceptance criteria, a milestone, a story-level outcome. A plan says *how we'll get there*. If you find yourself writing "and then I'll…", you're writing a plan, not a goal.
**Report vs. journal.** A report is a snapshot — it can be revised as new information arrives, and the latest version is the version that matters. A journal is append-only and tells the story of a problem, including missteps, dead ends, and course corrections. Post-mortems, multi-day bug hunts, and architectural-correction narratives are journals. If the historical sequence is itself part of the value, it's a journal. If only the current conclusion matters, it's a report.
**Brainstorm vs. design.** A brainstorm is divergent — multiple options, tradeoffs, no commitment. A design is convergent — one approach, fleshed out enough to build from.
## Lifecycles
Most work follows one of these flows. Use them as a guide for what to create next, not as a mandatory pipeline — skip stages when they wouldn't earn their keep.
**Feature work:** `brainstorm → goal → design → plan`. Start with options, settle on what success looks like, design the approach, then break it into steps.
**Investigative or reactive work:** `report → design → plan`, or `report → plan`, or just `plan`. You usually start by reporting on what's there or what's broken; a design is only needed if the fix is non-trivial.
When moving between stages, create a new file in the next folder rather than mutating the previous one. The earlier artifact stays as a record of how thinking evolved.
## What "write a report" means by default
When the user says "write a report on X" without further direction:
1. Create a markdown file in `<workpad>/reports/` with the `YYYY-MM-DD-hh-<slug>.md` naming.
2. Put the actual findings in the file.
3. In your reply to the user, **summarize directly** — don't restate the whole report. Mention the file path so they can open it.
The same default applies to "write a plan", "draft a brainstorm", etc. — the user wants a file in the right folder plus a short verbal summary, not the file's contents pasted back into chat.
## Steering other skills
If you're operating under another skill that wants to write a markdown artifact (a research note, a design sketch, a status report), and a workpad exists or is reasonable to create, route the artifact through the workpad rather than that skill's default location. The other skill governs **what goes in the file**; this skill governs **where the file lives and what it's called**. They compose cleanly.
## What this skill deliberately does not cover
- The internal structure or formatting of reports, plans, designs, etc. That's up to the user, the project's conventions, or another skill.
- Git workflow for workpad files (whether to commit them, branch them, etc.).
- Tooling for searching or indexing the workpad.
If the user asks for help with any of those, treat it as a separate concern.