go-unit-tests
Go Unit Tests
Generate comprehensive Go unit tests following testify patterns and the Arrange-Act-Assert methodology.
When to Use
- Write test suites for structs with dependencies
- Test standalone functions and value objects
- Create mock-based unit tests
- Add unit test coverage to existing code
Before Writing Tests
Identify the following before writing any code:
- Pattern — Use a test suite (Pattern 1) for structs with dependencies; use standalone functions (Pattern 2) for simple functions or value objects
- Dependencies — Which dependencies need mocks; which can use real instances
- Test cases — Happy path, error conditions, and edge cases
More from cristiano-pacheco/ai-rules
go-integration-tests
Generate Go integration tests with real database/infrastructure via itestkit containers. Use when testing use cases against real databases, verifying end-to-end flows, or adding integration test coverage.
15go-create-usecase
Generate Go use cases for modular architecture using ports-based dependencies and decorator-based observability. Use when implementing business actions in internal/modules/<module>/usecase/ such as create, update, list, delete, status transitions, uploads, notifications, or any domain operation that orchestrates repositories/services.
11go-cache
Generate Redis-backed Go cache. Invoke whenever user mentions cache or Redis.
11go-chi-handler
Generate Chi HTTP handlers, use case orchestration, Use for REST endpoint handlers or web http handlers.
10creating-cursor-rules-skill
Expert guidance for creating effective Cursor IDE rules with best practices, patterns, and examples
9go-chi-router
Generate Chi router files with route registration and Fx wiring. Use for CRUD routes, custom endpoints, versioned APIs, route groups, or any HTTP route setup.
9