http-api-patterns

Standardizes HTTP API development for the Chronicle backend using go-chi.

6|5|Updated Nov 11, 2025
One-click install
npx skills add https://github.com/Emyrk/chronicle --skill http-api-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: http-api-patterns
Source: https://github.com/Emyrk/chronicle/tree/main/agent-skills/http-api-patterns
Command: npx skills add https://github.com/Emyrk/chronicle --skill http-api-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a standardized approach to building and maintaining the HTTP API for Chronicle, ensuring consistency, security, and efficient development.

Core Features & Use Cases

  • API Endpoint Development: Guides the creation of new API endpoints using go-chi.
  • Request/Response Handling: Demonstrates best practices for reading requests and writing JSON responses with helper functions.
  • Authentication & Authorization: Details how to implement JWT authentication and permission checks.
  • SDK Generation: Explains the process of generating TypeScript types from Go SDK definitions.
  • Database Integration: Shows patterns for converting database models to API SDK types.

Quick Start

Use the http-api-patterns skill to add a new authenticated POST endpoint for managing user profiles.

Frequently Asked Questions about http-api-patterns

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

FAQPage Schema
How do I add a new authenticated API endpoint using go-chi?

To add an authenticated API endpoint with go-chi, define the route using the chi router and apply JWT authentication via the chronauth package to secure the handler. Use httpapi helpers to read request payloads and write JSON responses.

How does TypeScript SDK generation work for Go API definitions?

TypeScript SDK generation works by defining specific SDK types in your Go code, which are then automatically converted into TypeScript definitions. This ensures the frontend types match the backend API definitions.

What is the best way to convert database models to API SDK types in Go?

The best way to convert database models to API SDK types in Go is to follow standardized conversion patterns that map internal database structures to the API SDK definitions, ensuring type safety and data consistency for SDK generation.

Can I use httpapi helpers for request and response handling with go-chi?

Yes, you can use httpapi helpers for request and response handling with go-chi. These helpers provide standardized functions for reading request payloads and writing JSON responses, ensuring consistency across all API endpoints.

Do I need JWT authentication for all Chronicle API endpoints?

You do not always need JWT authentication for all Chronicle API endpoints. The chronauth package allows you to implement JWT authentication selectively, applying it to routes that require permission checks while leaving public endpoints unsecured.