/4layer - Four-Layer TDD Testing Protocol
Executes comprehensive four-layer TDD protocol from unit tests to end-to-end validation.
/plugin marketplace add jleechanorg/claude-commands/plugin install claude-commands@claude-commands-marketplaceWhen this command is invoked, YOU (Claude) must execute these steps immediately: This is NOT documentation - these are COMMANDS to execute right now. Use TodoWrite to track progress through multi-phase workflows.
Action Steps:
Planning Phase (/think):
Execution Phase (/e):
Implements comprehensive Test-Driven Development across 4 testing layers to ensure complete coverage from unit to end-to-end testing.
/4layer [feature_name]
test_main_[feature].pytest_llm_service_[feature].pytest_database_service_[feature].pytest_frontend_[feature].jstest_integration/test_[feature]_integration.pytesting_ui/test_[feature]_browser_mock.pytesting_ui/test_[feature]_browser_real.py
# Layer 1: test_main_structured_fields.py
def test_response_includes_structured_fields():
"""Unit test: main.py returns structured fields in response"""
# Mock all dependencies
# Test specific function behavior
# Layer 2: test_structured_fields_integration.py
def test_structured_fields_flow():
"""Integration: Full backend flow with mocked external services"""
# Mock only hosted databases, LLMs, and other third-party APIs
# Test complete data flow
# Layer 3: test_structured_fields_browser_mock.py
def test_structured_fields_display():
"""Browser: UI displays fields correctly (mocked services)"""
# Use Playwright with mocked backend integrations
# Capture screenshots
# Layer 4: test_structured_fields_browser_real.py
def test_structured_fields_e2e():
"""E2E: Complete system with real external services"""
# No mocks - real Firebase/databases/LLM APIs
# Final validation screenshots
When /4layer is invoked:
/think for planning/tdd principles for implementation/e with structured milestones