backend-verification
Automatically runs required Go checks after any backend code changes. Ensures go vet, gofmt, and go test pass before commits. Use whenever modifying files in the backend/ directory.
When & Why to Use This Skill
This Claude skill automates the essential verification workflow for Go-based backend development. It streamlines the development process by executing a sequence of critical checks—including code formatting (gofmt), static analysis (go vet), and unit testing (go test)—ensuring that every code change meets high-quality standards and remains bug-free before being committed to the repository.
Use Cases
- Pre-commit Validation: Automatically verify backend logic after code changes to ensure no regressions are introduced before pushing to version control.
- Automated Code Formatting: Maintain a consistent codebase by applying standard Go formatting rules automatically, reducing manual effort and style-related PR comments.
- Static Analysis & Bug Prevention: Use static analysis to catch common Go programming errors, such as unreachable code or malformed printf statements, early in the development cycle.
- Local CI Simulation: Run the same checks locally that are required by the CI/CD pipeline to catch failures early and speed up the pull request review process.
| name | backend-verification |
|---|---|
| description | Automatically runs required Go checks after any backend code changes. Ensures go vet, gofmt, and go test pass before commits. Use whenever modifying files in the backend/ directory. |
Backend Verification
This skill ensures all Go code changes pass required CI checks before committing.
Required Commands
After ANY changes to Go files in backend/, run these commands in order:
1. Format Code
cd /home/user/ishkul/backend && gofmt -w .
Automatically formats all Go files to standard style.
2. Run Static Analysis
cd /home/user/ishkul/backend && go vet ./...
Catches common errors like:
- Printf format string issues
- Unreachable code
- Suspicious constructs
3. Run Tests
cd /home/user/ishkul/backend && go test ./...
Ensures all unit tests pass.
Quick One-Liner
Run all checks at once:
cd /home/user/ishkul/backend && gofmt -w . && go vet ./... && go test ./...
When to Use
- After creating new handlers in
internal/handlers/ - After modifying existing Go code
- Before committing any backend changes
- After adding new packages or dependencies
CI Integration
These checks run automatically in the CI pipeline. Running them locally first:
- Catches issues early
- Speeds up the PR review process
- Prevents failed deployments
Common Issues
go vet Failures
- Check for unused variables
- Verify printf format strings match arguments
- Look for unreachable code after return statements
Test Failures
- Check test file naming:
*_test.go - Verify test function naming:
Test* - Run specific test:
go test -run TestFunctionName ./...