AgentSkillsCN

red-frontend

按照TDD(红灯阶段)编写一项Selenium浏览器测试。以@Tag(“frontend”)扩展AbstractUiTest创建测试。在用户想要创建Selenium UI测试,或提及“/red-selenium”命令时使用此功能。

SKILL.md
--- frontmatter
name: red-frontend
description: Write ONE Vitest logic test following TDD (red phase). Creates test for pure frontend logic (.logic.ts). Use when user wants to create frontend logic tests or mentions /red-frontend command.

/red-frontend - Write Frontend Logic Test (Red Phase)

Orchestrates red-agent for frontend-logic layer.

Usage

code
/red-frontend "Story name" "Scenario name"
/red-frontend 2 "Validate email"
/red-frontend                          # Interactive selection

CRITICAL TDD RULE

Test MUST be run WITHOUT .skip first to verify failure. Only after confirming failure is correct, add .skip marker.

Workflow

  1. Parse user input (story, scenario)
  2. Load agent instructions from .claude/agents/red-agent.md
  3. Load layer template from .claude/templates/frontend/logic-test.md
  4. Execute the following steps:
    • Read story spec from ProductSpecification/stories/{story}/
    • Analyze existing tests in frontend/src/
    • Predict expected failure (document before writing test)
    • Write ONE test WITHOUT .skip initially
    • Run test using Skill tool: skill="test-frontend", args="{test-file-pattern}"
    • Verify failure matches prediction
    • Add .skip to the test
    • Verify test is now SKIPPED
  5. Return result summary with predicted vs actual failure

Key Rules

  • ONE test per invocation
  • ALWAYS predict failure BEFORE running
  • Verify RED state before adding .skip
  • Pure functions only in .logic.ts files (no React, no fetch)
  • Use it.skip(...) to disable after verifying failure
  • Use Skill tool for test execution (not npx directly)

Expected Failure Patterns

Current ImplementationExpected Test Failure
No module fileCannot find module
throw new Error('Not implemented')Error: Not implemented
Function returns undefinedAssertion failure
Returns wrong valueAssertion comparison failure

Story Mapping

#Story
01Login/Logout
02Registration
03Password Reset
04Connect Calendar
05Create Task
06Edit Task
07Delete Task
08Archive/Restore Task
09Task Detail View
10Activity Log
11Dashboard
12Billing & Subscription

Next Step

After red phase: /green-frontend "Story name" "Scenario name"