scratchpad

Extracts JSDoc examples from TypeScript source files into runnable scratchpad files.

3|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/craft-ts/craft-ts --skill scratchpad-craft-ts
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: scratchpad
Source: https://github.com/craft-ts/craft-ts/tree/main/.references/effect-ts/.agents/skills/scratchpad
Command: npx skills add https://github.com/craft-ts/craft-ts --skill scratchpad-craft-ts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? When reading Effect-TS source code, developers often want to try out a JSDoc example interactively, but manually copying the code block, adding imports, and wiring up an Effect runner is tedious and error-prone. ## Core Features & Use Cases - Nearest Example Extraction: Locates the JSDoc **Example** block containing, following, or preceding the cursor line in a TypeScript source file. - Automatic Runner Injection: Appends Effect.runPromise(program) when a top-level program binding exists, or preserves an existing runner. - Safe File Output: Writes to a scratchpad/ directory with slugified filenames and numeric suffixes so existing files are never overwritten. - Use Case: While reading packages/effect/src/Schedule.ts, place the cursor on an example and ask to open it in scratchpad; the skill produces a ready-to-run TypeScript file like scratchpad/Schedule-retrying-and-repeating-effects.ts. ## Quick Start Use the scratchpad skill to extract the JSDoc example at my current cursor position in the active TypeScript file into a scratchpad file.

Frequently Asked Questions about scratchpad

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract a JSDoc example from a TypeScript file?▼

Run the extract-example.mjs script with the source path and line number, for example: node .agents/skills/scratchpad/scripts/extract-example.mjs packages/effect/src/Schedule.ts 9. It writes the nearest example into the scratchpad directory as a TypeScript file.

How does the scratchpad skill choose which example to extract?▼

It selects the example whose section contains the given line; otherwise it picks the first following example, and if none exists, the nearest previous example in the file.

What happens if the extracted example has no Effect runner?▼

In auto mode the script exits with code 2 and reports a needs-runner status. You can rerun with --mode preserve to copy the example exactly, or --runner <identifier> to append Effect.runPromise for a specific value.

Does extracting examples overwrite existing scratchpad files?▼

No. The script generates filenames from the source file and example title, and appends a numeric suffix when a file with the same name already exists, so existing scratchpad files are preserved.

What are the limitations of JSDoc example extraction?▼

The script only detects examples marked with an **Example** heading followed by a fenced ts or typescript code block inside JSDoc comments. Examples in other formats or plain comments are not recognized.