test-generationlisted
Install: claude install-skill paruff/uFawkesAI
# Skill: Test Generation
> **Load trigger:** `"load test-generation skill"`
> **DORA:** Cap 5 (Small Batches / Shift Left on Quality)
> **Token cost:** Low
## TDD Pattern — Language Agnostic
### Commit Sequence (required order)
```
1. test: add failing tests for [feature] ← CI fails here intentionally
2. feat: implement [feature] to pass tests
3. refactor: clean up [feature] if needed
```
## TypeScript/Jest Pattern
```typescript
// tests/services/auth.test.ts
import { signIn } from "../src/services/auth";
import { mockFirebaseAuth } from "./mocks/firebase";
describe("signIn", () => {
it("returns user object on valid credentials", async () => {
mockFirebaseAuth.mockResolvedValueOnce({
uid: "user-123",
email: "test@test.com",
});
const result = await signIn("test@test.com", "valid-password");
expect(result.uid).toBe("user-123");
});
it("throws AuthError when credentials are invalid", async () => {
mockFirebaseAuth.mockRejectedValueOnce(new Error("auth/wrong-password"));
await expect(signIn("test@test.com", "wrong")).rejects.toThrow(
"auth/wrong-password",
);
});
it("throws AuthError when email is malformed", async () => {
await expect(signIn("not-an-email", "password")).rejects.toThrow();
});
});
```
## Python/pytest Pattern
```python
# tests/test_auth.py
import pytest
from unittest.mock import patch, MagicMock
from src.services.auth import sign_in, AuthError
def test_sign_in_returns_user_on_valid_cr