Write and fix tests that catch real bugs, by testing behaviour, faking only the device boundary and seeding data the way the product writes it. Use when a bug needs a test that fails first, or a unit test is failing or flaky, or when the user says "add a test for this bug", "fix this failing test" or "why is this test flaky". For the bar every test is held to, use test-like-a-user.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Bug Trap?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/wednesday-solutions-bug-trap)
---
name: bug-trap
description: Write and fix tests that catch real bugs, by testing behaviour, faking only the device boundary and seeding data the way the product writes it. Use when a bug needs a test that fails first, or a unit test is failing or flaky, or when the user says "add a test for this bug", "fix this failing test" or "why is this test flaky". For the bar every test is held to, use test-like-a-user.
---
# Tests
1. **Test behaviour, not layout.** Tests should survive a UI redesign.
2. **Below the UI first:** engine and service contract tests for what the feature does.
3. **Rendered tests** find elements by role, label or test id. Never by copy or position.
4. **Fake only the device boundary:** native modules, network, disk, clock, memory. No mocks of the project's own code.
5. **Seed through the product's own write paths.** Data enters the way the app writes it (capture, import, analysis), never by `INSERT` into its tables. A hand-seeded row tests your guess of the schema, not the product.
6. **A failing test is a finding.** Fix the cause. Never loosen the test or raise a timeout.
7. **Hard cases:** read `test-like-a-user/reference/test-doctrine.md`. For the full standard on journeys and review verdicts, see `test-like-a-user`.