test-changed
Skill2 starsChanged 2 months agoMITView on GitHub
Orchestrate parallel test generation for all changed components, jobs, models, policies, and services in the current branch. Native replacement for scripts/test-changed-all.sh.
In this repository67 other files it gives its agents.
- acceptance-criteriaSkill
- architect-guideSkill
- architect-reviewSkill
- audit-fixerSkill
- avo-admin-expertSkill
- backend-services-expertSkill
- bug-hunt-allSkill
- bug-hunt-fixSkill
- bug-huntSkill
- build-feature-remoteSkill
- build-featureSkill
- codeSkill
- component-testSkill
- controller-expertSkill
- create-qa-documentSkill
- debugSkill
- devops-expertSkill
- execute-qaSkill
- feature-qaSkill
- fix-bug-indexSkill
- fix-honeybadgerSkill
- fix-system-testSkill
- frontend-expertSkill
- frontend-reviewSkill
- full-qa-fixSkill
- full-qaSkill
- full-reviewSkill
- green-ciSkill
- honeybadger-auditSkill
- ideateSkill
- impact-assessmentSkill
- improveSkill
- merge-mainSkill
- model-expertSkill
- model-testSkill
- native-bug-hunt-fixSkill
- native-bug-huntSkill
- page-speedSkill
- plan-questionsSkill
- planSkill
- plan-system-testsSkill
- policy-testSkill
- prdSkill
- prd-worktreeSkill
- product-questionSkill
- product-question-tldrSkill
- qa-branchSkill
- qa-testerSkill
- resolve-issueSkill
- review-acceptance-criteriaSkill
- review-fixesSkill
- review-railsSkill
- rspec-test-expertSkill
- scale-reviewSkill
- service-testSkill
- stedi-billing-expertSkill
- sync-user-docsSkill
- system-test-expertSkill
- system-testSkill
- ticketsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
If --every-file is set, only guards 1 and 2 apply.
- Distinctive: line 41
Run discovery for all five categories.
- Very specific: line 68
If --include-specs is set, also pick up changed files under spec/<dir>/.
- Very specific: line 90
If --dry-run, stop here.
- Distinctive: line 92
If every category is empty, print a green "Nothing to do — no changed files in any category." and exit.
- Very specific: line 147
All non-empty category agents are dispatched in a single assistant turn with multiple Agent tool calls so they run concurrently — the same …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test Changed — Parallel Test Coverage Orchestrator
Native Claude orchestrator that mirrors scripts/test-changed-all.sh. Discovers files changed in the current branch across five categories, then dispatches one specialized test-generation agent per category in parallel to create or improve specs for each changed file.
| Category | Source dir | Spec dir | Skill to invoke |
| components | app/components/ | spec/components/ | viewcomponent-test-expert |
| jobs | app/jobs/ | spec/jobs/ | rspec-test-expert |
| models | app/models/ | spec/models/ | rspec-test-expert |
| policies | app/policies/ | spec/policies/ | rspec-test-expert |
| services | app/services/ | spec/services/ | service-test |
Inputs
Parse $ARGUMENTS for these flags (any order; pass-through behavior matches the original script):
--dry-run— Discover files and print what would be processed, then stop. No agents are dispatched.--every-file— Process every file in each source dir, not just files changed on the branch.--include-specs— Also pass any changed spec files to the relevant agent for review/improvement (not just new/missing specs).-h/--help— Print the table above plus this options list, then stop.- Any non-flag positional argument is treated as the base branch (default
main).
Hard-Stop Guards
Before discovery, verify:
- The working directory is inside a git repo (
git rev-parse --is-inside-work-tree). git branch --show-currentreturns a non-empty branch name.- The base branch exists locally (
git rev-parse --verify <base>). If not, suggestgit fetch origin <base>and abort. - The merge base (
git merge-base <base> HEAD) resolves. If not, abort with a clear message.
If --every-file is set, only guards 1 and 2 apply.
Step 1 — Discover Files
Run discovery for all five categories. Use Bash to compute the diff once, then filter in-process. Pseudocode (adapt to actual paths):
BASE="${BASE_BRANCH:-main}"
MERGE_BASE=$(git merge-base "$BASE" HEAD)
if [ "$EVERY_FILE" = true ]; then
CANDIDATES=$(find app/components app/jobs app/models app/policies app/services -name "*.rb" -type f | sort)
else
CANDIDATES=$(git diff --name-only --diff-filter=AMR "$MERGE_BASE" HEAD)
fiThen bucket each candidate path into a category and skip these excluded files (they have no business spec):
app/components/application_component.rbapp/jobs/application_job.rbapp/models/application_record.rb,app/models/concerns/**(concerns are tested via includers — skip them unless--include-specsis set and a concern spec already exists)app/policies/application_policy.rbapp/services/application_service.rb,app/services/base_service.rb,app/services/concerns/**
For each kept source file, derive:
- Class name — snake_case path under
app/<dir>/→ CamelCase with::separators. Example:app/services/billing/charge_service.rb→Billing::ChargeService. - Spec path — swap
app/forspec/and append_spec.rb. Example:app/services/billing/charge_service.rb→spec/services/billing/charge_service_spec.rb. - Spec status —
[spec exists]or[no spec](used to choose the agent's prompt).
If --include-specs is set, also pick up changed files under spec/<dir>/. Map each spec back to its source path and add it to its category's list (deduped).
Step 2 — Print Discovery Summary
Print a compact summary BEFORE dispatching agents, grouped by category:
Discovered changes vs <base> (merge-base <short-sha>):
components (2)
UserAvatarComponent (app/components/user_avatar_component.rb) [spec exists]
Billing::InvoiceRowComponent (app/components/billing/invoice_row_component.rb) [no spec]
jobs (0)
models (1)
Client (app/models/client.rb) [spec exists]
policies (0)
services (3)
...
Dispatching 3 agents (skipping empty categories: jobs, policies).If --dry-run, stop here.
If every category is empty, print a green "Nothing to do — no changed files in any category." and exit.
Step 3 — Dispatch Agents in Parallel
For each non-empty category, dispatch one Agent in parallel (single message, multiple Agent tool uses). Use subagent_type: "general-purpose". Each agent's prompt must be self-contained and include:
- The category name and the list of
(class_name, source_path, spec_path, spec_status)tuples to process. - The skill the agent should invoke per file (from the table at the top).
- A loop instruction: for each tuple, invoke the appropriate skill with a prompt tailored to whether the spec exists.
- The expected report format (see Step 4).
Prompt template (per agent)
You are processing the
<category>category for the test-changed orchestrator. Process the files below sequentially. For each file, invoke/<skill-name>via the Skill tool with the prompt indicated.Files to process:
<ClassName>— source:<source_path>, spec:<spec_path>, status:<spec_status>- ...
If status is
[no spec]invoke the skill with:Create comprehensive RSpec tests for the
<ClassName><singular-category>.
- Source file:
<source_path>- Spec file to create:
<spec_path>Read the source, generate the spec following project conventions (FactoryBot, Result objects where applicable, multi-tenant context, etc.), then run
bundle exec rspec <spec_path>and iterate until green.If status is
[spec exists]invoke the skill with:Review and improve the RSpec tests for the
<ClassName><singular-category>.
- Source file:
<source_path>- Spec file:
<spec_path>Read both files, identify gaps in coverage (public methods, success/failure paths, edge cases, side effects), add the missing tests, then run
bundle exec rspec <spec_path>and iterate until green.After each file, record one of:
PASS,FAIL <one-line reason>, orSKIP <reason>.When done, return a single message with this exact shape:
CATEGORY: <category> RESULTS: <ClassName> — PASS | FAIL: <reason> | SKIP: <reason> ... SUMMARY: <N pass> / <N fail> / <N skip>Do not commit, push, or create PRs.
<singular-category> is component, job, model, policy, or service.
Parallelism rule
All non-empty category agents are dispatched in a single assistant turn with multiple Agent tool calls so they run concurrently — the same shape as the original bash & + wait pattern.
Step 4 — Aggregate and Report
Once all agents return, print a combined summary (mirrors the bash script's COMBINED SUMMARY block):
========================================
COMBINED SUMMARY
========================================
PASS components (2/2)
FAIL services (2 pass, 1 fail)
...
----- Failures -----
services / Billing::ChargeService — spec failed after 3 iterations: ActiveRecord::RecordInvalid on factory(:invoice)
Next steps:
1. Review changes: git diff
2. Re-run any failed category: bundle exec rspec <failed_spec_paths>
3. Commit when satisfiedExit non-zero (in spirit — i.e. surface clearly to the user) if any category reported failures, matching the script's exit-1 behavior.
Principles
- One message dispatches all categories. This is the entire point of "parallel" — do NOT serialize the Agent calls.
- Mirror the bash script's file-selection rules exactly. Same excludes, same
--diff-filter=AMR, same merge-base comparison, same class-name derivation. - Don't shell out to the original scripts. This skill is the native replacement; calling
scripts/test-changed-all.shwould defeat the purpose. - Don't commit anything. The user reviews
git diffand commits themselves — same as the original script. - Empty categories are skipped silently in agent dispatch but listed in the discovery summary so the user can see they were considered.
--include-specsis additive, not a mode switch — it adds spec-file-driven entries to whatever the changed-source pass produced.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

