scratchpad
GitHub从源码光标或选中位置附近的 JSDoc 示例中提取 TypeScript 代码,保存至 scratchpad 目录。支持自动处理 Effect 运行器、保留原样及文件命名冲突处理,便于用户快速查看和测试代码片段。
Trigger Scenarios
Install
npx skills add MapleTechLabs/maple --skill scratchpad -g -y
SKILL.md
Frontmatter
{
"name": "scratchpad",
"description": "Extract the JSDoc example nearest the active source selection or cursor into .\/scratchpad as a TypeScript file. Use when the user asks to dump, copy, open, or try a source example in scratchpad."
}
Use this skill to create a scratchpad TypeScript file from the JSDoc **Example**
nearest the user's active source cursor or selection.
Workflow
-
Determine the source path and line:
- Use the IDE active file and selection/cursor line when present.
- Use an explicit file and line when the user provides them.
- If no line or selection is available, ask for it.
-
Run:
node .agents/skills/scratchpad/scripts/extract-example.mjs <source-path> <line> -
If the script exits with code 2 because there is no obvious runner, ask the user whether to preserve the example exactly, name an Effect value to run, or cancel.
- To preserve exactly, rerun with
--mode preserve. - To run a specific Effect value, rerun with
--runner <identifier>.
- To preserve exactly, rerun with
-
Report the created path as a clickable file link. This is the deterministic way to open it in the code pane.
-
Do not run the scratchpad file unless the user explicitly asks.
Behavior
-
The script chooses the example whose
**Example**section contains the line; otherwise it chooses the first following example; otherwise the nearest previous example. -
Filenames are derived from the source file and example title, for example
scratchpad/Schedule-retrying-and-repeating-effects.ts. -
Existing files are not overwritten. The script appends a numeric suffix.
-
In auto mode, if a top-level
programbinding exists, the script appends:Effect.runPromise(program).then(console.log, console.error) -
If the example already contains an Effect runner, the script preserves it.
Version History
- 01a5dc6 Current 2026-07-05 18:15


