- Home
- Skills
- Testing & Debugging
- test driven development
test driven development
Enforce Red-Green-Refactor and Prove-It bug fixing workflows to ensure every code change is verified by tests.
Free
Works with the AI Agents you already use
test driven development
Example session with this skill installed
Fix the bug where completing a task doesn't update the timestamp, and make sure we have a test for it.
- Read your context and instructions
- Compiled the test driven development
I have identified the bug in `TaskService`. I will follow the Prove-It Pattern by writing a reproduction test first, verifying its failure, and then implementing the fix. ## Bug Fix: Task Completion Timestamp | Step | Action | Result | | :--- | :--- | :--- | | **RED** | Created `tests/task.test.ts` with a test asserting `completedAt` is a Date. | **FAIL**: `expected undefined to be instance of Date` | | **GREEN** | Updated `completeTask` in `src/services/task.ts` to include `completedAt: new Date()`. | **PASS**: Test successfully verified the timestamp. | | **REFACTOR** | Cleaned up the database update object for better readability. | **PASS**: Regression tests confirmed no side effects. | ```typescript // src/services/task.ts - Implementation Fix export async function completeTask(id: string): Promise<Task> { return db.tasks.update(id, { status: 'completed', completedAt: new Date(), }); } ``` **Next steps** 1. Run the full suite using `npm test` to ensure no regressions in the task lifecycle. 2. Review the `Task` type definition to ensure `completedAt` is no longer marked as optional. 3. Deploy the fix to the staging environment for final verification.
Connects securely to your tools. The creator never sees your data.
About this skill
Logic is brittle without verification. Manual testing fails to scale and provides no regression safety. This skill enforces a strict test-driven development workflow to ensure code behaves as expected before it is even written. It shifts the focus from writing code that seems to work to writing code that is proven to work. ## What it does - **Red-Green-Refactor enforcement** drives every code change through a cycle of failure, minimal implementation, and cleanup. - **Prove-It bug fixing** requires a failing reproduction test before any fix is attempted, preventing phantom fixes. - **Project stack discovery** automatically identifies build tools, test frameworks, and local wrappers like `./gradlew` or `pytest`. - **Test pyramid alignment** prioritizes fast unit tests over heavy integration and E2E flows to maintain suite performance. - **State-based assertion** focuses on outcomes rather than internal method calls to keep tests resilient during refactoring. ## How it works 1. **Discover** the repository's specific testing commands, file conventions, and existing patterns. 2. **RED** step involves writing a test that demonstrates the desired behavior or reproduces a reported bug. 3. **GREEN** step implements the minimum code necessary to satisfy the failing test. 4. **REFACTOR** step cleans up the implementation while using the new test as a safety net. ## Frameworks & tools The skill works with any language ecosystem including Node.js (Jest, Vitest), Python (pytest), Java (JUnit, Gradle), Go, and Rust. It integrates with Chrome DevTools MCP for runtime browser verification. ## Why this beats prompting it yourself Generic prompts often lead to tests written after the code, which only verify what the code already does rather than what it should do. This skill embeds the Red-Green-Refactor loop into the agent's core decision logic, ensuring that reproduction tests for bugs are never skipped. ## Use cases - Implementing new business logic with built-in documentation and safety. - Fixing reported bugs by first proving they exist with a test case. - Refactoring legacy codebases where existing behavior must be preserved. - Verifying complex browser interactions using runtime DOM and console inspection. ## Known limitations This skill focuses on behavioral logic and excludes pure configuration, documentation, or static content changes. High-level E2E tests are limited to critical paths to avoid suite bloat.
Excludes pure configuration or documentation changes. E2E tests are restricted to critical paths. Requires existing test infrastructure or a supported build tool to be present.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
This skill has been used 5 times.
Trust & safety
Security scan
Security scan passed 1 month ago
- Free with an Agensi account