agentleFS
majiayu000majiayu000/test-loop/.claude/skills/report-render/SKILL.md

report-render

Skill0 starsChanged 37 days agoMITView on GitHub

Turn a test runner's raw log into a Markdown report plus a structured JSON summary. Embeds the failure classification so a reader can see the failing tests, the run summary, and the failure-class counts on one page.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 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.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After every test run, whether green or red.

    line 21
  2. Very specific:

    Collect (--collect): read the existing date-based log.txt without running the command.

    line 51
  3. Distinctive:

    Classify: if not already classified (call failure-classify on the log).

    line 71
  4. Very specific:

    When run with a failing test injected, the report gains a Failures by class section with the ASSERTION_FAILURE bucket populated.

    line 110
  5. Very specific:

    Renaming summary.json per run: Keep the schema stable across days.

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

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

report-render

Render a test run into something a human wants to read.

When to use

  • After every test run, whether green or red.
  • From CI, with the report and summary uploaded as artifacts.
  • Manually, to investigate a flake or to attach a report to a bug.

Inputs

NameRequiredDefaultDescription
repo_rootyes.Path to the project root. The script writes outputs under docs/reports/<YYYY-MM-DD>/.
log_pathyesnoneRaw test runner output. Usually the file produced by `swift test 2>&1tee log.txt` or its equivalent.
classify_jsonno(none)If failure-classify has already been run, pass its JSON output path to embed the classification. The render script calls the classifier itself if this is omitted.
collect_onlynofalseWhen true, skip running the test runner; render only from the existing log. Use to re-render a report after editing a summary template.

Output

Three artifacts under docs/reports/<YYYY-MM-DD>/:

FilePurpose
log.txtThe raw test runner output, byte-for-byte.
summary.jsonStructured facts: total, passed, failed, report exit_code (see below), run_line, plus the merged failures_by_class and failures_grouped when classification is available.
report.mdA human-readable summary when rendering completes. Contains a Failures by class section only when there is at least one failure.

Exit status and verdict

The preview at bin/render_report.sh uses the same report status for its process exit code, summary.json.exit_code, and Markdown PASS/FAIL verdict:

  • Live: preserve a nonzero test-command exit code. If the command exits 0 but parsed failures are present, use 1; otherwise use 0.
  • Collect (--collect): read the existing date-based log.txt without running the command. Use 1 when parsed failures are present, else 0. This cannot recover the original runner exit code.

These rules describe a completed render. An unsupported --language value or a missing collect log exits 2 before a new summary or report is written. A zero status or zero test count is not proof that tests ran or passed; compare the raw log and original runner result. Classification names such as EXPECTED_FAILURE do not override the report status.

Algorithm

  1. Capture the test runner's stdout and stderr to log.txt. Use tee rather than > so the same output appears in the user's terminal.
  2. Count results using the selected language's log patterns, and extract the run summary. Swift uses ✔ and ✘ lines; the other runners use their own result lines or summaries. See "Runner differences" below.
  3. List the failing test names, deduplicated.
  4. Classify if not already classified (call failure-classify on the log).
  5. Render the Markdown. Use a ✅ PASS / ❌ FAIL indicator on the first line, then counts, then the run summary, then failing tests, then the failure-class breakdown, then a list of artifact paths.

Runner differences

Result extraction and run-summary formats are runner-specific. The working preview supports --language swift|python|go|rust and recognises:

RunnerSummary line shape
Swift TestingTest run with N tests passed after X.XXX seconds.
pytestN passed in X.XXs
go testok <package> X.XXXs or FAIL per package
cargo testtest result: ok. N passed; M failed; ...

An unsupported --language value is rejected, including when a custom --test-command is supplied. For a supported language whose log has no recognized summary, the report still renders with run_line set to (no summary line found). This fallback alone does not change the status; the live-command status and parsed failures still determine the verdict.

Worked example (Swift, end-to-end)

bash scripts/render_report.sh

Produces, in docs/reports/2026-06-02/:

log.txt            # full swift test output
summary.json       # 83 / 85 / 0, exit 0, run_line="Test run with 83 tests..."
report.md          # 10-line markdown summary

When run with a failing test injected, the report gains a Failures by class section with the ASSERTION_FAILURE bucket populated.

Anti-patterns

  • Treating the Markdown report as a primary source of truth. It is a view. summary.json is the structured fact. Build downstream tools off summary.json.
  • Committing docs/reports/ to source control. It is a run output, not a design artifact. Add docs/reports/ to .gitignore.
  • Renaming summary.json per run. Keep the schema stable across days. Triage tools that consume it should not need to be told which day a report came from.

Cross-references

  • failure-classify — invoked by this skill when no classify_json is supplied.
  • init-loop — installs the render script into a fresh project.
  • drift-check — the corresponding pre-test step in the loop.

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.