AGENT SKILL

visual-playground

Create and configure interactive or static design playgrounds (sandboxes) for playtesting visual features, layouts, animations, sound effects, or font choices. Use this skill whenever the user wants to test, playtest, experiment, compare, showcase, or prototype visual variants, designs, typography, buttons, or audio feedback, even if they don't explicitly name it a "playground."

License 许可
MIT
最近更新
2026-09-05
Stars
★ 0
Forks
0

01 前言 Front Matter

name
visual-playground
description
Create and configure interactive or static design playgrounds (sandboxes) for playtesting visual features, layouts, animations, sound effects, or font choices. Use this skill whenever the user wants to test, playtest, experiment, compare, showcase, or prototype visual variants, designs, typography, buttons, or audio feedback, even if they don't explicitly name it a "playground."

02 资源文件 1

03 SKILL.md 正文

Visual Playground

Use this skill to build dedicated, high-fidelity playtesting/showcase pages (playgrounds) where users can dynamically experiment with and compare different design variations (interactive elements, fonts, styling options, icons, animations, sound effects) before integrating them into production code.

Core Directives

  1. Dedicated Output Directory:

    • Create a folder named playgrounds at the root of the project if it doesn't already exist.
    • Save all generated playground files inside this directory (e.g., playgrounds/font_playground.html).
  2. Relative Style Mapping:

    • Because the playground HTML is nested in playgrounds/, ensure links to project styles correctly resolve paths (e.g. link to ../style.css or ../extension/style.css instead of style.css).
  3. Adapt to Project Design Guidelines:

    • Check the project root for design guidelines (like DESIGN.md, custom stylesheets, or layout config docs).
    • If design guidelines or tokens are defined, parse them and update the CSS variables on the playground page to match the project's brand colors, typography, margins, and borders.
    • If no project-specific design exists, default to the premium vanilla CSS variables embedded in the template.
  4. Use local playgrounds and templates first:

    • Before copying the bundled template, check if the project already contains existing playground files (e.g., under playground/, playgrounds/, or files ending in _playground.html).
    • Prioritize reusing, adapting, or building directly on top of the project's existing playground framework, styling patterns, and helper JavaScript functions.
    • If no local playground files exist, fall back to the skill's bundled assets file: template.html. Read its contents and replace the comment placeholders with your custom playtest elements.

Playground Layout Strategies

Select the best layout configuration based on the type of visual feature being playtested:

Strategy A: Concept Cards Grid (Interactive Features)

Use this for playtesting interactive elements like checkmark animations, button hover effects, sound effects, page transitions, or custom canvas triggers.

  • Render options inside a grid of .concept-card elements.
  • Each card should contain a description of the concept, a .sandbox-section with interactive preview elements, and action/toggle triggers.
  • Support selecting an active option using .active-selection and showing the .active-badge.
  • Connect options to real action functions that trigger the visual/sound effects in real time.

Strategy B: Viewport Comparison Layout (Static Visual Comparisons)

Use this for playtesting static visual layouts, font pairings, line heights, page templates, header sizes, or spacing themes.

  • Render the options inside a scrollable flex row .comparison-container.
  • Display each design variant inside its own .viewport-frame container containing a .viewport-meta bar and a .viewport-canvas frame.
  • Load the identical target page/component mockup inside each canvas but apply the distinct styling configuration (like a specific Google Font pairing, theme variables, or padding rules) to each viewport so the user can scroll side-by-side to visually inspect and contrast them.
  • Provide a simple toolbar/dropdown to switch viewports or scale them.

Essential Components

To ensure a premium and functional experience, every playground must include:

  1. Interactive Controls:

    • Add control elements (sliders for duration/speed/size, select dropdowns for font pairings/color schemes, color pickers, text inputs) to dynamically update the preview elements.
    • Write clean, straightforward JavaScript event listeners that update CSS custom properties (variables) or DOM styling attributes on input.
  2. Code Snippet Exporter:

    • Provide a section or overlay displaying the corresponding CSS rules or configuration JSON for the currently selected design variant.
    • Update this snippet dynamically as the user modifies settings (like slider speeds or font choices) so they can instantly copy-paste it into their source files.
  3. Navigation Integration:

    • Connect the playground to the main app by setting up a clear back-link (e.g., pointing to ../index.html or /).
    • If there is a settings or navigation menu in the main application, offer to add a link pointing to the new playground.

Testing & Verification Guidelines

  • Keep testing minimal: Since playgrounds are prototype/sandbox environments for visual features, do not write extensive Playwright integration or unit tests for them.
  • Basic checks only: If verification is needed, focus on simple checks that verify the page loads, elements render, and basic interactivity functions without errors.

04 同仓库更多 Skills