跳到正文
cccskills
免费在 GitHub 公开

go-testing

Write and review Go tests using patterns suited to functions, file operations, and terminal interfaces. Cover multiple scenarios, check state changes, and compare rendered output with saved expected results while keeping slow integration tests separately skippable.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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

查看安装方法

适用场景

  • Testing Go functions and parsers across multiple cases
  • Checking file operations in temporary directories
  • Testing Bubbletea state changes and interactions
  • Updating and verifying golden output files

包含的文件(2)

  • SKILL.md2.1 KB
  • references/examples.md2.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

TargetTest pattern
Pure function or parserTable-driven unit test.
Error behaviorExplicit success and failure cases.
File operationst.TempDir() plus focused assertions.
TUI state transitionDirect Model.Update() call with tea.Msg.
Full TUI interactionteatest.NewTestModel().
Rendered outputGolden file test.
Real external commandIntegration 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

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

branch-pr

免费

Prepare pull requests by checking approved issue links, change-type labels, and required automated checks. Draft the repository’s PR template using observed test results, while leaving commits, pushes, PR creation, and merging under human control.

中文简介正在准备中。当前显示英语简介。

  • Preparing a branch for review
  • Drafting a PR linked to an approved issue
  • Checking required CI before declaring a PR merge-ready
Gentleman-Programming/gentle-ai78642026年10月18日 更新

Split changes exceeding 400 lines into linked pull requests with clear boundaries and dependencies. Choose a chain structure, keep tests and documentation with each work unit, and document review order, verification plans, and justified size exceptions.

中文简介正在准备中。当前显示英语简介。

  • Splitting a change that exceeds 400 lines
  • Planning PRs that can merge independently
  • Coordinating a feature through a draft tracker PR
Gentleman-Programming/gentle-ai78642026年10月18日 更新

Structure guides, READMEs, design documents, and pull request descriptions so readers can find answers quickly. Put outcomes first, introduce details gradually, and use examples, tables, and checklists to support understanding and review.

中文简介正在准备中。当前显示英语简介。

  • Reorganizing a long or dense README
  • Writing an onboarding guide for new contributors
  • Making a pull request's review steps clear
Gentleman-Programming/gentle-ai78642026年10月18日 更新

Draft clear, considerate comments for code reviews, issue replies, and team updates. Put the actionable point first, explain technical reasons when needed, and give a concrete next step while matching the conversation’s language.

中文简介正在准备中。当前显示英语简介。

  • Requesting a code change with a clear reason
  • Replying to a contributor’s issue
  • Writing a brief asynchronous team update
Gentleman-Programming/gentle-ai78642026年10月18日 更新

Create and verify gentle-ai journeys, which are scripted sequences of product actions. Check their declarations separately from actual execution, review outdated expectations after behavior changes, and record execution results for pull requests.

中文简介正在准备中。当前显示英语简介。

  • Adding a product operation journey
  • Updating expectations after behavior changes
  • Reproducing a bench failure from CI
Gentleman-Programming/gentle-ai78642026年10月18日 更新

Prepare Gentle AI changes for review by linking approved issues, following branch and commit naming rules, and drafting pull requests with observed test results. Check change size and required automated checks before claiming readiness.

中文简介正在准备中。当前显示英语简介。

  • Preparing a branch for a fix or feature
  • Drafting a pull request linked to an approved issue
  • Organizing test results and reviewer notes
Gentleman-Programming/gentle-ai78642026年10月18日 更新

查看 Gentleman-Programming 的全部技能

报告此技能的问题