What problem does it solve?
Developing complex AI deliberation systems requires rigorous testing to ensure reliability, prevent regressions, and maintain high code quality. This Skill teaches Test-Driven Development (TDD) patterns specifically tailored for AI Counsel's features.
Core Features & Use Cases
- TDD Workflow: Guides through the "red-green-refactor" cycle for developing new features, ensuring tests are written before implementation.
- Unit Test Patterns: Provides strategies for mocking adapters, subprocesses, and Pydantic models to create fast, isolated tests.
- Integration Test Patterns: Demonstrates how to test real adapter invocations, use VCR cassettes for HTTP tests, and conduct performance benchmarks.
- Code Quality Checks: Emphasizes running
black, ruff, and mypy to maintain consistent code style and type safety.
- Use Case: When adding a new HTTP adapter for a local LLM, first write a failing unit test that asserts the adapter correctly parses the model's response. Then, implement the adapter's
parse_response() method to make the test pass, ensuring the integration is robust from the start.
Quick Start
Before implementing any new feature, write a test that will initially fail:
tests/unit/test_new_feature.py
import pytest
from my_module import NewFeature
class TestNewFeature:
def test_feature_does_something(self):
feature = NewFeature()
result = feature.do_something()
assert result == "expected output"