write-failing-test
Write a single test from a given test plan. Use as part of a TDD loop to write a failing test before writing code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Write a single test from a given test plan. Use as part of a TDD loop to write a failing test before writing code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Analyzes the extracted story document, capturing capability, acceptance criteria, edge cases, dependencies and open design questions. Use after extracting a story from a user request, to clarify the stories intended and likley imact. Use before designing the implementation.
Discovers the current application reality BEFORE designing or implementing. Surfaces relevant ADRs, existing code patterns, and target architecture.
Design the implementation of a new user story based on the current application reality, and analysis of the proposed user story.
Design comprehensive test cases for a given set of requirements. Use before starting TDD to plan coverage.
Drafts a high-level implementation plan based on the extracted story document
Extract a user story from a given document or text, into a json format
| name | write-failing-test |
| description | Write a single test from a given test plan. Use as part of a TDD loop to write a failing test before writing code. |
From your test plan, identify:
- The highest priority unimplemented test
- The specific behavior being tested
- The expected outcome
Create the Test with the proper structure. Identify the appripriate language for the component and review an example in one of these files:
/reference/test_example.cs/reference/test_example.py/reference/test_example.tsSet up the test preconditions:
- Create test data using factories/builders
- Configure mocks for dependencies
- Initialize the system under test (SUT)
Keep setup minimal - only what's needed for THIS test.
Execute the behavior under test:
- Single method call or action
- Capture the result if needed
- Should be ONE line in most cases
Verify the expected outcome:
- Use specific assertions (not just assertTrue)
- One logical assertion per test
- Assert on behavior, not implementation
Run the test and confirm:
✓ Test executes without setup errors
✓ Test fails for the RIGHT reason
✓ Failure message is clear and helpful
✗ Test should NOT pass yet
If test passes → Something is wrong:
- Test may not be testing new behavior
- Code already exists
- Test has a bug
// TODO - Add Run-Test Skill specific to the project's testing framework, supporting that projects structure
Update the test plan and mark the test as "failing".
.process directory, named {skill-name}.done.json.tdd-green phase→ tdd-green: Write minimal code to make the test pass
❌ Writing multiple tests at once
❌ Writing any production code
❌ Tests that pass immediately
❌ Vague assertion messages
❌ Testing implementation details
❌ Over-complicated test setup
// Good: Focused, clear, fails correctly
[Fact]
public void Calculate_WithTwoPositiveNumbers_ReturnsSum()
{
// Arrange
var calculator = new Calculator();
// Act
var result = calculator.Add(2, 3);
// Assert
Assert.Equal(5, result);
}
// Run: dotnet test --filter "Calculate_WithTwoPositiveNumbers"
// Result: FAIL - Calculator class does not exist
// ✓ Correct failure - ready for tdd-green