go-code-review_skill

This skill reviews Encore Go code for best practices, highlighting infrastructure placement, context usage, error handling, and security improvements to guide

15

GitHub Stars

1

Bundled Files

6 months ago

Catalog Refreshed

8 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill encoredev/skills --skill go-code-review

  • SKILL.md5.4 KB

Overview

This skill reviews Encore Go code for common security, correctness, and style issues. It highlights critical problems (like infra-in-functions, missing context, SQL injection, and ignored errors) and flags warnings (like non-idempotent subscribers or public internal endpoints). The output is a concise checklist and line-specific findings following a clear severity format.

How this skill works

The reviewer inspects Go packages for Encore-specific patterns: package-level infrastructure declarations, API handler signatures, SQL usage, error handling, pubsub handlers, and row lifecycle. It reports problems as [CRITICAL], [WARNING], or [GOOD] with file:line hints and concise remediation guidance. A checklist is produced to ensure consistent, repeatable reviews.

When to use it

  • Before code is merged to main or released
  • During pull request reviews for Encore Go services
  • When adding new APIs, pubsub handlers, or database code
  • As part of periodic security and correctness audits
  • When onboarding engineers to Encore best practices

Best practices

  • Declare infrastructure (DB, topics, subscriptions) at package level, not inside functions
  • Always include context.Context as the first parameter for API and handler functions
  • Use parameterized SQL queries ($1, $2, ...) to prevent injection
  • Return pointers for resource structs in encore:api handlers and handle all errors explicitly
  • Make pubsub handlers idempotent because delivery can be at-least-once
  • Always defer rows.Close() and check rows.Err(); check sqldb.ErrNoRows for not-found cases

Example use cases

  • Run the skill on pull requests that add or modify DB queries to catch SQL injection and missing defer rows.Close()
  • Scan new API handlers to ensure ctx is first parameter and return types are pointers
  • Audit subscription handlers to confirm idempotency and avoid duplicate side effects like double-charging
  • Validate package layout to ensure infrastructure is declared at package scope, including migrations path checks
  • Pre-release checklist to confirm internal endpoints are private and ErrNoRows is handled

FAQ

Findings are reported as lines prefixed with [CRITICAL], [WARNING], or [GOOD], and include file:line and a short remediation note.

How do I fix an ErrNoRows case?

Check errors.Is(err, sqldb.ErrNoRows) and return a NotFound semantic error (eg. errs.Error with Code errs.NotFound) instead of returning a generic error or nil.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational