Skip to content
Skillpedia
Testing8.2k · #12551

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.md

Copy 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

Use this skill to help me: https://github.com/Gentleman-Programming/gentle-ai/blob/main/internal/assets/skills/go-testing/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

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; use teatest only for interactive flows.
  • Golden files must be deterministic; update only through the repo's -update path 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

  1. Identify behavior under test and the smallest public boundary that proves it.
  2. Choose the test pattern from the decision gate.
  3. Name cases by scenario, not input mechanics.
  4. Assert outputs, errors, state, and side effects explicitly.
  5. Run the narrow package test first, then the relevant broader suite.
  6. 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

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.

repo: Gentleman-Programming/gentle-ai

Popularity

GitHub stars
8.2k
Ranking position
#12551
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills