# failing test first

> Enforce bug-fix integrity by requiring a committed failing test reproduction before any production code changes.

failing test first is a free AI agent skill on Agensi by Daniele Bordignon, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Daniele Bordignon](https://www.agensi.io/creators/daniele-bordignon)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Version: 1.0
- Last updated: 2026-11-23
- Security: scan passed (2026-11-23); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/failing-test-first
- Tags: testing, tdd, jest, pytest, code-quality

## About this skill

Manual bug fixing often lacks the rigor needed to prevent regressions. This skill enforces a test-first discipline by requiring a committed reproduction of the defect before any production code is touched.

### What it does
- **Reproduction enforcement** ensures every bug starts with an automated test demonstrating the failure.
- **Failure verification** confirms the test fails for the specific reported defect, not an unrelated environment issue.
- **Evidence logging** captures the pre-fix failure state to validate that the eventual fix actually addresses the root cause.
- **Requirement tracking** prevents developers from modifying test expectations to force a pass without explicit justification.
- **Manual fallback documentation** provides a structured protocol for visual or hardware defects that cannot be automated.

### How it works
1. **Initiate reproduction**: The developer creates a new test case targeting the reported bug.
2. **Verify failure**: The agent runs the test suite to confirm a Red state while production code remains unchanged.
3. **Commit proof**: The failing test is committed or its output is logged as baseline evidence.
4. **Apply fix**: Production code is modified until the new test and all existing regressions are Green.

### Frameworks & tools
This skill is framework-agnostic. It works with standard test runners like Jest, Pytest, Mocha, JUnit, Vitest, and Go's testing package.

### Why this beats prompting it yourself
Prompting often leads to agents jumping straight to the solution, which risks "fixing" a symptom rather than the cause. This skill locks the agent into a strict TDD lifecycle, ensuring the bug is actually reproducible and that the fix is verified against a stable failing state.

### Use cases
- **Fixing regressions** by creating a permanent guard against known bugs.
- **Standardizing PRs** by requiring `Test: <name>` evidence for every bug fix.
- **Triaging issues** where a reproduction test helps verify if a bug actually exists in the current environment.

### Known limitations
Does not support specific test runner syntax out of the box. Requires the developer to define the fallback manual check logic for hardware-only defects.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the failing test first skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does 'failing test first' actually enforce the TDD workflow during a bug fix?

This skill acts as a gatekeeper that prevents an AI agent from modifying your production code until it has first committed or logged a verifiable, failing test case that reproduces the specific bug.

### Which AI agents and testing frameworks is this skill compatible with?

It is framework-agnostic and supports any agent capable of executing shell commands and file edits, working seamlessly with popular runners like Jest, Pytest, Mocha, and JUnit.

### What exactly is included in the purchase of this skill?

Your purchase includes the core logic for the reproduction-fix lifecycle, documentation for manual fallback protocols, and integration templates for standard CI/CD environments.

### Why should I use this skill instead of just telling my AI agent to write a test first?

Standard prompting often results in agents 'guessing' a fix; this skill adds a mandatory verification layer, ensuring you never accept a fix for a bug that the agent couldn't first prove existed.

### Can this skill handle UI bugs or hardware issues that are difficult to write automated tests for?

The skill includes a structured manual fallback protocol that requires the agent to document the visual or hardware-specific failure state before proceeding with the fix.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
