Agent skill

Playground Examples

by andymai in andymai/brepjs

This skill should be used when adding, editing, or fixing an example in apps/playground — when a task says "add a playground example", "example fails check:examples", "playgroundExamples.test.ts is…

Apache-2.0Auto-check passedDevelopment

Install Playground Examples

skills CLI
$ npx skills add andymai/brepjs --skill playground-examples -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install andymai/brepjs playground-examples --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/andymai/brepjs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/playground-examples .claude/skills/playground-examples && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
playground-examples
GitHub stars
114
Token cost
~3.7k tokens
SKILL.md length
1,324 words
Files
1
Skills in repo
21
Repo updated
First seen
Licence
Apache-2.0

At a glance

This skill should be used when adding, editing, or fixing an example in apps/playground — when a task says "add a playground example", "example fails check:examples", "playgroundExamples.test.ts is…

  • Works in 4 steps: Unique id and label across all examples… → Evals + meshes: each example produces… → No silent finishing-op fallback: the… → …
  • Development work in your project
  • SKILL.md covers Example anatomy, The three gates, Symptom → cause → fix and Checklist for a new example, plus 1 more section
  • Calls npm, npx and tsc

What it does

Playground Examples is an agent skill from andymai/brepjs. This skill should be used when adding, editing, or fixing an example in apps/playground — when a task says "add a playground example", "example fails check:examples", "playgroundExamples.test.ts is failing", "regenerate ambient types", "generate-types", "example thumbnail is missing", "run npm run thumbs", "example renders wrong / blank viewer", "example works in tests but breaks in the browser", or when a new example needs to pass its three gates (types, geometry, thumbnail) before merge.

Its SKILL.md is about 3.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development. It works with npm. The repository describes itself as: Web CAD library with exact B-Rep geometry. The licence is Apache-2.0.

When your agent uses it

  • Development work in your project

Example prompts

  • “add a playground example”
  • “example fails check:examples”
  • “playgroundExamples.test.ts is failing”
  • “/playground-examples”

Requirements

  • Node.js

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Unique id and label across all examples (lines 20-25).
  2. Evals + meshes: each example produces shapeCount > 0 and totalVertices > 0 (lines 27-33).
  3. No silent finishing-op fallback: the regex /(.ok\s*\?[^:]*:|isOk\s*([^)]*)\s*\?[^:]*:)/ must not match — patterns like x.ok ? x.value…
  4. Connected-body check for a hard-coded assembly list CONNECTED_BODY_EXAMPLES (universal-joint, geneva-drive, bench-vise, scotch-yoke…

What it can do on your machine

Read from SKILL.md and the folder at commit ee50994. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • npx
    • tsc
    • vitest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm and npx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Playground Examples loads about 3.7k tokens when it runs. Until then it costs about 129 tokens; SKILL.md has 1,324 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~129
When it runs · the whole SKILL.md, loaded when a task matches
~3.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from andymai/brepjs at commit ee50994, republished under its Apache-2.0 licence (© andymai). 1,324 words, ~3,699 tokens.

Download SKILL.mdSave it as .claude/skills/playground-examples/SKILL.md (or your agent's skills folder).
name
playground-examples
description
This skill should be used when adding, editing, or fixing an example in apps/playground — when a task says "add a playground example", "example fails check:examples", "playgroundExamples.test.ts is failing", "regenerate ambient types", "generate-types", "example thumbnail is missing", "run npm run thumbs", "example renders wrong / blank viewer", "example works in tests but breaks in the browser", or when a new example needs to pass its three gates (types, geometry, thumbnail) before merge.

Playground examples

Add or fix an example in apps/playground and clear its three gates: types, geometry, thumbnail. Every example is a self-contained code string that (1) type-checks against the editor's ambient types, (2) evaluates and meshes against the OCCT kernel in the root test suite, and (3) ships a committed .webp thumbnail. Miss any one and CI or the gallery breaks.

For bulk import from an OpenSCAD reference library, use the /scad-to-playground workflow instead — it encodes the same validate→render→repair loop for many examples at once. This skill is the manual, single-example counterpart.

Example anatomy

An example is an Example { id, label, description, code } (apps/playground/src/lib/examples/types.ts). Examples live in category files and are aggregated by a barrel:

FileCategoryNotes
apps/playground/src/lib/examples/basics.tsBasicsCalibration for house comment style
apps/playground/src/lib/examples/mechanical.tsMechanicalLargest set
apps/playground/src/lib/examples/sheetMetal.tsSheet Metalimports brepjs-sheetmetal
apps/playground/src/lib/examples/bim.tsBIMimports brepjs-bim, uses top-level await
apps/playground/src/lib/examples/families.tsFamiliesimports brepjs-families (+ brepjs-bim for the IFC projection)
apps/playground/src/lib/examples/index.tsbarrelbuilds CATEGORIES + flat EXAMPLES

To add an example: append an Example to the appropriate category array. To add a new category: create a file exporting an Example[], then register it in CATEGORIES (index.ts).

Code-string rules (hard constraints)

The code field becomes the Monaco editor buffer verbatim AND is executed by both the browser worker and the root test harness. It must obey (types.ts):

  • Self-contained. No shared helpers, no imports of other examples, no TS-only constructs the harness's sucrase strip can't handle (transforms: ['typescript'], tests/helpers/playgroundExampleEval.ts).
  • Named imports only, from the recognized specifiers. The eval harness rewrites only the import { … } from '<spec>' form for these specifiers: brepjs, brepjs/quick, brepjs/playground, brepjs-sheetmetal, brepjs-bim, brepjs-families (playgroundExampleEval.ts). Namespace (import * as) and default imports are NOT rewritten and will fail at runtime. Prefer 'brepjs/quick'.
  • Ends in export default <shape | shape[]>. Return one shape or an array; an array renders each shape. The harness turns export default into return (playgroundExampleEval.ts).
  • color() / present() come from 'brepjs/playground', not published API. color(shape, css) tags a color; present(shape, { dxf, ifc, bimTree, overlay2d }) attaches downloadable artifacts. Both are stripped back to the shape before meshing (playgroundExampleEval.ts, 108-113).
  • unwrap() finishing ops — never x.ok ? x.value : base. See Gate 2; the silent-fallback ban is enforced by regex.
Comment style

Match basics.ts: one punchy header line, aligned trailing dimension comments, terse one-line section notes. Example from basics.ts:

const drilled = unwrap(cut(box(30, 20, 10), cylinder(5, 15, { at: [15, 10, -2] })));

Keep comments concise — they are read in a small Monaco pane. Avoid multi-line walls of prose.

The three gates

Gate 1 — types (check:examples)
cd apps/playground && npm run check:examples

apps/playground/scripts/checkExamples.ts type-checks every example's code against the generated ambient .d.ts files (src/types/brepjs-ambient.d.ts, -sheetmetal-, -bim-, -families-), wrapped into declare module blocks by the same buildBrepjsModuleDts the Monaco editor uses, with the editor's compiler options (ES2022, moduleResolution Bundler, strict, skipLibCheck). Passing == "no red squiggles in the editor". It also checks the docs landing hero snippet docs-hero:PLAYGROUND_PROGRAM extracted from apps/docs/.vitepress/theme/components/CodeCadHero.vue — if that template literal is renamed or moved, the script exits 1 with a pointed message.

On failure, decide the cause:

SymptomCauseFix
Error on an API the example usesExample bugFix the code string
Method/type exists in src but not the ambient .d.tsStale ambient typesRebuild the package(s), run npm run generate-types, commit the regenerated src/types/*-ambient.d.ts
"Could not find PLAYGROUND_PROGRAM"Hero literal movedRestore the literal or update the PLAYGROUND_PROGRAM regex in checkExamples.ts

Regenerating types: generate-ambient-types.ts reads each package's built node_modules/<pkg>/dist/index.d.ts (build the package first), and deliberately excludes the experimental implicit/ modules (EXCLUDED_MODULE_RE = /(^|\/)implicit\//, generator lines 60-64) because they re-export core primitives aliased as sdfCylinder etc. that would otherwise overwrite the real cylinder/box/cone. Satellite packages re-emit their brepjs-sourced names as a top-of-file import type { … } from 'brepjs' that resolves against the sibling declare module 'brepjs' at consumption time — leave that mechanism intact. See kernel-abstraction and companion-packages skills for package build order.

Where it runs in CI: the playground build script is tsc -b && npm run check:examples && vite build (package.json), reached through the site-build job's npm run build:site (path-gated on the site filter in .github/workflows/ci.yml). The playground's prebuild hook (build:deps) builds brepjs-families, brepjs-bim, brepjs-sheetmetal, and brepjs-viewer first.

Gate 2 — geometry (tests/playgroundExamples.test.ts)
npx vitest run --project occt-wasm tests/playgroundExamples.test.ts

Run from the repo root. This lives in tests/, so it is part of the root suite and needs no dist build — root vitest aliases brepjs, brepjs-sheetmetal, brepjs-bim, and brepjs-families to live src (vitest.config.ts). Pre-commit's changed-file run (vitest run --project occt-wasm --changed) picks it up when an example file changes, because vitest --changed follows the import graph into apps/playground/src/lib/examples/.

Four assertion families (tests/playgroundExamples.test.ts):

  1. Unique id and label across all examples (lines 20-25).
  2. Evals + meshes: each example produces shapeCount > 0 and totalVertices > 0 (lines 27-33).
  3. No silent finishing-op fallback: the regex /(\.ok\s*\?[^:]*:|isOk\s*\([^)]*\)\s*\?[^:]*:)/ must not match — patterns like x.ok ? x.value : base or isOk(x) ? unwrap(x) : base are banned (lines 40-48). A swallowed fillet/chamfer failure makes a no-op pass the mesh check while shipping an unfinished part. Use unwrap() so failures throw and get caught. See result-error-handling.
  4. Connected-body check for a hard-coded assembly list CONNECTED_BODY_EXAMPLES (universal-joint, geneva-drive, bench-vise, scotch-yoke, three-jaw-chuck, worm-gear-drive, lines 55-62): each exported body must have getSolids().length === 1. A disjoint compound still meshes but detaches on STEP/GLB export. When adding a multi-body mechanism/assembly example, add its id to this list.

If geometry is wrong (see debugging-geometry for the full triage): common example pitfalls are revolve() of a profile whose edge touches the axis (degenerate), features added where they should be cut (inverted boolean), and the silent-fallback pattern above.

Show full SKILL.md (449 more words)Show less
Gate 3 — thumbnail (committed .webp)

Each example needs a committed apps/playground/public/example-thumbs/<id>.webp (58 static thumbnails committed today; a further 46 optional .turntable.webp files also live here), consumed by ExampleGallery.tsx. Generating one requires a running dev server:

cd apps/playground
(npm run dev > tmp/pg.log 2>&1 &) ; sleep 6
PORT_URL=$(grep -oE 'http://localhost:[0-9]+' tmp/pg.log | head -1)
npm run thumbs "$PORT_URL" <example-id>

Vite may pick a non-5173 port if one is busy — always sniff the actual URL from the log, don't hardcode. npm run thumbs (shootExamples.ts --thumbs) frames the model (Iso preset, Fit, grid off) and writes a centred square WebP. Commit public/example-thumbs/<id>.webp.

Optional companion: npm run turntables "$PORT_URL" <id> writes an animated <id>.turntable.webp (needs img2webp or ffmpeg on PATH and the DEV-only window.__brepjsOrbit hook). The gallery lazy-loads it on hover and remembers 404s, so a missing turntable is tolerated — many examples ship only the static webp.

Visual-repair loop: npm run shoot "$PORT_URL" tmp/shots <id> writes a full-page PNG; Read it to confirm the shape looks right, edit the code, re-run Gate 2, re-shoot. A shape can pass eval+mesh yet render off-centre, floating, or degenerate — the screenshot is the only thing that catches that.

Symptom → cause → fix

SymptomCauseFix
Gates green, browser shows blank/broken viewerStale companion dist (worker lazy-imports brepjs-bim/brepjs-sheetmetal/brepjs-families from their built dist, not src)build:deps runs on predev/prebuild and auto-heals; restart a long-running dev server after editing brepjs-bim/brepjs-sheetmetal/brepjs-families/brepjs-viewer. See companion-packages.
Namespace/default import fails at runtime but type-checksHarness only rewrites import { … } from formConvert to named imports
Example edit not lint/format-checked locallyPlayground app code is outside root lint/typecheck/lint-stagedIts own gates are tsc -b + check:examples + vite build, reached through the path-gated site-build CI job
Thumbnail command fails to connectWrong portSniff the port from the dev-server log
check:examples fails on the hero snippetHero literal moved in CodeCadHero.vueKeep PLAYGROUND_PROGRAM intact or update checkExamples.ts

Note: the production playground-smoke workflow only checks the deployed engine boots; it does NOT verify examples. Gate 2 is the sole guard that each example runs.

Checklist for a new example

  1. Add the Example to the right category file (or register a new category in index.ts).
  2. cd apps/playground && npm run check:examples — types green.
  3. npx vitest run --project occt-wasm tests/playgroundExamples.test.ts — geometry green (add multi-body assemblies to CONNECTED_BODY_EXAMPLES).
  4. Start dev server, npm run thumbs "$URL" <id>, commit public/example-thumbs/<id>.webp.
  5. Optional: npm run shoot "$URL" tmp/shots <id> + Read the PNG to confirm framing.

Additional resources

The in-code file headers are the authoritative depth and stay current with the code; read them rather than a restatement:

  • apps/playground/src/lib/examples/types.ts — authoring rules
  • apps/playground/scripts/checkExamples.ts — Gate 1
  • tests/playgroundExamples.test.ts + tests/helpers/playgroundExampleEval.ts — Gate 2 + eval harness mechanics
  • apps/playground/scripts/shootExamples.ts — Gate 3, audit and turntable modes
  • apps/playground/scripts/generate-ambient-types.ts + apps/playground/src/lib/ambientModule.ts — the editor type surface
  • .claude/workflows/scad-to-playground.js — bulk-import automation precedent

Sibling skills: debugging-geometry (wrong/empty geometry), result-error-handling (unwrap vs fallback), companion-packages (dist build order, stale-dist trap), quality-gates and ci-triage (gate/CI mechanics).

© andymai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/playground-examples of andymai/brepjs.

Open the folder on GitHubat commit ee50994

Compare with similar skills

Playground Examples next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Playground Examples compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Playground Examples this skillandymai/brepjs114—~3.7kAutomated safety check: PassApache-2.0
Install Anti-Slop Oxlint Rulesdmmulroy/anti-slop5.3k1 repos~2.2kAutomated safety check: PassMIT
Nx Run Tasksnomcopter/react-mosaic4.8k8 repos~613Automated safety check: PassCustom licence
Get API Docs with chubandrewyng/context-hub14k2 repos~775Automated safety check: PassMIT
Migrate Internal Package into GhostTryGhost/Ghost55k—~3.8kAutomated safety check: PassMIT
Open Code Review CLIalibaba/open-code-review44k—~3.1kAutomated safety check: PassApache-2.0

Similar skills

  • Installs, updates or migrates the vendored anti-slop Oxlint plugin in a repository, keeping local rule changes and the plugin's license and provenance files.

    5.3k GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • Nx Run Tasks

    nomcopter/react-mosaic

    Helps with running tasks in an Nx workspace. An agent skill from nomcopter/react-mosaic.

    4.8k GitHub starsUsed in 8 repos~613 tokens
    DevelopmentAuto-check passed
  • Get API Docs with chub

    andrewyng/context-hub

    Fetches current documentation for third-party APIs and SDKs with the chub CLI before the agent writes code against them, instead of relying on remembered API shapes.

    14k GitHub starsUsed in 2 repos~775 tokens
    DevelopmentAuto-check passed
  • Moves a package from another TryGhost repository into Ghost as an internal workspace package while keeping its Git history, with checkpoints for the steps that need an administrator.

    55k GitHub stars~3.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Open Code Review CLI

    alibaba/open-code-review

    Runs the ocr command-line tool to review Git changes, a commit or a branch comparison with an AI model, returning line-level comments and optionally applying fixes.

    44k GitHub stars~3.1k tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • Cutting A Release

    TriliumNext/Trilium

    A skill your agent uses when cutting, preparing, or debugging a Trilium release — bumping the monorepo version, tagging, or diagnosing a failed "Release" workflow run.

    38k GitHub stars~3.2k tokensUpdated today
    DevelopmentAuto-check passed

More from andymai/brepjs

All 21 skills in this repo
  • Implement

    andymai/brepjs

    A skill your agent uses when authoring or editing a brepjs .brep.ts part — writing the geometry with the functional API (box, cylinder, fuse, cut, fillet, sketch→extrude…), declaring an expected…

    114 GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Memory And Disposal

    andymai/brepjs

    This skill should be used when managing WASM handle lifetimes or hunting memory leaks in brepjs — when a task mentions "createHandle() without using keyword risks WASM memory leak"…

    114 GitHub stars~3.1k tokensUpdated today
    Auto-check passed
  • Polish

    andymai/brepjs

    A skill your agent uses when a valid brepjs part should look designed rather than glued-from-primitives (products, toys, mechanisms, anything a human eyeballs), and when exporting/handing off the…

    114 GitHub stars~588 tokensUpdated today
    Auto-check passed
  • Wasm Interop

    andymai/brepjs

    This skill should be used when working across the JS/WASM boundary in brepjs — writing or debugging code in src/kernel/occt, src/kernel/occtWasm, or src/kernel/brepkit, or diagnosing symptoms like…

    114 GitHub stars~3k tokensUpdated today
    Auto-check passed
  • Writing Tests

    andymai/brepjs

    This skill should be used when writing, running, or fixing tests in the brepjs repository — when a task says "add a test", "write a regression test", "tests are failing", "test timed out", "coverage…

    114 GitHub stars~4.3k tokensUpdated today
    Auto-check passed
  • Adding Operations

    andymai/brepjs

    This skill should be used when adding or extending a geometric shape operation in brepjs — the end-to-end recipe once the target module is chosen (which is decided by architecture-navigation) — when…

    114 GitHub stars~4.4k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Playground Examples

What does Playground Examples do?

This skill should be used when adding, editing, or fixing an example in apps/playground — when a task says "add a playground example", "example fails check:examples", "playgroundExamples.test.ts is…. Playground Examples is an agent skill from andymai/brepjs.ts is failing", "regenerate ambient types", "generate-types", "example thumbnail is missing", "run npm run thumbs", "example renders wrong / blank viewer", "example works in tests but breaks in the browser", or when a new example needs to pass its three gates (types, geometry, thumbnail) before merge.

When should I use Playground Examples?

Playground Examples fits situations like: development work in your project.

How do I install Playground Examples in Claude Code?

Run `npx skills add andymai/brepjs --skill playground-examples -a claude-code`. Or copy the skill folder (.claude/skills/playground-examples in andymai/brepjs) into .claude/skills/playground-examples in your project. Claude Code loads it when a task matches its description.

How do I install Playground Examples in Codex?

Run `npx skills add andymai/brepjs --skill playground-examples -a codex`. Or copy the skill folder (.claude/skills/playground-examples in andymai/brepjs) into .agents/skills/playground-examples in your project. Codex loads it when a task matches its description.

Can I use Playground Examples in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add andymai/brepjs --skill playground-examples -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/playground-examples, .gemini/skills/playground-examples, .github/skills/playground-examples and .opencode/skills/playground-examples in your project.

What does Playground Examples need to run?

Going by SKILL.md and its folder, Playground Examples needs the command-line tools its instructions call (npm, npx, tsc and vitest). Our summary lists: Node.js.

Does Playground Examples access the network?

SKILL.md contains no URLs. Its commands use npm and npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Playground Examples safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Playground Examples use?

Playground Examples is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Playground Examples use?

About 3.7k tokens (SKILL.md is roughly 15k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Playground Examples?

Skills that share tags, products or a category with Playground Examples: Install Anti-Slop Oxlint Rules (dmmulroy/anti-slop, 5.3k stars), Nx Run Tasks (nomcopter/react-mosaic, 4.8k stars), Get API Docs with chub (andrewyng/context-hub, 14k stars) and Migrate Internal Package into Ghost (TryGhost/Ghost, 55k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Playground Examples?

andymai (a GitHub user) maintains it in andymai/brepjs, which has 114 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on October 8, 2026.

Source: andymai/brepjs on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.