stackblitz-core-workflow-a
Architect a custom in-browser development experience around WebContainers with explicit file, editor, terminal, process, preview, and persistence boundaries. Use when evolving a playground into a maintainable IDE-like product. Trigger with "build a WebContainer IDE", "browser code editor architecture", or "StackBlitz playground design".
Allowed Tools
Provided by Plugin
stackblitz-pack
Production StackBlitz workflows for WebContainer lifecycle, embeds, testing, diagnostics, capacity, and security (10 skills)
Installation
This skill is included in the stackblitz-pack plugin:
/plugin install stackblitz-pack@claude-code-plugins-plus
Click to copy
Instructions
Custom WebContainer Experience Architecture
Overview
This skill converts an IDE-like feature request into a bounded architecture. It keeps the host UI, virtual filesystem, editor models, terminal streams, runtime processes, preview frames, and persistence strategy separate so a prototype does not accidentally become an unsafe monolith.
Prerequisites
- Named user journeys and a target browser application
- A decision that a custom WebContainer experience is preferable to a StackBlitz SDK embed
- Product, licensing, security, and persistence owners for production use
Tool Discipline
Use Read, Glob, and Grep to map the host framework, editor and terminal libraries, application state, persistence, and runtime boundary. Use WebFetch only for current official StackBlitz or WebContainers documentation. Use Write or Edit only for a user-approved bounded slice.
Current Contract
- The host application owns a single lifecycle adapter; individual panes do not call
boot()orteardown(). - File explorer paths are validated and normalized before virtual-filesystem operations; editor models use stable canonical paths.
- Terminal input/output is explicitly bound to one process and released on disposal.
- Preview URLs come from runtime events and are treated as untrusted application content, not trusted host UI.
- The WebContainer filesystem is not a persistence guarantee. Define an explicit save/export/versioning path before claiming durable work.
- Register error, port, and server readiness observers with bounded logging and unsubscribe ownership.
Authentication
Do not mount host secrets, auth tokens, customer .env files, or ambient browser credentials into user-controlled projects. If private packages are required, use the documented organization auth boundary and disclose which project code can access installed material.
Workflow
- Define the smallest user journey and decide which panes and runtime capabilities it truly needs.
- Draw ownership for host state, lifecycle adapter, filesystem, editor models, process/terminal handles, preview, and persistence.
- Establish a typed message/event contract between panes instead of sharing raw runtime globals.
- Implement one vertical slice: open a synthetic file, edit it, write it, run a bounded command, and display the emitted preview URL.
- Add path-policy, process-cancellation, preview isolation, save/export, and permanent-disposal behavior.
- Verify keyboard/accessibility behavior, HMR ownership, memory cleanup, and recovery from failed startup before expanding features.
Approval Boundaries
Require explicit approval before executing arbitrary user code, persisting or exporting user files, connecting private registries, injecting preview scripts, or enabling collaboration/telemetry. Present data flow, abuse cases, retention, and rollback first.
Output
Return the user journey, component and trust-boundary map, lifecycle and data contracts, implemented slice, verification evidence, persistence semantics, rollout stages, rollback, and open product/security decisions.
Error Handling
| Condition | Response |
|---|---|
| UI panes share raw runtime state | Introduce a scoped adapter and typed events before adding features. |
| Editor and filesystem diverge | Reconcile by canonical path and explicit write acknowledgements. |
| Preview is treated as trusted | Isolate it and define allowed host-preview communication. |
| Persistence is unspecified | Label the experience ephemeral and stop durability claims. |
Examples
For an educational playground, implement one synthetic project with a file pane, editor, bounded terminal command, preview, and explicit download/export action while leaving collaboration and private packages out of scope.