# Execution

How Stencila executes documents - kernels, staleness-driven re-execution, execution...

- Repository: https://github.com/stencila/stencila (914 stars)
- Category: Testing
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add stencila/stencila --skill execution -g -a claude-code -y`
Codex: `npx skills add stencila/stencila --skill execution -g -a codex -y`
Cursor: `npx skills add stencila/stencila --skill execution -g -a cursor -y`
Gemini CLI: `npx skills add stencila/stencila --skill execution -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add stencila/stencila`

## Description

How Stencila executes documents - kernels, staleness-driven re-execution, execution options, and debugging chunks that error or do not re-run. Use when running stencila execute or render, when a code chunk is not re-running, when choosing a language/kernel, or when reading execution errors.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Executing Stencila documents

`stencila execute doc.smd` runs the executable code in a document and saves
the outputs into it. `stencila render doc.smd out.html` is execute **plus**
encode to output formats. Always invoke non-interactively:

```sh
NO_COLOR=1 stencila execute doc.smd --yes
NO_COLOR=1 stencila render doc.smd out.html --yes
```

## Staleness: why a chunk may not re-run

Execution is staleness-driven. A chunk re-runs only when it (or something it
depends on) has changed since its last recorded execution. This is why
"I edited the prose and re-executed, but the plot didn't regenerate" is
expected behaviour, not a bug. Also check the chunk's execution mode in the
source: `lock` prevents re-execution to preserve outputs, `always` forces
re-run every time.

To override staleness:

- `--force-all`, re-execute everything regardless of staleness. The first
  thing to try when outputs look out of date.
- `--skip-code`, skip executing code (useful to re-run only other
  executable node types).
- `--ignore-errors`, do not fail the command on execution errors; render
  what can be rendered.
- `--no-save` (`execute` only), run without writing outputs back to the
  source document. Use for a reproducibility check that must not mutate
  files.
- `--dry-run`, compile and prepare but do not actually execute.

`execute` and `render` share the execution option group, but `--no-save` is
`execute`-only, and output/encoding options (`--to`, `--theme`, etc.) are
`render`-only. Check `--help` when unsure.

## Kernels

Each language executes in a kernel. `stencila kernels list` shows what is
available on this machine. Current kernels include:

The rest: https://github.com/stencila/stencila/blob/HEAD/claude/skills/execution/SKILL.md
