go-review-pr
Automated diff-aware Go code review to ensure quality gates are met before PR submission.
Install
mkdir -p .claude/skills/go-review-pr && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17013" && unzip -o skill.zip -d .claude/skills/go-review-pr && rm skill.zipInstalls to .claude/skills/go-review-pr
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Review all changes in the current branch against GOB project conventions before opening a PR. Diff-aware: only analyzes what changed, not the entire codebase. Triggers: \"review pr\", \"revisar pr\", \"pre-pr check\", \"review branch\", \"revisar branch\", \"checar antes do pr\", \"quality gate\".Key capabilities
- →Analyze Go source files for convention adherence
- →Verify JSON tags are in snake_case
- →Check SQL queries for schema prefix usage
- →Validate Go compilation and test execution
- →Review migration files for naming and rollback safety
- →Examine frontend files for API client usage and type safety
How it works
The skill gathers the diff between the current and base branch, categorizes changed files, and then performs per-service analysis including compilation, tests, and linting. It also conducts convention checks on changed Go files, migration files, and frontend files.
Inputs & outputs
When to use go-review-pr
- →Validating Go code changes
- →Automated pre-PR checks
- →Running Go tests on diffs
About this skill
CSTK Adaptation
Adapted from JotJunior/cstk skill go-review-pr at commit 35922cf.
Use this as a Codex skill; follow local repository instructions and Codex tool names when source text mentions Claude-specific commands or slash commands.
Go Review PR
Perform a diff-aware quality review of ALL changes in the current branch before opening a PR. This is the final quality gate — it checks everything that go-review-service checks, but scoped to the diff only.
Arguments
the user's request should specify:
- Base branch (optional, default:
main) — the branch to compare against
Step 1: Gather the Diff
# Get the base branch (default: main)
BASE=${1:-main}
# All changed files in this branch vs base
git diff --name-only $BASE...HEAD
# Full diff for context
git diff $BASE...HEAD
# Commits in this branch
git log --oneline $BASE..HEAD
Categorize changed files:
- Go source files (*.go, excluding *_test.go)
- Go test files (*_test.go)
- Migration files (migrations/*.sql)
- Frontend files (*.ts, *.tsx)
- Config files (*.json, *.yaml, *.toml, go.mod, go.sum)
- Documentation (*.md)
Step 2: Per-Service Analysis
For each service with changed files, read the changed files and run these checks:
Check A: Compilation
cd services/{service} && go build ./...
Check B: Tests Pass
cd services/{service} && go test ./... -count=1 -timeout 60s
Check C: Lint
cd services/{service} && golangci-lint run ./... 2>&1 || true
Step 3: Convention Checks (on diff only)
For each changed Go file, verify:
3.1 Code in English
- All new variable names, function names, comments, error messages are in English
- FAIL if Portuguese found in code (excluding string literals for user-facing messages)
3.2 JSON Tags snake_case
- All new struct fields with
json:""tags use snake_case - FAIL if camelCase or PascalCase found in json tags
3.3 DB Tags Match Columns
- All new struct fields with
db:""tags use snake_case matching column names - Cross-reference with migration files if available
3.4 Schema Prefix in SQL
- All SQL queries in repository files use
{schema}.{table}format - FAIL if any bare table name found (e.g.,
FROM membersinstead ofFROM member.members)
3.5 Route Registration Order
- In handler files: static routes BEFORE parameterized
/:idroutes - Sub-groups BEFORE
/:idcatch-all - FAIL if order is wrong (Fiber trie conflict)
3.6 Error Patterns
- Service layer: sentinel errors (
var ErrXxxNotFound), no HTTP codes - Handler layer:
errors.Is()dispatch,dto.ErrorResponsereturns - Repository layer:
sql.ErrNoRows→nil, nil
3.7 Import Hierarchy
Verify no import cycles:
domain → (nothing)
dto → domain (if needed)
repository → domain
service → repository + domain
handler → service + dto + domain
factory → repository + postgres
FAIL if handler imports repository directly, or service imports handler, etc.
3.8 Context First Parameter
- All repository and service methods have
context.Contextas first parameter - FAIL if any public method is missing context
3.9 Middleware Order (if main.go changed)
Verify order: recover → requestid → nrfiber → logging → cors → [dryrun] → audit → endpoints
3.10 Test Coverage
- Every new .go file (excluding main.go, migrations, mocks) should have a corresponding _test.go
- New service methods should have test cases for: happy path, not found, validation error, repo error
Step 4: Migration Checks (if migrations changed)
4.1 Naming Convention
- Format:
{NNN}_{descriptive_name}.up.sql/{NNN}_{descriptive_name}.down.sql - Number is sequential (no gaps, no duplicates)
- Up and down files exist as pairs
4.2 Schema Prefix
- CREATE TABLE uses
{schema}.{table_name} - All references use schema prefix
4.3 Rollback Safety
- Down migration has
DROP TABLE IF EXISTS ... CASCADEor appropriate reversal - Down migration reverses ALL changes in up migration
4.4 CIM Format
- Any CIM values in seed data use 7-digit zero-padded format (e.g.,
'0051522') - Uses
LPADif converting from integer sources
4.5 Idempotency
- Uses
IF NOT EXISTSfor CREATE TABLE/INDEX - Uses
DO $$ ... IF NOT EXISTSfor enum types
Step 5: Frontend Checks (if frontend files changed)
5.1 API Client Usage
- Uses
apiClient(not raw fetch/axios/ky) - snake_case in request bodies (backend expects it)
- FormData uploads use
{ body: data }(not{ json: data }) transformResponsecamelCase conversion accounted for in types
5.2 Portuguese Accents
- UI text uses proper Portuguese accents (é, ã, ç, ô, í)
- Lodge display format: "No {number} - {name}" (not just name)
5.3 Type Safety
- No
anytypes where a proper type could be used - Response types match backend DTOs
- Query key factories pattern used (
fooKeys.all/lists/detail)
5.4 Shared Components
- Uses
PageHeaderfor page titles (not custom headers) - Uses
ServerPaginationfor tables (not custom pagination) - Uses
useConfirmDialogfor destructive actions (not inline confirm) - CRUD forms on dedicated pages, NOT modals
5.5 Navigation
- Parent nav items use
end: trueto prevent highlight on child routes - New routes registered in
src/config/navigation.ts
Step 6: Cross-Cutting Checks
6.1 go.mod Consistency
- No replace directives (unless justified —
go-commonsreplace is expected) go mod tidywas run (no extra/missing deps)
6.2 Submodule State
- If changes span multiple services, submodule pointers are updated
6.3 AGENTS.md Updates
- If new routes/endpoints added, check if routing table in AGENTS.md needs update
- If new service added, check if service table needs update
6.4 Storage API (if S3/storage used)
- Uses
storage.Storageinterface (not direct S3 calls) - Key pattern:
{service}/{category}/{entityID}/{uuid}-{filename}.ext - Upload uses
Upload(ctx, key, reader, size, contentType)— NOTPut - Presigned URL uses
PresignedGetURL(ctx, key, expiry)— NOTGetPresignedURL
6.5 RabbitMQ Events (if publisher/consumer changed)
- Publisher uses
AMQPPublisher+NoopPublisher(graceful degradation) - Consumer uses
ExchangeDeclarePassivefor foreign exchanges (notExchangeDeclare) - Channel reopened after passive declare failure
- Return
nilfor unrecognized event routing keys (not error)
6.6 Inter-Service Clients (if client/ changed)
- Authenticated with
X-Internal-Keyheader - Key from ETCD
INTERNAL_API_KEYorSHARED_INTERNAL_API_KEY - Graceful degradation: service continues if external service unavailable
Output Format
# PR Review: {branch-name}
Date: {date}
Base: {base-branch}
Changes: {N} files across {M} services
## Build & Test
| Service | Build | Tests | Lint |
|---------|-------|-------|------|
| gob-xxx-service | PASS | PASS (12/12) | PASS |
| gob-yyy-service | FAIL | - | - |
## Convention Checks
| # | Check | Status | Details |
|---|-------|--------|---------|
| A | Code in English | PASS | |
| B | JSON tags snake_case | FAIL | dto/member.go:45 — `firstName` should be `first_name` |
| C | Schema prefix | PASS | |
| ... | ... | ... | ... |
## Migration Checks
| # | Check | Status | Details |
|---|-------|--------|---------|
| 1 | Naming | PASS | |
| 2 | Rollback | WARNING | 015_add_column.down.sql missing |
| ... | ... | ... | ... |
## Summary
- **PASS**: X checks
- **FAIL**: Y checks (must fix before merge)
- **WARNING**: Z checks (review recommended)
## Required Actions
1. [List of things that MUST be fixed]
## Recommendations
1. [List of things that SHOULD be fixed]
Important Notes
- This skill is read-only — it does NOT modify any files
- Always provide
file:linereferences for FAIL and WARNING results - If the branch has no Go changes, skip Go-specific checks
- If the branch has no migration changes, skip migration checks
- Run Build & Test checks first — if build fails, skip convention checks for that service
- Be thorough but avoid false positives — when uncertain, use WARNING not FAIL
Source License
This skill includes material adapted from JotJunior/cstk, licensed under MIT. The copyright and permission notice are included in references/cstk-license.md.
When not to use it
- →When the branch has no Go changes
- →When the branch has no migration changes
- →When the branch has no frontend changes
Limitations
- →If build fails, convention checks for that service are skipped
- →Uncertain checks result in a WARNING instead of a FAIL
How it compares
This skill automates the review of specific changes in a Go project by running checks only on the diff, rather than requiring a manual review of the entire codebase.
Compared to similar skills
go-review-pr side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| go-review-pr (this skill) | 0 | 2mo | Review | Intermediate |
| go-dev-guidelines | 14 | 9mo | No flags | Intermediate |
| code-formatting | 1 | 2mo | No flags | Beginner |
| tidb-test-guidelines | 2 | 1mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
go-dev-guidelines
jumppad-labs
This skill should be used when writing, refactoring, or testing Go code. It provides idiomatic Go development patterns, TDD-based workflows, project structure conventions, and testing best practices using testify/require and mockery. Activate this skill when creating new Go features, services, packages, tests, or when setting up new Go projects.
code-formatting
openshift
MANDATORY: When writing Go tests, you MUST use 'When...it should...' format for ALL test names. When writing any Go code, you MUST remind user to run 'make lint-fix' and 'make verify'. These are non-negotiable HyperShift requirements.
tidb-test-guidelines
pingcap
Decide where to place TiDB tests and how to write them (basic structure, naming, testdata usage). Use when asked about test locations, writing conventions, shard_count limits, casetest categorization, or when reviewing test changes in code review.
lsp-hover-testing
MadAppGang
Automated LSP hover validation for Dingo transpiler. Use when testing hover functionality, validating position mappings, checking for hover drift, or debugging LSP issues after sourcemap changes.
go-rig
mudrii
Use this skill when building, reviewing, or refactoring Go code in this repository. It adds process discipline for TDD/ATDD, package boundaries, dependency injection, and review quality, and complements the always-on rules in AGENTS.md.
code-coverage
viknesh20-20
Analyzes test coverage, identifies untested code paths, and generates tests for the most critical uncovered areas. Use to improve test coverage before releases.