agentleFS
perberperber/leafwiki/.claude/skills/tidy-tests/SKILL.md

tidy-tests

Skill1.2k starsChanged 19 days agoMITView on GitHub

Restructure the tests of one LeafWiki package, file or feature for readability — split oversized test files by capability, turn copy-pasted cases into table-driven (matrix) tests, introduce a default fixture with overrides — without changing what is tested. Produces proof that no case and no coverage was lost. Use for dedicated test-cleanup PRs (e.g. "split router_test.go", "tidy the pages tests"); pass the package or file as argument.

1 other project uses a version of this.

Trending

Less talk lately.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 2 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 2 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the perber/leafwiki repository that our weekly crawl found: only 5 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. choegyumin/agent-skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't table cases with different setup or different assertions.

    line 36
  2. Distinctive:

    Coverage: after ≥ before (per package).

    line 53
  3. Very specific:

    No assertion weakened (e.g.

    line 58
  4. Very specific:

    Run the reviewer agent on the diff with the before/after case lists and coverage numbers.

    line 63

≈ “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

Tidy tests

A behaviour-preserving refactoring of test code only. The rules are in docs/development/conventions.md ("Tests"). Production code is not touched — if a test can only be simplified by changing production code, note it and stop there.

1. Baseline (before any edit)

Record, for the target package(s):

go test ./<pkg>/... -count=1 -v 2>&1 | grep -E '^(=== RUN|--- (PASS|FAIL|SKIP))' > before-cases.txt
go test ./<pkg>/... -count=1 -coverprofile=before.cov && go tool cover -func=before.cov | tail -1

Frontend: npx vitest run <path> --reporter=verbose > before-cases.txt and npm run test:coverage -- <path>. Keep these files outside the repo (scratch directory).

2. Plan the restructuring

List what you will change and why, grouped:

  • Split a file over ~800 lines by capability (e.g. router_test.go → router_pages_test.go, router_auth_test.go, …, shared setup in router_fixture_test.go).
  • Tables: groups of tests with the same setup and assertion that differ only in input and expected output. Name every row.
  • Fixture: one default fixture per package with explicit overrides; t.Cleanup for every opened store; build only what each test needs.
  • Names to Test<Type>_<Scenario>_<Expectation>; dead helpers removed.

Don't table cases with different setup or different assertions. No generic assertion DSL. Show the plan to the person if it touches more than one package.

3. Restructure in small steps

One kind of change per step, each meant to become its own commit (test: split router tests by slice, test: table-drive slug validation, …), the suite green after each. Commit each step locally (Conventional Commits, suite green before each); don't push. The PR is capped at ~1,000 changed lines; a big file is split over several PRs.

4. Prove nothing was lost

go test ./<pkg>/... -count=1 -v 2>&1 | grep -E '^(=== RUN|--- (PASS|FAIL|SKIP))' > after-cases.txt
go test ./<pkg>/... -count=1 -coverprofile=after.cov && go tool cover -func=after.cov | tail -1
  • Coverage after ≥ before (per package).
  • Cases: map every test from before-cases.txt to a test or table row in the new code. Old test functions that became rows have a different name; the mapping goes into the PR description as a table (old name → new location). A case without a mapping is a lost case: restore it.
  • No assertion weakened (e.g. exact comparison replaced by "not empty"), no t.Skip added.
  • Lint and format: golangci-lint run ./<pkg>/...; frontend npm run lint, npm run format.

5. Review

Run the reviewer agent on the diff with the before/after case lists and coverage numbers. A lost case or lower coverage is blocking. Don't push or open a PR without the person's OK.

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.