.claude/skills/testing-workflow/SKILL.md
Write comprehensive tests following project conventions (tiers, patterns, anti-patterns). Use when writing tests, improving test coverage, fixing failing tests, or reviewing test quality.
npx skillsauth add awannaphasch2016/jousef-landing testing-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Ask yourself:
pytest --tier=0)pytest, default)pytest --tier=2)pytest --tier=3)pytest --tier=4)For Lambda/infrastructure testing (layers beyond pytest):
just test-scheduler-unit, 15s)just test-scheduler, 2 min)just test-scheduler-docker, 90s)just test-scheduler-contracts, 10s)just test-scheduler-all, 5 min)just test-scheduler-integration, 60s)See Progressive Testing Strategy for the 7-layer approach.
NEW: Docker-based testing prevents "filesystem unaware" deployment failures
For Lambda functions (LINE bot, Telegram API), run tests in Docker to match production runtime:
# LINE bot Docker import validation
./scripts/test_line_bot_docker.sh
# Pre-commit validation (syntax + unit tests + Docker imports)
./scripts/test_line_bot_pre_commit.sh
Why Docker tests matter:
/var/task)CI/CD integration:
.github/workflows/deploy-line-dev.yml)Anti-pattern prevented: ❌ Running tests in dev environment (setup-python) but deploying to Lambda (Docker container) ✅ Run tests in Docker container that matches deployed environment
See: .claude/specifications/workflow/2025-12-29-implement-test-workflow-to-reduce-false-positive-deployment.md
Escalation Trigger:
/validate shows tests don't actually test the claimTools Used:
/validate - Verify tests actually test what they claim (sabotage code, test should fail)/consolidate - Align test intent with code reality (update tests or fix code)/trace - Understand test failure causality (why did this test fail?)/reflect - Assess test quality (are we testing outcomes or just execution?)Why This Works: Testing naturally involves synchronize loop—ensuring tests align with code behavior, not just pass.
See Thinking Process Architecture - Feedback Loops for structural overview.
tests/
├── conftest.py # Shared fixtures ONLY
├── shared/ # Agent, workflow, data tests
├── telegram/ # Telegram API tests
├── line_bot/ # LINE Bot tests (mark: legacy)
├── e2e/ # Playwright browser tests
├── integration/ # External API tests
└── infrastructure/ # S3, DynamoDB tests
| Tier | Command | Includes | Use Case |
|------|---------|----------|----------|
| 0 | pytest --tier=0 | Unit only | Fast local |
| 1 | pytest (default) | Unit + mocked | Deploy gate |
| 2 | pytest --tier=2 | + integration | Nightly |
| 3 | pytest --tier=3 | + smoke | Pre-deploy |
| 4 | pytest --tier=4 | + e2e | Release |
class TestComponent:class TestComponent in appropriate test filesetup_method() if component needs initializationdef test_behavior_description(self):@pytest.mark.integration@pytest.mark.ratelimited)pytest --cov to see coverage report@pytest.mark.integration # External APIs (LLM, yfinance)
@pytest.mark.smoke # Requires live server
@pytest.mark.e2e # Requires browser
@pytest.mark.legacy # LINE bot (skip in Telegram CI)
@pytest.mark.ratelimited # API rate limited (--run-ratelimited to include)
pytestmark = pytest.mark.legacy # Mark entire file
# Deploy gate (Tier 1)
just test-deploy
# Integration + Telegram only (Tier 2)
pytest --tier=2 tests/telegram
# Skip LINE bot and browser tests
pytest -m "not legacy and not e2e"
# Include rate-limited tests
pytest --run-ratelimited
# Coverage report
pytest --cov
| DO | DON'T |
|----|-------|
| class TestComponent: | def test_foo() at module level |
| assert x == expected | return True/False (pytest ignores!) |
| assert isinstance(r, dict) | assert r is not None (weak) |
| Define mocks in conftest.py | Duplicate mocks per file |
| Patch where USED: @patch('src.api.module.lib') | Patch where defined: @patch('lib') |
| AsyncMock for async methods | Mock for async (breaks await) |
tools
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.
content-media
Clone and customize existing templates (landing pages, dashboards, admin panels) with style extraction, config-driven content, and theme customization
development
Create high-converting B2B landing pages using psychological section sequencing. Use when building landing pages for services, agencies, consultants, or B2B products. Provides 14-section framework optimized for conversion psychology.
development
Systematic investigation and root cause analysis. Use when debugging persistent issues, understanding complex systems, or before making architectural decisions.