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 backend development. It streamlines code quality control by integrating gofmt for styling, go vet for static analysis, and go test for functional validation. By running these checks locally before commits, it helps developers catch errors early, maintain consistent coding standards, and ensure a higher success rate for CI/CD pipelines.
Use Cases
- Pre-commit Validation: Automatically verify backend Go code changes to ensure that only formatted, error-free, and tested code is committed to the repository.
- Automated Code Formatting: Use the skill to instantly apply standard Go styling across the backend directory, eliminating manual formatting effort and PR style comments.
- Static Analysis & Bug Detection: Identify common programming mistakes such as unreachable code or suspicious constructs using go vet before they cause runtime issues.
- Regression Testing: Execute the full suite of unit tests after modifying internal handlers or packages to guarantee that new changes haven't broken existing functionality.
- CI/CD Optimization: Reduce build failures and feedback loops in the main CI pipeline by catching and resolving environment-specific or logic issues locally.
| 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 ./...