本文へスキップ
Skillpedia
テスト8.2k · #12551

go-testing

できること

このスキルは、Goのプログラミング言語でテストを書いたりレビューしたりするとき、AIを導きます。ターミナルのインターフェースのテストを含め、集中して信頼できるテストがほしいGo開発者向けです。

使う場面

  • ✓入力のケースが多いGoの関数のテストを書くとき。
  • ✓Bubbleteaで作られたターミナルのユーザーインターフェースをテストしているとき。
  • ✓ゴールデンファイルのテストや、ファイルシステムに触れるテストが必要なとき。

スキルのリンク

https://github.com/Gentleman-Programming/gentle-ai/blob/main/internal/assets/skills/go-testing/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/Gentleman-Programming/gentle-ai/blob/main/internal/assets/skills/go-testing/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このパーサーの表駆動のGoテストを、エラーのケースも含めて書いてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

スキルは、対象に合わせてテストのパターンを選びます。関数には表駆動のテスト、ターミナルのインターフェースには直接のモデルの更新を使います。テストを決定的に保ち、短いモードでは遅い外部テストを飛ばします。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)を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

よくある質問

ゴールデンファイルとは何ですか?

テストが比較する、保存された期待される出力です。スキルは、それが決定的であることを求めます。

ターミナルのインターフェースはどうテストしますか?

状態の変化を直接テストし、完全な対話の流れにだけteatestを使います。

テストで実際のホームフォルダを使いますか?

いいえ。スキルは一時フォルダを使い、実際のホームディレクトリには決して頼らないよう述べています。

詳細

作者による元の説明

Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.

repo: Gentleman-Programming/gentle-ai

人気

GitHubのスター
8.2k
ランキング
#12551
ライセンス
MIT
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル