frontend-unit-testing

frontend-unit-testing is a skill for Claude Code, Codex from gradio-app/gradio. It costs 37 tokens per session (4,077 once invoked), scanned A, original, Apache-2.0.

A testing tool for Gradio’s Svelte frontend components. It uses Vitest, Playwright, and related test utilities to check what users can see and do.

In plain words
What is it for?
Use it to write unit tests for clicks, typing, visibility, component data updates, returned state, and events in Gradio frontend components.
Why use it?
It helps catch broken interface behaviour before release, without relying on internal code details. It also checks how components exchange data and events.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

About the project

Gradio is a Python package for building web interfaces around machine learning models, APIs, or ordinary Python functions. It is used by developers and data scientists to create and share interactive demos without writing frontend code.

gradio-app/gradio · 43,478 stars · on GitHub · gradio.app

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.

agentmods
npx agentmods add skills/gradio-app/gradio/frontend-unit-testing
Any agent
npx skills add gradio-app/gradio --skill frontend-unit-testing
Clone the repo
git clone --depth 1 https://github.com/gradio-app/gradio

Made for: Claude Code, Codex.

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 frontend-unit-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/gradio-app/gradio/frontend-unit-testing.svg)](https://agentmods.dev/skills/gradio-app/gradio/frontend-unit-testing)
Your own site
<a href="https://agentmods.dev/skills/gradio-app/gradio/frontend-unit-testing"><img src="https://agentmods.dev/badge/skills/gradio-app/gradio/frontend-unit-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,077 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00037 $0.04077
Opus 5 $0.00018 $0.02039
Sonnet 5 $0.00007 $0.00815
Haiku 4.5 $0.00004 $0.00408

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

Security

Grade A, and why

frontend-unit-testing 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 6d 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.

.agents/skills/frontend-unit-testing/SKILL.md · 382 lines

How it starts

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

Frontend Unit Testing Skill

You are an expert at writing unit tests for Gradio's Svelte frontend components. Follow these instructions precisely.

Core Principles (Non-Negotiable)

  1. Test everything. Unit tests are cheap. Having too many is a problem we want to have. When in doubt, write the test. Multiple tests per feature/argument is fine and encouraged.

  2. Test behaviour, not implementation. Never assert on implementation details like CSS class names, internal state, or DOM structure for its own sake. Instead, test observable behaviour.

    • BAD: assert that an input has a step attribute set to 5
    • GOOD: type a value, click the increment button, and assert the value increased by 5
    • BAD: assert that a container has class hidden
    • GOOD: assert that the element is not visible with toBeVisible()
  3. Test Gradio-specific functionality. Every component has get_data, set_data, and dispatches events. These must be tested, including their interactions with props.

    • set_data -> verify the DOM reflects the change
    • get_data -> verify it returns the current state
    • set_data -> get_data round-trips
    • User interaction -> get_data reflects it
    • Events: change, input, submit, blur, focus, clear, upload, select, custom_button_click, etc.
  4. Real browser environment. Tests run in Vitest browser mode with a Playwright provider. This is a real browser, not jsdom. Do not mock or stub unless absolutely unavoidable (e.g., navigator.clipboard, MediaStream). If you must mock, explain why in a comment.

  5. Test sub-components in isolation when they have meaningful standalone logic (e.g., a utility function, a shared inner component). These tests are in addition to full Index.svelte integration tests.

  6. Never refactor production code for testability without explicit user approval. If a refactor would help, recommend it and wait for a go-ahead.

  7. Visual-only props get test.todo placeholders. If a prop or argument results in a purely visual change (colours, spacing, fonts, border styles, shadows, etc.) that cannot be meaningfully asserted with behavioural queries, do NOT skip it silently. Instead:

    • Add a test.todo("description") explaining that it needs a visual regression test
    • The description should state what prop/value is being tested and what the expected visual outcome is
    • This ensures visual-only behaviour is tracked and not forgotten

Read the full file on GitHub · 382 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. 6d ago First seen · 382 lines · 37 tokens per session scan A 60e252cf0757

Subscribe to this mod's changes

frontend-unit-testing is a skill published in the GitHub repository gradio-app/gradio (43,478 stars, last pushed today), licensed Apache-2.0. It adds 37 tokens to every session and 4,077 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-08-30.

Related

Other skills, from other repositories

addressing-pr-review-comments

Address all valid review comments on a PR for the current branch in the streamlit/streamlit repo. Covers both inline review comments and general PR (issue) comments. Use when a PR has reviewer feedback to address, including code changes, style fixes, and documentation updates.

streamlit/streamlit · 61 tokens

understanding-streamlit-architecture

Explains Streamlit's internal architecture including backend runtime, frontend rendering, and WebSocket communication. Use when debugging cross-layer issues, understanding how features work end-to-end, planning architectural changes, or onboarding to the codebase. Covers ForwardMsg/BackMsg protocol, script rerun…

streamlit/streamlit · 75 tokens

fixing-streamlit-ci

Analyze and fix failed GitHub Actions CI jobs for the current branch/PR. Use when CI checks fail, PR checks show failures, or you need to diagnose lint/type/test errors and verify fixes locally.

streamlit/streamlit · 47 tokens

implementing-feature

Implement a feature from a product/tech spec, URL, GitHub issue, or by auto-selecting the next papercut enhancement. Reads the spec, implements the feature following Streamlit patterns, and creates a merge-ready PR. Use when given a spec folder path, document URL, or issue link to implement, or when asked to implement…

streamlit/streamlit · 83 tokens

assessing-external-test-risk

Assesses whether branch or PR changes are high-risk for externally hosted or embedded Streamlit usage and recommends whether external e2e coverage with @pytest.mark.externaltest is needed. Use during code review, PR triage, or test planning when changes touch routing, auth, websocket/session behavior, embedding…

streamlit/streamlit · 88 tokens

updating-internal-docs

Review internal documentation (.md files) against the current codebase state and propose updates for outdated or incorrect information.

streamlit/streamlit · 29 tokens