/vibeworks-library:tdd-workflowfrom vibeworks-library
Guides through the red-green-refactor TDD cycle: writing failing tests first, minimal implementation, and iterative refinement. Useful when implementing features test-first or when the user asks for TDD.
Ships in vibeworks-library. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
TDD is a design discipline, not just a testing technique. Writing tests first forces you to think about the interface before the implementation, producing code that is inherently testable, loosely coupled, and driven by actual requirements.
Checklist before moving to GREEN:
it should return 404 when resource not found).The "simplest thing that could work" principle:
return 42, write return 42. Do not write a general formula yet.if statement. Do not write a loop yet.Checklist before moving to REFACTOR:
Refactoring targets:
Return to Step 1 with the next smallest behavior.
Use descriptive names that serve as documentation:
// Pattern: [unit]_[scenario]_[expected result]
test_calculateTotal_withEmptyCart_returnsZero
test_calculateTotal_withSingleItem_returnsItemPrice
test_calculateTotal_withDiscount_appliesDiscountToSubtotal
// BDD-style
describe("calculateTotal") {
it("should return zero for an empty cart")
it("should return the item price for a single item")
it("should apply discount to subtotal")
}
// Given-When-Then
given_emptyCart_when_calculateTotal_then_returnsZero
Rules:
describe or test class.RED: Write a test for a single function or method.
GREEN: Implement just that function.
REFACTOR: Clean up the function and its test.
Cycle time: 1-5 minutes.
RED: Write a test that exercises two or more components together.
GREEN: Wire the components and implement any missing glue code.
REFACTOR: Extract shared setup, clean interfaces between components.
Cycle time: 5-15 minutes.
RED: Write a test that sends an HTTP request and asserts on status + body.
GREEN: Implement the route handler with minimal logic.
REFACTOR: Extract validation, business logic, and serialization into separate layers.
Cycle time: 5-20 minutes.
# RED: First test — empty slug
def test_shorten_rejects_empty_url():
with pytest.raises(ValueError):
shorten("")
# GREEN: Minimal implementation
def shorten(url):
if not url:
raise ValueError("URL cannot be empty")
pass # nothing else needed yet
# RED: Second test — returns a short code
def test_shorten_returns_six_char_code():
result = shorten("https://example.com")
assert len(result) == 6
# GREEN: Hardcode, then generalize
def shorten(url):
if not url:
raise ValueError("URL cannot be empty")
return url[:6] # naive but passing
# RED: Third test — codes are unique
def test_shorten_returns_unique_codes():
a = shorten("https://example.com/a")
b = shorten("https://example.com/b")
assert a != b
# GREEN: Now we need real logic
import hashlib
def shorten(url):
if not url:
raise ValueError("URL cannot be empty")
return hashlib.md5(url.encode()).hexdigest()[:6]
# REFACTOR: Extract hashing, add type hints, rename for clarity
When adding features to code without tests:
The Mikado Method for legacy TDD:
Is the behavior well-understood?
YES -> Classic TDD (test-first)
NO -> Spike first (throwaway prototype), then TDD the real implementation
Is the code interacting with external systems?
YES -> Write a contract/interface test, then use a fake/stub for unit TDD
NO -> Pure function TDD (easiest case)
Is the code algorithmically complex?
YES -> Start with simple examples, build up with property-based tests
NO -> Standard example-based TDD
Are you fixing a bug?
YES -> Write a test that reproduces the bug FIRST, then fix it
NO -> Normal TDD cycle
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
tdd, test-driven-development, red-green-refactor, test-first
34 skills in this plugin
/agent-developmentAgent DevelopmentThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins./api-designREST and API design principles — resource naming, HTTP methods, status codes, pagination, versioning, and error responses. Reference when designing or reviewing APIs./architecture-decision-recordADR format and methodology for documenting significant technical decisions with context, alternatives considered, and consequences. Use when making or documenting architectural decisions./branch-strategyBranch naming conventions, Git Flow vs trunk-based development, feature branch lifecycle, and release strategies. Reference when creating branches, planning releases, or choosing a branching model./code-review-checklistComprehensive code review criteria covering correctness, readability, maintainability, security, performance, and testing. Reference when reviewing code changes or preparing code for review./command-developmentCommand DevelopmentThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.npx claudepluginhub claude-code-community-ireland/claude-code-resources --plugin vibeworks-libraryOther plugins' skills for the same job