go-testing

GitHub

提供 Go 语言测试最佳实践,涵盖表格驱动测试、Bubbletea/TUI 行为与交互测试、Golden files 管理及集成测试跳过策略。指导开发者选择合适模式并执行标准化测试流程。

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

Trigger Scenarios

编写或审查 Go 测试用例 增加代码覆盖率 测试 Bubbletea TUI 应用 更新 Golden files

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-research/SKILL.md
internal/assets/skills/sdd-spec/SKILL.md
internal/assets/skills/sdd-tasks/SKILL.md
internal/assets/skills/sdd-verify/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
4acaf42
Hash
87205f2e
Indexed
2026-07-25 06:59

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-21 06:41
浙ICP备14020137号-1