Test-Driven Development (TDD) for Openclaw

A unified TDD skill that enforces test-first development through automated spec parsing, pattern discovery, and the RED-GREEN-REFACTOR cycle.

imbeasting
v1.0.0
Mar 7, 2026
1
1.6k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install imbeasting-test-driven-development

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install imbeasting-test-driven-development using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Test-Driven Development (TDD)?

The Test-Driven Development skill is a robust framework designed to integrate high-standard engineering practices into AI-driven workflows. By leveraging Openclaw Skills, this tool ensures that agents never write implementation code before a failing test exists. It bridges the gap between requirements and code by supporting three distinct entry points: formal specifications, task files, and ad-hoc descriptions.

Built with a focus on maintainability and repository consistency, it performs deep pattern discovery to match existing test styles. This ensures that the generated tests feel native to your project while maintaining a strict cycle of verification that eliminates bugs before they are even written.

Test-Driven Development (TDD) Use Cases

  • Developing new features from formal acceptance criteria found in .spec.md files.
  • Executing coding tasks while ensuring 100% requirement coverage via automated tests.
  • Refactoring existing codebases by first establishing a baseline of failing and passing tests.
  • Implementing complex logic where property-based testing is required to verify edge cases.

How Test-Driven Development (TDD) Works

  1. Detect Input Type: The skill determines if the source is a specification file, a task document, or a manual description.
  2. Extract Criteria: For specs, it uses programmatic support to parse Given/When/Then triples into actionable stubs.
  3. Pattern Discovery: It searches the repository for existing test module layouts and assertion styles to ensure consistency.
  4. RED Phase: Failing tests are created to establish the expected behavior before implementation begins.
  5. GREEN Phase: The minimal implementation is added to pass the specific test cases.
  6. REFACTOR Phase: The code is optimized and cleaned while keeping tests in a green state.
  7. Reporting: Completion events are emitted with coverage evidence and build status.

Test-Driven Development (TDD) Setup

To use the TDD workflow within Openclaw Skills, ensure your development environment is configured for testing. For Rust projects, follow these steps:

# Install coverage tools
cargo install cargo-tarpaulin

# Ensure your project structure follows repository patterns
# The skill looks for tests in crates/*/tests/*.rs

Test-Driven Development (TDD) Data Schema & Taxonomy

Component Format Purpose
Input Spec .spec.md Acceptance criteria source
Task File .code-task.md Implementation requirement source
Test Stubs Rust #[test] Placeholder for the RED cycle phase
Coverage tarpaulin/html Verification evidence for backpressure

Test-Driven Development (TDD) Advanced Features

  • Automated Spec Parsing: Uses specialized core functions to extract acceptance criteria triples from markdown files.
  • Proptest Integration: Intelligent assessment of when to apply property-based testing for deterministic functions with large input spaces.
  • Backpressure Signaling: Emits completion events that include lint, typecheck, and coverage percentages to notify orchestrators of quality status.
  • Custom Test Location Rules: Smart mapping of requirements to either inline module tests or external integration test files based on scope.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*