backend-dev-guidelines

Establish Go/Chi/PostgreSQL backend practices with Clean Architecture.

1|Updated Nov 7, 2017
One-click install
npx skills add https://github.com/jhouser/actionphase --skill backend-dev-guidelines-jhouser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-dev-guidelines
Source: https://github.com/jhouser/actionphase/tree/main/.claude/skills/backend-dev-guidelines
Command: npx skills add https://github.com/jhouser/actionphase --skill backend-dev-guidelines-jhouser

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/go-chi/chi/v5, github.com/jackc/pgx/v5, github.com/rs/zerolog, github.com/golang-jwt/jwt/v5, github.com/stretchr/testify.

What problem does it solve?

Backend development can suffer from inconsistent patterns, tight coupling, and poor error handling. This skill provides a comprehensive guide to building maintainable, scalable, and testable Go backends using Clean Architecture, ensuring high code quality and reducing debugging time.

Core Features & Use Cases

  • Clean Architecture: Enforces layered design (handlers → services → database) and interface-first development for modularity.
  • Type-Safe Database Access: Utilizes sqlc for generated, type-safe SQL queries, eliminating common database errors.
  • Observability & Error Handling: Mandates structured logging with correlation IDs and typed errors for easier debugging and monitoring.
  • Use Case: When implementing a new API endpoint, use this skill to define the service interface, write type-safe SQL queries with sqlc, implement business logic in the service layer, and ensure proper error handling and logging, guaranteeing a robust and consistent API.

Quick Start

Ask for a checklist to create a new backend feature following ActionPhase guidelines.

Frequently Asked Questions about backend-dev-guidelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Go backend with Clean Architecture?

Clean Architecture separates your Go backend into layers: handlers receive HTTP requests, services contain business logic, and the database layer executes type-safe queries. This layering reduces coupling, improves testability, and makes your codebase maintainable as it grows.

What's the best way to handle database queries safely in Go?

Use sqlc to generate type-safe SQL queries from your schema. sqlc eliminates runtime query errors by catching mistakes at compile time, ensuring your Go code and PostgreSQL queries stay synchronized without manual mapping.

How do I implement JWT authentication in a Go API?

Define authentication middleware using jwt/v5 to validate tokens on protected routes, then pass the authenticated user context to your handlers and services. Combine this with structured logging and correlation IDs to track authenticated requests end-to-end.

Why use interfaces in Go backend development?

Interfaces enable interface-first design, letting you define service contracts before implementation and swap implementations for testing. Go's compile-time interface verification catches missing methods early, making your layered architecture robust and testable.

How do I add structured logging and error handling to a Go backend?

Use zerolog for structured logging with correlation IDs attached to requests, and define typed errors for different failure modes. Structured logs and typed errors make debugging faster and enable better observability across your API.

Can I use Clean Architecture with Chi routing in Go?

Yes. Chi integrates seamlessly into the handler layer of Clean Architecture. Chi routes map HTTP requests to handlers, which delegate to services for business logic, keeping routing concerns separate from domain logic.