Analyze a target repository's automated testing approach and run the most appropriate test command(s) safely.
Install
npx skillscat add nesnilnehc/ai-cortex/run-automated-tests Install via the SkillsCat registry.
SKILL.md
Skill: Run Automated Tests
Purpose
Determine how a target repository expects automated tests to be executed (commands, frameworks, prerequisites, and scope), then run the best matching test suite(s) with a safety-first interaction policy.
Use Cases
- You cloned a repo and want the correct test command without guessing.
- A repo has multiple test layers (unit/integration/e2e) and you need a safe default run plan.
- CI is failing and you want to reproduce locally by running the same commands used in workflows.
Behavior
Establish scope and constraints (ask if ambiguous)
- If the user did not specify, default to a fast, local, non-destructive run:
- Unit tests only, no external services, no Docker, no network-dependent setup.
- Ask the user to choose a mode if needed:
fast: unit tests only, minimal setup.ci: mirror CI workflow commands as closely as possible.full: include integration/e2e tests and service dependencies.
- Ask whether Docker is allowed, whether network access is allowed, and whether installing dependencies is allowed.
- If the user did not specify, default to a fast, local, non-destructive run:
Discover the test plan (evidence-based)
- Read these sources in order; stop early if a clear, explicit test command is found:
README.md,CONTRIBUTING.md,TESTING.md,docs/testing*,Makefile- CI configs:
.github/workflows/*.yml,.gitlab-ci.yml,azure-pipelines.yml,Jenkinsfile - Build manifests:
package.json,pyproject.toml,setup.cfg,tox.ini,go.mod,pom.xml,build.gradle*,*.csproj,Cargo.toml
- Identify:
- Primary test entrypoints (
npm test,pnpm test,yarn test,pytest,tox,go test,dotnet test,mvn test,gradle test,cargo test, etc.) - Test layers and markers (unit vs integration vs e2e)
- Environment prerequisites (DB, Redis, Docker Compose, required env vars, secrets)
- How CI sets up dependencies (services, caches, artifacts)
- Primary test entrypoints (
- Prefer explicit instructions found in docs or CI over heuristics.
- Read these sources in order; stop early if a clear, explicit test command is found:
Select an execution plan
- If
cimode: derive the run sequence from the repo's CI workflow steps (closest match). - If
fastmode: pick the most direct unit-test command with the least prerequisites. - If multiple stacks exist (e.g., backend + frontend), propose running each stack separately in a deterministic order.
- If the plan requires dependency installation or service startup, request confirmation before proceeding.
- If
Execute with guardrails
- Always print the exact commands you will run before running them.
- Use a working directory rooted at the target repo (default
.). - Capture and summarize failures:
- First failing command and exit code
- The most relevant error excerpt
- Next actions (missing toolchain, missing env var, service not running, etc.)
- Avoid destructive operations:
- Do not run
rm -rf,git clean -fdx,docker system prune, or database drop/migrate commands without explicit user approval.
- Do not run
- If the repo requires secrets, do not ask the user to paste secrets into chat. Prefer
.envfiles, secret managers, or documented local dev flows.
Input & Output
Input
- Target repository path (default
.). - Mode:
fast(default),ci, orfull. - Constraints: allow dependency install (yes/no), allow network (yes/no), allow Docker (yes/no).
Output
- A short "Test Plan Summary" containing:
- Evidence: which files/paths informed the plan
- Chosen commands (in order)
- Assumptions and prerequisites
- What was executed and what was skipped (and why)
- Command transcript snippets sufficient to debug failures (do not dump extremely long logs unless asked).
Restrictions
- Do not invent test commands when evidence exists (prefer docs/CI).
- Do not install dependencies, run Docker, or start external services without confirmation.
- Do not modify repository files unless the user explicitly requests it (exception: generating a report file if the user asked for artifacts).
- Do not exfiltrate secrets; do not request sensitive credentials in chat.
Self-Check
Before you finish:
- Confirm you identified at least one authoritative test instruction source:
- A doc file (README/CONTRIBUTING/TESTING), or
- A CI workflow step, or
- A build manifest script target (e.g.,
package.jsonscripts).
- Confirm you asked for confirmation before any action that:
- Installs dependencies, uses network, starts Docker/services, or changes state outside the repo.
- Confirm the final output includes:
- Evidence paths, selected commands, execution results, and any missing prerequisites.
- If tests failed, confirm you provided:
- The first failing command, exit code, and the likely root cause category (toolchain/env/service/test failure).
Examples
Example 1: JavaScript repo with package.json
User: "Run tests for this repo."
Agent:
- Inspect
package.jsonscripts and.github/workflows/*. - Decide mode
fastand propose:npm test(orpnpm test/yarn testif the repo standardizes on it)
- Ask: "Install dependencies (
npm ci) and allow network?" - Run:
npm cinpm test
- Summarize results and point to failing test output if any.
Example 2 (Edge case): Monorepo with integration tests requiring Docker
User: "Mirror CI locally."
Agent:
- Parse
.github/workflows/ci.ymland identify separate jobs:- backend unit tests
- frontend tests
- integration tests with
docker compose
- Ask for confirmation:
- allow Docker
- allow network
- which jobs to run (all vs only failing job)
- Execute in a controlled order:
- install deps per job
- run unit tests first
- bring up services for integration tests
- If integration tests fail, summarize:
- service health / port conflicts
- missing env vars
- how CI config differs from local