qe-defect-intelligence
Predicts defect-prone code using change frequency, complexity metrics, and historical bug patterns. Use when predicting defects before they escape, analyzing root causes of test failures, learning from past defect patterns, or implementing proactive quality management.
Best use case
qe-defect-intelligence is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Predicts defect-prone code using change frequency, complexity metrics, and historical bug patterns. Use when predicting defects before they escape, analyzing root causes of test failures, learning from past defect patterns, or implementing proactive quality management.
Teams using qe-defect-intelligence should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/qe-defect-intelligence/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How qe-defect-intelligence Compares
| Feature / Agent | qe-defect-intelligence | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Predicts defect-prone code using change frequency, complexity metrics, and historical bug patterns. Use when predicting defects before they escape, analyzing root causes of test failures, learning from past defect patterns, or implementing proactive quality management.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# QE Defect Intelligence
## Purpose
Guide the use of v3's defect intelligence capabilities including ML-based defect prediction, pattern recognition from historical data, and automated root cause analysis.
## Activation
- When predicting defect-prone code
- When analyzing failure patterns
- When performing root cause analysis
- When learning from past defects
- When prioritizing testing based on risk
## Quick Start
```bash
# Predict defects in changed code
aqe defect predict --changes HEAD~5..HEAD
# Analyze failure patterns
aqe defect patterns --period 90d --min-occurrences 3
# Root cause analysis
aqe defect rca --failure "test/auth.test.ts:45"
# Learn from resolved defects
aqe defect learn --source jira --status resolved
```
## Agent Workflow
```typescript
// Defect prediction
Task("Predict defect-prone code", `
Analyze PR #456 changes and predict defect likelihood:
- Historical defect correlation
- Code complexity factors
- Author experience with module
- Test coverage gaps
Flag high-risk changes requiring extra review.
`, "qe-defect-predictor")
// Root cause analysis
Task("Analyze test failure", `
Investigate recurring failure in AuthService tests:
- Collect failure history (last 30 days)
- Identify common patterns
- Trace to potential root causes
- Suggest fixes using 5-whys analysis
`, "qe-root-cause-analyzer")
```
## Prediction Models
### 1. Change-Based Prediction
```typescript
await defectPredictor.predictFromChanges({
changes: prChanges,
factors: {
codeChurn: { weight: 0.2 },
complexity: { weight: 0.25 },
authorExperience: { weight: 0.15 },
fileHistory: { weight: 0.2 },
testCoverage: { weight: 0.2 }
},
threshold: {
high: 0.7,
medium: 0.4,
low: 0.2
}
});
```
### 2. Pattern Learning
```typescript
await patternLearner.learnPatterns({
source: {
defects: 'jira:project=MYAPP&type=bug',
commits: 'git:last-6-months',
tests: 'test-results:last-1000-runs'
},
patterns: [
'code-smell-to-defect',
'change-coupling',
'test-gap-correlation',
'complexity-defect-density'
],
output: {
rules: true,
visualizations: true,
recommendations: true
}
});
```
### 3. Root Cause Analysis
```typescript
await rootCauseAnalyzer.analyze({
failure: testFailure,
methods: [
'five-whys',
'fishbone-diagram',
'fault-tree',
'change-impact'
],
context: {
recentChanges: true,
environmentDiff: true,
dependencyChanges: true,
similarFailures: true
}
});
```
## Defect Prediction Report
```typescript
interface DefectPrediction {
file: string;
riskScore: number; // 0-1
riskLevel: 'critical' | 'high' | 'medium' | 'low';
factors: {
name: string;
contribution: number;
details: string;
}[];
historicalDefects: {
count: number;
recent: Defect[];
patterns: string[];
};
recommendations: {
action: string;
priority: string;
expectedRiskReduction: number;
}[];
}
```
## Pattern Categories
| Pattern | Detection | Prevention |
|---------|-----------|------------|
| Null pointer | Static analysis | Null checks, Optional |
| Race condition | Concurrency analysis | Locks, atomic ops |
| Memory leak | Heap analysis | Resource cleanup |
| Off-by-one | Boundary analysis | Loop invariants |
| Injection | Taint analysis | Input validation |
## Root Cause Templates
```yaml
root_cause_analysis:
five_whys:
max_depth: 5
prompt_template: "Why did {effect} happen?"
fishbone:
categories:
- people
- process
- tools
- environment
- materials
- measurement
fault_tree:
top_event: "Test Failure"
gate_types: [AND, OR, NOT]
basic_events: true
```
## Integration with Issue Tracking
```typescript
await defectIntelligence.syncWithTracker({
source: 'jira',
project: 'MYAPP',
sync: {
defectData: 'bidirectional',
predictions: 'create-tasks',
patterns: 'update-labels'
},
automation: {
flagHighRisk: true,
suggestAssignee: true,
linkRelated: true
}
});
```
## Coordination
**Primary Agents**: qe-defect-predictor, qe-pattern-learner, qe-root-cause-analyzer
**Coordinator**: qe-defect-intelligence-coordinator
**Related Skills**: qe-coverage-analysis, qe-quality-assessmentRelated Skills
ReasoningBank Intelligence
Implement adaptive learning with ReasoningBank for pattern recognition, strategy optimization, and continuous improvement. Use when building self-learning agents, optimizing workflows, or implementing meta-cognitive systems.
qe-code-intelligence
Builds semantic code indexes, maps dependency graphs, and performs intelligent code search across large codebases. Use when understanding unfamiliar code, tracing call chains, analyzing import dependencies, or reducing context window usage through targeted retrieval.
qe-visual-testing-advanced
Advanced visual regression testing with pixel-perfect comparison, AI-powered diff analysis, responsive design validation, and cross-browser visual consistency. Use when detecting UI regressions, validating designs, or ensuring visual consistency.
qe-verification-quality
Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.
qe-testability-scoring
AI-powered testability assessment using 10 principles of intrinsic testability with Playwright and optional Vibium integration. Evaluates web applications against Observability, Controllability, Algorithmic Simplicity, Transparency, Stability, Explainability, Unbugginess, Smallness, Decomposability, and Similarity. Use when assessing software testability, evaluating test readiness, identifying testability improvements, or generating testability reports.
qe-test-reporting-analytics
Advanced test reporting, quality dashboards, predictive analytics, trend analysis, and executive reporting for QE metrics. Use when communicating quality status, tracking trends, or making data-driven decisions.
qe-test-idea-rewriting
Transform passive 'Verify X' test descriptions into active, observable test actions. Use when test ideas lack specificity, use vague language, or fail quality validation. Converts to action-verb format for clearer, more testable descriptions.
qe-test-environment-management
Test environment provisioning, infrastructure as code for testing, Docker/Kubernetes for test environments, service virtualization, and cost optimization. Use when managing test infrastructure, ensuring environment parity, or optimizing testing costs.
qe-test-design-techniques
Systematic test design with boundary value analysis, equivalence partitioning, decision tables, state transition testing, and combinatorial testing. Use when designing comprehensive test cases, reducing redundant tests, or ensuring systematic coverage.
qe-test-data-management
Strategic test data generation, management, and privacy compliance. Use when creating test data, handling PII, ensuring GDPR/CCPA compliance, or scaling data generation for realistic testing scenarios.
qe-test-automation-strategy
Design and implement effective test automation with proper pyramid, patterns, and CI/CD integration. Use when building automation frameworks or improving test efficiency.
qe-technical-writing
Write clear, engaging technical content from real experience. Use when writing blog posts, documentation, tutorials, or technical articles.