QA Strategy and Metrics Skill
Metadata (Tier 1)
Keywords: strategy, testing pyramid, quality, metrics, technical debt, complexity, maintainability, coverage principles
File Patterns: N/A (conceptual skill)
Modes: code_review, testing_frontend, testing_backend
Activation: Conceptual queries about testing strategy, quality metrics, or technical debt.
Instructions (Tier 2)
Testing Pyramid
E2E (5-10%)
Integration (15-20%)
Unit Tests (70-80%)
Rationale:
- Unit: Fast (ms), cheap, high confidence in individual components
- Integration: Moderate speed (seconds), tests component interactions
- E2E: Slow (seconds-minutes), expensive, fragile, but validates real workflows
Anti-Pattern: Inverted pyramid (too many E2E tests)
- Slow CI/CD pipeline
- Flaky tests due to external dependencies
- High maintenance burden
Cyclomatic Complexity (CC)
Formula: CC = E - N + 2P
- E = edges in control flow graph
- N = nodes
- P = connected components
Interpretation:
- 1-5: Low risk, straightforward logic
- 6-10: Moderate complexity, well-structured
- 11-20: Complex, consider refactoring
- 21+: Very complex, MUST refactor
When to refactor:
- Function has CC > 15
- Function has multiple responsibilities
- Difficult to write tests (need many mocks)
Code Coverage Metrics
Statement Coverage: % of code lines executed
Branch Coverage: % of decision paths taken (if/else, switch)
Function Coverage: % of functions called
Critical Insight: 100% coverage ≠ 100% tested
- May miss edge cases
- May not test error handling
- May not validate business logic
Focus Areas:
- Error handlers (try/except, catch)
- Boundary conditions (null, empty, max)
- Complex conditionals
Maintainability Index (MI)
Formula (simplified):
MI = 171 - 5.2 * ln(HV) - 0.23 * CC - 16.2 * ln(LOC)
- HV = Halstead Volume (code complexity)
- CC = Cyclomatic Complexity
- LOC = Lines of Code
Ranges:
- 85-100: Highly maintainable
- 65-84: Moderately maintainable
- 0-64: Difficult to maintain
Technical Debt
Formula: Debt = (Cost to Fix) * (Impact if Not Fixed)
Types:
- Code Debt: Poor structure, duplication
- Test Debt: Low coverage, missing tests
- Documentation Debt: Missing/outdated docs
- Architectural Debt: Design constraints
When to Pay Down:
- High-traffic code paths
- Before major refactoring
- Security-sensitive areas
1---2name: qa-strategy-and-metrics3description: Testing pyramid, quality metrics, and technical debt management strategies. PROACTIVELY activate for: (1) Designing testing strategy, (2) Evaluating code quality metrics, (3) Managing technical debt, (4) Analyzing test coverage approaches, (5) Calculating complexity. Triggers: "testing strategy", "testing pyramid", "quality metrics", "technical debt", "cyclomatic complexity", "maintainability", "coverage principles"4---56# QA Strategy and Metrics Skill78## Metadata (Tier 1)910**Keywords**: strategy, testing pyramid, quality, metrics, technical debt, complexity, maintainability, coverage principles1112**File Patterns**: N/A (conceptual skill)1314**Modes**: code_review, testing_frontend, testing_backend1516**Activation**: Conceptual queries about testing strategy, quality metrics, or technical debt.1718---1920## Instructions (Tier 2)2122### Testing Pyramid2324```25 E2E (5-10%)26 Integration (15-20%)27 Unit Tests (70-80%)28```2930**Rationale**:31- **Unit**: Fast (ms), cheap, high confidence in individual components32- **Integration**: Moderate speed (seconds), tests component interactions33- **E2E**: Slow (seconds-minutes), expensive, fragile, but validates real workflows3435**Anti-Pattern**: Inverted pyramid (too many E2E tests)36- Slow CI/CD pipeline37- Flaky tests due to external dependencies38- High maintenance burden3940### Cyclomatic Complexity (CC)4142**Formula**: CC = E - N + 2P43- E = edges in control flow graph44- N = nodes45- P = connected components4647**Interpretation**:48- 1-5: Low risk, straightforward logic49- 6-10: Moderate complexity, well-structured50- 11-20: Complex, consider refactoring51- 21+: Very complex, MUST refactor5253**When to refactor**:54- Function has CC > 1555- Function has multiple responsibilities56- Difficult to write tests (need many mocks)5758### Code Coverage Metrics5960**Statement Coverage**: % of code lines executed61**Branch Coverage**: % of decision paths taken (if/else, switch)62**Function Coverage**: % of functions called6364**Critical Insight**: 100% coverage ≠ 100% tested65- May miss edge cases66- May not test error handling67- May not validate business logic6869**Focus Areas**:70- Error handlers (try/except, catch)71- Boundary conditions (null, empty, max)72- Complex conditionals7374### Maintainability Index (MI)7576**Formula** (simplified):77```78MI = 171 - 5.2 * ln(HV) - 0.23 * CC - 16.2 * ln(LOC)79```80- HV = Halstead Volume (code complexity)81- CC = Cyclomatic Complexity82- LOC = Lines of Code8384**Ranges**:85- 85-100: Highly maintainable86- 65-84: Moderately maintainable87- 0-64: Difficult to maintain8889### Technical Debt9091**Formula**: Debt = (Cost to Fix) * (Impact if Not Fixed)9293**Types**:941. **Code Debt**: Poor structure, duplication952. **Test Debt**: Low coverage, missing tests963. **Documentation Debt**: Missing/outdated docs974. **Architectural Debt**: Design constraints9899**When to Pay Down**:100- High-traffic code paths101- Before major refactoring102- Security-sensitive areas