go-testing

GitHub

指导编写和审查Go测试,涵盖表格驱动测试、Bubbletea/TUI流测试(teatest)、黄金文件管理及覆盖率提升。提供决策门径和执行步骤,确保测试行为导向且可维护。

internal/assets/skills/go-testing/SKILL.md Gentleman-Programming/gentle-ai

Trigger Scenarios

编写Go单元测试或集成测试 审查Go测试代码 添加测试覆盖率 使用teatest测试TUI交互 更新或验证黄金文件

Install

npx skills add Gentleman-Programming/gentle-ai --skill go-testing -g -y
More Options

Non-standard path

npx skills add https://github.com/Gentleman-Programming/gentle-ai/tree/main/internal/assets/skills/go-testing -g -y

Use without installing

npx skills use Gentleman-Programming/gentle-ai@go-testing

指定 Agent (Claude Code)

npx skills add Gentleman-Programming/gentle-ai --skill go-testing -a claude-code -g -y

安装 repo 全部 skill

npx skills add Gentleman-Programming/gentle-ai --all -g -y

预览 repo 内 skill

npx skills add Gentleman-Programming/gentle-ai --list

SKILL.md

Frontmatter
{
    "name": "go-testing",
    "license": "Apache-2.0",
    "metadata": {
        "author": "gentleman-programming",
        "version": "1.0"
    },
    "description": "Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns."
}

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

Version History

  • e01b114 Current 2026-07-25 06:59

Same Skill Collection

internal/assets/skills/_shared/SKILL.md
internal/assets/skills/branch-pr/SKILL.md
internal/assets/skills/chained-pr/SKILL.md
internal/assets/skills/cognitive-doc-design/SKILL.md
internal/assets/skills/comment-writer/SKILL.md
internal/assets/skills/gentle-ai-bench/SKILL.md
internal/assets/skills/hermes-ephemeral-delegation/SKILL.md
internal/assets/skills/issue-creation/SKILL.md
internal/assets/skills/judgment-day/SKILL.md
internal/assets/skills/rdd-defect-workflow/SKILL.md
internal/assets/skills/sdd-archive/SKILL.md
internal/assets/skills/sdd-design/SKILL.md
internal/assets/skills/sdd-explore/SKILL.md
internal/assets/skills/sdd-init/SKILL.md
internal/assets/skills/sdd-onboard/SKILL.md
internal/assets/skills/sdd-propose/SKILL.md
internal/assets/skills/sdd-spec/SKILL.md
internal/assets/skills/sdd-tasks/SKILL.md
internal/assets/skills/skill-creator/SKILL.md
internal/assets/skills/skill-improver/SKILL.md
internal/assets/skills/skill-registry/SKILL.md
internal/assets/skills/systemic-issue-triage/SKILL.md
internal/assets/skills/work-unit-commits/SKILL.md
skills/branch-pr/SKILL.md
skills/chained-pr/SKILL.md
skills/cognitive-doc-design/SKILL.md
skills/comment-writer/SKILL.md
skills/gentle-ai-bench/SKILL.md
skills/gentle-ai-collab-perfect/SKILL.md
skills/issue-creation/SKILL.md
skills/issue-root-resolution/SKILL.md
skills/rdd-advisory-transport/SKILL.md
skills/rdd-defect-workflow/SKILL.md
skills/systemic-issue-triage/SKILL.md
skills/work-unit-commits/SKILL.md

Metadata

Files
0
Version
35deba3
Hash
87205f2e
Indexed
2026-07-25 06:59

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 05:04
浙ICP备14020137号-1 $mapa de visitantes$