go-testing
What it does
This skill guides your AI when it writes or reviews tests in the Go programming language. It is for Go developers who want focused, reliable tests, including terminal interface tests.
When to use it
- ✓When you write tests for a Go function that has many input cases.
- ✓When you are testing a terminal user interface built with Bubbletea.
- ✓When you need golden file tests or tests that touch the file system.
Skill link
https://github.com/Gentleman-Programming/gentle-ai/blob/main/internal/assets/skills/go-testing/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Write table-driven Go tests for this parser, including the error cases.”
5 new skills a week. 1 minute to read.
How it works
The skill picks a test pattern to match the target, such as table-driven tests for functions or direct model updates for terminal interfaces. It keeps tests deterministic and skips slow external tests in short mode.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Activation Contract
Load this skill when writing or reviewing Go tests, adding coverage, testing Bubbletea/TUI flows, using teatest, or updating golden files.
Hard Rules
- Prefer table-driven tests for multiple cases; use
t.Run(tt.name, ...). - Test behavior and state transitions, not implementation trivia.
- Use
t.TempDir()for filesystem tests; never rely on a real home directory. - Keep integration tests skippable with
testing.Short()when they run external commands or slow flows. - For Bubbletea, test
Model.Update()directly for state changes; useteatestonly for interactive flows. - Golden files must be deterministic; update only through the repo's
-updatepath and rerun tests without-update. - Use small mocks/interfaces around system or command execution boundaries.
Decision Gates
| Target | Test pattern |
|---|---|
| Pure function or parser | Table-driven unit test. |
| Error behavior | Explicit success and failure cases. |
| File operations | t.TempDir() plus focused assertions. |
| TUI state transition | Direct Model.Update() call with tea.Msg. |
| Full TUI interaction | teatest.NewTestModel(). |
| Rendered output | Golden file test. |
| Real external command | Integration test; skip in -short. |
Execution Steps
- Identify behavior under test and the smallest public boundary that proves it.
- Choose the test pattern from the decision gate.
- Name cases by scenario, not input mechanics.
- Assert outputs, errors, state, and side effects explicitly.
- Run the narrow package test first, then the relevant broader suite.
- For golden updates: run with
-update, inspect diff, then rerun without-update.
Output Contract
Report test files changed, scenarios covered, commands executed, golden files updated, and any skipped integration scope.
References
- references/examples.md — compact table-driven, Bubbletea, teatest, golden, and command examples.
FAQ
What is a golden file?
It is a saved expected output that tests compare against, and the skill requires it to stay deterministic.
How does it test terminal interfaces?
It tests state changes directly and uses teatest only for full interactive flows.
Does it use the real home folder in tests?
No. The skill says to use temporary folders and never rely on a real home directory.
Details
Original description by the author
Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.
Popularity
- GitHub stars
- 8.2k
- Ranking position
- #12551
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
branch-pr
8.2kHelps your agent prepare branches and pull requests that follow the destination project's own contribution rules, not a generic template.
chained-pr
8.2kHelps your agent split a large change of over 400 lines into a chain of smaller, reviewable pull requests that each stand on their own.
cognitive-doc-design
8.2kTeaches your agent to write guides, READMEs and reviews that are easy to scan and remember, by leading with the answer and grouping details.
comment-writer
8.2kHelps your agent write short, warm and direct comments for pull requests, reviews, issue replies and team chat messages.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.