increase-test-coverage

Generates table-driven Go tests to reach 100% statement coverage per touched package.

37|4|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/jmrplens/gitlab-mcp-server --skill increase-test-coverage-jmrplens
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: increase-test-coverage
Source: https://github.com/jmrplens/gitlab-mcp-server/tree/main/.github/skills/increase-test-coverage
Command: npx skills add https://github.com/jmrplens/gitlab-mcp-server --skill increase-test-coverage-jmrplens

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Go packages often ship with uncovered functions, untested error paths, and assertions that would pass even when the code is wrong. This Skill drives test coverage to 100% per touched package using a structured Research → Plan → Implement pipeline, then proves the tests actually catch bugs with condition coverage and mutation testing. ## Core Features & Use Cases - Coverage Gap Analysis: Measures baseline coverage with go test -coverprofile, ranks uncovered and partially covered functions by priority, and maps existing test helpers like testutil.NewTestClient() and testutil.RespondJSON(). - Table-Driven Test Generation: Writes buildable tests using httptest mocks for GitLab API endpoints, covering happy paths, error responses, pagination, context cancellation, and edge cases, with stdlib t.Errorf/t.Fatalf assertions only. - Mutation and Condition Verification: Gates each package on make coverage-mutants (Lived 0, Not covered 0 via gremlins) and make coverage-conditions (gobco), so decisions are exercised both ways and no mutant survives. - Use Case: After adding a new tool handler to a Go MCP server, run this Skill to generate the missing tests, mock the GitLab API responses, and verify the package reaches 100% coverage with zero lived mutants before opening the pull request. ## Quick Start Ask the agent to increase test coverage for the package you just changed, for example: raise internal/tools to 100% coverage and verify it with mutation and condition checks.

Frequently Asked Questions about increase-test-coverage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I increase Go test coverage to 100% for a package?

Measure baseline coverage with go test -coverprofile, identify uncovered functions and branches, then write table-driven tests covering happy paths, error cases, and edge cases. Validate with go tool cover -func and confirm quality with mutation testing.

How to mock GitLab API responses in Go tests?

Use httptest.NewServer with an http.HandlerFunc that returns the expected status code and JSON body. Helpers like testutil.NewTestClient and testutil.RespondJSON wire the mock server into the GitLab client, and pagination headers simulate multi-page responses.

What is mutation testing in Go and why use it?

Mutation testing with gremlins rewrites operators in the source and reruns tests; a surviving mutant means no assertion would catch that change. It proves tests verify behavior rather than just executing lines, which statement coverage alone cannot show.

Does this approach work with testify assertions?

No, this workflow targets projects using only the standard testing package with plain t.Errorf and t.Fatalf calls. The patterns, helpers, and lint gates assume no testify dependency exists in the codebase.

Why does 100% statement coverage still miss bugs?

Statement coverage only records that a line ran, not that a decision was taken both ways or that an assertion checked the outcome. Compound conditions and weak assertions pass unchanged code, which gobco condition coverage and gremlins mutation testing expose.

How do I test error branches that real inputs cannot trigger?

Introduce a seam: a package-level function variable defaulting to the standard-library call, overridden in the test and restored with t.Cleanup. Prefer real failing inputs like broken symlinks first, and document which branch each seam exists for.