agentsclimarketplace

Adept writing tests

Skill itaywol/adeptability/.adeptability/skills/adept-writing-tests

How to write tests in the adept Go codebase — table-driven tests with testify, golden fixtures under testdata/, the cmd/adept e2e harness, temp-dir/HOME isolation, and coverage gates. Apply when adding or changing Go tests here. (matches: **/*_test.go)From its SKILL.md

Install
npx -y skills add itaywol/adeptability --skill adept-writing-tests

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 9 stars9 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 4 commands, including `go test ./...` and 3 more.

SKILL.md

2.3 KB, 512 tokens by cl100k_base, as published. Nobody here has run it

Writing tests for adept

Defaults

  • Table-driven tests with github.com/stretchr/testify/require. One t.Run(tc.name, …) per case; name cases for the behavior they pin.
  • Put unit tests in the same package (package foo) for white-box access; use package foo_test when you want to assert only the public surface.
  • Use t.TempDir() for any filesystem work — never write into the repo or a shared path.
  • No network in unit tests. Use net/http/httptest for HTTP clients, and the package's interfaces + fakes for git, the registry, and the LLM provider (see how Deps is wired).

Golden fixtures

Renderers are pinned by golden files in each internal/render/<id>/testdata/. When you change rendered output on purpose:

  1. Update the fixture in the same PR.
  2. Explain why in the commit message.

Never loosen an assertion to make a diff pass — fix the code or update the golden deliberately.

End-to-end tests

cmd/adept/*_test.go build the real binary and drive commands against temp dirs with an isolated environment:

env := []string{
    "PATH=" + os.Getenv("PATH"),
    "HOME=" + t.TempDir(),          // isolate user config
    "ADEPT_LIBRARY=" + libRoot,     // isolate the library
}

Guard the slow ones so go test -short skips them:

if testing.Short() { t.Skip("skipping e2e under -short") }

Assert on observable behavior — exit codes, files on disk, stdout/JSON — not internals. Exit codes: 0 clean · 1 error · 2 drift/dirty or merge conflict.

Run them

go test ./...                  # fast
go test -race ./...            # CI gate
go test -run E2E ./cmd/adept   # e2e only
go test -cover ./...           # per-package coverage

Coverage gates

Keep ≥80% on internal/render, internal/status, internal/budget, internal/locks, and internal/canonical. Prefer tests that would actually catch a regression (error paths, edge cases, round-trips) over coverage-padding happy-path calls.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.