- Home
- Skills
- Testing & Debugging
- failing test first
failing test first
Enforce bug-fix integrity by requiring a committed failing test reproduction before any production code changes.
Free
failing test first
Example session with this skill installed
I have a bug where the user profile page crashes when the 'bio' field is exactly 500 characters. Fix it using the failing-test-first protocol.
- Read your context and instructions
- Compiled the failing test first
I will begin by reproducing the reported crash with a failing test case before applying any fixes to the production code. ## Bug Reproduction and Verification | Step | Action | Result | | :--- | :--- | :--- | | **1. Create Test** | Added `tests/profile.test.js` with a 500-char string input. | `PASS` (Test Created) | | **2. Verify Failure** | Ran `npm test tests/profile.test.js`. | `FAIL` (TypeError: bio.substring is not a function) | | **3. Evidence** | Committed failing test in `feat/repro-bio-crash`. | `RECORDED` | ### Failing Test Evidence ```javascript // tests/profile.test.js test('should handle bio at exactly 500 characters limit', () => { const bio = "a".repeat(500); const result = renderProfile({ bio }); expect(result).not.toThrow(); }); ``` ### Production Fix ```javascript // src/components/Profile.js export const renderProfile = (user) => { // Fix: Ensure bio is treated as string and check bounds correctly const displayBio = String(user.bio || "").substring(0, 500); return `<div>${displayBio}</div>`; }; ``` **Next steps** 1. Run the full test suite to ensure no other profile features are broken. 2. Verify the `Test: tests/profile.test.js` entry is added to the PR description. 3. Merge the fix now that the reproduction test is passing.
Connects securely to your tools. The creator never sees your data.
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
- 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 buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 12 days ago
- Free with an Agensi account
Permissions
What's inside
Frequently Asked Questions
New in Testing & Debugging
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.