安装方式
命令行安装
在项目根目录执行以下命令,完成 Skill 安装。
npx bzskills add luongnv89/skills --skill 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.
7
下载量
命令行安装
在项目根目录执行以下命令,完成 Skill 安装。
npx bzskills add luongnv89/skills --skill test-coverage name: test-coverage
description: 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.
license: MIT
effort: low
metadata:
version: 1.3.1
author: "Luong NGUYEN <luongnv89@gmail.com>"Expand unit test coverage by targeting untested branches and edge cases.
Detect the project's language from its manifest file and use the matching commands throughout the Workflow below:
| Manifest | Stack | Coverage command | Test framework |
|---|---|---|---|
package.json | JavaScript/TypeScript | npx jest --coverage or npx vitest --coverage | Jest, Vitest, Mocha |
pyproject.toml | Python | pytest --cov=. --cov-report=term-missing | pytest, unittest |
go.mod | Go | go test -coverprofile=coverage.out ./... | testing, testify |
Cargo.toml | Rust | cargo tarpaulin or cargo llvm-cov | built-in test framework |
If none of these manifests is found, see Edge Cases — "No test framework detected".
Before creating/updating/deleting files in an existing repository, sync the current branch with remote:
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:
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.
Before making any changes:
feat/, feature/, etc.)feat/test-coverageRun the coverage command for the detected Stack above.
From the report, identify:
Review code for:
Use the test framework for the detected Stack above.
Target scenarios:
Run coverage again and confirm measurable increase. Report:
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.
A run passes when all of the following are true:
jest --coverage, pytest --cov, go test -cover).npm test, pytest, go test ./..., etc.).feat/test-coverage), never on main/master.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.pytest-cov, nyc, cargo tarpaulin, etc.) and retries rather than failing silently.pytest-asyncio, jest fakeTimers) rather than bare sync wrappers.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