frontend-testing

frontend-testing is a skill for Claude Code, Codex from Ohh-889/skyroc. It costs 50 tokens per session (2,414 once invoked), scanned A, original, MIT.

A testing guide for Dify's frontend code, using Vitest to run tests and React Testing Library to check React components. Dify is the software project this guidance targets.

In plain words
What is it for?
Use it to write or review unit and integration tests for Dify frontend code. It also covers test coverage, mock timers, and related test files.
Why use it?
It helps developers follow the project's existing testing patterns instead of guessing how tests should be structured. It focuses on frontend components, hooks, and utilities.

Skill for Claude CodeCodex

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/ohh-889/skyroc/frontend-testing
Any agent
npx skills add Ohh-889/skyroc --skill frontend-testing
Clone the repo
git clone --depth 1 https://github.com/Ohh-889/skyroc

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/ohh-889/skyroc/frontend-testing.svg)](https://agentmods.dev/skills/ohh-889/skyroc/frontend-testing)
Your own site
<a href="https://agentmods.dev/skills/ohh-889/skyroc/frontend-testing"><img src="https://agentmods.dev/badge/skills/ohh-889/skyroc/frontend-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,414 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 $0.00050 $0.02414
Opus 5 $0.00025 $0.01207
Sonnet 5 $0.00010 $0.00483
Haiku 4.5 $0.00005 $0.00241

Measured 4d ago against content hash ea806c65a25a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

frontend-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 4d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (assets/hook-test.template.ts, assets/utility-test.template.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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-testing/SKILL.md · 326 lines

How it starts

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

Dify Frontend Testing Skill

This skill enables Codex to generate high-quality, comprehensive frontend tests for the Dify project following established conventions and best practices.

⚠️ Authoritative Source: This skill is derived from web/testing/testing.md. Use Vitest mock/timer APIs (vi.*).

When to Apply This Skill

Apply this skill when the user:

  • Asks to write tests for a component, hook, or utility
  • Asks to review existing tests for completeness
  • Mentions Vitest, React Testing Library, RTL, or spec files
  • Requests test coverage improvement
  • Uses pnpm analyze-component output as context
  • Mentions testing, unit tests, or integration tests for frontend code
  • Wants to understand testing patterns in the Dify codebase

Do NOT apply when:

  • User is asking about backend/API tests (Python/pytest)
  • User is asking about E2E tests (Playwright/Cypress)
  • User is only asking conceptual questions without code context

Quick Reference

Tech Stack

Tool Version Purpose
Vitest 4.0.16 Test runner
React Testing Library 16.0 Component testing
jsdom - Test environment
nock 14.0 HTTP mocking
TypeScript 5.x Type safety

Key Commands

# Run all tests
pnpm test

# Watch mode
pnpm test:watch

# Run specific file
pnpm test path/to/file.spec.tsx

# Generate coverage report
pnpm test:coverage

# Analyze component complexity
pnpm analyze-component <path>

# Review existing test
pnpm analyze-component <path> --review

File Naming

  • Test files: ComponentName.spec.tsx (same directory as component)
  • Integration tests: web/__tests__/ directory

Test Structure Template

import { render, screen, fireEvent, waitFor } from '@testing-library/react'
import Component from './index'

// ✅ Import real project components (DO NOT mock these)
// import Loading from '@/app/components/base/loading'
// import { ChildComponent } from './child-component'

// ✅ Mock external dependencies only
vi.mock('@/service/api')
vi.mock('next/navigation', () => ({
  useRouter: () => ({ push: vi.fn() }),
  usePathname: () => '/test',
}))

// ✅ Zustand stores: Use real stores (auto-mocked globally)
// Set test state with: useAppStore.setState({ ... })

// Shared state for mocks (if needed)
let mockSharedState = false

describe('ComponentName', () => {
  beforeEach(() => {
    vi.clearAllMocks()  // ✅ Reset mocks BEFORE each test
    mockSharedState = false  // ✅ Reset shared state
  })

  // Rendering tests (REQUIRED)
  describe('Rendering', () => {
    it('should render without crashing', () => {
      // Arrange
      const props = { title: 'Test' }
      
      // Act
      render(<Component {...props} />)
      
      // Assert
      expect(screen.getByText('Test')).toBeInTheDocument()
    })
  })

  // Props tests (REQUIRED)
  describe('Props', () => {
    it('should apply custom className', () => {
      render(<Component className="custom" />)
      expect(screen.getByRole('button')).toHaveClass('custom')
    })
  })

  // User Interactions
  describe('User Interactions', () => {
    it('should handle click events', () => {
      const handleClick = vi.fn()
      render(<Component onClick={handleClick} />)
      
      fireEvent.click(screen.getByRole('button'))
      
      expect(handleClick).toHaveBeenCalledTimes(1)
    })
  })

  // Edge Cases (REQUIRED)
  describe('Edge Cases', () => {
    it('should handle null data', () => {
      render(<Component data={null} />)
      expect(screen.getByText(/no data/i)).toBeInTheDocument()
    })

    it('should handle empty array', () => {
      render(<Component items={[]} />)
      expect(screen.getByText(/empty/i)).toBeInTheDocument()
    })
  })
})

Read the full file on GitHub · 326 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. 4d ago First seen · 326 lines · 50 tokens per session scan A ea806c65a25a

Subscribe to this mod's changes

frontend-testing is a skill published in the GitHub repository Ohh-889/skyroc (792 stars, last pushed 3d ago), licensed MIT. It adds 50 tokens to every session and 2,414 once invoked, about $0.0003 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

pro-upgrade

Use when the user wants to upgrade their Ant Design Pro project to the latest version. Triggers on: upgrade pro, pro upgrade, migrate pro, update pro, 升级, 迁移项目, "how to upgrade", "update to latest", "keep project up to date".

ant-design/ant-design-pro · 63 tokens

demo-create

基于项目中 .vscode/south.code-snippets 定义的 CRUD 模板,快速生成后台管理系统的标准 CRUD 页面代码。该技能根据用户提供的业务模块信息(如模块名称、API路径、字段配置等),自动生成完整的页面文件(Page)、数据模型文件(Model)和 API 接口文件(Api),支持分页列表页面(demoPage)、独立操作页面(demoOptionPage)两种页面模式。.

southliu/south-admin-react · 99 tokens

init-project

初始化整个项目,清除模板自带的示例内容(src/pages/demo、src/pages/content、src/components/Github、src/servers/content、menus/demo 及相关 i18n),并连带删除代码中的 import 与引用。执行时会先以 dry-run 预览将要删除的文件和将要修改的引用,经用户确认后再真正执行。.

southliu/south-admin-react · 83 tokens

antd

Use when the user's task involves Ant Design (antd) — writing antd components, debugging antd issues, querying antd APIs/props/tokens/demos, migrating between antd versions, or analyzing antd usage in a project. Triggers on antd-related code, imports from 'antd', or explicit antd questions.

ant-design/ant-design-pro · 69 tokens

creative-tim-ui

Creative Tim UI block library assistant. Use when adding, generating, or modifying UI blocks/components/pages from creative-tim.com/ui. Covers design philosophy (minimalism, the 95% rule, research-first), block discovery, both CLI install methods, PRO API key setup, and Creative Tim design rules (orange brand…

creativetimofficial/ui · 91 tokens

admin-console-blueprint

Use when you need to design, scaffold, refactor, or document a medium-sized admin console built as an independent Vite/React SPA backed by modular Go admin APIs, Cookie session auth, and CLI-provisioned administrator accounts. Helpful for tasks like planning a new admin console, extracting reusable architecture from…

LSTM-Kirigaya/jinhui-skills · 91 tokens