affected

Selects tests affected by git changes and outputs the exact command to run them.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/vinzenz/workflows --skill affected-vinzenz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: affected
Source: https://github.com/vinzenz/workflows/tree/main/.agents/skills/affected
Command: npx skills add https://github.com/vinzenz/workflows --skill affected-vinzenz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After editing a few files, running the entire test suite wastes minutes and floods you with output just to learn about one test. This Skill inspects the current git diff and identifies only the test files actually worth running, along with the exact command to run them. ## Core Features & Use Cases - Diff-based test selection: Maps changed files to tests via a static import graph for JS/TS, filename conventions for Go and Python, and defers to Jest/Vitest native resolvers when available. - Runnable command output: affected command emits a raw command line you can pipe directly into a shell, e.g. $(affected command). - Coverage honesty reporting: Every run reports which changed files could not be mapped to any test and suggests the full-suite fallback, so a green run is never silently incomplete. - Use Case: You just edited src/gh-tool/commands/label.ts. Run affected to see which tests reach that file, then execute only those tests instead of the whole suite. ## Quick Start After editing some files, ask the agent to run affected and execute only the tests impacted by your current git changes.

Frequently Asked Questions about affected

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run only the tests affected by my code changes?▼

Run `affected` after editing files to see which tests map to your git diff, then use `$(affected command)` to execute exactly those tests. It supports uncommitted changes, staged changes via `--staged`, or diffs against a base ref via `--base`.

How does affected decide which tests to run?▼

For JS/TS it walks a bounded static import graph from changed files; for Go and Python it matches filename conventions like foo.go to foo_test.go. When Jest or Vitest is present, it defers entirely to their native related-tests resolvers.

Does affected work with Jest and Vitest projects?▼

Yes. When a project uses Jest or Vitest, affected delegates test selection to their `--findRelatedTests` or `related` resolvers instead of guessing. The test list is resolved by the real runner at execution time.

Can I trust affected test selection as proof nothing broke?▼

No. It is a best-effort heuristic for skipping unnecessary work, not a correctness guarantee. Every run reports unmapped changed files and suggests the full-suite command as the safe fallback when coverage is incomplete.

What are the limitations of import-graph test selection?▼

Only the root tsconfig.json paths are honored, the import graph is capped in file count and BFS depth, and Go/Python get filename-convention matching only. Changed lockfiles, configs, or fixtures are flagged as potentially affecting the whole suite.