api-endpoint-pattern
БесплатноБез исполняемых скриптовНе проверенStandards for creating and organizing HTTP API endpoints using the Echo framework
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
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.
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
- If introducing a new domain, create
internal/router/[domain]/router.go. - Implement a
Bind(e *echo.Group, db *sql.DB) *echo.Groupfunction. - Register the sub-router in
internal/router/router.go:domainrouter.Bind(api.Group("/domain"), config.DB.Conn) - 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.DBintoBind, then into handlers. Avoid globals. - Response Handling:
- Success:
c.JSON(200, data)orc.String(200, "OK") - Error:
c.String(code, err.Error())— log significant errors with zerolog.
- Success:
- 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.
Установить api-endpoint-pattern в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл api-endpoint-pattern?
Standards for creating and organizing HTTP API endpoints using the Echo framework
Как установить скилл api-endpoint-pattern?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-endpoint-pattern запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic