Skip to content
Agentmart
Submit a tool

test-hygiene

Guidelines for writing effective tests that actually catch bugs.

Skill by ejacklab

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ejacklab-test-hygiene

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Guidelines for writing effective tests that actually catch bugs. Use when: (1) writing tests for new code, (2) deciding whether to mock or use real services, (3) reviewing test quality, (4) setting up test infrastructure. NOT for: running tests (that's just exec).

Use cases: testing, devops, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/test-hygiene

What's inside

Skill name
test-hygiene
Description
Guidelines for writing effective tests that actually catch bugs. Use when: (1) writing tests for new code, (2) deciding whether to mock or use real services, (3) reviewing test quality, (4) setting up test infrastructure. NOT for: running tests (that's just exec).
License
MIT
Instructions
72 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Test Hygiene

## Core Principle

**Real tests over mocks.** Mocks give false confidence. Real-service tests catch real bugs.

## Mock vs Real Decision

| Dependency | Mock? | Why |
|------------|-------|-----|
| External API (OpenAI, GitHub) | ✅ Mock | Unreliable, rate-limited, costs money |
| Internal service (TicketService) | ❌ Real | Must verify actual behavior |
| Database (Zvec, Postgres) | ❌ Real | Different DBs behave differently |
| File system | ❌ Real | Use tmp_path, not mocks |
| HTTP client (internal) | ❌ Real | Use TestClient, not mocks |
| Time/timeouts | ✅ Mock | Can't wait for real time in tests |

## vtic Lessons

### Mocks Hide Real Bugs
- Mock-based API route tests: all passed ✅
- Integration tests with real TicketService: **async/await bug caught** ❌
- The mock didn't enforce the actual async contract

### Test Types by Confidence

| Type | Confidence | Use For |
|------|-----------|---------|
| Unit test with real services | High | Core logic, data transformations |
| Integration test (FastAPI TestClient) | Highest | Full request→response flow |
| Unit test with mocks | Medium | External API calls only |
| Performance test | High | Verify targets (<10ms BM25, <5ms CRUD) |

## Test Infrastructure

```python
# Good pattern: tmp_path + real services
def test_create_ticket(client, tmp_path):
    """client = FastAPI TestClient with real TicketService + Zvec"""
    response = client.post("/tickets", json={"title": "Bug in login"})
    assert response.status_code == 201
    assert response.json()["title"] == "Bug in login"
```

```python
# Bad pattern: mocked everything
def test_create_ticket(mocker):
    mock_service = mocker.MagicMock()
    mock_service.create.return_value = Ticket(id="C1", ...)
    # This test proves nothing — it tests the mock, not the code
```

## Test Naming

Use descriptive names that explain what's being tested:
```
✅ test_search_with_filters_returns_only_matching_tickets
✅ test_create_ticket_with_missing_title_returns_400
❌ test_search
❌ test_create
```

## Edge Cases to Always Test

- Empty input / empty results
- Invalid input (wrong types, missing fields)
- Not found (404)
- Duplicate operations
- Boundary values (limit=0, limit=10000)
- Concurrent-like patterns (sequential rapid ops)

From ejacklab/vtic, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Mar 21, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ejacklab

Cite this page

test-hygiene skill. Agent Mart. https://agentmart.dev/skills/ejacklab-test-hygiene (last updated 2026-10-24)