brainstorming
Structured design dialogue that validates ideas before implementation begins.
pytest-test-scaffolder
Scaffolds pytest unit tests for Python backend functions and classes. Use when creating tests for FastAPI endpoints, services, and utilities.
Full skill instructions
Generates comprehensive unit tests for Python backend code using pytest with Pydantic validation, Firestore mocking, and Genkit integration testing patterns.
Identify function/class to test:
backend/app/api/endpoints/profiles.py)backend/app/tests/{{module}}/test_{{name}}.pyAnalyze code structure:
Generate test file:
{{FUNCTION_NAME}} - Function being tested{{FUNCTION_MODULE}} - Module import path{{PARAMETERS}} - Function parameters with defaults{{RETURN_TYPE}} - Expected return type{{HAPPY_PATH_TESTS}} - Success scenarios{{ERROR_TESTS}} - Exception handling{{FIXTURES}} - Mock/fixture setupbackend/app/tests/{{module}}/test_{{name}}.pyInclude comprehensive test scenarios:
Use pytest best practices:
monkeypatch for environment variables@pytest.mark for test categorizationtest_{{function}}_{{scenario}}Report success:
pytest backend/app/tests/{{module}}/test_{{name}}.py -v# Happy path: Valid request → 200 response
def test_create_user_success(client, monkeypatch):
mock_firestore = monkeypatch.setattr(...)
response = client.post("/api/users", json={...})
assert response.status_code == 200
assert response.json()["id"]
# Validation error: Invalid input → 422 response
def test_create_user_validation_error(client):
response = client.post("/api/users", json={"name": ""})
assert response.status_code == 422
# Permission error: No auth → 401 response
def test_create_user_unauthorized(client):
response = client.post("/api/users", json={...})
assert response.status_code == 401
# Not found: Resource missing → 404 response
def test_get_user_not_found(client):
response = client.get("/api/users/invalid-id")
assert response.status_code == 404
# Mock Firestore for service tests
@pytest.fixture
def mock_firestore(monkeypatch):
mock_db = MagicMock()
monkeypatch.setattr("app.services.firestore_client", mock_db)
return mock_db
def test_service_with_firestore(mock_firestore):
mock_firestore.collection.return_value.document.return_value.get.return_value.exists = True
result = UserService.get_user("user-123")
assert result is not None
# Mock Genkit responses
@pytest.fixture
def mock_genkit(monkeypatch):
mock_flow = MagicMock()
monkeypatch.setattr("app.ai.genkit_service.flow", mock_flow)
return mock_flow
@pytest.mark.ai_services
async def test_genkit_flow_execution(mock_genkit):
mock_genkit.return_value = {"text": "Generated response"}
result = await ai_service.generate_content(prompt="test")
assert "Generated" in result
@pytest.mark.asyncio
async def test_async_database_query(client, monkeypatch):
mock_db = AsyncMock()
mock_db.get_user.return_value = {"id": "123", "name": "Test"}
monkeypatch.setattr("app.db.get_user", mock_db)
result = await fetch_user_profile("123")
assert result["name"] == "Test"
See references/backend-test-patterns.md for:
Templates located in .claude/skills/pytest-test-scaffolder/templates/:
endpoint.test.py.tpl - FastAPI endpoint testsservice.test.py.tpl - Service/utility testsasync.test.py.tpl - Async function testsconftest.py.tpl - Shared fixture templatepytest backend/app/tests/ -vRun pytest backend/app/tests/ --cov=app --cov-report=html to measure coverage.
Structured design dialogue that validates ideas before implementation begins.
Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.
Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.
Introduction to the obra skills system with mandatory skill invocation rules and best practices.
Execute a written implementation plan with critical review and task checkpoints.
Delegate independent tasks to specialized agents working concurrently with isolated context.
Isolated git worktrees with smart directory selection and safety verification.
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Plan searchable and shareable content that drives traffic, builds authority, and generates leads.
README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.
Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.
Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.
The world's fastest calendar for remote work
Capture, organize, and utilize your knowledge effortlessly.
Instant Summaries of Audio & Video Interviews with AnySummary
Transform PDFs into engaging mind maps.
Chat with any PDF instantly
Create an optimal daily plan using your voice
A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.
AskYourPDF Pricing Plans: Tailored to Your Needs