Skip to main content
skill CX Codex

qe-defect-intelligence — Claude Code skill: predict defect-prone code

qe-defect-intelligence identifies high-risk code before bugs escape by analyzing change frequency, complexity metrics, and past defect patterns. Flags risky PRs and runs root cause analysis on test failures.

MIT 129 installs ★ 533 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add proffesor-for-testing/agentic-qe --skill qe-defect-intelligence -a claude-code
Open on GitHub

What qe-defect-intelligence does

The skill operates on three tracks: predicts defect likelihood in modified code using complexity metrics and developer experience, learns from historical test failures to spot recurring patterns, and performs structured root cause analysis via five-whys and fishbone diagrams.

Each prediction factor gets a weight—code churn, complexity, test coverage, author experience, and file history. Risk scores range from low to critical. Integrates with Jira to create tasks for high-risk changes and suggest reviewers based on past patterns.

Needs access to git history, test results, and defect tracking systems. Orchestrates three agents: qe-defect-predictor, qe-pattern-learner, and qe-root-cause-analyzer.

What it helps with

  • spot which changed files are likely to break in production
  • trace a failing test back to its root cause using structured analysis
  • discover recurring bug patterns that repeat month after month
  • prioritize code review effort by actual risk, not PR size

Example prompts for the agent

  • Predict defect likelihood for PR #456 using recent changes and complexity metrics
  • Investigate why the AuthService test keeps failing and find the underlying cause in the last 30 days
  • Learn from resolved bugs in Jira and flag similar code patterns in the current codebase

How to install qe-defect-intelligence

1Skills CLI (Vercel)

npx skills add proffesor-for-testing/agentic-qe --skill qe-defect-intelligence -a claude-code

2Manually: put the files in place

~/.claude/skills/qe-defect-intelligence/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/qe-defect-intelligence/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about qe-defect-intelligence

How do I install qe-defect-intelligence in Claude Code?

Run npx skills add proffesor-for-testing/agentic-qe --skill qe-defect-intelligence -a claude-code. The skill will be installed to ~/.claude/skills/qe-defect-intelligence/SKILL.md.

What does qe-defect-intelligence do?

Predicts defect likelihood by analyzing code churn, complexity, and author experience. Learns failure patterns from test history and performs root cause analysis using five-whys and fault trees.

What dependencies does qe-defect-intelligence need?

Git history (at least five commits), test run results, and access to a defect tracker like Jira. Without these, the model cannot learn patterns or correlate changes to failures.

Source text

SKILL.md · MIT
---
name: "qe-defect-intelligence"
description: "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."
trust_tier: 3
validation:
  schema_path: schemas/output.json
  validator_path: scripts/validate-config.json
  eval_path: evals/qe-defect-intelligence.yaml
---

# 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-assessment

© proffesor-for-testing · MIT · proffesor-for-testing/agentic-qe

Similar skills

All skills for Testing and QA →

From the same set73

The whole set →
six-thinking-hats Applies Six Thinking Hats to test strategy, failure analysis, and retrospectives. It separates facts, risks, benefits, ideas, feelings, and next actions. CX Codex +1 131installs a11y-ally The a11y-ally skill audits pages for WCAG issues and suggests fixes based on page context. Use it to review a site or assess video accessibility. CX Codex +1 131installs contract-testing Guides consumer-driven contract testing for microservices using Pact, catching breaking API changes before deploy. CX Codex +1 130installs qe-quality-assessment qe-quality-assessment reviews code quality through complexity, lint, code smells, and test health. Use it for release scoring, quality gates, and deployment checks. CX Codex +1 129installs risk-based-testing risk-based-testing directs QA effort to high-risk areas using a 1-5 probability and impact scale, adjusting test depth dynamically. CX Codex +1 128installs n8n-trigger-testing-strategies n8n-trigger-testing-strategies — a skill for testing how n8n workflows get triggered: webhooks, cron schedules, service events, polling. Useful when a workflow fires at the wrong moment or not at all. CX Codex +1 128installs n8n-expression-testing n8n-expression-testing is a Claude Code skill that checks n8n expressions against different data contexts, including missing values, while debugging data transformations. CX Codex +1 127installs qe-coverage-analysis qe-coverage-analysis inspects Istanbul, c8, and lcov data to detect untested paths with risk scoring. Useful when prioritizing test efforts or checking PR quality gates. CX Codex +1 127installs

Project sponsors

Companies that keep this analytics open