Borrowing it
Nothing to install: this file belongs to cohen-liel/hivemind. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/cohen-liel/hivemind/main/.claude/skills/pytest-patterns/SKILL.mdgit clone --depth 1 https://github.com/cohen-liel/hivemindWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cohen-liel/hivemind/pytest-patterns)<a href="https://agentmods.dev/skills/cohen-liel/hivemind/pytest-patterns"><img src="https://agentmods.dev/badge/skills/cohen-liel/hivemind/pytest-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cohen-liel/hivemind/pytest-patterns"><img src="https://agentmods.dev/badge/skills/cohen-liel/hivemind/pytest-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00034 | $0.00771 |
| Opus 5.5 | $0.00014 | $0.00308 |
| Sonnet 5.5 | $0.00007 | $0.00154 |
| Haiku 4.5 | $0.00003 | $0.00077 |
Grade A, and why
pytest-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 112 lines — stays where its author put it; the contents beside it link to each section on GitHub.
pytest Patterns
Structure
tests/
conftest.py # Shared fixtures
unit/ # Pure unit tests (no I/O)
integration/ # DB, Redis, API tests
e2e/ # Full flow tests
test_models.py # Test naming: test_<module>.py
conftest.py (Fixtures)
import pytest
from httpx import AsyncClient, ASGITransport
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
@pytest.fixture(scope="session")
def event_loop():
loop = asyncio.new_event_loop()
yield loop
loop.close()
@pytest.fixture(scope="session")
async def engine():
engine = create_async_engine("postgresql+asyncpg://test:test@localhost/test_db")
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
yield engine
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.drop_all)
@pytest.fixture
async def db(engine):
async with AsyncSession(engine) as session:
yield session
await session.rollback()
@pytest.fixture
async def client(db):
app.dependency_overrides[get_db] = lambda: db
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as c:
yield c
app.dependency_overrides.clear()
@pytest.fixture
async def user(db):
u = User(email="[email protected]", name="Test")
db.add(u)
await db.flush()
return u
Test Patterns
# Parametrize for edge cases
@pytest.mark.parametrize("email,valid", [
("[email protected]", True),
("invalid", False),
("", False),
("a" * 300 + "@x.com", False),
])
async def test_email_validation(email, valid):
...
# Mock external services
from unittest.mock import AsyncMock, patch
async def test_sends_email(client, user):
with patch("app.services.email.send") as mock_send:
mock_send.return_value = None
resp = await client.post("/users/verify", json={"email": user.email})
assert resp.status_code == 200
mock_send.assert_called_once_with(user.email, subject="Verify your account")
# Test error cases
async def test_get_user_not_found(client):
resp = await client.get("/users/99999")
assert resp.status_code == 404
assert "not found" in resp.json()["detail"].lower()
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 112 lines · 34 tokens per session scan A 236639cbad0d
pytest-patterns is a skill published in the GitHub repository cohen-liel/hivemind (112 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 34 tokens to every session and 771 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
gentle-ai-bench
Trigger: bench, journey, journeys, driven mode, gentle-ai-bench, journey corpus, j-numbers, bench axis. Author and verify gentle-ai bench journeys; go test ./bench never proves driven execution.
go-testing
Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.
include-test-files-that-assert-on-behavior-being-changed-in-decl
When delegating a task affected by this skill, include.
Autonomous Agent Testing
Testing patterns for autonomous AI coding agents like Devin and SWE-Agent including task verification, output validation, sandboxed execution, regression testing for agent behavior, and safety guardrails for autonomous code generation.
ring:running-dev-cycle
Running the backend dev cycle: implements every task in a rolling-wave plan.md (ring:writing-plans format) for a Go/TS service, driving specialist agents through Gate 0 implementation/TDD, Gate 8 parallel review, and Gate 9 validation per epic, elaborating later phases at each phase boundary. Use when starting or…
ring:instrumenting-streaming-events
Instrumenting streaming events: wires lib-streaming event emission end-to-end into a Lerian Go service via a 13-gate cycle (catalog, Builder bootstrap, Emit sites, outbox, HTTP manifest, NoopEmitter fallback, integration and chaos tests), dispatching ring:backend-go under TDD. Consumes the validated…