重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/sammcj/agentic-coding --skill writing-go-tests本技能提供可操作的测试指南。如需详细的实现模式、代码示例、原理说明以及生产系统参考,请查阅 go-testing-best-practices.md。
始终应用以下当前最佳实践:
*_test.go 命名规则,将测试文件与源代码放在一起package foo_test)handler_auth_test.go、handler_validation_test.go)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
testing/synctestt.Parallel()google/go-cmp 中的 cmp.Diff()go test -cover 和 go tool cover -html 进行分析testdata 目录存放测试固件(Go 工具链自动忽略)t.Helper() 标记辅助函数,以获得准确的错误报告t.Cleanup() 进行资源清理(优于测试中的 defer)B.Loop() 方法作为首选模式(防止编译器优化)benchstat 进行统计分析-benchmem 进行内存分析Test*、Benchmark*、Fuzz*、Example*(前缀后首字母大写)got 和 want 表示实际值与期望值当你需要时,请加载 go-testing-best-practices.md:
详细指南包含完整的上下文、带解释的示例以及经过生产验证的模式。本 SKILL.md 提供需要应用的可操作规则。
专注于验证行为而非实现的有意义测试。 务实的卓越胜过理论上的完美。
每周安装次数
47
代码仓库
GitHub 星标数
112
首次出现
2026年1月30日
安全审计
安装于
opencode44
gemini-cli44
codex44
cursor43
github-copilot42
amp42
This skill provides actionable testing guidelines. For detailed implementation patterns, code examples, rationale, and production system references, consult go-testing-best-practices.md.
Always apply these current best practices:
*_test.go namingpackage foo_test) for integration testing and exampleshandler_auth_test.go, handler_validation_test.go)testing/synctest for deterministic concurrent testing (Go 1.24+)t.Parallel() first in test functionscmp.Diff() from google/go-cmp for complex comparisonsgo test -cover and go tool cover -html for analysistestdata directory for test fixtures (automatically ignored by Go toolchain)t.Helper() for accurate error reportingt.Cleanup() for resource cleanup (superior to defer in tests)B.Loop() method as the preferred pattern (prevents compiler optimisations)benchstat for statistical analysis-benchmem for memory profilingTest*, Benchmark*, Fuzz*, Example* (capital letter after prefix)got and want for actual vs expected valuesLoadgo-testing-best-practices.md when you need:
The detailed guide contains full context, examples with explanations, and production-proven patterns. This SKILL.md provides the actionable rules to apply.
Focus on meaningful tests that validate behaviour rather than implementation. Pragmatic excellence over theoretical perfection.
Weekly Installs
47
Repository
GitHub Stars
112
First Seen
Jan 30, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode44
gemini-cli44
codex44
cursor43
github-copilot42
amp42
测试策略完整指南:单元/集成/E2E测试金字塔与自动化实践
11,200 周安装