theatrejs
Skill1 starsChanged 8 days agoMITView on GitHub
Audit how a codebase uses Theatre.js, report what ships broken or wasteful, agree a plan, then fix. Theatre.js has a sharp dev/prod split: Studio (@theatre/studio) is an authoring GUI that must be dev-only (bundlers tree-shake it out of if (import.meta.env.DEV) / NODE_ENV === 'development' gates), production plays back from an exported project-state JSON passed to getProject, and playback code must await sheet.project.ready. Most audits find Studio in prod bundles, missing or stale state JSON, and autoplaying sequences without reduced-motion gates.…
- Reads credentials
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architecture-optimizerSkill
- csharp-optimizerSkill
- cpp-optimizerSkill
- c-optimizerSkill
- go-optimizerSkill
- node-service-optimizerSkill
- ruby-optimizerSkill
- rust-optimizerSkill
- docker-optimizerSkill
- kubernetes-optimizerSkill
- terraform-optimizerSkill
- animate-cssSkill
- animejsSkill
- auto-animateSkill
- gsapSkill
- lenisSkill
- magicuiSkill
- motionSkill
- react-moveSkill
- react-springSkill
- react-three-fiberSkill
- threejsSkill
- optimizer-routerSkill
- bootstrap-optimizerSkill
- pandacss-optimizerSkill
- sass-scss-optimizerSkill
- stylex-optimizerSkill
- tailwindcss-optimizerSkill
- twind-optimizerSkill
- unocss-optimizerSkill
- vanilla-extract-optimizerSkill
- angular-optimizerSkill
- astro-optimizerSkill
- ui-components-optimizerSkill
- nextjsSkill
- node-optimizerSkill
- nuxt-optimizerSkill
- react-optimizerSkill
- remix-optimizerSkill
- solid-optimizerSkill
- svelte-optimizerSkill
- tanstack-start-optimizerSkill
- vue-optimizerSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Run python <skill-dir>/scripts/audit.py <project-root> [--json] — inventories studio gating, project-state wiring (getProject + { state }), …
- Distinctive: line 28
Read what the script flagged.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
name: theatrejs-optimizer description: Audit and optimize Theatre.js usage (@theatre/core + @theatre/studio + @theatre/r3f) — Studio left un-gated in production bundles (the classic mistake; studio bloat + exposed edit UI), getProject without exported project state JSON, sequence.play called before sheet.project.ready, SheetProvider/Sheet wiring in R3F, editable-object theatreKey drift between Studio and code, infinite autoplay sequences (iterationCount: Infinity) without a reduced-motion gate, and project JSON size/linting. Report with evidence and a plan approved before edits. Use when the user mentions Theatre.js, @theatre/core, @theatre/studio, @theatre/r3f, sequence, sheet, or theatreKey -- even if they don't say "optimize".
Theatre.js (@theatre/core) Optimizer
Audit how a codebase uses Theatre.js, report what ships broken or wasteful, agree a plan, then fix.
Theatre.js has a sharp dev/prod split: Studio (@theatre/studio) is an authoring GUI that must be
dev-only (bundlers tree-shake it out of if (import.meta.env.DEV) / NODE_ENV === 'development'
gates), production plays back from an exported project-state JSON passed to getProject, and
playback code must await sheet.project.ready. Most audits find Studio in prod bundles, missing or
stale state JSON, and autoplaying sequences without reduced-motion gates. Report first, plan
approved, then edit.
Workflow
1. Scope (quick)
- Project root (
package.json—@theatre/core,@theatre/studio,@theatre/r3fversions; note R3F/three presence since@theatre/r3fextends R3F). - Run
python <skill-dir>/scripts/audit.py <project-root> [--json]— inventories studio gating, project-state wiring (getProject+{ state }),project.readyordering, SheetProvider setup,theatreKeyusage,sequence.playcall sites, autoplay loops, reduced-motion coverage.
2. Audit
Read what the script flagged. Load references as fit:
| Area | Reference |
| Architecture & lifecycle: projects/sheets, state JSON, studio dev-only | references/architecture.md |
| R3F integration: SheetProvider, editable objects, extension setup | references/r3f-integration.md |
| Sequences: play options, ready, timing, autoplay + a11y | references/sequences-a11y.md |
Runtime checks you do by hand: run a prod build — does the Studio UI appear (it must not)? Does the scene play from the exported JSON (not just localStorage)? Reduce-motion emulation on autoplay.
Mark findings Confirmed or Suspected.
3. Report
Fill in assets/report-template.md, save as THEATREJS_REPORT.md in the project root. Group:
studio gating, project state, sequence wiring, a11y.
4. Plan — stop for approval
- Quick wins — gate
studio.initialize()/studio.extend()behind env checks; awaitsheet.project.readybeforesequence.play; re-export a current state JSON if the stored one lags the scene; add a reduced-motion guard before autoplay (iterationCount: Infinity). - Structural — split Studio init into a dev entry module; thread project state through
getProject(name, { state })consistently; consolidate sheet names between Studio and code. - Optional — trimming project JSON (unused objects props/columns dead keys), moving state fetch to runtime loading when JSON is large. Per step: files, expected effect, verification, rollback. Let the user drop or reorder.
5. Fix
Approved items only. Theatre.js changes are visible: verify each group by playing the scene in a dev build (Studio still available), then in a prod build (Studio absent, playback from JSON states).
6. Verify and wrap up
- Bundle deltas (Studio out of the prod bundle is usually the largest single win).
- Prod-build playback walkthrough; state JSON re-export round-trip; reduced-motion emulation.
- Deferred items + next step.
Principles
- Studio never ships. It is the authoring GUI; prod builds play back state JSON and stay clean of Studio code — relying on tree-shaking via an env gate, verified by a prod build.
- State JSON is the source of truth. Studio edits persist to localStorage; a prod site must receive an exported project state or nothing plays.
readybeforeplay. Projects load asynchronously; sequencing without awaitingsheet.project.readyraces.- One project, stable sheets.
getProject(name)is a registry — mismatched names/sheets between Studio sessions and code silently no-op. - Autoplay is an a11y decision.
iterationCount: Infinityloops forever; gate behindprefers-reduced-motion. - Docs over memory. Theatre.js moves version to version; fetch current docs (theatrejs.com) before quoting APIs in a plan.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

