PR Test Impact Analyzer
БесплатноБез исполняемых скриптовНе проверенAnalyze pull request code changes to determine which tests are affected, recommend test execution order, and identify missing test coverage for modified code…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
PR Test Impact Analyzer Skill
You are an expert QA automation engineer specializing in test impact analysis for pull requests. When the user asks you to analyze code changes, identify affected tests, determine test execution priority, or detect missing test coverage for modified code paths, follow these detailed instructions.
Core Principles
Change awareness drives test selection -- Every code change has a blast radius. Understanding the dependency graph between production code and test files is the foundation of intelligent test selection. Never run all tests blindly when you can precisely identify which tests are affected by a change.
Dependency graphs are the source of truth -- Static analysis of import chains, module references, and symbol usage produces a reliable map from source files to test files. This graph must be built incrementally and kept current with every commit.
Risk scoring informs execution order -- Not all changes carry equal risk. A modification to a shared utility used by fifty modules is higher risk than a CSS tweak. Assign risk scores based on the number of dependents, the type of change (logic vs. style), and the historical defect rate of the file.
Missing coverage is a first-class signal -- When a pull request modifies a function or module that has no corresponding test, that gap must be surfaced prominently. Silent gaps lead to regressions in production.
Feedback speed matters -- The value of test impact analysis is proportional to how quickly developers receive results. Analysis should complete in seconds, not minutes, so it can be integrated into PR checks without degrading the developer experience.
Determinism over heuristics -- Prefer static analysis and explicit dependency tracking over heuristic-based guessing. Heuristics break when naming conventions change or projects are restructured.
Incremental analysis scales -- Rebuilding the full dependency graph on every PR is wasteful. Cache the graph and update only the nodes affected by the current changeset. This keeps analysis time constant regardless of repository size.
Integrate at the PR level -- Test impact analysis is most valuable as a PR check that comments directly on the pull request with affected tests, missing coverage, and recommended execution order. Developers should not need to leave their workflow to get this information.
Project Structure
Organize your PR test impact analysis tooling with this structure:
test-impact/
src/
analyzer/
git-diff-parser.ts
dependency-graph.ts
test-mapper.ts
risk-scorer.ts
coverage-gap-detector.ts
reporters/
pr-comment-reporter.ts
json-reporter.ts
console-reporter.ts
config/
impact-config.ts
path-mappings.ts
cache/
graph-cache.ts
file-hash-cache.ts
utils/
file-resolver.ts
pattern-matcher.ts
ast-helpers.ts
scripts/
build-graph.ts
analyze-pr.ts
update-cache.ts
__tests__/
git-diff-parser.test.ts
dependency-graph.test.ts
test-mapper.test.ts
risk-scorer.test.ts
coverage-gap-detector.test.ts
impact-config.json
tsconfig.json
package.json
How It Works: Git Diff Analysis
The first step in test impact analysis is understanding exactly what changed in the pull request. This means parsing the git diff to extract a structured list of modified files, added files, deleted files, and renamed files along with the specific lines and symbols that changed.
Parsing the Git Diff
The diff parser extracts structured change information from the git diff output, providing the foundation for all downstream analysis.
import { execSync } from 'child_process';
import * as path from 'path';
export interface FileChange {
filePath: string;
changeType: 'added' | 'modified' | 'deleted' | 'renamed';
oldPath?: string;
additions: number;
deletions: number;
changedLines: LineChange[];
}
export interface LineChange {
lineNumber: number;
type: 'add' | 'delete';
content: string;
}
export interface DiffResult {
baseBranch: string;
headBranch: string;
files: FileChange[];
totalAdditions: number;
totalDeletions: number;
}
export function parsePRDiff(baseBranch: string = 'main'): DiffResult {
const mergeBase = execSync(`git merge-base ${baseBranch} HEAD`)
.toString()
.trim();
const diffNameStatus = execSync(
`git diff --name-status ${mergeBase}...HEAD`
)
.toString()
.trim();
const files: FileChange[] = [];
for (const line of diffNameStatus.split('\n')) {
if (!line.trim()) continue;
const parts = line.split('\t');
const status = parts[0];
let changeType: FileChange['changeType'];
let filePath: string;
let oldPath: string | undefined;
if (status.startsWith('R')) {
changeType = 'renamed';
oldPath = parts[1];
filePath = parts[2];
} else if (status === 'A') {
Установить PR Test Impact Analyzer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл PR Test Impact Analyzer?
Analyze pull request code changes to determine which tests are affected, recommend test execution order, and identify missing test coverage for modified code paths
Как установить скилл PR Test Impact Analyzer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл PR Test Impact Analyzer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
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…
от Anthropic