Agent skill
Testing
Standards for unit testing, table-driven tests, and mocking in Golang.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/testing-hoangnguyen0403-agent-skills-standar-7
Metadata
Additional technical details for this skill
- labels
-
golang testing tdd mocking unit-tests
- triggers
-
{ "files": [ "**/*_test.go" ], "keywords": [ "testing", "unit tests", "go test", "mocking", "testify" ] }
SKILL.md
Golang Testing Standards
Priority: P0 (CRITICAL)
Principles
Guidelines
TDD Workflow
- Red: Write a failing table-driven test case.
- Green: Implement logic to pass.
- Refactor: Simplify code.
Golden Snippet
See Table-Driven Tests for full template.
Tools
- Stdlib:
testingpackage is usually enough. - Testify (
stretchr/testify): Assertions (assert,require) and Mocks. - Mockery: Auto-generate mocks for interfaces.
- GoMock: Another popular mocking framework.
Naming
- Test file:
*_test.go - Test function:
func TestName(t *testing.T) - Example function:
func ExampleName()
Anti-Patterns
- Sleeping in tests: Use channels/waitgroups or retry logic.
- Testing implementation details: Test public behavior/interface.
References
- Table-Driven Tests
- Mocking Strategies
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?