test-coverage
Generate unit tests for untested branches and edge cases. Use when coverage is low, CI flags gaps, or a release needs hardening. Not for integration/E2E suites, framework migrations, or fixing production bugs.
What this skill does
# Test Coverage Expander Expand unit test coverage by targeting untested branches and edge cases. ## When to Use - User asks to "increase test coverage", "add more tests", "expand unit tests", or "cover edge cases" - A CI pipeline reports low coverage and the user wants it improved - A code review flags untested error paths or boundary conditions - The user wants to identify and fill gaps in an existing test suite before a release ## Instructions 1. Sync the branch with remote (see Repo Sync section below) 2. Create a feature branch for the new tests 3. Run the project's coverage tool to get a baseline report 4. Identify the lowest-coverage files and untested code paths 5. Write tests for error paths, boundary values, and missing branches 6. Re-run coverage to confirm improvement 7. Commit the new tests with a descriptive message ## Repo Sync Before Edits (mandatory) Before creating/updating/deleting files in an existing repository, sync the current branch with remote: ```bash branch="$(git rev-parse --abbrev-ref HEAD)" git fetch origin git pull --rebase origin "$branch" ``` If the working tree is not clean, stash first, sync, then restore: ```bash git stash push -u -m "pre-sync" branch="$(git rev-parse --abbrev-ref HEAD)" git fetch origin && git pull --rebase origin "$branch" git stash pop ``` If `origin` is missing, pull is unavailable, or rebase/stash conflicts occur, stop and ask the user before continuing. ## Workflow ### 0. Create Feature Branch Before making any changes: 1. Check the current branch - if already on a feature branch for this task, skip 2. Check the repo for branch naming conventions (e.g., `feat/`, `feature/`, etc.) 3. Create and switch to a new branch following the repo's convention, or fallback to: `feat/test-coverage` ### 1. Analyze Coverage Detect the project's test runner and run the coverage report: - **JavaScript/TypeScript**: `npx jest --coverage` or `npx vitest --coverage` - **Python**: `pytest --cov=. --cov-report=term-missing` - **Go**: `go test -coverprofile=coverage.out ./...` - **Rust**: `cargo tarpaulin` or `cargo llvm-cov` From the report, identify: - Untested branches and code paths - Low-coverage files/functions (prioritize files below 60%) - Missing error handling tests ### 2. Identify Test Gaps Review code for: - Logical branches (if/else, switch) - Error paths and exceptions - Boundary values (min, max, zero, empty, null) - Edge cases and corner cases - State transitions and side effects ### 3. Write Tests Use project's testing framework: - **JavaScript/TypeScript**: Jest, Vitest, Mocha - **Python**: pytest, unittest - **Go**: testing, testify - **Rust**: built-in test framework Target scenarios: - Error handling and exceptions - Boundary conditions - Null/undefined/empty inputs - Concurrent/async edge cases ### 4. Verify Improvement Run coverage again and confirm measurable increase. Report: - Before/after coverage percentages - Number of new test cases added - Files with the biggest coverage gains ## Expected Output After a successful run on a Python project, the final verification report shows: ``` Coverage before: 61% (47/77 statements) Coverage after: 84% (65/77 statements) New tests added: 9 Files improved: - src/parser.py 52% → 91% (+7 tests: null input, empty string, unicode overflow) - src/auth.py 71% → 88% (+2 tests: expired token, missing header) All 56 tests passing. No regressions. ``` ## Acceptance Criteria A run passes when **all** of the following are true: - [ ] Coverage report exists from a runnable command for the detected stack (e.g., `jest --coverage`, `pytest --cov`, `go test -cover`). - [ ] Post-run total coverage is strictly higher than the pre-run baseline — no test additions that fail to move the metric. - [ ] New tests target previously-untested branches, error paths, or boundary values — not duplicates of existing assertions. - [ ] The full test suite passes locally before committing (`npm test`, `pytest`, `go test ./...`, etc.). - [ ] All new tests live on a feature branch (e.g., `feat/test-coverage`), never on `main`/`master`. - [ ] Commit message records the before/after coverage percentages and the files newly covered. ## Edge Cases - **No test framework detected**: Skill checks `package.json`, `pyproject.toml`, `Cargo.toml`, or `go.mod` for test dependencies; if none found, asks the user which framework to use before writing any tests. - **Coverage tool not installed**: Installs the appropriate tool (`pytest-cov`, `nyc`, `cargo tarpaulin`, etc.) and retries rather than failing silently. - **Existing tests are already failing**: Does not add new tests until existing failures are resolved; reports the failing tests to the user first. - **100% coverage already reached**: Reports this to the user and exits — no tests are added unnecessarily. - **Generated code or vendored files in coverage report**: Excludes auto-generated and third-party directories from analysis to avoid writing tests for code the project does not own. - **Async / concurrent code paths**: Uses framework-appropriate async test utilities (e.g., `pytest-asyncio`, `jest fakeTimers`) rather than bare sync wrappers. ## Step Completion Reports After completing each major step, output a status report in this format: ``` ◆ [Step Name] ([step N of M] — [context]) ·································································· [Check 1]: √ pass [Check 2]: √ pass (note if relevant) [Check 3]: × fail — [reason] [Check 4]: √ pass [Criteria]: √ N/M met ____________________________ Result: PASS | FAIL | PARTIAL ``` Adapt the check names to match what the step actually validates. Use `√` for pass, `×` for fail, and `—` to add brief context. The "Criteria" line summarizes how many acceptance criteria were met. The "Result" line gives the overall verdict. **Branch Setup phase checks:** `Feature branch created`, `Base coverage measured` **Analysis phase checks:** `Coverage report parsed`, `Gaps identified`, `Priority ranked` **Test Writing phase checks:** `Tests written`, `Edge cases covered`, `Framework conventions followed` **Verification phase checks:** `Tests pass`, `Coverage improved`, `No regressions` ## Error Handling ### No test framework detected **Solution:** Check `package.json`, `pyproject.toml`, `Cargo.toml`, or `go.mod` for test dependencies. If none found, ask the user which framework to use and install it. ### Coverage tool not installed **Solution:** Install the appropriate coverage tool (`nyc`, `pytest-cov`, etc.) and retry. ### Existing tests failing **Solution:** Do not add new tests until existing failures are resolved. Report failing tests to the user first. ## Guidelines - Follow existing test patterns and naming conventions - Place test files alongside source or in the project's existing test directory - Group related test cases logically - Use descriptive test names that explain the scenario - Do not mock what you do not own — prefer integration tests for external boundaries
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.