go-tests
Skill2 starsChanged 15 days agoMITView on GitHub
Use when adding, changing, or reviewing Go unit, integration, or E2E tests or test stages, when choosing which test level a code change needs, when choosing between integration and E2E tests, when writing a benchmark or an Example, when reading a coverage report, or when picking the test runtime. Covers unit tests for pure public functions, integration tests on Docker Compose, and E2E tests on the project's full-stack runtime, all in the fluent given/when/then stage pattern (*_test.go plus *_stage_test.go). Also use when migrating an existing Go test suite onto that fluent pattern. Browser tests: see go-browser-tests.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- CasLubbers/code-design-skillstheir own version, first seen Aug 25, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- CasLubbers/code-design-skills★ 2same 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 repository31 other files it gives its agents.
- android-debloatSkill
- arch-linux-cachyosSkill
- beansSkill
- chezmoi-workflowsSkill
- coding-rulesSkill
- context7Skill
- docker-compose-setupSkill
- audioSkill
- deploymentSkill
- ecsSkill
- game-loopSkill
- inputSkill
- physicsSkill
- renderingSkill
- resourcesSkill
- ebitenSkill
- ebook-convertSkill
- gitSkill
- go-browser-testsSkill
- go-devSkill
- go-htmx-frontendSkill
- go-setupSkill
- interactive-browser-testingSkill
- keep-on-goingSkill
- mcpcSkill
- obsidian-vault-triageSkill
- pixellabSkill
- playwright-mcpSkill
- public-repo-maturitySkill
- researchSkill
- skill-craftSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Test data, fake upstream servers, async checks, or test file layout: test-data-and-config.md.
- Distinctive: line 48
Test only pure, easily testable functions, ideally public ones.
- Very specific: line 50
Before handoff, run on new unit files in the diff (skip test/integration/ and test/e2e/):
- Very specific: line 59
Always use a file pair. *_test.go holds scenarios.
- Very specific: line 60
Use the fluent stage: given, when, then := newStage(t).
- Very specific: line 61
No build tags. No mocks. No //nolint.
- Very specific: line 64
When the code paces output (interval, backoff, debounce) or has timeouts, assert the pacing and test at least one duration past the server …
- Very specific: line 65
Use the repo runner, usually make or just.
- Distinctive: line 69
Do not patch first. Record the bug (what failed, how to reproduce) before you change code, then fix it with a test that fails first.
≈ “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.
Files
Go tests
Go unit, integration, and E2E tests. These conventions are required. Do not swap them for a shorter generic approach.
Shared Go rules are in ../go-dev/SKILL.md.
Choose the level
Choose by behaviour, not by convenience.
| Level | Use for | Runs on | Read |
| Unit | Pure public functions: validation, parsing, mapping, formatting, deterministic calculations, simple business rules | No services | unit-tests.md |
| Integration | Databases, queues, streams, storage, service components | Docker Compose | fluent-stage-tests.md, integration-tests.md |
| E2E | API contracts, multi-service workflows, deployed service wiring | The project's full-stack runtime (for example Tilt or a deployed stack) | fluent-stage-tests.md, e2e-tests.md |
Runtime and command choice: test-orchestration.md.
More references, each with its load condition:
- Growing or splitting a stage, adding a stage file, or changing the stage type: stage-structure.md.
- Test data, fake upstream servers, async checks, or test file layout: test-data-and-config.md.
- Comparing implementations or input sizes, or writing a new benchmark: benchmarks.md.
- Reading a coverage report or choosing which untested path to attack next: coverage.md.
- A runnable
Example*next to a public API: examples.md. - Fuzzing a target, or faking time with
testing/synctest: unit-tests.md. - Moving an existing suite onto the fluent stage DSL: fluent-migration.md.
Hard rules: unit
- At most one unit test file per source file. Name it after the file under test with a
_test.gosuffix (foo.gobecomesfoo_test.go). Not every source file needs a unit test. Do not dump tests for many source files into one test file. - Blackbox tests in
package <name>_test. - A unit test feeds inputs and asserts outputs and errors on pure code. If the test needs a hand-written type that satisfies a production interface, write an integration or E2E test instead.
- Test only pure, easily testable functions, ideally public ones.
- Assert on direct inputs, outputs, and returned errors.
- Before handoff, run on new unit files in the diff (skip
test/integration/andtest/e2e/):git diff --name-only --diff-filter=A origin/<default-branch> -- '*_test.go' | grep -vE '/test/(integration|e2e)/' | xargs rg --files-without-match '^package \w+_test$'. Empty output means pass. - One
Test*function per outcome. Assert that outcome directly (require.NoError,require.Error, and the like). - A table shares inputs for one outcome only. Put another outcome in its own
Test*function. - Mixed success/error table fields (
wantErr,wantError,wantFail, and the like) bundle two outcomes in one row. Do not write them. - Mark sections with
// given,// when, and// then. given is explicit setup only (no asserts, not the call under test). when is usually one call under test. then holds all asserts.
Hard rules: integration and E2E
- Integration tests live in
test/integration/withpackage integration_test. E2E tests live intest/e2e/withpackage e2e_test. - Always use a file pair.
*_test.goholds scenarios.*_stage_test.goholds the stage. - Use the fluent
stage:given, when, then := newStage(t). Onegiven, onewhen, onethenper test. given is explicit stage setup only (no asserts, no action under test). when is usually one-ingcall under test. then holds all asserts. Do not blur phases; details in fluent-stage-tests.md. - No build tags. No mocks. No
//nolint. Never skip or delete a test to get green. - Tests run on the host and connect to exposed ports. Clean up external resources with
t.Cleanup, registered in thegivenmethod that creates them. - Wire behaviour (streaming formats, delivery headers, retry exhaustion) needs at least one E2E assertion each, even when unit tests cover the parts. Only E2E proves the real server, router, and middleware are wired.
- When the code paces output (interval, backoff, debounce) or has timeouts, assert the pacing and test at least one duration past the server limits (for example
http.ServerWriteTimeout). A suite where every stream ends in 100 ms cannot see a cut at 10 s. - Use the repo runner, usually
makeorjust.
Bugs found by tests
Do not patch first. Record the bug (what failed, how to reproduce) before you change code, then fix it with a test that fails first.
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
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.

