From reins
Invoke before writing any backend Python code. Enforces Red-Green-Refactor cycle with project-specific Clean Code constraints.
How this skill is triggered — by the user, by Claude, or both
Slash command
/reins:backend-tddThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Invoke before writing any backend Python code. Enforces Red-Green-Refactor cycle with project-specific Clean Code constraints.
Invoke before writing any backend Python code. Enforces Red-Green-Refactor cycle with project-specific Clean Code constraints.
uv run pytest backend/tests/unit/test_<module>.py -v -k "test_<behavior>" --no-header
test_<verb>_<scenario>_<expected> (e.g., test_returns_empty_when_no_results)Write the smallest amount of production code that makes the test green. No more.
uv run pytest backend/tests/unit/test_<module>.py -v --no-header
Apply the constraints below. Run tests after every change:
uv run ruff format backend/ && uv run ruff check backend/ --fix
uv run mypy backend/agents/ backend/interfaces/ backend/domain/ backend/infrastructure/
uv run pytest backend/tests/unit/ -v --no-header -q
dict[str, object] for structured data. Use dataclass or Pydantic BaseModel.str for IDs, statuses, or enums. Use NewType, Literal, or Enum.assert for runtime validation. Use if not x: raise ValueError(...).object at trust boundaries (JSON parsing), then narrow with isinstance().find_bangumi_by_title, not bangumi_lookup)is_/has_/can_/should_ prefixRouteOptimizer, not RouteHelper)SCREAMING_SNAKE_build_params)test_returns_404_when_session_not_foundasyncio.sleep or use freezegun/time-machine.assert result == expected, not assert result is not Noneassert len(items) == 3, f"Expected 3 items, got {len(items)}"pytest.raises(ValueError, match="...") with match patternrespx for HTTP mocks, TestModel for Pydantic AI.@pytest.mark.parametrize for testing multiple inputs with same logic.make_point(), make_bangumi()), not inline dicts.| Anti-Pattern | Example | Fix |
|---|---|---|
| God function | handle() at 217 lines | Extract sub-methods by phase |
| God module | 694-line service file | Split into route modules |
| dict[str, object] | Session state as bare dict | Create SessionState dataclass |
| assert for validation | assert x is not None | if not x: raise ValueError(...) |
| Duplicated handlers | search_bangumi ≈ search_nearby | Extract shared template |
| Feature envy | Method calls 5+ other module functions | Move logic to owning module |
| Flaky timing test | assert elapsed >= 0.15 | Mock the clock |
| Eager test | One test, 4 unrelated asserts | Split into 4 tests |
| Mystery guest | Fixture sets hidden state | Make dependencies explicit |
Provides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.
npx claudepluginhub lifeodyssey/reins --plugin reins