The Complete Production SOP: How to Deploy and Run Stencil Web Component Compiler & Design System Bundler in Autonomous AI Agents
Step-by-step SOP to install and run Stencil Web Component Compiler in Codex, Claude Code, and Cursor. Build cross-framework design systems deterministically.
Technical Overview & Architectural Context
Autonomous coding agents frequently encounter friction when scaffolding cross-framework design systems using Stencil. Without strict boundaries, LLMs conflate standard React JSX patterns with Stencil's JSX compiler constraints (e.g., misusing class instead of class/className conventions, failing to bind custom element lifecycle methods, or improperly mutating reactive @Prop state internally). Furthermore, AI agents often overlook critical configuration requirements in stencil.config.ts, such as distinct targets for React, Vue, or Angular wrappers and Shadow DOM style encapsulation boundaries. The stencil-cross-framework-components skill provides a deterministic procedural guardrail. It enforces Stencil's specific decorator patterns (@Component, @Prop, @State, @Watch, @Event), formalizes the component lifecycle (componentWillLoad, componentDidLoad), and prevents agents from writing invalid custom element wrappers. By enforcing workspace-scoped filesystem boundaries and deterministic output verification gates, this skill guarantees that generated components build cleanly to standards-compliant Custom Elements and multi-framework packages.
Prerequisites & Environment Requirements
Verified Search Intents & Long-Tail Queries Solved
This operational tutorial is engineered to provide deterministic solutions for these developer search queries:
Step-by-Step Execution Playbook
Local Environment Setup & SKILL.md Mounting
Create the local skill manifest directory and inject verified procedural rules into the agent context.
Autonomous agent runtimes discover deterministic behavioral rules through standardized manifests. By placing SKILL.md in your agent skill registry directory (~/.agents/skills/ for global discovery, or .cursor/skills/ for project-level Cursor usage), the runtime parses the YAML frontmatter triggers and activates specialized Stencil compilation constraints when invoked.
mkdir -p ~/.agents/skills/stencil-cross-framework-components && curl -fsSL https://askills.dev/api/skills/stencil-cross-framework-components/raw -o ~/.agents/skills/stencil-cross-framework-components/SKILL.md---
name: "stencil-cross-framework-components"
description: "Build standards-compliant design systems that compile to native Web Components for all frameworks."
metadata:
author: "Ionic Team"
version: "1.0.0"
runtime_compatibility:
- "codex"
- "claude-code"
- "cursor"
- "windsurf"
triggers:
- "build design system stencil"
- "generate react bindings stencil"
- "stencil component lifecycle"
permissions:
fs_read: true
fs_write: "workspace"
shell_exec: false
net_access: false
---In Claude Code or Cursor, mount the skill directly in .claude/skills/ or .cursor/rules/ to bypass loading unused skills, preserving up to 4,000 context tokens per agent iteration.
Ensure fs_write permissions remain restricted to 'workspace'. Setting fs_write to global can lead to accidental overwrites of system-level Node modules or parent repository configurations.
Stencil Project Scaffolding & Configuration
Initialize the design system repository and define framework wrapper output targets in stencil.config.ts.
Stencil requires precise configuration in stencil.config.ts to export custom element definitions alongside wrapper packages for React (@stencil/react-output-target) and Vue (@stencil/vue-output-target). This step ensures the agent prepares build targets without hallucinating non-existent bundler flags.
npm init stencil component design-system-core && cd design-system-core && npm install -D @stencil/react-output-targetimport { Config } from '@stencil/core';
import { reactOutputTarget } from '@stencil/react-output-target';
export const config: Config = {
namespace: 'design-system-core',
outputTargets: [
{
type: 'dist',
esmLoaderPath: '../loader',
},
{
type: 'dist-custom-elements',
customElementsExportBehavior: 'auto-define-custom-elements',
externalRuntime: false,
},
reactOutputTarget({
componentCorePackage: 'design-system-core',
proxiesFile: '../packages/react-bindings/src/components.ts',
}),
],
};Instruct the agent to use 'dist-custom-elements' with customElementsExportBehavior set to 'auto-define-custom-elements' to eliminate tree-shaking dead code in consumer bundles.
Omitting componentCorePackage inside reactOutputTarget will cause build-time proxy module resolution failures in downstream monorepo consumers.
Intent Matching & Trigger Invocation
Verify deterministic activation using tested natural language prompts for component architecture.
Trigger matching works best when the user prompt incorporates frontmatter triggers such as 'build design system stencil' or 'generate react bindings stencil'. This signals the agent to follow the decorator conventions (@Component, @Prop, @State) and avoid React-specific hooks or Vue composition APIs inside Stencil classes.
import { Component, Prop, State, Event, EventEmitter, h } from '@stencil/core';
@Component({
tag: 'ds-button',
styleUrl: 'ds-button.css',
shadow: true,
})
export class DsButton {
@Prop({ reflect: true }) variant: 'primary' | 'secondary' = 'primary';
@Prop() disabled: boolean = false;
@State() isPressed: boolean = false;
@Event() dsClick: EventEmitter<void>;
private handleClick = () => {
if (!this.disabled) {
this.isPressed = !this.isPressed;
this.dsClick.emit();
}
};
render() {
return (
<button
class={`btn btn-${this.variant} ${this.isPressed ? 'active' : ''}`}
disabled={this.disabled}
onClick={this.handleClick}
>
<slot />
</button>
);
}
}Ensure @Prop definitions with primitive values exposed as attributes set reflect: true, allowing external CSS selectors to bind styling dynamically without mutation observers.
Never attempt to mutate a @Prop directly inside the component class; Stencil props are immutable by default unless { mutable: true } is explicitly declared.
Verification, Linting & Output Quality Gate
Execute automated compiler type-checks, unit tests, and framework proxy audits.
Before closing the agent task loop, run Stencil's internal compiler verification suite. This runs Jest-based Spec tests, builds custom element outputs, and ensures downstream React binding files match the emitted typings.
npm run build && npm run test:specAlways inspect git status --short and inspect the generated proxiesFile to confirm bindings were emitted cleanly without syntax errors before merging.
Do not let agents suppress Stencil compiler warnings (like STC-100 or non-reflecting attribute warnings); treat compiler diagnostics as hard quality gate errors.
Real-World Scenario: Implement an Accessible Cross-Framework Modal Dialog with React Proxies
“Using Stencil Web Component Compiler & Design System Bundler, build design system stencil component ds-modal with shadow DOM, reactive @Prop isOpen, keyboard escape listener, and generate react bindings stencil in packages/react-bindings.”
Runtime Troubleshooting & Failure Modes
Root Cause: The agent attempted to reassign an internal @Prop value directly (e.g., this.isOpen = false) without configuring the prop as mutable.
Change the prop decorator declaration to: @Prop({ mutable: true, reflect: true }) isOpen: boolean = false; or delegate the modification to a separate internal @State variable.Root Cause: The reactOutputTarget proxy destination path was not created by the agent or stencil build failed before generating the proxy file.
mkdir -p packages/react-bindings/src && npx stencil build --docsFrequently Asked Questions (Stencil Web Component Compiler & Design System Bundler SOP)
Q:Can I use Stencil Web Component Compiler & Design System Bundler across Codex, Claude Code, and Cursor simultaneously?
Yes. The skill conforms to the universal SKILL.md specification supported across all modern agent runtimes. You can mount the single manifest locally or across distributed team IDE configs.
Q:How does Stencil Web Component Compiler & Design System Bundler prevent context window overflow during long agent sessions?
By establishing concise procedural boundaries and deterministic validation gates rather than polluting system prompts with redundant rules, the agent retains maximum context for your design tokens and custom elements.
Q:Does this skill require escalated root or container permissions?
No. It is audited with a security score of 98/100 and runs safely within workspace-scoped sandboxes with shell execution disabled by default.
Ready to equip your autonomous agent with Stencil Web Component Compiler & Design System Bundler?
Copy the complete audited SKILL.md specification or download the 1-click zip bundle directly from our verified registry.