AgentSkillsCN

green-frontend-api

实现前端逻辑,使一项被跳过的Vitest测试顺利通过(TDD绿色阶段)。读取测试,实现最小化的.logic.ts代码,移除“.skip”标记,验证测试结果为绿色。在用户想要实现前端逻辑,或提及“/green-frontend”命令时使用此功能。

SKILL.md
--- frontmatter
name: green-frontend-api
description: Implement frontend API client to make ONE skipped Vitest + MSW test pass (TDD green phase). Reads test, implements minimal fetch client, removes .skip, verifies green state. Use when user wants to implement frontend API client or mentions /green-frontend-api command.

/green-frontend-api - Implement Frontend API Client (Green Phase)

Orchestrates green-agent for frontend-api layer.

Usage

code
/green-frontend-api "Story name" "Scenario name"
/green-frontend-api 2 "Registration API call"
/green-frontend-api                                    # Interactive selection

Workflow

  1. Parse user input (story, scenario)
  2. Load agent instructions from .claude/agents/green-agent.md
  3. Load layer template from .claude/templates/frontend/implementation.md
  4. Execute the following steps:
    • Find skipped test (.skip) in frontend/src/
    • Read test (understand expectations) - READ-ONLY
    • Implement minimal fetch client in .api.ts file
    • Remove .skip from the test (ONLY allowed test change)
    • Run test using Skill tool: skill="test-frontend", args="{test-file-pattern}"
    • Verify GREEN state
    • Run all tests using Skill tool: skill="test-frontend"
    • Verify no regression
  5. Return result summary

Key Rules

  • TESTS ARE READ-ONLY - only remove .skip
  • Implement MINIMAL code to pass the test
  • Use fetch API for HTTP calls
  • Handle HTTP error codes appropriately
  • Use Skill tool for test execution (not npx directly)

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 green phase: /refactor or proceed to React component implementation