Learn-skills.dev asciinema-record
Record a terminal session to a named .cast file using asciinema, trim the recording to marked content, and optionally convert it to a GIF using agg.
git clone https://github.com/NeverSight/learn-skills.dev
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/abuxton/skills/asciinema-record" ~/.claude/skills/neversight-learn-skills-dev-asciinema-record && rm -rf "$T"
data/skills-md/abuxton/skills/asciinema-record/SKILL.mdAsciinema Record
Record a focused terminal session using asciinema, trim the raw
.cast file to the content between start here / end here markers, and optionally render an animated GIF with agg.
Role
You are an expert in terminal recording, asciinema workflows, and developer experience tooling.
- Derive a short, descriptive filename from the task being demonstrated (e.g. a file-listing demo →
)ls.cast - Produce clean recordings by stripping shell preamble and teardown, keeping only the content the viewer needs to see
- Handle the full pipeline: record → trim → (optionally) render GIF
- Never overwrite an existing
file without confirmation.cast
Workflow
-
Derive the cast filename — From the task description, choose a concise snake_case name that identifies what is being demonstrated (e.g. "show directory listing" →
, "install dependencies" →ls
, "run tests" →npm_install
). The output file will betest_run
../tmp/<name>.cast -
Ensure the output directory exists — Run:
mkdir -p ./tmp -
Start the recording — Launch an asciinema session targeting the output file:
asciinema rec ./tmp/<name>.castThis opens an interactive shell inside the recording session.
-
Emit the start marker — As the very first command inside the recorded session, run:
echo "start here" -
Perform the demonstration — Run the commands that illustrate the task. Keep the session focused; avoid long pauses or unrelated commands.
-
Emit the end marker — When the demonstration is complete, run:
echo "end here" -
End the recording session — Exit the recorded shell:
exitasciinema writes and closes
../tmp/<name>.cast -
Trim the cast file — Use the Python script in
to strip everything outside the markers, always preserving the header (line 1):references/trim_cast.pypython3 skills/asciinema-record/references/trim_cast.py ./tmp/<name>.castThe script rewrites the file in-place: header line + only the events between (exclusive of) the
andstart here
marker lines.end here -
Render a GIF (optional) — If the task calls for a GIF or the
utility is available, convert the cast:aggagg ./tmp/<name>.cast ./tmp/<name>.gifThe GIF shares the same base name as the cast file.
Notes
- The
andstart here
strings must appear as plainend here
output in the cast; the trim script searches for them as substrings in the event data.echo - If
is not installed, skip step 9 and note the cast file location for the user to convert manually.agg - The
directory should be added to./tmp/
if recordings are not meant to be committed; add the specific files explicitly if they should be..gitignore - See
for example_assets/asciinema/
and.cast
reference files..gif