src/hestai_mcp/_bundled_hub/library/skills/test-coverage/SKILL.md
Python pytest coverage analysis, gap identification, and TDD workflow for achieving 90%+ coverage
npx skillsauth add elevanaltd/hestai-mcp test-coverageInstall 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.
===TEST_COVERAGE=== META: TYPE::SKILL VERSION::"1.0" STATUS::ACTIVE PURPOSE::"Python pytest coverage analysis, gap identification, and TDD workflow for achieving 90%+ coverage" DOMAIN::ATHENA[quality]⊕ARTEMIS[precision_targeting]
§1::WHEN_TO_USE TRIGGERS::[ "Analyzing coverage reports and identifying gaps", "Planning tests to achieve 90%+ coverage targets", "Understanding uncovered line categories", "Applying TDD discipline to fill gaps systematically" ] COMPLEMENTARY::[test-infrastructure,test-ci-pipeline,testing]
§2::ANALYSIS_PROTOCOL STEP_1::RUN_COVERAGE[ COMMAND::"pytest --cov=src/{module} --cov-report=term-missing", OUTPUT::[Stmts::total,Miss::uncovered,Cover::percentage,Missing::line_numbers] ] STEP_2::CATEGORIZE_GAPS[ A::VALIDATION_PATHS[HIGH::security_critical,"raise ValueError('...')"], B::EDGE_CASES[MEDIUM::behavioral,"if not items: return None"], C::ERROR_HANDLERS[MEDIUM::defensive,"except OSError: logger.warning(...)"], D::INFRASTRUCTURE[LOW::diminishing_returns,"logger.debug(...)"] ] STEP_3::PRIORITIZE[ORDER::A→B→C→D,"Security first, then behavioral, then defensive, then optional"]
§3::TEST_PATTERNS VALIDATION_PATH::[ PATTERN::"Test invalid inputs raise appropriate exceptions", TEMPLATE::"def test_{fn}rejects{case}(): with pytest.raises({Error}): {fn}({invalid})" ] EDGE_CASE::[ PATTERN::"Test boundary conditions and None/empty handling", TEMPLATE::"def test_{fn}handles{edge}(): assert {fn}({input}) == {expected}", COMMON::[None,empty_string,empty_list,zero,negative,max_value] ] ERROR_HANDLER::[ PATTERN::"Mock dependencies to trigger exception paths", TEMPLATE::"with patch.object({T}, '{m}', side_effect={E}): assert {fn}(...) == {fallback}" ]
§4::TARGETS THRESHOLDS::[ 90%::MINIMUM[quality_gate], 95%::RECOMMENDED[comprehensive], 100%::ASPIRATIONAL[critical_paths_only] ] CRITICAL_PATHS::[security_validation,auth,data_transformation,public_api] ACCEPTABLE_GAPS::[platform_specific,debug_logging,rare_defensive_handlers,third_party_errors]
§5::TDD_DISCIPLINE RED_GREEN_REFACTOR::[ RED::"Write failing test that exercises uncovered line", GREEN::"Verify test passes (line already implemented)", REFACTOR::"Improve test clarity" ] COVERAGE_ADAPTATION::[ DIFFERENCE::"Code exists, tests retroactive", APPROACH::"Write test FIRST, verify covers target line", VERIFICATION::"Run --cov before/after" ] GIT_EVIDENCE::"test({module}): improve coverage from X% to Y%"
§6::COMMANDS BASIC::"pytest --cov=src/{module}" TERM_MISSING::"pytest --cov=src/{module} --cov-report=term-missing" HTML::"pytest --cov=src/{module} --cov-report=html" FAIL_UNDER::"pytest --cov=src/{module} --cov-fail-under=90" SPECIFIC::"pytest tests/unit/{path}/test_{file}.py --cov=src/{path}/{file}" BRANCH::"pytest --cov=src/{module} --cov-branch"
§7::COMMON_PATTERNS RECOGNITION::[ EARLY_RETURN::"if not x: return None"→test_with_falsy, EXCEPTION_RAISE::"raise ValueError(...)"→test_invalid_expect_raises, EXCEPT_BLOCK::"except {E}: logger.warning(...)"→mock_to_raise, FALLBACK_PATH::"else: return default"→test_else_condition, LOOP_CONTINUE::"if not cond: continue"→include_failing_item, OS_ERROR::"except OSError: pass"→mock_file_op_to_raise ]
§8::ANTI_PATTERNS COVERAGE_THEATER::[ SYMPTOM::"Tests exercise code but don't assert behavior", EXAMPLE::"def test_fn(): fn() # no assertions", REMEDY::"Every test must have meaningful assertions" ] OVER_MOCKING::[ SYMPTOM::"Mock so much tests prove nothing", EXAMPLE::"Mock all deps, assert mock called", REMEDY::"Mock only external boundaries" ] CHASING_100::[ SYMPTOM::"Excessive effort for marginal gains", EXAMPLE::"Complex mocks to hit debug log", REMEDY::"Accept 95% with documented gaps" ]
§9::WORKFLOW STEPS::[ 1::"Run pytest --cov with term-missing", 2::"Identify highest-priority gaps (A→B→C→D)", 3::"Write targeted tests per category", 4::"Verify improvement after each batch", 5::"Commit: test({module}): improve coverage", 6::"Document remaining acceptable gaps" ]
===END===
tools
Supabase test harness patterns including local Supabase setup, test user creation via Auth Admin API, RLS testing, migration testing (db_reset), seed sequences, rate limiting, and environment detection. Use when setting up Supabase testing infrastructure, creating test users, troubleshooting Supabase test failures, or implementing RLS validation. Triggers on: supabase test setup, test user creation, supabase local testing, RLS testing, migration testing, supabase test harness, auth test helpers.
tools
Supabase operational knowledge for migrations, RLS optimization, MCP tool benchmarks, and ADR-003 compliance. Use when validating database migrations, optimizing Row-Level Security policies, checking MCP tool performance, or ensuring Supabase operational standards. Triggers on: migration validation, RLS patterns, Supabase benchmarks, ADR-003, database state tracking, schema governance.
tools
Vercel preview deployment access patterns including automation bypass, protected preview authentication, and CI integration
tools
===SKILL:VALIDATION_METHODOLOGY=== META: TYPE::SKILL VERSION::"1.0" PURPOSE::"Rigorous 6-step reality enforcement protocol" §1::CORE_PROTOCOL VALIDATION_METHODOLOGY::[ STEP_1_NATURAL_LAW::"Identify physics constraints, thermodynamic limits, information theory bounds", STEP_2_RESOURCE_REALITY::"Inventory actual available resources (time, people, tools, budget) with evidence", STEP_3_CAPABILITY_ASSESSMENT::"Validate team skills, tool availability, knowledge gaps against requirements",