api-endpoint-pattern

Standards for creating and organizing HTTP API endpoints using the Echo framework

16 stars

Best use case

api-endpoint-pattern is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Standards for creating and organizing HTTP API endpoints using the Echo framework

Teams using api-endpoint-pattern should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/api-endpoint-pattern/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/backend/api-endpoint-pattern/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/api-endpoint-pattern/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How api-endpoint-pattern Compares

Feature / Agentapi-endpoint-patternStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Standards for creating and organizing HTTP API endpoints using the Echo framework

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# API Endpoint Pattern Skill

Use this skill when adding or modifying HTTP endpoints in the API.

---

## Scope

- Creating new API endpoints
- Adding new domain routers
- Modifying handler logic

---

## Router Structure

### Main Router (`internal/router/router.go`)
Initializes Echo, sets up middleware, and groups routes by domain.

### Sub-Routers (`internal/router/[domain]/router.go`)
Each domain has its own sub-router with a `Bind` function that receives an `*echo.Group` and dependencies.

```go
func Bind(e *echo.Group, db *sql.DB) *echo.Group {
    e.GET("/list", func(c echo.Context) error {
        // handler logic
    })
    return e
}
```

---

## Adding a New Endpoint

1. If introducing a new domain, create `internal/router/[domain]/router.go`.
2. Implement a `Bind(e *echo.Group, db *sql.DB) *echo.Group` function.
3. Register the sub-router in `internal/router/router.go`:
   ```go
   domainrouter.Bind(api.Group("/domain"), config.DB.Conn)
   ```
4. Implement data access logic in `internal/models/` if needed.

---

## Handler Guidelines

- **Parameter Parsing**: Use helper functions for complex query params (e.g., trader levels).
- **Dependency Injection**: Pass `*sql.DB` into `Bind`, then into handlers. Avoid globals.
- **Response Handling**:
  - Success: `c.JSON(200, data)` or `c.String(200, "OK")`
  - Error: `c.String(code, err.Error())` — log significant errors with zerolog.
- **Business Logic**: Keep handlers thin. Move complex logic to `internal/models/` or other internal packages.

---

## Conventions

- Use `e.Group()` for logical route separation.
- Use plural names for collections (`/items`, `/weapons`).
- Use query parameters for filtering and optional configuration.
- Prefer HTTP status constants for consistency, but be consistent either way.

Related Skills

llm-app-patterns

16
from diegosouzapw/awesome-omni-skill

Production-ready patterns for building LLM applications. Covers RAG pipelines, agent architectures, prompt IDEs, and LLMOps monitoring. Use when designing AI applications, implementing RAG, building agents, or setting up LLM observability.

dbt-transformation-patterns

16
from diegosouzapw/awesome-omni-skill

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or ...

data-fetching-patterns

16
from diegosouzapw/awesome-omni-skill

Explains data fetching strategies including fetch on render, fetch then render, render as you fetch, and server-side data fetching. Use when implementing data loading, optimizing loading performance, or choosing between client and server data fetching.

Assembler Agent Pattern

16
from diegosouzapw/awesome-omni-skill

Execute work orders and implement code using coding agents and development tools

airflow-dag-patterns

16
from diegosouzapw/awesome-omni-skill

Build production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.

ai-product-patterns

16
from diegosouzapw/awesome-omni-skill

Builds AI-native products using OpenAI's development philosophy and modern AI UX patterns. Use when integrating AI features, designing for model improvements, implementing evals as product specs, or creating AI-first experiences. Based on Kevin Weil (OpenAI CPO) on building for future models, hybrid approaches, and cost optimization.

a2a-executor-patterns

16
from diegosouzapw/awesome-omni-skill

Agent-to-Agent (A2A) executor implementation patterns for task handling, execution management, and agent coordination. Use when building A2A executors, implementing task handlers, creating agent execution flows, or when user mentions A2A protocol, task execution, agent executors, task handlers, or agent coordination.

GitOps Patterns

16
from diegosouzapw/awesome-omni-skill

ArgoCD ApplicationSets, progressive delivery, Harness GitX, and multi-cluster GitOps patterns

dotnet-gha-patterns

16
from diegosouzapw/awesome-omni-skill

Composes GitHub Actions workflows. Reusable workflows, composite actions, matrix, caching.

bats-testing-patterns

16
from diegosouzapw/awesome-omni-skill

Comprehensive guide for writing shell script tests using Bats (Bash Automated Testing System). Use when writing or improving tests for Bash/shell scripts, creating test fixtures, mocking commands, or setting up CI/CD for shell script testing. Includes patterns for assertions, setup/teardown, mocking, fixtures, and integration with GitHub Actions.

bash-defensive-patterns

16
from diegosouzapw/awesome-omni-skill

Master defensive Bash programming techniques for production-grade scripts. Use when writing robust shell scripts, CI/CD pipelines, or system utilities requiring fault tolerance and safety.

apollo-client-patterns

16
from diegosouzapw/awesome-omni-skill

Use when implementing Apollo Client patterns for queries, mutations, cache management, and local state in React applications.