storybook-play-functions

storybook-play-functions is a skill for Claude Code from punkadillo/figma-code-composer. It costs 31 tokens per session (3,013 once invoked), scanned A, original, MIT.

A guide for testing user interactions inside Storybook stories. Its play functions simulate actions such as typing and clicking, then check the result.

In plain words
What is it for?
Test forms, buttons, and other interactive components with simulated user actions and checks on the rendered result.
Why use it?
It catches problems in component behavior and edge cases using the same examples used for visual review.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Test forms, buttons, and other interactive components with simulated user actions and checks on the rendered result.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/punkadillo/figma-code-composer/storybook-play-functions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add punkadillo/figma-code-composer --skill storybook-play-functions
Clone the repo
git clone --depth 1 https://github.com/punkadillo/figma-code-composer

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for storybook-play-functions

README.md
[![agentmods](https://agentmods.dev/badge/skills/punkadillo/figma-code-composer/storybook-play-functions/github.svg)](https://agentmods.dev/skills/punkadillo/figma-code-composer/storybook-play-functions)
Your own site
<a href="https://agentmods.dev/skills/punkadillo/figma-code-composer/storybook-play-functions"><img src="https://agentmods.dev/badge/skills/punkadillo/figma-code-composer/storybook-play-functions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for storybook-play-functions

Your own site · 80×15
<a href="https://agentmods.dev/skills/punkadillo/figma-code-composer/storybook-play-functions"><img src="https://agentmods.dev/badge/skills/punkadillo/figma-code-composer/storybook-play-functions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,013 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.03013
Opus 5 $0.00015 $0.01507
Sonnet 5 $0.00006 $0.00603
Haiku 4.5 $0.00003 $0.00301

Measured 5d ago against content hash d5cf5338a49e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

storybook-play-functions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.figma-pipeline/skills/storybook-play-functions/SKILL.md · 467 lines

How it starts

The opening of the file, as written. The whole thing — 467 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Storybook - Play Functions

Write automated interaction tests within stories using play functions to verify component behavior, simulate user actions, and test edge cases.

Key Concepts

Play Functions

Play functions run after a story renders, allowing you to simulate user interactions:

import { within, userEvent, expect } from '@storybook/test';
import type { Meta, StoryObj } from '@storybook/react';
import { LoginForm } from './LoginForm';

const meta = {
  component: LoginForm,
} satisfies Meta<typeof LoginForm>;

export default meta;
type Story = StoryObj<typeof meta>;

export const FilledForm: Story = {
  play: async ({ canvasElement }) => {
    const canvas = within(canvasElement);

    await userEvent.type(canvas.getByLabelText('Email'), '[email protected]');
    await userEvent.type(canvas.getByLabelText('Password'), 'password123');
    await userEvent.click(canvas.getByRole('button', { name: /submit/i }));

    await expect(canvas.getByText('Welcome!')).toBeInTheDocument();
  },
};

Testing Library Integration

Storybook integrates with Testing Library for queries and interactions:

  • within(canvasElement) - Scopes queries to the story
  • userEvent - Simulates realistic user interactions
  • expect - Jest-compatible assertions
  • waitFor - Waits for async changes

Test Execution

Play functions execute:

  • When viewing a story in Storybook
  • During visual regression testing
  • In test runners for automated testing
  • On story hot-reload during development

Best Practices

1. Use Testing Library Queries

Use semantic queries to find elements:

export const SearchFlow: Story = {
  play: async ({ canvasElement }) => {
    const canvas = within(canvasElement);

    // Good - Semantic queries
    const searchInput = canvas.getByRole('searchbox');
    const submitButton = canvas.getByRole('button', { name: /search/i });
    const results = canvas.getByRole('list', { name: /results/i });

    await userEvent.type(searchInput, 'storybook');
    await userEvent.click(submitButton);

    await expect(results).toBeInTheDocument();
  },
};

Read the full file on GitHub · 467 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 467 lines · 31 tokens per session scan A d5cf5338a49e

Subscribe to this mod's changes

storybook-play-functions is a skill published in the GitHub repository punkadillo/figma-code-composer (3 stars, last pushed 21d ago), licensed MIT. It adds 31 tokens to every session and 3,013 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

storybook-testing

Storybook 10 testing patterns with Vitest integration, ESM-only distribution, CSF3 typesafe factories, play() interaction tests, Chromatic TurboSnap visual regression, module automocking, accessibility addon testing, and autodocs generation. Use when writing component stories, setting up visual regression testing…

yonatangross/orchestkit · 77 tokens

testing-react

Stratégie de Tests React 19 + Compiler 1.0. Use when writing tests, reviewing test coverage, or setting up testing.

TheBeardedBearSAS/claude-craft · 32 tokens

visual-verification

Verify UI-facing changes by running a screenshot-analyze-verify loop across configured viewports, with a browser-tool priority cascade (Playwright MCP → Chrome DevTools MCP → CLI fallback → external skill fallback) and bounded iteration. Use after build/runtime verification passes and the diff includes…

synaptiai/synapti-marketplace · 137 tokens

ring:running-dev-cycle-frontend

Running the frontend (React/Next.js/TS) dev cycle from a plan.md (ring:writing-plans format; legacy tasks.md only for in-flight cycles) or backend handoff: drives frontend agents through Gate 0 TDD plus accessibility/visual/E2E/perf checks, Gate 7 parallel review, and Gate 8 user validation, with rolling-wave phase…

LerianStudio/ring · 114 tokens

storybook

A reference for Storybook, a tool for displaying and testing user-interface components separately from the full application. It covers stories, settings, interaction tests, documentation, and common add-ons.

Fandhe-AI/agent-reference-skills · 75 tokens