.stencila/skills/theme-creation/SKILL.md
Create, update, or plan a Stencila theme for documents or published sites. Use when asked to choose a theme direction, write or patch theme.css, recommend semantic or module token families, customize site navigation or branding, tune PDF and print page tokens, align web, Python, and R plots with a Stencila design system, list available builtin tokens with `stencila themes tokens`, or validate a theme file with `stencila themes validate`.
npx skillsauth add stencila/stencila theme-creationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Help the user create, update, or plan a Stencila theme. Depending on the request, this may mean producing a concrete artifact such as a workspace theme.css, a patch to an existing theme file, or a reusable CSS snippet, or it may mean producing an advisory plan such as token recommendations, target tradeoffs, branding direction, and a validation checklist before any file is edited.
Use the localized references in this skill directory instead of site/docs/themes/:
references/themes-guide.md for architectural context and workflow background when you need it; the numbered steps below remain the primary operating procedurereferences/semantic-and-font-tokens.md for semantic and font tokensreferences/node-token-families.md for document/node token families and guidance on when to use themreferences/print-and-pdf-tokens.md for print and PDF page tokensreferences/plot-tokens.md for plot theming tokensreferences/site-token-families.md for site-theme component families and verified exact site token namesreferences/cli-commands.md for token discovery and validation commandsreferences/snap-tool.md for visual verification with the snap tool and the /_specimen routeAlso use the theme CLI as a live source of truth when available:
stencila themes or stencila themes list to list all available themes (workspace, user, and builtin) with their type and locationstencila themes show [NAME] to display the resolved CSS of a theme (omit the name for the default resolved theme); add --verbose to also show resolved CSS variable valuesstencila themes new [NAME] to scaffold a new theme — omit the name for a workspace theme.css, or provide a name for a user theme; use --force to overwritestencila themes tokens to list builtin tokens, optionally filtered by --scope (semantic, node, site, plot, print) and --family, with --as json|yaml|toml for machine-readable outputstencila themes validate <FILE> to check that a CSS theme parses and that custom properties correspond to known builtin design tokens; use --strict when unknown tokens should fail validationstencila themes remove <NAME> to remove a user theme; use --force to skip the confirmation promptsnap and /_specimenUse the snap tool throughout theme creation to verify how changes render. Snap returns structured measurement data (tokens, CSS properties, layout metrics, contrast ratios, color palette) by default; screenshots are opt-in when you need visual confirmation. You can snap any page served by Stencila — including the user's own documents and site pages — but the /_specimen route is the canonical target for theme visual QA. It is a stable, deterministic page that renders representative examples of every major content type — typography, headings, lists, blockquotes, code blocks, math, images, tables, figures, admonitions, and thematic breaks — so it exercises all token families in one page. See references/snap-tool.md for the full parameter reference.
/_specimen to see the current baseline appearance and token values before making any changes.| Parameter | Use for |
|---|---|
| route: "/_specimen" | Target the specimen page — exercises all major content types in one page |
| measure: "theme" | Collect measurements using the theme-oriented selector preset |
| tokens: true | Extract resolved CSS custom property values to verify token overrides took effect. Requires at least one token_prefix — the tool returns a validation error without one |
| token_prefix: ["text", "heading"] | Filter token output to specific families (required with tokens). Use narrow prefixes — bare "color" matches 100+ primitive palette tokens; prefer "color-accent", "surface", etc. |
| palette: true | Extract the page's color palette to check color harmony |
| dark: true or light: true | Force a color scheme to verify light and dark variants |
| device: "mobile" | Test responsive behavior at a specific viewport (also "tablet", "laptop", "desktop") |
| full_page: true | Capture the full scrollable page instead of just the viewport |
| selector: "stencila-table" | Focus on a specific element type |
| assert: ["css(stencila-paragraph).fontSize>=16px"] | Assert numeric CSS properties; use ~= for string matching (e.g., fontFamily~=Source Serif) |
snap(route: "/_specimen", measure: "theme", tokens: true, token_prefix: ["text", "heading", "surface"]) — see what you are starting from. Measurements and tokens are returned by default without a screenshot.snap(route: "/_specimen", tokens: true, token_prefix: ["text", "heading", "surface"]) — verify the token overrides took effect.snap(route: "/_specimen", selector: "stencila-code-block", tokens: true, token_prefix: ["code"]) — spot-check specific node types and verify their tokens.snap(route: "/_specimen", dark: true, tokens: true, token_prefix: ["text", "surface"]) — verify dark-mode token values. Add screenshot: true for a visual check.snap(route: "/_specimen", device: "mobile", measure: "theme") — verify layout at a specific viewport. Run separate snaps for each device preset.snap(route: "/_specimen", palette: true) — review the overall color palette.You can also snap the user's actual document route (e.g., route: "/" or route: "/docs/") alongside /_specimen to verify the theme looks correct on real content too. When choosing a route from source files, remember that index.*, main.*, and README.* act as the index.html for their containing directory, so docs/README.md, docs/main.md, and docs/index.md all render at "/docs/".
Screenshots are opt-in (screenshot: true) and default to resize: "auto" which preserves full resolution unless the image exceeds hard provider limits (8000px). A 600px minimum width floor prevents worst-case mobile downscaling.
/_specimen) are useful for gross layout checks but get downscaled on very tall captures, making typography details harder to read. For font rendering and spacing verification, use selector-targeted snaps (e.g., selector: "stencila-heading") instead.measure: "theme" output has summaries and diagnostics first, followed by verbose per-element CSS. The summaries are typically the most useful part — scan those before diving into raw values.Theme resolution is cached for about 30 seconds. Batch your CSS changes before snapping rather than snapping after each small edit.
If snap cannot be run — for example, no Stencila server is running, the /_specimen route is not available, or the theme is not yet renderable — do not fabricate visual findings. Instead:
stencila themes validate) and token verification (stencila themes tokens) as the primary quality checks.snap commands to run once the environment is available.snap was actually executed and returned results.Stencila themes are token-first. Prefer semantic tokens as the stable public API, use module-specific tokens only when needed, and add custom CSS rules only where tokens are insufficient.
:root.--plot-* tokens for plot targets.stencila themes tokens to confirm builtin token availability and scope/family coverage when exact names matter or when the localized references may have drifted.stencila themes tokens, describe the token family and intended effect instead of guessing.Many tokens have *-dark variants (e.g., --text-color-primary-dark, --surface-background-dark, --plot-background-dark). The base theme applies these automatically via prefers-color-scheme: dark. When creating a theme:
*-dark variant explicitly when light and dark values need to differ (e.g., --color-accent and --color-accent-dark).stencila themes tokens --scope semantic or --scope plot to see which tokens have dark variants.Stencila always loads base.css implicitly before any theme CSS — both when rendering HTML (as a separate <link> tag) and when computing theme variables (base variables are merged before theme-specific ones). Users do not have base.css in their workspace, so do not include @import url("./base.css") in theme files. A workspace theme.css or user theme should contain only :root overrides and any additional rules or font imports.
:root {
--text-font-family: "Source Serif 4", Georgia, serif;
--heading-font-family: "Inter", Arial, sans-serif;
--text-color-primary: #1f2937;
--color-accent: #0f766e;
--surface-background: #ffffff;
--content-width: 72ch;
--content-spacing: 1.25rem;
--border-color-default: #d1d5db;
}
If the theme needs custom web fonts, add @import url(...) for the font provider (e.g., Google Fonts) before the :root block. For self-hosted fonts, use @font-face rules before :root instead:
@font-face {
font-family: "Custom Font";
src: url("./fonts/custom-font.woff2") format("woff2");
font-weight: normal;
font-display: swap;
}
:root {
--font-family-serif: "Custom Font", var(--font-family-serif);
--text-font-family: var(--font-family-serif);
}
Then add only the module-specific tokens or focused selectors needed for the user’s goal.
Choose the workflow branch early.
| Situation | Default action | |---|---| | User asks for direction, options, or tradeoffs | Assume plan only | | User asks for CSS, a patch, or file edits | Assume implement now | | Document theme vs site theme is unclear and published-site chrome may be affected | Ask a clarifying question | | Request is clearly article/report typography focused with no target stated | Assume document theme and state the assumption | | Existing file likely exists and patch-vs-rewrite changes the result materially | Inspect first or ask if inspection is not possible |
Identify the theme type and targets.
Inspect the existing theme context when implementation is requested.
theme.css and related assets before generating new CSS.stencila themes show to see the current default resolved theme CSS, or stencila themes show <NAME> for a specific theme. Add --verbose to also see resolved variable values — this is especially useful for understanding what values are inherited from the base theme.stencila themes list to see all available themes (workspace, user, and builtin) and their locations.theme.css first while walking up from the document path, then user default.css, then base theme (no overrides).stencila themes new to scaffold a workspace theme.css template, or stencila themes new <NAME> for a named user theme, when starting from scratch.Start from the semantic foundation.
references/semantic-and-font-tokens.md for semantic starting points, stable font patterns, and guidance on how semantic tokens are applied.--text-font-family, --heading-font-family, --code-font-family--text-color-primary, --color-accent, --surface-background--content-width, --content-spacing, --border-color-defaultVerify exact module-specific tokens before using them.
stencila themes tokensstencila themes tokens --scope semanticstencila themes tokens --scope site --family nav-menustencila themes tokens --scope plot --as jsonreferences/semantic-and-font-tokens.mdreferences/node-token-families.mdreferences/print-and-pdf-tokens.mdreferences/plot-tokens.mdreferences/site-token-families.mdBranch by theme type.
references/node-token-families.md and add node/module token families for headings, paragraphs, lists, links, code, tables, figures, citations, references, plots, and print/page behavior as needed.references/site-token-families.md for exact names in families such as layout, nav-menu, nav-tree, nav-groups, breadcrumbs, toc-tree, prev-next, logo, title, and site-search.title and site-search--site-title-*--search-*references/plot-tokens.md and use explicit --plot-* tokens.references/print-and-pdf-tokens.md and keep exportable page tokens in top-level :root.Keep cross-target values exportable.
:root.@media or @supports for non-web targets.@media print for web-only or print-only presentation, but state clearly that these are not exported as general non-web theme tokens.var(), calc(), and color-mix() can still be useful because they are resolved before target mapping.Add CSS rules only where tokens are insufficient.
Produce the right kind of output.
theme.css content:root overrides (do not include @import url("./base.css") since Stencila loads the base theme implicitly)Validate with target-specific checks.
stencila themes validate <FILE> before finishing.stencila themes validate <FILE> --strict when the user wants unknown tokens treated as errors.snap to visually verify the rendered result on the specimen page and the user's actual content:
snap(route: "/_specimen", measure: "theme", tokens: true, token_prefix: ["text", "heading", "surface"]) — verify content types render correctly and key token overrides took effect. Adjust the prefix list to match the token families you changed.snap(route: "/_specimen", dark: true, tokens: true, token_prefix: ["text", "surface"]) — verify dark-mode token values if dark variants were set. Add screenshot: true for a visual check.snap(route: "/_specimen", device: "mobile", measure: "theme") — verify responsive behavior at mobile viewport. Run separate snaps per device.snap(route: "/_specimen", palette: true) — verify color harmony.index.*, main.*, or README.*.--plot-* token transfer to plotsWhen useful, structure the response like this:
theme.css, patch, snippet, or plan)See references/cli-commands.md for CLI commands and references/snap-tool.md for visual verification.
Input: We have not started coding yet. Help us choose a theme direction for a documentation site that should feel calm, technical, and accessible across web and PDF.
Output:
--text-font-family, --heading-font-family, --text-color-primary, --surface-background, --color-accent, --border-color-default--content-width, --content-spacinglayout, nav-menu, nav-tree, breadcrumbs, toc-tree, title, logo, and site-searchreferences/print-and-pdf-tokens.md:root tokens rather than responsive-only rulesInput: Create a document theme for research reports with serif body text, sans-serif headings, slightly wider reading width, subtle table borders, and PDF-friendly page margins.
Output:
:root {
--text-font-family: "Source Serif 4", Georgia, serif;
--heading-font-family: "Inter", Arial, sans-serif;
--text-color-primary: #1f2937;
--surface-background: #ffffff;
--content-width: 74ch;
--content-spacing: 1.25rem;
--border-color-default: #d6dae1;
--page-width: 210mm;
--page-height: 297mm;
--page-margin-top: 18mm;
--page-margin-right: 16mm;
--page-margin-bottom: 20mm;
--page-margin-left: 16mm;
}
stencila-table {
--table-border-color: var(--border-color-default);
}
Notes:
stencila themes tokens --scope print if exact names matter.:root so they can be exported to print/PDF flows.Input: Create a minimal document theme with teal accents and verify it renders correctly.
Output:
:root {
--text-font-family: "Inter", Arial, sans-serif;
--text-color-primary: #1f2937;
--color-accent: #0f766e;
--surface-background: #fafafa;
--content-width: 70ch;
--border-color-default: #d1d5db;
}
Validation checklist:
stencila themes validate theme.css — confirm tokens parse and are recognized.snap(route: "/_specimen", tokens: true, token_prefix: ["text", "color-accent", "surface"]) — verify the semantic foundation and token overrides took effect.snap(route: "/_specimen", dark: true, tokens: true, token_prefix: ["text", "surface"]) — check that the base-theme dark fallbacks are acceptable (no explicit dark variants were set, so base defaults apply). Add screenshot: true for a visual check.snap(route: "/_specimen", device: "mobile", measure: "theme") — confirm mobile layout.snap(route: "/_specimen", palette: true) — verify the teal accent integrates with surrounding colors.If snap cannot be run (e.g., no Stencila server is running), mark visual verification as pending and rely on stencila themes validate and stencila themes tokens --scope semantic for now. Recommend running the snap commands above once the server is available.
Input: Update our published site theme so the header is slimmer, navigation is quieter, the site title is more prominent, and search feels more branded.
Output:
:root {
--layout-header-height: 56px;
--header-background: #ffffff;
--header-border-color: #e5e7eb;
--nav-menu-color: #4b5563;
--nav-menu-color-hover: #111827;
--nav-menu-color-active: #0f766e;
--nav-menu-item-padding-x: var(--space-2);
--site-title-font-size: var(--font-size-xl);
--site-title-font-weight: 700;
--site-title-color: #111827;
--search-modal-width: 34rem;
--search-highlight-color: #0f766e;
}
Notes:
references/site-token-families.md.stencila themes tokens --scope site --family nav-menu and related family queries when exact names matter.logo, breadcrumbs, toc-tree, or prev-next tokens only if the user asks for those surfaces.Input: Make Python and R plots match the document branding with teal accents, softer grid lines, and consistent typography.
Output:
:root {
--plot-theme: custom;
--plot-font-family: "Inter", Arial, sans-serif;
--plot-font-size: 11pt;
--plot-text-color: #1f2937;
--plot-grid-color: #d1d5db;
--plot-axis-line-color: #6b7280;
--plot-title-size: 14pt;
--plot-color-1: #0f766e;
--plot-color-2: #0ea5a4;
--plot-color-3: #334155;
}
Notes:
--plot-* tokens transfer to Python and R kernels.stencila themes tokens --scope plot before expanding the set.stencila themes tokens --scope plot and use references/plot-tokens.md to understand cross-target caveats before adding narrower plot variables.Input: Help us theme this, but we have not decided whether it is for the published site or for the article pages themselves.
Output:
Before proposing tokens or CSS, ask a clarifying question such as:
Do you want a document theme for the article/report content itself, a published-site theme for navigation/branding/chrome, or both?
Then proceed once the answer makes the target surfaces clear.
Input: Update the existing theme.css so links use our accent color and tables keep their current styling.
Output:
--- a/theme.css
+++ b/theme.css
@@
:root {
--text-font-family: "Source Serif 4", Georgia, serif;
- --color-accent: #2563eb;
+ --color-accent: #0f766e;
+ --link-color: var(--color-accent);
+ --link-color-hover: #115e59;
}
Notes:
Input: Patch our existing theme.css after inspection so it keeps the current font imports and table rules, but updates links and accent color for a calmer teal brand.
Output:
theme.css first.@import url(...) font lines unchanged.:root link and accent tokens.stencila-table rules untouched.--- a/theme.css
+++ b/theme.css
@@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
:root {
--text-font-family: "Inter", Arial, sans-serif;
- --color-accent: #2563eb;
+ --color-accent: #0f766e;
+ --link-color: var(--color-accent);
+ --link-color-hover: #115e59;
}
Notes:
@media or @supports, move them to top-level :root and explain why.--plot-* tokens are present even if the rest of the document theme is already defined.stencila themes tokens with the narrowest useful --scope and --family filters instead of guessing from memory.stencila themes validate <FILE> and mention --strict when unknown-token failures are desirable.snap cannot be run (no server, no served route, theme not yet renderable), mark visual verification as "pending" in the output, rely on CLI validation and token verification, and recommend specific snap commands to run once the environment is ready. Do not claim snap-based findings without actual snap results.references/ focused on workflow guidance, architecture, application patterns, and caveats that the CLI token listing does not provide.stencila themes tokens can provide a more current comprehensive list, to minimize drift.documentation
An agent skill providing instructions for AI agents.
testing
Critically review a Stencila workflow and suggest improvements. Use when asked to review, audit, critique, evaluate, or improve a workflow directory or WORKFLOW.md file. Covers frontmatter validation, DOT pipeline quality, workflow structure, agent selection quality, discovery metadata, ephemeral workflow conventions, workflow composition, and adherence to Stencila workflow patterns.
development
Create a new Stencila workflow. Use when asked to create, write, scaffold, or set up a workflow directory or WORKFLOW.md file. Covers workflow discovery, duplicate-name checks, ephemeral workflows, WORKFLOW.md frontmatter, DOT pipeline authoring, goals, agents, branching, composition, and validation.
development
Critically review an existing or proposed Stencila theme artifact for correctness, token usage, target coverage, cross-target portability, dark-mode handling, maintainability, and approval readiness. Use when asked to review, critique, assess, audit, or validate a theme.css file, theme patch, theme plan, site theme, document theme, plot theme, print or PDF theme, check design tokens, assess DOCX or email behavior, review dark mode support, or validate with stencila themes validate.