一键导入
pix-storybook
Autonomous pixel-perfect Stencil component implementation using Figma MCP, Storybook, and Playwright MCP for visual testing and fixing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Autonomous pixel-perfect Stencil component implementation using Figma MCP, Storybook, and Playwright MCP for visual testing and fixing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | pix-storybook |
| description | Autonomous pixel-perfect Stencil component implementation using Figma MCP, Storybook, and Playwright MCP for visual testing and fixing. |
| allowed-tools | ["Bash","Read","Write","Edit","Glob","Grep","skill","mcp1_browser_*","mcp2_sequentialthinking"] |
Note: This skill requires Figma MCP, Playwright MCP, and Storybook. It leverages existing Stencil skills for component creation.
# Check for existing Storybook setup
ls -la .storybook/
cat package.json | grep storybook
If Storybook is not installed:
npx storybook@latest init --type web_components
whoamimcp1_browser_install.storybook/main.js for custom port# Check if already running
lsof -i :6006
# If not running, start in background
npm run storybook &
// Use Playwright MCP to open Storybook
mcp1_browser_navigate({ url: "http://localhost:6006" })
Ask for Figma link: "Paste the Figma link to the component you want to build (use 'Copy link to selection')"
Execute this sequence using Figma MCP tools:
Component Structure
// Get component hierarchy
figma_get_metadata({ node_id: "<extracted_id>" })
Design Context
// Get complete design specs
figma_get_design_context({ node_id: "<extracted_id>" })
Design Tokens
// Extract variables and tokens
figma_get_variable_defs({ file_id: "<file_id>" })
Existing Mappings
// Check for existing code components
figma_get_code_connect_map({ file_id: "<file_id>" })
mcp2_sequentialthinking({
thought: "Analyzing Figma design to plan Stencil component structure...",
thoughtNumber: 1,
totalThoughts: 5,
nextThoughtNeeded: true
})
Consider:
Use the appropriate skill based on component type:
// For new component creation
skill({
SkillName: "stenciljs-component-development"
})
// For design system components
skill({
SkillName: "stencil-atomic-design-system"
})
Create component following the cor- prefix pattern:
// src/components/cor-[component-name]/cor-[component-name].tsx
import { Component, Prop, h, Host } from '@stencil/core';
@Component({
tag: 'cor-[component-name]',
styleUrl: 'cor-[component-name].css',
shadow: true,
})
export class Cor[ComponentName] {
// Props based on Figma analysis
@Prop() variant: 'primary' | 'secondary' = 'primary';
@Prop() size: 'small' | 'medium' | 'large' = 'medium';
render() {
return (
<Host>
{/* Slot-based composition */}
<slot name="icon-left"></slot>
<slot></slot>
<slot name="icon-right"></slot>
</Host>
);
}
}
Map Figma tokens to CSS variables:
/* cor-[component-name].css */
:host {
/* Map to generated token variables */
--component-padding: var(--spacing-md);
--component-radius: var(--radius-md);
--component-font-size: var(--font-size-md);
--component-font-weight: var(--font-weight-semi-bold);
--component-color: var(--color-primary-text-default);
--component-background: var(--color-primary-background-default);
}
skill({
SkillName: "storybook-story-writing"
})
// src/components/cor-[component-name]/cor-[component-name].stories.ts
import { html } from 'lit';
import type { Meta, StoryObj } from '@storybook/web-components';
const meta: Meta = {
title: '[AtomicLevel]/Cor[ComponentName]',
component: 'cor-[component-name]',
parameters: {
layout: 'centered',
docs: {
description: {
component: 'Pixel-perfect implementation from Figma design',
},
},
},
argTypes: {
variant: {
control: { type: 'select' },
options: ['primary', 'secondary'],
},
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
};
export default meta;
type Story = StoryObj;
// Default story matching Figma design
export const Default: Story = {
args: {
variant: 'primary',
size: 'medium',
},
render: (args) => html`
<cor-[component-name]
variant="${args.variant}"
size="${args.size}"
>
Content from Figma
</cor-[component-name]>
`,
};
// All states for visual comparison
export const AllStates: Story = {
render: () => html`
<div style="display: flex; flex-direction: column; gap: 16px;">
<cor-[component-name] variant="primary">Primary</cor-[component-name]>
<cor-[component-name] variant="secondary">Secondary</cor-[component-name]>
<cor-[component-name] size="small">Small</cor-[component-name]>
<cor-[component-name] size="large">Large</cor-[component-name]>
</div>
`,
};
// Navigate to the specific story
mcp1_browser_navigate({
url: "http://localhost:6006/iframe.html?id=[atomic-level]-cor[component-name]--default&viewMode=story"
})
// Wait for component to render
mcp1_browser_wait_for({ time: 2 })
// Screenshot Storybook component
mcp1_browser_take_screenshot({
filename: "storybook-component.png",
fullPage: false
})
// Get Figma reference screenshot
figma_get_screenshot({
node_id: "<node_id>",
scale: 2
})
mcp2_sequentialthinking({
thought: "Comparing Storybook component with Figma design...",
thoughtNumber: 1,
totalThoughts: 3,
nextThoughtNeeded: true
})
Check for discrepancies:
// Test hover states
mcp1_browser_hover({
ref: "button",
element: "component button"
})
mcp1_browser_take_screenshot({
filename: "hover-state.png"
})
// Test focus states
mcp1_browser_click({
ref: "button",
element: "component button"
})
mcp1_browser_take_screenshot({
filename: "focus-state.png"
})
// Test disabled states (if applicable)
Use Playwright MCP to inspect elements:
// Get computed styles
mcp1_browser_evaluate({
function: "(element) => window.getComputedStyle(element)",
ref: "component-element"
})
For each issue found:
Explain the problem: "Font weight is 400 but should be 600 according to Figma"
Update the code:
/* Fix in component CSS */
--component-font-weight: var(--font-weight-semi-bold); /* 600 */
Rebuild and refresh:
// Refresh Storybook
mcp1_browser_navigate_back()
mcp1_browser_navigate({ url: "http://localhost:6006/..." })
Re-test: Take new screenshot and compare
Component is complete when:
Create a special story for side-by-side comparison:
export const PixelPerfectComparison: Story = {
render: () => html`
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 32px;">
<div>
<h3>Storybook Component</h3>
<cor-[component-name]>Content</cor-[component-name]>
</div>
<div>
<h3>Figma Reference</h3>
<img src="/figma-reference.png" alt="Figma design" />
</div>
</div>
`,
};
Update component readme with:
Ask for feedback:
/pix-storybook
> Starting Storybook and preparing environment...
> Paste Figma link: https://figma.com/design/abc123/MyApp?node-id=42-100
> Analyzing design... Creating cor-button component...
> Writing Storybook stories...
> Testing visual accuracy with Playwright...
> Found 2px padding difference, fixing...
> Component ready for review at http://localhost:6006/?path=/story/atoms-corbutton--default
Use when the user wants to design, plan, write, review, refactor, test, debug, optimize, harden, or otherwise improve production code. Covers feature implementation, code review, system architecture, debugging, performance work, refactoring, test strategy, error handling, edge cases, dependency choices, and technical standards. Handles 'shape this before I build it', 'review my approach', 'what's wrong with this code', 'simplify this mess', 'why is this slow', 'what tests should I write', 'is this the right abstraction'. Sets up engineering standards (STACK.md, PRINCIPLES.md, TESTING.md) so all sub-commands follow the team's posture. Not for visual / UI design (use impeccable instead) or pure documentation.
Autonomous task-execution loop that pulls actionable issues from a task tracker (Linear or Jira), branches from main, implements, tests, opens a GitHub PR with no AI attribution, and self-paces the next iteration. Use when the user runs `/taskloop init` (one-time per-project setup that picks a provider and generates the loop's memory/config files), `/taskloop start` (re-arms the Monitor + ScheduleWakeup so the loop resumes for the current project), `/taskloop stop`, `/taskloop add-rule [slug]`, or `/taskloop status`. Also triggers when the user says "start" / "porneste" / "resume loop" in a working directory that already has a taskloop config under `~/.claude/projects/SLUG/memory/`.
Manage and maintain a TypeScript MCP server using @modelcontextprotocol/sdk with Express and Streamable HTTP/SSE. Supports setup, adding new MCP tools (handler.ts/prompt.ts/type.ts/index.ts), enforcing strict Zod schemas, token-lean prompts (Claude/Grok friendly), manual tool registration, and transport-level API key injection (query/header → env, never in tool params). All code examples use TypeScript (.ts files). Triggers: "setup MCP server", "add MCP tool", "create handler.ts prompt.ts type.ts", "register tool", "refactor MCP prompt", "API key via header/query".
D3.js data visualization in React/Next.js components with PIXEL-PERFECT Figma matching. Use when building interactive charts, graphs, network diagrams, geographic maps, or any custom data visualization with D3.js inside React components. Covers pixel-perfect Figma extraction workflow, iterative visual validation via Playwright, two integration approaches (useRef+useEffect imperative vs declarative React rendering), responsive sizing, TypeScript typing, SSR/Next.js compatibility, accessibility, and performance. Triggers on: 'create a chart', 'add a D3 visualization', 'build a graph component', 'data visualization', 'interactive chart', 'force-directed graph', 'bar chart', 'line chart', 'heatmap', 'scatter plot', 'pie chart', 'chord diagram'.
Carbon Design System icon usage for React components. MANDATORY when any component includes an icon. Use when implementing UI components that need icons, building atoms/molecules/organisms with icon elements, or adding icons to buttons, inputs, navigation, or any other UI element. Covers icon imports, sizing, color, alignment, touch targets, and the V-Shield Design System icon labeling system.
Import vector illustrations from Figma as reusable React atom components. Use when a component or page needs a custom illustration (NOT a standard Carbon icon). Triggers on requests like 'implement this illustration from Figma', 'add this Figma illustration', 'create illustration component', or when a Figma node contains a multi-layer vector illustration (lock, envelope, microscope, etc.). BEFORE creating a new illustration, always check if it already exists in `apps/web-app/src/components/atoms/Illustration*.tsx` and `apps/web-app/public/assets/illustrations/`.