AgentSkillsCN

red-usecase

运用马丁·福勒的模式重构代码。提升代码可读性,将行为更贴近数据,去除不必要的抽象层。

SKILL.md
--- frontmatter
name: red-usecase
description: Write ONE use-case test following TDD (red phase). Creates test with 3-tier architecture (test class -> statements -> scope). Use when user wants to create use-case tests or mentions /red-usecase command.

/red-usecase - Write Use-Case Test (Red Phase)

Orchestrates red-agent for usecase layer.

Usage

code
/red-usecase "Story name" "Scenario name"
/red-usecase 1 "Successful login"
/red-usecase                          # Interactive selection

Workflow

  1. Parse user input (story, scenario)
  2. Load agent instructions from .claude/agents/red-agent.md
  3. Load layer template from .claude/templates/usecase/test-class.md
  4. Execute the following steps:
    • Read story spec from ProductSpecification/stories/{story}/
    • Analyze existing tests in backend/usecase/src/test/
    • Predict expected failure
    • Write ONE test WITHOUT @Disabled initially
    • Run test using Skill tool: skill="test-usecase", args="{TestClassName}"
    • Act when failure doesn't match prediction
    • Add @Disabled annotation with actual failure reason
    • Verify test is now SKIPPED
  5. Return result summary

Key Rules

  • ONE test per invocation
  • ALWAYS predict failure BEFORE running
  • Verify RED state before disabling
  • Follow 3-tier architecture (Test -> Statements -> Scope)
  • Use Skill tool for test execution (not gradle 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 red phase: /green-usecase "Story name" "Scenario name"