Generate requirement to test traceability matrix for complete coverage visibility
Generates requirement-to-test traceability matrices to identify coverage gaps and ensure compliance.
npx claudepluginhub xarlord/devflow-enforcerThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill generates traceability matrices:
Ensure complete test coverage of requirements. Use this skill:
1. PARSE requirement documents
2. PARSE test specifications
3. EXTRACT requirement IDs
4. MAP tests to requirements
5. CALCULATE coverage metrics
6. IDENTIFY gaps
7. GENERATE matrix report
| Parameter | Type | Description | Required |
|---|---|---|---|
| requirementsPath | string | Path to requirements doc | No |
| testsPath | string | Path to test files | No |
| threshold | number | Minimum coverage % | No |
| format | string | matrix, list, graph | No |
# Traceability Matrix Report
**Generated:** [timestamp]
**Source:** docs/requirements.md
**Tests:** tests/**/*.spec.ts
## Summary
| Metric | Value |
|--------|-------|
| Total Requirements | 24 |
| Covered Requirements | 21 |
| Coverage Percentage | 87.5% |
| Gaps | 3 |
| Orphan Tests | 2 |
## Coverage by Priority
| Priority | Total | Covered | Coverage |
|----------|-------|---------|----------|
| P1 - Critical | 8 | 8 | 100% |
| P2 - High | 6 | 5 | 83% |
| P3 - Medium | 6 | 5 | 83% |
| P4 - Low | 4 | 3 | 75% |
## Detailed Matrix
### Requirements → Tests
| Req ID | Requirement | Test Cases | Coverage |
|--------|-------------|------------|----------|
| REQ-001 | User login | TC-001, TC-002 | ✅ Full |
| REQ-002 | Password reset | TC-003 | ⚠️ Partial |
| REQ-003 | Session timeout | - | ❌ Gap |
| REQ-004 | SSO integration | TC-004, TC-005, TC-006 | ✅ Full |
### Tests → Requirements
| Test ID | Test Description | Requirements |
|---------|------------------|--------------|
| TC-001 | Login with valid credentials | REQ-001 |
| TC-002 | Login with invalid credentials | REQ-001 |
| TC-003 | Password reset email | REQ-002 |
| TC-004 | SSO redirect | REQ-004 |
## Gap Analysis
### Uncovered Requirements
1. **REQ-003: Session Timeout**
- Priority: P1 - Critical
- Risk: High
- Suggested Tests:
- TC-NEW-1: Verify 30-minute timeout
- TC-NEW-2: Verify session refresh
- TC-NEW-3: Verify timeout warning
2. **REQ-010: Bulk User Import**
- Priority: P2 - High
- Risk: Medium
- Suggested Tests:
- TC-NEW-4: CSV import
- TC-NEW-5: Error handling
### Orphan Tests (No Requirements)
| Test ID | Description | Recommendation |
|---------|-------------|----------------|
| TC-099 | Helper utility | Remove or document |
| TC-100 | Edge case | Link to requirement |
## Compliance Status
| Standard | Requirement | Status |
|----------|-------------|--------|
| ISO 27001 | A.14.2.9 | ⚠️ Partial |
| SOC 2 | CC8.1 | ✅ Compliant |
| GDPR | Art. 32 | ⚠️ Partial |
## Recommendations
1. **Critical:** Add tests for REQ-003 (Session Timeout)
2. **High:** Complete coverage for REQ-010 (Bulk Import)
3. **Medium:** Link or remove orphan tests
4. **Documentation:** Update spec comments
USER: /spec-traceability
SKILL OUTPUT:
# Traceability Matrix Report
## Summary
- Total Requirements: 24
- Covered: 21 (87.5%)
- Gaps: 3
## Critical Gaps
1. REQ-003: Session Timeout (P1)
2. REQ-010: Bulk Import (P2)
3. REQ-022: Audit Log (P3)
**Action Required:** Add 8 tests to reach 100% coverage
USER: /spec-traceability --by-category
SKILL OUTPUT:
# Coverage by Category
| Category | Total | Covered | % |
|----------|-------|---------|---|
| Authentication | 5 | 5 | 100% |
| User Management | 6 | 5 | 83% |
| Payments | 4 | 4 | 100% |
| Reporting | 5 | 4 | 80% |
| Admin | 4 | 3 | 75% |
**Lowest Coverage:** Admin (75%)
**Recommendation:** Focus testing on Admin features
USER: /spec-traceability --compliance SOC2
SKILL OUTPUT:
# SOC 2 Compliance Report
## Control Coverage
| Control | Requirement | Tests | Status |
|---------|-------------|-------|--------|
| CC6.1 | Access Control | TC-001-005 | ✅ |
| CC6.6 | Security | TC-010-015 | ✅ |
| CC7.1 | Monitoring | TC-020-025 | ⚠️ |
| CC8.1 | Change Mgmt | TC-030-035 | ✅ |
## Compliance Status: 87.5%
⚠️ **Warning:** CC7.1 Monitoring incomplete
- Missing: Log retention tests
- Missing: Alert tests
**Remediation:** Add TC-NEW-6, TC-NEW-7 for CC7.1
{
"traceability": {
"requirements": {
"path": "docs/requirements.md",
"idPattern": "REQ-\\d+",
"priorityField": "priority"
},
"tests": {
"path": "tests/**/*.spec.ts",
"idPattern": "TC-\\d+",
"requirementTag": "@requirement"
},
"thresholds": {
"overall": 90,
"byPriority": {
"P1": 100,
"P2": 90,
"P3": 80,
"P4": 70
}
}
}
}
## REQ-001: User Authentication
**Priority:** P1 - Critical
**Category:** Authentication
**Status:** Approved
Users must be able to authenticate using email and password.
### Acceptance Criteria
- Valid credentials grant access
- Invalid credentials show error
- Account locks after 5 failures
/**
* @requirement REQ-001
* @coverage full
*/
describe('REQ-001: User Authentication', () => {
/**
* @test-case TC-001
* @criterion Valid credentials grant access
*/
it('should authenticate with valid credentials', () => {
// Test implementation
});
/**
* @test-case TC-002
* @criterion Invalid credentials show error
*/
it('should show error for invalid credentials', () => {
// Test implementation
});
});
| Req | TC-001 | TC-002 | TC-003 |
|---|---|---|---|
| REQ-001 | ✅ | ✅ | - |
| REQ-002 | - | - | ✅ |
REQ-001 ──┬── TC-001
├── TC-002
└── TC-003
REQ-002 ──┬── TC-004
└── TC-005
# Export to Excel
/spec-traceability --export xlsx
# Export to CSV
/spec-traceability --export csv
# Export to HTML
/spec-traceability --export html
# Export to JSON
/spec-traceability --export json
This skill integrates with:
coverage-analysis: Combined test coveragespec-validation: Validate spec completenessSearch, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP, WebSocket). Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.