Back to skills
SkillHub ClubShip Full StackFull StackTesting

coverage

[UDS] Analyze test coverage and provide recommendations

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
46
Hot score
91
Updated
March 20, 2026
Overall rating
C3.0
Composite score
3.0
Best-practice grade
A88.0

Install command

npx @skill-hub/cli install asiaostrich-universal-dev-standards-test-coverage-assistant

Repository

AsiaOstrich/universal-dev-standards

Skill path: .claude/skills/test-coverage-assistant

[UDS] Analyze test coverage and provide recommendations

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack, Testing.

Target audience: everyone.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: AsiaOstrich.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install coverage into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/AsiaOstrich/universal-dev-standards before adding coverage to shared team environments
  • Use coverage for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: coverage
scope: partial
description: "[UDS] Analyze test coverage and provide recommendations"
allowed-tools: Read, Grep, Glob, Bash(npm test:*)
argument-hint: "[file or module | 檔案或模組]"
---

# Test Coverage Assistant | 測試覆蓋率助手

Analyze test coverage across multiple dimensions and provide actionable recommendations.

多維度分析測試覆蓋率並提供可執行的建議。

## Coverage Dimensions | 覆蓋率維度

| Dimension | What it Measures | 測量內容 |
|-----------|------------------|----------|
| **Line** | Lines of code executed | 執行的程式碼行數 |
| **Branch** | Decision paths taken | 決策路徑覆蓋 |
| **Function** | Functions called | 呼叫的函數 |
| **Statement** | Statements executed | 執行的陳述式 |

## 8-Dimension Framework | 八維度框架

1. **Code Coverage** - Lines, branches, functions
2. **Requirement Coverage** - All requirements have tests
3. **Risk Coverage** - High-risk areas prioritized
4. **Integration Coverage** - Component interaction paths
5. **Edge Case Coverage** - Boundary conditions tested
6. **Error Coverage** - Error handling paths verified
7. **Permission Coverage** - Access control scenarios
8. **AI Generation Quality** - AI-generated test effectiveness

## Coverage Targets | 覆蓋率目標

| Level | Coverage | Use Case | 適用場景 |
|-------|----------|----------|----------|
| Minimum | 60% | Legacy code | 遺留程式碼 |
| Standard | 80% | Most projects | 大多數專案 |
| High | 90% | Critical systems | 關鍵系統 |
| Critical | 95%+ | Safety-critical | 安全關鍵 |

## Workflow | 工作流程

1. **Run coverage tool** - Generate coverage report | 產生覆蓋率報告
2. **Analyze gaps** - Identify untested areas | 識別未測試區域
3. **Prioritize** - Rank by risk and importance | 依風險排序
4. **Recommend tests** - Suggest specific tests to add | 建議新增測試
5. **Track progress** - Monitor coverage over time | 追蹤進度

## Usage | 使用方式

```
/coverage                   - Run full coverage analysis | 執行完整覆蓋率分析
/coverage src/auth          - Analyze specific module | 分析特定模組
/coverage --recommend       - Get test recommendations | 取得測試建議
```

## Reference | 參考

- Detailed guide: [guide.md](./guide.md)
- Core standard: [test-completeness-dimensions.md](../../core/test-completeness-dimensions.md)


---

## Referenced Files

> The following files are referenced in this skill and included for context.

### guide.md

```markdown
---
scope: partial
description: |
  Evaluate test completeness using the 8 dimensions framework.
  Use when: writing tests, reviewing test coverage, ensuring test quality.
  Keywords: test coverage, completeness, dimensions, 8 dimensions, test quality, AI test quality, 測試覆蓋, 測試完整性, 八維度.
---

# Test Coverage Assistant

> **Language**: English | [繁體中文](../../locales/zh-TW/skills/test-coverage-assistant/SKILL.md)

**Version**: 1.1.0
**Last Updated**: 2026-01-25
**Applicability**: Claude Code Skills

---

## Purpose

This skill helps evaluate and improve test completeness using the 8 dimensions framework, ensuring comprehensive test coverage for each feature.

## Quick Reference

### The 8 Dimensions

```
┌─────────────────────────────────────────────────────────────┐
│              Test Completeness = 8 Dimensions                │
├─────────────────────────────────────────────────────────────┤
│  1. Happy Path        Normal expected behavior              │
│  2. Boundary          Min/max values, limits                │
│  3. Error Handling    Invalid input, exceptions             │
│  4. Authorization     Role-based access control             │
│  5. State Changes     Before/after verification             │
│  6. Validation        Format, business rules                │
│  7. Integration       Real query verification               │
│  8. AI Generation     AI-generated test quality (NEW)       │
└─────────────────────────────────────────────────────────────┘
```

### Dimension Summary Table

| # | Dimension | What to Test | Key Question |
|---|-----------|--------------|--------------|
| 1 | **Happy Path** | Valid input → expected output | Does the normal flow work? |
| 2 | **Boundary** | Min/max values, limits | What happens at edges? |
| 3 | **Error Handling** | Invalid input, not found | How do errors behave? |
| 4 | **Authorization** | Role permissions | Who can do what? |
| 5 | **State Changes** | Before/after states | Did the state change correctly? |
| 6 | **Validation** | Format, business rules | Is input validated? |
| 7 | **Integration** | Real DB/API calls | Does the query really work? |
| 8 | **AI Generation** | AI-generated test quality | Are AI tests meaningful? |

### When to Apply Each Dimension

| Feature Type | Required Dimensions |
|--------------|---------------------|
| CRUD API | 1, 2, 3, 4, 6, 7, 8* |
| Query/Search | 1, 2, 3, 4, 7, 8* |
| State Machine | 1, 3, 4, 5, 6, 8* |
| Validation Logic | 1, 2, 3, 6, 8* |
| Background Job | 1, 3, 5, 8* |
| External Integration | 1, 3, 7, 8* |

*Dimension 8 (AI Generation Quality) applies when tests are AI-generated

## Test Design Checklist

Use this checklist for each feature:

```
Feature: ___________________

□ Happy Path
  □ Valid input produces expected success
  □ Correct data is returned/created
  □ Side effects occur as expected

□ Boundary Conditions
  □ Minimum valid value
  □ Maximum valid value
  □ Empty collection
  □ Single item collection
  □ Large collection (if applicable)

□ Error Handling
  □ Invalid input format
  □ Missing required fields
  □ Duplicate/conflict scenarios
  □ Not found scenarios
  □ External service failure (if applicable)

□ Authorization
  □ Each permitted role tested
  □ Each denied role tested
  □ Unauthenticated access tested
  □ Cross-boundary access tested

□ State Changes
  □ Initial state verified
  □ Final state verified
  □ All valid state transitions tested

□ Validation
  □ Format validation (email, phone, etc.)
  □ Business rule validation
  □ Cross-field validation

□ Integration (if UT uses wildcards)
  □ Query predicates verified
  □ Entity relationships verified
  □ Pagination verified
  □ Sorting/filtering verified

□ AI Generation Quality (if AI-generated)
  □ Tests verify meaningful behavior
  □ Assertions are specific (not just "not null")
  □ Tests are independent and self-contained
  □ Mutation score > 80% (if evaluated)
```

## Detailed Guidelines

For complete standards, see:
- [Test Completeness Dimensions](../../core/test-completeness-dimensions.md)
- [Testing Standards](../../core/testing-standards.md)

### AI-Optimized Format (Token-Efficient)

For AI assistants, use the YAML format files for reduced token usage:
- Base standard: `ai/standards/test-completeness-dimensions.ai.yaml`

## Examples

### 1. Happy Path

```csharp
[Fact]
public async Task CreateUser_WithValidData_ReturnsSuccess()
{
    // Arrange
    var request = new CreateUserRequest
    {
        Username = "newuser",
        Email = "[email protected]"
    };

    // Act
    var result = await _service.CreateUserAsync(request);

    // Assert
    result.Success.Should().BeTrue();
    result.Data.Username.Should().Be("newuser");
}
```

### 2. Boundary

```csharp
[Theory]
[InlineData(0, false)]      // Below minimum
[InlineData(1, true)]       // Minimum valid
[InlineData(100, true)]     // Maximum valid
[InlineData(101, false)]    // Above maximum
public void ValidateQuantity_BoundaryValues_ReturnsExpected(
    int quantity, bool expected)
{
    var result = _validator.IsValidQuantity(quantity);
    result.Should().Be(expected);
}
```

### 4. Authorization

```csharp
[Fact]
public async Task DeleteUser_AsAdmin_Succeeds()
{
    var adminContext = CreateContext(role: "Admin");
    var result = await _service.DeleteUserAsync(userId, adminContext);
    result.Success.Should().BeTrue();
}

[Fact]
public async Task DeleteUser_AsMember_ReturnsForbidden()
{
    var memberContext = CreateContext(role: "Member");
    var result = await _service.DeleteUserAsync(userId, memberContext);
    result.ErrorCode.Should().Be("FORBIDDEN");
}
```

### 5. State Changes

```csharp
[Fact]
public async Task DisableUser_UpdatesStateCorrectly()
{
    // Arrange
    var user = await CreateEnabledUser();
    user.IsEnabled.Should().BeTrue();  // Verify initial state

    // Act
    await _service.DisableUserAsync(user.Id);

    // Assert
    var updatedUser = await _repository.GetByIdAsync(user.Id);
    updatedUser.IsEnabled.Should().BeFalse();  // Verify final state
}
```

## Authorization Matrix Template

Create a matrix for each feature:

| Operation | Admin | Manager | Member | Guest |
|-----------|-------|---------|--------|-------|
| Create | ✅ | ✅ | ❌ | ❌ |
| Read All | ✅ | ⚠️ Scoped | ❌ | ❌ |
| Update | ✅ | ⚠️ Own dept | ❌ | ❌ |
| Delete | ✅ | ❌ | ❌ | ❌ |

Each cell should have a corresponding test case.

## Anti-Patterns to Avoid

- ❌ Testing only happy path
- ❌ Missing authorization tests for multi-role systems
- ❌ Not verifying state changes
- ❌ Using wildcards in UT without corresponding IT
- ❌ Same values for ID and business identifier in test data
- ❌ Testing implementation details instead of behavior
- ❌ Accepting AI-generated tests without review
- ❌ Assuming high line coverage means effective tests

---

## Configuration Detection

This skill supports project-specific configuration.

### Detection Order

1. Check `CONTRIBUTING.md` for "Testing Standards" section
2. Check for existing test patterns in the codebase
3. If not found, **default to all 8 dimensions** (dimension 8 only when tests are AI-generated)

### First-Time Setup

If no configuration found:

1. Suggest: "This project hasn't configured test completeness requirements. Would you like to customize which dimensions are required?"
2. Suggest documenting in `CONTRIBUTING.md`:

```markdown
## Test Completeness

We use the 8 Dimensions framework for test coverage.

### Required Dimensions by Feature Type
- API endpoints: All 8 dimensions (8 only when AI-generated)
- Utility functions: Dimensions 1, 2, 3, 6, 8*
- Background jobs: Dimensions 1, 3, 5, 8*

*Dimension 8 applies when tests are AI-generated
```

---

## Related Standards

- [Test Completeness Dimensions](../../core/test-completeness-dimensions.md)
- [Testing Standards](../../core/testing-standards.md)
- [Testing Guide](../testing-guide/SKILL.md)

---

## Version History

| Version | Date | Changes |
|---------|------|---------|
| 1.1.0 | 2026-01-25 | Updated: 7 dimensions → 8 dimensions (added AI Generation Quality) |
| 1.0.0 | 2025-12-30 | Initial release |

---

## License

This skill is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).

**Source**: [universal-dev-standards](https://github.com/AsiaOstrich/universal-dev-standards)

```

coverage | SkillHub