[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DDJG3VACD4G63HQ3WWDTV5":3,"skill-same:01M7DDJG3VACD4G63HQ3WWDTV5":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":13,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7DDJG3VACD4G63HQ3WWDTV5","testing-expert",null,"Expert knowledge for analyzing testing architecture and planning improvements","AgentParadise\u002Fagentic-workspace","AgentParadise","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F242330113?v=4","01M6C52MXXSE01NH5GKMC3N7JA","01M7DDFCPP7TW5GGJZYGFPKMK2",0,"MIT","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Ftesting-expert\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: Expert knowledge for analyzing testing architecture and planning improvements\nmodel: sonnet\nallowed-tools: Read, Grep, Glob, Bash\n---\n\n# Testing Expert\n\nExpert knowledge for analyzing repository testing architecture, identifying gaps, and planning comprehensive testing improvements—with special focus on AI agent verification.\n\n## Philosophy\n\n### Core Principles\n\n> **\"Testing code is as important as production code.\"**\n>\n> **\"Don't trust the agent, verify the world.\"**\n\nTests are not second-class citizens. They:\n- Document expected behavior\n- Enable safe refactoring\n- Catch regressions before production\n- Provide deployment confidence\n\nFor AI agents specifically, tests must **verify reality**, not just that the agent claimed success.\n\n---\n\n## The 5 Verification Levels\n\nThis is the most important concept for testing AI agent systems.\n\n### The Problem: Tests That Lie\n\nTraditional tests verify function returns. Agent tests often only verify:\n- The code didn't crash\n- The agent claimed success\n\n**This is insufficient.** AI agents can claim success while failing. We found this actual code:\n\n```python\ndef test_github_app_works(self):\n    \"\"\"Verify GitHub App can create files.\"\"\"\n    assert True  # ← Tests NOTHING\n```\n\n### The Verification Hierarchy\n\n| Level | Name | Description | Confidence |\n|-------|------|-------------|------------|\n| 5 | **Invariant** | Property is ALWAYS true | ⭐⭐⭐⭐⭐ |\n| 4 | **Outcome** | World state changed correctly | ⭐⭐⭐⭐ |\n| 3 | **Event** | Correct events were emitted | ⭐⭐⭐ |\n| 2 | **Output** | Function returned success | ⭐⭐ |\n| 1 | **Existence** | Code didn't crash | ⭐ |\n\n**Minimum acceptable: Level 3**\n**Critical paths: Level 4-5**\n\n### Anti-Patterns to Find\n\n```python\n# ❌ Level 1: USELESS - Tests nothing\ndef test_agent_works():\n    agent.run(\"do something\")\n    assert True\n\n# ❌ Level 2: WEAK - Trusts agent's claim\ndef test_agent_creates_file():\n    result = agent.run(\"create file.py\")\n    assert result.status == \"success\"  # Agent could be lying\n\n# ✅ Level 4: GOOD - Verifies reality\ndef test_agent_creates_file():\n    result = agent.run(\"create file.py\")\n    assert Path(\"file.py\").exists()  # Check filesystem\n    content = Path(\"file.py\").read_text()\n    compile(content, \"file.py\", \"exec\")  # Verify valid Python\n```\n\n### Three-Source Verification\n\nFor critical claims, verify from THREE independent sources:\n\n```python\nasync def verify_pr_created(execution_id: str, pr_number: int) -> bool:\n    # Source 1: Our event store\n    events = await event_store.read(f\"execution-{execution_id}\")\n    pr_event = next((e for e in events if e.type == \"PRCreated\"), None)\n\n    # Source 2: External API\n    github_pr = await github.get_pr(pr_number)\n\n    # Source 3: Ground truth\n    branch_exists = await git_branch_exists(f\"aef\u002F{execution_id}\")\n\n    # ALL THREE must agree\n    return pr_event and github_pr and branch_exists\n```\n\n---\n\n## Analysis Workflow\n\n### Step 1: Discover Test Structure\n\n```bash\n# Find test configuration\ncat pytest.ini pyproject.toml setup.cfg 2>\u002Fdev\u002Fnull | grep -A20 \"\\[tool.pytest\"\ncat jest.config.* vitest.config.* 2>\u002Fdev\u002Fnull\n\n# Find test directories\nfind . -type d -name \"test*\" -o -name \"*tests*\" | head -20\n\n# Count test files\nfind . -name \"test_*.py\" -o -name \"*_test.py\" | wc -l\nfind . -name \"*.test.ts\" -o -name \"*.spec.ts\" | wc -l\n```\n\n### Step 2: Assess Test Types\n\n```bash\n# Find test markers\u002Fcategories\ngrep -r \"@pytest.mark\\.\" --include=\"*.py\" | cut -d: -f2 | sort | uniq -c\n\n# Find integration tests\nfind . -path \"*\u002Fintegration\u002F*\" -name \"test_*.py\"\n\n# Find E2E tests\nfind . -path \"*\u002Fe2e\u002F*\" -name \"*.py\" -o -name \"e2e_*.py\"\n```\n\n### Step 3: Find Anti-Patterns\n\n```bash\n# Level 1: assert True (useless)\ngrep -rn \"assert True\" --include=\"*.py\"\n\n# Level 2: Only checking status\ngrep -rn \"assert.*\\.status\\|assert.*\\.success\" --include=\"*.py\"\n\n# Missing assertions\ngrep -rn \"def test_\" --include=\"*.py\" -A10 | grep -B5 \"^--$\"\n```\n\n### Step 4: Assess Coverage\n\n```bash\n# Check coverage configuration\ngrep -r \"cov\" pyproject.toml pytest.ini\n\n# Find coverage reports\nfind . -name \"*.coverage\" -o -name \"coverage.xml\" -o -name \"htmlcov\"\n\n# Check CI for coverage gates\ncat .github\u002Fworkflows\u002F*.yml | grep -i \"coverage\\|cov-fail\"\n```\n\n### Step 5: Check CI Integration\n\n```bash\n# What runs in CI?\ncat .github\u002Fworkflows\u002F*.yml | grep -E \"pytest|jest|vitest|test\"\n\n# Coverage gates?\ncat .github\u002Fworkflows\u002F*.yml | grep \"cov-fail-under\"\n\n# Test parallelization?\ncat .github\u002Fworkflows\u002F*.yml | grep -i \"parallel\\|matrix\"\n```\n\n---\n\n## Assessment Report Template\n\n```markdown\n# Testing Architecture Assessment\n\n## Summary\n\n| Metric | Current | Target | Gap |\n|--------|---------|--------|-----|\n| Test Files | X | - | - |\n| Test Functions | X | - | - |\n| Coverage | X% | 80% | X% |\n| Unit:Integration:E2E | X:X:X | 70:20:10 | - |\n\n## Test Structure\n\n### Strengths\n- ✅ [What's working well]\n\n### Gaps\n- ❌ [What's missing or broken]\n\n## Anti-Patterns Found\n\n### Level 1 Violations (assert True)\n| File | Line | Issue |\n|------|------|-------|\n| path\u002Ffile.py | 42 | `assert True` |\n\n### Level 2 Violations (Trust without verify)\n| File | Line | Issue |\n|------|------|-------|\n| path\u002Ffile.py | 88 | `assert result.success` without verification |\n\n## Recommendations\n\n### Priority 1: Critical (Do Now)\n1. [Action item]\n\n### Priority 2: Important (This Sprint)\n1. [Action item]\n\n### Priority 3: Nice to Have (Backlog)\n1. [Action item]\n\n## Implementation Plan\n\n### Week 1: Foundation\n- [ ] Task 1\n- [ ] Task 2\n\n### Week 2: Core Improvements\n- [ ] Task 3\n- [ ] Task 4\n```\n\n---\n\n## Testing Patterns\n\n### Pattern 1: Arrange-Act-Assert (AAA)\n\n```python\ndef test_user_creation():\n    # Arrange\n    user_data = {\"name\": \"Alice\", \"email\": \"alice@example.com\"}\n\n    # Act\n    user = create_user(user_data)\n\n    # Assert\n    assert user.id is not None\n    assert user.name == \"Alice\"\n```\n\n### Pattern 2: Given-When-Then (BDD)\n\n```python\ndef test_checkout_applies_discount():\n    # Given a cart with items over $100\n    cart = Cart()\n    cart.add(Item(price=150))\n\n    # When checkout is performed\n    order = checkout(cart, discount_code=\"SAVE10\")\n\n    # Then 10% discount is applied\n    assert order.total == 135\n```\n\n### Pattern 3: Fixture Factory\n\n```python\n@pytest.fixture\ndef make_user():\n    \"\"\"Factory fixture for creating test users.\"\"\"\n    created = []\n\n    def _make_user(**kwargs):\n        user = User(\n            name=kwargs.get(\"name\", \"Test User\"),\n            email=kwargs.get(\"email\", f\"test-{uuid4()}@example.com\"),\n        )\n        created.append(user)\n        return user\n\n    yield _make_user\n\n    # Cleanup\n    for user in created:\n        user.delete()\n```\n\n### Pattern 4: Test Markers (Categorization)\n\nMarkers tag tests with metadata so pytest can run them selectively:\n\n```python\nimport pytest\n\n@pytest.mark.unit\ndef test_fast_logic():\n    \"\"\"Runs in milliseconds, no I\u002FO.\"\"\"\n    assert 1 + 1 == 2\n\n@pytest.mark.integration\nasync def test_with_database():\n    \"\"\"Needs real database connection.\"\"\"\n    result = await db.query(\"SELECT 1\")\n    assert result == 1\n\n@pytest.mark.e2e\nasync def test_full_workflow():\n    \"\"\"Needs entire stack running.\"\"\"\n    response = await api.post(\"\u002Fexecute\")\n    assert response.status_code == 200\n```\n\n**Running by marker:**\n```bash\npytest -m unit           # Fast, every commit (~30s)\npytest -m integration    # Slower, PR only (~2min)\npytest -m \"not e2e\"      # Skip expensive tests\n```\n\n**Register in pyproject.toml:**\n```toml\n[tool.pytest.ini_options]\nmarkers = [\n    \"unit: Fast tests with no external dependencies\",\n    \"integration: Tests requiring database or services\",\n    \"e2e: End-to-end tests requiring full stack\",\n]\n```\n\n**Auto-detection rules:**\n| If test has... | Mark as |\n|----------------|---------|\n| `MagicMock`, `AsyncMock`, no DB imports | `@pytest.mark.unit` |\n| `event_store`, `postgresql:\u002F\u002F`, `docker` | `@pytest.mark.integration` |\n| `e2e_` in filename | `@pytest.mark.e2e` |\n\n### Pattern 5: Test Doubles\n\n| Double | Use Case |\n|--------|----------|\n| **Dummy** | Fill parameters, never used |\n| **Stub** | Return predetermined values |\n| **Spy** | Record calls for later verification |\n| **Mock** | Pre-programmed expectations |\n| **Fake** | Working implementation (in-memory DB) |\n\n### Pattern 5: Property-Based Testing\n\n```python\nfrom hypothesis import given, strategies as st\n\n@given(st.lists(st.integers()))\ndef test_sort_is_idempotent(items):\n    \"\"\"Sorting twice gives same result as sorting once.\"\"\"\n    once = sorted(items)\n    twice = sorted(sorted(items))\n    assert once == twice\n\n@given(st.lists(st.integers()))\ndef test_sort_preserves_length(items):\n    \"\"\"Sorting doesn't change list length.\"\"\"\n    assert len(sorted(items)) == len(items)\n```\n\n---\n\n## Coverage Best Practices\n\n### Coverage Targets by Component Type\n\n| Component | Target | Rationale |\n|-----------|--------|-----------|\n| Business Logic | 90%+ | Core value, must be correct |\n| API Handlers | 80%+ | User-facing, critical paths |\n| Utilities | 85%+ | Widely used, high leverage |\n| Infrastructure | 70%+ | Integration tested |\n| Generated Code | 0% | Skip, test generator instead |\n\n### Coverage Exclusions\n\n```python\n# pyproject.toml\n[tool.coverage.report]\nexclude_lines = [\n    \"pragma: no cover\",\n    \"def __repr__\",\n    \"if TYPE_CHECKING:\",\n    \"raise NotImplementedError\",\n    \"if __name__ == .__main__.:\",\n]\n```\n\n### Coverage vs Quality\n\n> **High coverage ≠ Good tests**\n\n100% coverage with bad assertions is worse than 60% coverage with thorough verification.\n\n**Focus on:**\n- Critical path coverage\n- Edge case coverage\n- Verification quality (Level 4+)\n\n---\n\n## CI\u002FCD Integration\n\n### Essential CI Gates\n\n```yaml\n# Required for merge\n- name: Run tests\n  run: pytest --cov --cov-fail-under=70\n\n- name: Check types\n  run: mypy src\n\n- name: Lint\n  run: ruff check .\n```\n\n### Test Parallelization\n\n```yaml\nstrategy:\n  matrix:\n    shard: [1, 2, 3, 4]\nsteps:\n  - run: pytest --shard-id=${{ matrix.shard }} --num-shards=4\n```\n\n### Flaky Test Detection\n\n```yaml\n- name: Run tests with retries\n  run: pytest --reruns 2 --reruns-delay 1\n```\n\n---\n\n## Common Gaps & Fixes\n\n### Gap 1: No Integration Tests\n\n**Symptom:** All tests mock everything\n**Fix:** Add tests with real database\u002Fservices using testcontainers\n\n### Gap 2: Tests Without Assertions\n\n**Symptom:** `def test_x(): some_code()` with no assert\n**Fix:** Add explicit verification of expected outcomes\n\n### Gap 3: Flaky Tests\n\n**Symptom:** Tests pass\u002Ffail randomly\n**Fix:**\n- Remove time-dependencies (use freezegun)\n- Add proper async handling\n- Use deterministic test data\n\n### Gap 4: Slow Test Suite\n\n**Symptom:** Tests take >5 minutes\n**Fix:**\n- Parallelize with pytest-xdist\n- Use fixtures with proper scope\n- Mock expensive external calls\n\n### Gap 5: Missing Edge Cases\n\n**Symptom:** Bugs in production that \"tests should have caught\"\n**Fix:**\n- Add property-based testing\n- Review with mutation testing\n- Add regression tests for each bug found\n\n---\n\n## Related Skills\n\n- `testing\u002Fai-agent-verification` - Deep dive on AI agent testing\n- `devops\u002Fci-cd` - CI\u002FCD pipeline configuration\n- `review\u002Fprioritize` - Prioritize issues by severity\n","# Testing Expert\n\nExpert knowledge for analyzing repository testing architecture, identifying gaps, and planning comprehensive testing improvements—with special focus on AI agent verification.\n\n## Philosophy\n\n### Core Principles\n\n> **\"Testing code is as important as production code.\"**\n>\n> **\"Don't trust the agent, verify the world.\"**\n\nTests are not second-class citizens. They:\n- Document expected behavior\n- Enable safe refactoring\n- Catch regressions before production\n- Provide deployment confidence\n\nFor AI agents specifically, tests must **verify reality**, not just that the agent claimed success.\n\n---\n\n## The 5 Verification Levels\n\nThis is the most important concept for testing AI agent systems.\n\n### The Problem: Tests That Lie\n\nTraditional tests verify function returns. Agent tests often only verify:\n- The code didn't crash\n- The agent claimed success\n\n**This is insufficient.** AI agents can claim success while failing. We found this actual code:\n\n```python\ndef test_github_app_works(self):\n    \"\"\"Verify GitHub App can create files.\"\"\"\n    assert True  # ← Tests NOTHING\n```\n\n### The Verification Hierarchy\n\n| Level | Name | Description | Confidence |\n|-------|------|-------------|------------|\n| 5 | **Invariant** | Property is ALWAYS true | ⭐⭐⭐⭐⭐ |\n| 4 | **Outcome** | World state changed correctly | ⭐⭐⭐⭐ |\n| 3 | **Event** | Correct events were emitted | ⭐⭐⭐ |\n| 2 | **Output** | Function returned success | ⭐⭐ |\n| 1 | **Existence** | Code didn't crash | ⭐ |\n\n**Minimum acceptable: Level 3**\n**Critical paths: Level 4-5**\n\n### Anti-Patterns to Find\n\n```python\n# ❌ Level 1: USELESS - Tests nothing\ndef test_agent_works():\n    agent.run(\"do something\")\n    assert True\n\n# ❌ Level 2: WEAK - Trusts agent's claim\ndef test_agent_creates_file():\n    result = agent.run(\"create file.py\")\n    assert result.status == \"success\"  # Agent could be lying\n\n# ✅ Level 4: GOOD - Verifies reality\ndef test_agent_creates_file():\n    result = agent.run(\"create file.py\")\n    assert Path(\"file.py\").exists()  # Check filesystem\n    content = Path(\"file.py\").read_text()\n    compile(content, \"file.py\", \"exec\")  # Verify valid Python\n```\n\n### Three-Source Verification\n\nFor critical claims, verify from THREE independent sources:\n\n```python\nasync def verify_pr_created(execution_id: str, pr_number: int) -> bool:\n    # Source 1: Our event store\n    events = await event_store.read(f\"execution-{execution_id}\")\n    pr_event = next((e for e in events if e.type == \"PRCreated\"), None)\n\n    # Source 2: External API\n    github_pr = await github.get_pr(pr_number)\n\n    # Source 3: Ground truth\n    branch_exists = await git_branch_exists(f\"aef\u002F{execution_id}\")\n\n    # ALL THREE must agree\n    return pr_event and github_pr and branch_exists\n```\n\n---\n\n## Analysis Workflow\n\n### Step 1: Discover Test Structure\n\n```bash\n# Find test configuration\ncat pytest.ini pyproject.toml setup.cfg 2>\u002Fdev\u002Fnull | grep -A20 \"\\[tool.pytest\"\ncat jest.config.* vitest.config.* 2>\u002Fdev\u002Fnull\n\n# Find test directories\nfind . -type d -name \"test*\" -o -name \"*tests*\" | head -20\n\n# Count test files\nfind . -name \"test_*.py\" -o -name \"*_test.py\" | wc -l\nfind . -name \"*.test.ts\" -o -name \"*.spec.ts\" | wc -l\n```\n\n### Step 2: Assess Test Types\n\n```bash\n# Find test markers\u002Fcategories\ngrep -r \"@pytest.mark\\.\" --include=\"*.py\" | cut -d: -f2 | sort | uniq -c\n\n# Find integration tests\nfind . -path \"*\u002Fintegration\u002F*\" -name \"test_*.py\"\n\n# Find E2E tests\nfind . -path \"*\u002Fe2e\u002F*\" -name \"*.py\" -o -name \"e2e_*.py\"\n```\n\n### Step 3: Find Anti-Patterns\n\n```bash\n# Level 1: assert True (useless)\ngrep -rn \"assert True\" --include=\"*.py\"\n\n# Level 2: Only checking status\ngrep -rn \"assert.*\\.status\\|assert.*\\.success\" --include=\"*.py\"\n\n# Missing assertions\ngrep -rn \"def test_\" --include=\"*.py\" -A10 | grep -B5 \"^--$\"\n```\n\n### Step 4: Assess Coverage\n\n```bash\n# Check coverage configuration\ngrep -r \"cov\" pyproject.toml pytest.ini\n\n# Find coverage reports\nfind . -name \"*.coverage\" -o -name \"coverage.xml\" -o -name \"htmlcov\"\n\n# Check CI for coverage gates\ncat .github\u002Fworkflows\u002F*.yml | grep -i \"coverage\\|cov-fail\"\n```\n\n### Step 5: Check CI Integration\n\n```bash\n# What runs in CI?\ncat .github\u002Fworkflows\u002F*.yml | grep -E \"pytest|jest|vitest|test\"\n\n# Coverage gates?\ncat .github\u002Fworkflows\u002F*.yml | grep \"cov-fail-under\"\n\n# Test parallelization?\ncat .github\u002Fworkflows\u002F*.yml | grep -i \"parallel\\|matrix\"\n```\n\n---\n\n## Assessment Report Template\n\n```markdown\n# Testing Architecture Assessment\n\n## Summary\n\n| Metric | Current | Target | Gap |\n|--------|---------|--------|-----|\n| Test Files | X | - | - |\n| Test Functions | X | - | - |\n| Coverage | X% | 80% | X% |\n| Unit:Integration:E2E | X:X:X | 70:20:10 | - |\n\n## Test Structure\n\n### Strengths\n- ✅ [What's working well]\n\n### Gaps\n- ❌ [What's missing or broken]\n\n## Anti-Patterns Found\n\n### Level 1 Violations (assert True)\n| File | Line | Issue |\n|------|------|-------|\n| path\u002Ffile.py | 42 | `assert True` |\n\n### Level 2 Violations (Trust without verify)\n| File | Line | Issue |\n|------|------|-------|\n| path\u002Ffile.py | 88 | `assert result.success` without verification |\n\n## Recommendations\n\n### Priority 1: Critical (Do Now)\n1. [Action item]\n\n### Priority 2: Important (This Sprint)\n1. [Action item]\n\n### Priority 3: Nice to Have (Backlog)\n1. [Action item]\n\n## Implementation Plan\n\n### Week 1: Foundation\n- [ ] Task 1\n- [ ] Task 2\n\n### Week 2: Core Improvements\n- [ ] Task 3\n- [ ] Task 4\n```\n\n---\n\n## Testing Patterns\n\n### Pattern 1: Arrange-Act-Assert (AAA)\n\n```python\ndef test_user_creation():\n    # Arrange\n    user_data = {\"name\": \"Alice\", \"email\": \"alice@example.com\"}\n\n    # Act\n    user = create_user(user_data)\n\n    # Assert\n    assert user.id is not None\n    assert user.name == \"Alice\"\n```\n\n### Pattern 2: Given-When-Then (BDD)\n\n```python\ndef test_checkout_applies_discount():\n    # Given a cart with items over $100\n    cart = Cart()\n    cart.add(Item(price=150))\n\n    # When checkout is performed\n    order = checkout(cart, discount_code=\"SAVE10\")\n\n    # Then 10% discount is applied\n    assert order.total == 135\n```\n\n### Pattern 3: Fixture Factory\n\n```python\n@pytest.fixture\ndef make_user():\n    \"\"\"Factory fixture for creating test users.\"\"\"\n    created = []\n\n    def _make_user(**kwargs):\n        user = User(\n            name=kwargs.get(\"name\", \"Test User\"),\n            email=kwargs.get(\"email\", f\"test-{uuid4()}@example.com\"),\n        )\n        created.append(user)\n        return user\n\n    yield _make_user\n\n    # Cleanup\n    for user in created:\n        user.delete()\n```\n\n### Pattern 4: Test Markers (Categorization)\n\nMarkers tag tests with metadata so pytest can run them selectively:\n\n```python\nimport pytest\n\n@pytest.mark.unit\ndef test_fast_logic():\n    \"\"\"Runs in milliseconds, no I\u002FO.\"\"\"\n    assert 1 + 1 == 2\n\n@pytest.mark.integration\nasync def test_with_database():\n    \"\"\"Needs real database connection.\"\"\"\n    result = await db.query(\"SELECT 1\")\n    assert result == 1\n\n@pytest.mark.e2e\nasync def test_full_workflow():\n    \"\"\"Needs entire stack running.\"\"\"\n    response = await api.post(\"\u002Fexecute\")\n    assert response.status_code == 200\n```\n\n**Running by marker:**\n```bash\npytest -m unit           # Fast, every commit (~30s)\npytest -m integration    # Slower, PR only (~2min)\npytest -m \"not e2e\"      # Skip expensive tests\n```\n\n**Register in pyproject.toml:**\n```toml\n[tool.pytest.ini_options]\nmarkers = [\n    \"unit: Fast tests with no external dependencies\",\n    \"integration: Tests requiring database or services\",\n    \"e2e: End-to-end tests requiring full stack\",\n]\n```\n\n**Auto-detection rules:**\n| If test has... | Mark as |\n|----------------|---------|\n| `MagicMock`, `AsyncMock`, no DB imports | `@pytest.mark.unit` |\n| `event_store`, `postgresql:\u002F\u002F`, `docker` | `@pytest.mark.integration` |\n| `e2e_` in filename | `@pytest.mark.e2e` |\n\n### Pattern 5: Test Doubles\n\n| Double | Use Case |\n|--------|----------|\n| **Dummy** | Fill parameters, never used |\n| **Stub** | Return predetermined values |\n| **Spy** | Record calls for later verification |\n| **Mock** | Pre-programmed expectations |\n| **Fake** | Working implementation (in-memory DB) |\n\n### Pattern 5: Property-Based Testing\n\n```python\nfrom hypothesis import given, strategies as st\n\n@given(st.lists(st.integers()))\ndef test_sort_is_idempotent(items):\n    \"\"\"Sorting twice gives same result as sorting once.\"\"\"\n    once = sorted(items)\n    twice = sorted(sorted(items))\n    assert once == twice\n\n@given(st.lists(st.integers()))\ndef test_sort_preserves_length(items):\n    \"\"\"Sorting doesn't change list length.\"\"\"\n    assert len(sorted(items)) == len(items)\n```\n\n---\n\n## Coverage Best Practices\n\n### Coverage Targets by Component Type\n\n| Component | Target | Rationale |\n|-----------|--------|-----------|\n| Business Logic | 90%+ | Core value, must be correct |\n| API Handlers | 80%+ | User-facing, critical paths |\n| Utilities | 85%+ | Widely used, high leverage |\n| Infrastructure | 70%+ | Integration tested |\n| Generated Code | 0% | Skip, test generator instead |\n\n### Coverage Exclusions\n\n```python\n# pyproject.toml\n[tool.coverage.report]\nexclude_lines = [\n    \"pragma: no cover\",\n    \"def __repr__\",\n    \"if TYPE_CHECKING:\",\n    \"raise NotImplementedError\",\n    \"if __name__ == .__main__.:\",\n]\n```\n\n### Coverage vs Quality\n\n> **High coverage ≠ Good tests**\n\n100% coverage with bad assertions is worse than 60% coverage with thorough verification.\n\n**Focus on:**\n- Critical path coverage\n- Edge case coverage\n- Verification quality (Level 4+)\n\n---\n\n## CI\u002FCD Integration\n\n### Essential CI Gates\n\n```yaml\n# Required for merge\n- name: Run tests\n  run: pytest --cov --cov-fail-under=70\n\n- name: Check types\n  run: mypy src\n\n- name: Lint\n  run: ruff check .\n```\n\n### Test Parallelization\n\n```yaml\nstrategy:\n  matrix:\n    shard: [1, 2, 3, 4]\nsteps:\n  - run: pytest --shard-id=${{ matrix.shard }} --num-shards=4\n```\n\n### Flaky Test Detection\n\n```yaml\n- name: Run tests with retries\n  run: pytest --reruns 2 --reruns-delay 1\n```\n\n---\n\n## Common Gaps & Fixes\n\n### Gap 1: No Integration Tests\n\n**Symptom:** All tests mock everything\n**Fix:** Add tests with real database\u002Fservices using testcontainers\n\n### Gap 2: Tests Without Assertions\n\n**Symptom:** `def test_x(): some_code()` with no assert\n**Fix:** Add explicit verification of expected outcomes\n\n### Gap 3: Flaky Tests\n\n**Symptom:** Tests pass\u002Ffail randomly\n**Fix:**\n- Remove time-dependencies (use freezegun)\n- Add proper async handling\n- Use deterministic test data\n\n### Gap 4: Slow Test Suite\n\n**Symptom:** Tests take >5 minutes\n**Fix:**\n- Parallelize with pytest-xdist\n- Use fixtures with proper scope\n- Mock expensive external calls\n\n### Gap 5: Missing Edge Cases\n\n**Symptom:** Bugs in production that \"tests should have caught\"\n**Fix:**\n- Add property-based testing\n- Review with mutation testing\n- Add regression tests for each bug found\n\n---\n\n## Related Skills\n\n- `testing\u002Fai-agent-verification` - Deep dive on AI agent testing\n- `devops\u002Fci-cd` - CI\u002FCD pipeline configuration\n- `review\u002Fprioritize` - Prioritize issues by severity\n",{"model":23,"description":7,"allowed-tools":24},"sonnet","Read, Grep, Glob, Bash","main","8341ffb3b4128f405d0797b5f3f3affb25de91ea","plugins\u002Fsdlc\u002Fskills\u002Ftesting-expert","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace","https:\u002F\u002Fgithub.com\u002FAgentParadise","2026-11-09 13:31:42",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add AgentParadise\u002Fagentic-workspace --skill testing-expert",{"tool":37,"command":38},"bunx","bunx skills add AgentParadise\u002Fagentic-workspace --skill testing-expert",{"tool":40,"command":41},"pnpm","pnpm dlx skills add AgentParadise\u002Fagentic-workspace --skill testing-expert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Ftesting-expert\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":18},"01M7DDJ3Z86RTM7YBDFF4QED1A","security-hardening","Audit and harden repository security — supply chain, CI\u002FCD scanners, secrets, credentials","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fsecurity-hardening\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M7DDHZY3KRZ1PM4YTVR8Y5B5","review","Review implementation against project plan and verify completeness","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Freview\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M7DDHVFQK785K8Z7HX5GRN4A","qa-setup","Verify or create standardized QA commands for polyglot projects","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fqa-setup\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7DDHSD25FQ20METGDRWAWED","prioritize","Prioritize review comments by severity","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fprioritize\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M7DDHPHRVKHR1TZBYNSTA0XX","pre-commit-qa","Run standardized QA checks before committing changes","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fpre-commit-qa\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M7DDHG61S2MH55PPEAGN58H0","macos-keychain-secrets","Store and retrieve secrets securely using macOS Keychain. Use when working with API keys, tokens, credentials, or any sensitive values that should not be stored in plain text files, dotfiles, or committed to git. Triggers on requests to store secrets, manage credentials, set up environment variables securely, or avoid hardcoding sensitive values.","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fmacos-keychain-secrets\u002FSKILL.md",[],[]]