agentleFS
Renozoic-FoundryRenozoic-Foundry/forge-public/.claude/skills/test/SKILL.md

test

Skill0 starsChanged 3 months agoMITView on GitHub

Run the test suite and report results

185 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-context-isolation, agentica-infrastructure and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 158 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the project's test suite and report results.

    line 7
  2. Very specific:

    If $ARGUMENTS is ? or help: Print:

    line 10
  3. Distinctive:

    Stop — do not execute any further steps.

    line 27
  4. Very specific:

    If Step 1 printed (unresolved), ask exactly ONE question — never fall back to a stack-specific runner, and never fail with that runner's …

    line 123
  5. Distinctive:

    If a path argument was provided, append it to the resolved command.

    line 137
  6. Distinctive:

    Run in the project root.

    line 138
  7. Distinctive:

    If any tests fail:

    line 146
  8. Distinctive:

    If new: attempt to fix before proceeding

    line 148
  9. Distinctive:

    If pre-existing: note it as a known defect in the session log and continue

    line 149

“Common” is measured: kept by at least 6 in 10 of the 158 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Framework: FORGE

Run the project's test suite and report results. Accepts an optional path to a specific test file or directory, or an explicit command override.

If $ARGUMENTS is ? or help: Print:

/test — Run the project test suite.
Usage: /test [path/to/tests] [--cmd "<command>"]
Arguments:
  path (optional)   — run only that file or directory. Omit to run everything.
  --cmd "<command>" — run this exact command instead of the resolved one.
Examples:
  /test                            — run the full suite with the resolved command
  /test tests/unit                 — run one path
  /test --cmd "npm run test:ci"    — override the resolved command for this run
Behavior: Resolves the project's test command (explicit override → configured value →
detected stack → ask), prints it, runs it, then reports pass/fail and identifies new
vs pre-existing failures.
See: CLAUDE.md (key commands)

Stop — do not execute any further steps.


Usage: /test [optional: path] [--cmd "<command>"]

[mechanical] Step 1 — Resolve the test command (Spec 651)

FORGE does not assume a stack. The command is resolved in a fixed precedence order and the source is always reported, so an operator can see why a given command ran. Run the resolver below with FORGE_TEST_CMD_ARG set to the --cmd value when one was passed (unset otherwise):

# forge:spec-651-resolve-block:start
# Precedence: explicit --cmd  ->  project.test_command in .forge/onboarding.yaml
#             ->  file-presence stack detection  ->  unresolved (Step 2 asks).
# This block RESOLVES and PRINTS only. It never executes the command — the
# operator sees the resolved string first (Spec 651 Constraints).
forge_test_cmd=""
forge_test_src=""

if [[ -n "${FORGE_TEST_CMD_ARG:-}" ]]; then
  forge_test_cmd="$FORGE_TEST_CMD_ARG"
  forge_test_src="explicit --cmd argument"
fi

if [[ -z "$forge_test_cmd" && -f .forge/onboarding.yaml ]]; then
  configured="$(sed -n 's/^[[:space:]]*test_command:[[:space:]]*//p' .forge/onboarding.yaml | head -1)"
  configured="${configured%\"}"; configured="${configured#\"}"
  configured="${configured%\'}"; configured="${configured#\'}"
  if [[ -n "$configured" && "$configured" != "null" && "$configured" != "~" ]]; then
    forge_test_cmd="$configured"
    forge_test_src="project.test_command (.forge/onboarding.yaml)"
  fi
fi

# File-presence detection only — no dependency-detection framework (Constraints).
# Order is fixed and declared so a polyglot repo resolves predictably.
if [[ -z "$forge_test_cmd" ]]; then
  if [[ -f package.json ]]; then
    forge_test_cmd="npm test";        forge_test_src="detected stack: Node (package.json)"
  elif [[ -f pyproject.toml || -f setup.py ]]; then
    forge_test_cmd="pytest -q";       forge_test_src="detected stack: Python (pyproject.toml/setup.py)"
  elif [[ -f go.mod ]]; then
    forge_test_cmd="go test ./...";   forge_test_src="detected stack: Go (go.mod)"
  elif [[ -f Cargo.toml ]]; then
    forge_test_cmd="cargo test";      forge_test_src="detected stack: Rust (Cargo.toml)"
  elif compgen -G "*.csproj" > /dev/null 2>&1 || compgen -G "*.sln" > /dev/null 2>&1; then
    forge_test_cmd="dotnet test";     forge_test_src="detected stack: .NET (*.csproj/*.sln)"
  fi
fi

if [[ -z "$forge_test_cmd" ]]; then
  echo "Test command: (unresolved)"
  echo "Resolved from: none — no configured command and no recognized stack"
else
  echo "Test command: $forge_test_cmd"
  echo "Resolved from: $forge_test_src"
fi
# forge:spec-651-resolve-block:end

PowerShell / Windows equivalent (same precedence; command quoting differs):

$forgeTestCmd = ''
$forgeTestSrc = ''
if ($env:FORGE_TEST_CMD_ARG) { $forgeTestCmd = $env:FORGE_TEST_CMD_ARG; $forgeTestSrc = 'explicit --cmd argument' }
if (-not $forgeTestCmd -and (Test-Path '.forge/onboarding.yaml')) {
  $line = Select-String -Path '.forge/onboarding.yaml' -Pattern '^\s*test_command:\s*(.*)$' |
    Select-Object -First 1
  if ($line) {
    $configured = $line.Matches[0].Groups[1].Value.Trim().Trim('"').Trim("'")
    if ($configured -and $configured -ne 'null' -and $configured -ne '~') {
      $forgeTestCmd = $configured; $forgeTestSrc = 'project.test_command (.forge/onboarding.yaml)'
    }
  }
}
if (-not $forgeTestCmd) {
  if     (Test-Path 'package.json')   { $forgeTestCmd = 'npm test';      $forgeTestSrc = 'detected stack: Node (package.json)' }
  elseif ((Test-Path 'pyproject.toml') -or (Test-Path 'setup.py')) { $forgeTestCmd = 'pytest -q'; $forgeTestSrc = 'detected stack: Python (pyproject.toml/setup.py)' }
  elseif (Test-Path 'go.mod')         { $forgeTestCmd = 'go test ./...'; $forgeTestSrc = 'detected stack: Go (go.mod)' }
  elseif (Test-Path 'Cargo.toml')     { $forgeTestCmd = 'cargo test';    $forgeTestSrc = 'detected stack: Rust (Cargo.toml)' }
  elseif ((Get-ChildItem -Filter *.csproj -ErrorAction SilentlyContinue) -or
          (Get-ChildItem -Filter *.sln    -ErrorAction SilentlyContinue)) { $forgeTestCmd = 'dotnet test'; $forgeTestSrc = 'detected stack: .NET (*.csproj/*.sln)' }
}
if (-not $forgeTestCmd) {
  "Test command: (unresolved)"
  "Resolved from: none — no configured command and no recognized stack"
} else {
  "Test command: $forgeTestCmd"
  "Resolved from: $forgeTestSrc"
}

[decision] Step 2 — Ask, only when nothing resolved

If Step 1 printed (unresolved), ask exactly ONE question — never fall back to a stack-specific runner, and never fail with that runner's error:

No test command is configured and no stack was detected.
What should /test run? (a command, or `none` to skip testing this run)

STOP — wait for response. On a command: use it for this run and offer to persist it with /configure → Test command. On none: report No test command configured — skipping. and stop.

[mechanical] Step 3 — Run

  1. Echo the resolved command and its source (Step 1's two lines) before running anything.
  2. If a path argument was provided, append it to the resolved command; otherwise run it as-is.
  3. Run in the project root.

[mechanical] Step 4 — Report

  • Pass/fail count
  • Any failures, with the runner's short output
  • Whether the result matches the expectation from the spec being worked on

If any tests fail:

  • Identify whether the failure is in new code (this session) or pre-existing
  • If new: attempt to fix before proceeding
  • If pre-existing: note it as a known defect in the session log and continue

[mechanical] Lint command

The delivery gate's lint step resolves project.lint_command from .forge/onboarding.yaml by the same precedence and reports the same way. Stack defaults, when nothing is configured: Node → eslint ., Python → ruff check ., Go → golangci-lint run, Rust → cargo clippy, .NET → dotnet format --verify-no-changes. With nothing configured and no stack detected, lint is skipped with a stated reason — never silently, and never with an assumed runner.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.