otaviof

go-cover

0
0
# Install this skill:
npx skills add otaviof/gosmith --skill "go-cover"

Install specific skill from multi-skill repository

# Description

Generate Go test coverage report with package breakdown.

# SKILL.md


name: go-cover
description: Generate Go test coverage report with package breakdown.
argument-hint: [package-pattern]
allowed-tools: Bash
model: haiku


Instructions

  1. Validate: Check go.mod exists in cwd or parent dirs

  2. Execute:

  3. Pattern: <ARG> or default ./...
  4. --html: Generate coverage.html and report path
  5. Run: go test -coverprofile=coverage.out -covermode=atomic <pattern>

  6. Parse: Extract per-package coverage from coverage.out

  7. Skip mode/total lines
  8. Group by package path
  9. Calculate percentage: (covered statements / total statements) ร— 100

  10. Format:
    ```markdown
    ## COVERAGE REPORT

Package Coverage Target Status
pkg/domain 87.2% 80% PASS
pkg/service 72.1% 80% FAIL

Overall: 83.4% | Target: 80% | Status: PASS
```

  1. Report:
  2. Standard: Markdown table with overall status
  3. HTML mode: "Coverage report: coverage.html"

  4. Edge cases:

  5. No tests: "No test files found in <pattern>"
  6. Build failure: Report compilation errors (first 5 lines)
  7. Target: Env GO_COVER_TARGET or default 80%

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.