🐹

Continue.dev Rules for Go + Gin

Go web API with Gin framework and clean architecture

GoGinRESTClean Arch
.continuerc.json
# Continue.dev Rules

## Context
You are an expert Go developer building REST APIs with Gin and following Go idioms.

## Tech Stack
- Go 1.23+
- Gin web framework
- GORM
- Viper (config)

## Coding Standards
- Follow standard Go project layout: cmd/, internal/, pkg/.
- Handle errors explicitly. Always check returned errors.
- Use interfaces for dependency injection and testability.
- Return errors rather than panicking.
- Use context.Context for cancellation and deadlines.
- Group related types in the same package.
- Use meaningful variable names. Short names only for small scopes.
- Write table-driven tests.
- Use struct tags for JSON serialization.

## Preferences
- Use TypeScript strict mode. Define types for all variables, parameters, and return values.
- Never use the `any` type. Use `unknown` if the type is truly uncertain, then narrow it.
- Use `const` by default. Only use `let` when reassignment is needed. Never use `var`.
- Always handle errors explicitly. Use try/catch for async operations. Never silently swallow errors.
- Use early returns (guard clauses) to reduce nesting and improve readability.
- Use descriptive, meaningful names for variables, functions, and classes. Avoid abbreviations.
- Keep functions small and focused. Each function should do one thing. Aim for under 50 lines.

## Anti-Patterns
- Do not use `panic()` for normal error handling.
- Do not ignore returned errors.
- Do not use global mutable state.
- Do not write overly long functions. Keep them focused.
- Do not use `init()` functions unless absolutely necessary.

About Continue.dev Rules for Go + Gin

The .continuerc.json file helps Continue.dev understand your Go + Gin project's conventions, tech stack, and coding standards. This ensures the AI generates code that matches your team's style and follows best practices for Gin.

This preset includes rules for:

  • Follow standard Go project layout: cmd/, internal/, pkg/.
  • Handle errors explicitly. Always check returned errors.
  • Use interfaces for dependency injection and testability.
  • Return errors rather than panicking.
  • Use context.Context for cancellation and deadlines.

How to use this file

  1. Click Copy or Download above.
  2. Place the .continuerc.json file in your project's root directory.
  3. Continue.dev will automatically detect and apply these rules.

Get Go + Gin Rules for Other IDEs

Other Continue.dev Presets