About rive-script-builder
Rive Script Builder is a skill for Rive creators to write, fix, and review runnable Rive Luau scripts. It emphasizes choosing the correct protocol, verifying API signatures, and providing editor wiring and debugging guidance.
Key features
- 01Route tasks to the appropriate Rive protocol
- 02Generate typed Luau scripts
- 03Consult Rive docs and verify APIs
- 04Provide editor wiring steps
- 05Suggest debugging and tests
- 06Follow lifecycle and runtime constraints
Use cases
- 01Implement a clear Rive scripting request
- 02Investigate script API or protocol choices
- 03Plan multi-script work and editor bindings
MCP support
It can use Context7 MCP to look up Rive documentation and verify exact or uncertain API details; if unavailable, it follows the documented local script lookup fallback.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ sanqiushili/ rive_skills --skill rive-script-builderAfter installing, type/rive-script-builderin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamldocs/api-signature-cheatsheet.mdclarification-checklists.mdcommon-errors-and-fixes.mdcontext7-query-recipes.mddata-binding-deep-dive.mddebug-test-playbook.mdeditor-wiring-recipes.mdlive-docs-workflow.mdpath-api-performance-notes.mdpointer-events-playbook.mdprotocol-router.mdquality-gates.mdREADME.mdscript-inputs-deep-dive.mdsource-scripting-index.mddocs/source-scripting/api-reference/artboards/animation.mdxartboard.mdxnode-data.mdxnode-read-data.mdxpointer-event.mdxview-model.mdxdocs/source-scripting/api-reference/color/color.mdxdocs/source-scripting/api-reference/data-value/data-value-boolean.mdxdata-value-color.mdxdata-value-number.mdxdata-value-string.mdxdata-value.mdxlistener.mdxproperty-trigger.mdxDetails
From the project READMERive Script Builder
Build accurate, runnable Rive Luau scripts. Optimize for correct protocol choice, valid Luau signatures, editor wiring, and minimal user back-and-forth.
Knowledge policy:
- Use embedded essentials in this file and local references for common protocol work.
- Prefer Context7 MCP lookup for exact or uncertain API details (library:
/rive-app/rive-docs). - If Context7 is unavailable, fall back to
sync_rive_docs.pyonline/cache/offline chain. - Never invent APIs, lifecycle methods, or editor menus.
Fast Operating Mode
- If the user explicitly asks to write/fix/review code and the protocol is clear, proceed directly with a small implementation.
- If one or two details are ambiguous, make reasonable assumptions and state them before the code.
- Ask questions only when the answer changes protocol choice, data ownership, or editor wiring.
- Use a pending plan and wait for approval only for broad/unclear requests, risky rewrites, or multi-script architecture.
Critical Rive Runtime Context
- Rive scripts run in Rive's sandboxed Luau VM, not Roblox, browser JavaScript, or normal Lua.
- Do not use file I/O, network,
os.execute,loadstring, Roblox globals, or shared mutable module state for attachable scripts. - Script names should be PascalCase; the main exported type should match the script name when practical.
- Every attachable script returns a factory function that creates a fresh instance per attachment.
- Use
late()for Rive objects created ininit, editor-assigned references,Input<Data.X>, and other values initialized later. Input<Trigger>defaults tofunction() end, notlate()ornil.- Primitive
Input<T>values are read directly, for exampleself.speed, notself.speed.value. - Normal script inputs are effectively read-only from scripts. Runtime writes should go through ViewModel data.
Coloris immutable; channel helpers return new colors.- Keep callbacks bounded and deterministic. Long synchronous loops can be killed by the runtime.
Non-Negotiable Contract
- Parse user goal and recommend protocol(s) first.
- Ask only high-impact unresolved questions.
- For unclear/risky tasks, provide a "pending implementation plan" before writing code.
- Wait for explicit approval only when the task needs that pending plan.
- For approved or already-clear implementation requests, output:
- Luau script code
- Rive editor wiring steps
- Debug and test suggestions
- Follow the user's language automatically.
- If approval is required but missing, do not output final script code.
Workflow
Phase 0: Live Docs Lookup (When Needed)
Lookup order when exact API confirmation is needed:
- Context7 MCP (primary)
scripts/sync_rive_docs.py(secondary fallback)
Context7 MCP primary call:
resolve-library-id -> /rive-app/rive-docs
query-docs(libraryId="/rive-app/rive-docs", query="<target API/protocol question>")
Query templates:
docs/context7-query-recipes.md
Fallback lookup commands:
cd /path/to/rive-script-builder
python3 scripts/sync_rive_docs.py search --source auto --query "PathEffect"
python3 scripts/sync_rive_docs.py show --source auto --path scripting/protocols/path-effect-scripts.mdx
Optional cache prewarm (recommended, not required):
cd /path/to/rive-script-builder
python3 scripts/sync_rive_docs.py sync
Resolve scripts/sync_rive_docs.py relative to this SKILL.md; do not assume a fixed global skill directory.
auto fallback chain:
search: online -> cache -> offlineshow: online -> cache
If fallback happens, keep the reason explicit in output.
See docs/live-docs-workflow.md.
Offline knowledge includes full upstream mirror at docs/source-scripting/.
Phase 1: Scope and Route
- Identify target protocol using
docs/protocol-router.md. - Use
docs/api-signature-cheatsheet.mdto lock exact method signatures. - If exact API details are ambiguous, check matching files in
docs/source-scripting/api-reference/. - For data-driven scripts, align with
docs/data-binding-deep-dive.mdanddocs/script-inputs-deep-dive.md. - If multiple protocols are needed, propose the smallest viable combination and explain why.
- State assumptions explicitly.
Phase 2: Clarify Uncertainty
- Ask only questions that change implementation decisions.
- Use
docs/clarification-checklists.md. - For interaction-heavy requests, use
docs/pointer-events-playbook.mdto narrow unresolved event-routing details. - Skip questions already answered by user context.
Phase 3: Present Pending Plan
Use this phase only when the request is broad, underspecified, or likely to require multiple scripts.
Present this structure before coding:
- Goal understanding
- Recommended protocol(s) and rationale
- Assumptions and constraints
- Implementation outline (functions, inputs, data flow)
- Rive wiring steps
- Debug and test plan
- Explicit confirmation request
If user does not approve, keep refining plan only.
Phase 4: Implement
- Generate minimal, runnable, typed Luau script first when the request is clear or approved.
- Extend with requested behavior only.
- Reuse templates from
references/scaffold-templates.md. - For common tasks, start from
references/case-recipes.mdand adapt. - Keep protocol lifecycle contracts valid.
Phase 5: Deliver With Integration Guidance
Always include:
- Final Luau code
- Editor wiring instructions (where to attach, bind, and run)
- Debug checklist (Problems and Console)
- Test suggestions (especially Test scripts for Util logic)
Use docs/editor-wiring-recipes.md and docs/debug-test-playbook.md.
Use docs/path-api-performance-notes.md for path-heavy scripts.
Use docs/quality-gates.md as final quality checklist.
Protocol and API Guardrails
- Never invent lifecycle functions, interfaces, or editor paths.
- Prefer
Vectoras the canonical vector type;Vec2Dmay exist as an alias but should not be the default in generated code. Node.update(self)is for input-change recomputation.PathEffect.update(self, inPath)receives host path data and returns replacement path data.- Luau uses
~=,and,or,not; do not output JavaScript/C syntax such as!=,&&,||, or!. - Do not use
import/export default; use Rive'srequire("UtilName")andreturnpatterns. - Do not mutate state in
draw; rebuild paths inupdateor before drawing inadvance. - Do not mutate or
reset()aPathagain in the same frame after drawing it. - Keep
TransitionCondition.evaluatefast and side-effect free. - Use
ListenerAction.performfor side effects. - For
PathEffect, keepupdatedeterministic; useadvanceonly for time-based behavior. - Remember: scripts cannot set normal input values; use context or view model access for writable data.
- Bind strings to Text Runs, not parent Text objects.
- Remove long-lived listeners when no longer needed to avoid leaks.
- Check
docs/common-errors-and-fixes.mdbefore final handoff. - If required details are missing, ask before coding.
Output Format
When approval is needed:
- Understanding
- Open questions
- Pending plan
- Confirmation prompt
For direct implementation, or after approval:
- Script code
- Wiring steps
- Debug plan
- Test plan
Docs and References Map
- Live docs sync and fallback rules:
docs/live-docs-workflow.md - Cross-platform publishing guidance:
docs/publish-cross-platform.md - Protocol routing and method contracts:
docs/protocol-router.md - Signature and API quick reference:
docs/api-signature-cheatsheet.md - Clarification questions by protocol:
docs/clarification-checklists.md - Data binding deep dive:
docs/data-binding-deep-dive.md - Script inputs deep dive:
docs/script-inputs-deep-dive.md - Pointer events playbook:
docs/pointer-events-playbook.md - Path API and performance notes:
docs/path-api-performance-notes.md - Final quality gates:
docs/quality-gates.md - Context7 query templates:
docs/context7-query-recipes.md - Full mirror index:
docs/source-scripting-index.md - Full upstream mirror folder:
docs/source-scripting/ - Editor attach and binding steps:
docs/editor-wiring-recipes.md - Debug and test workflow:
docs/debug-test-playbook.md - Common errors and fixes:
docs/common-errors-and-fixes.md - Minimal Luau templates:
references/scaffold-templates.md - Practical case recipes:
references/case-recipes.md