1---2name: 3219378872-zero-powers-rest-api3description: go-zero REST API4---56# go-zero REST API78## Core Principles910### Always Follow11- **Three-layer separation**: Handler (routing/validation) → Logic (business) → Model (data), never mix12- **Context propagation**: Pass `ctx context.Context` through all layers for tracing and cancellation13- **Type safety**: Define request/response types in `.api` files, generate with goctl14- **Structured errors**: Use `httpx.Error(w, err)` for HTTP error responses15- **Middleware layering**: Auth → Validation → Business logic1617### Never Do18- Put business logic in handlers19- Hard-code configuration values (use `conf.MustLoad` + ServiceContext)20- Mix layers (handler doing database calls)21- Discard errors with `_`2223## Common Workflows2425### New REST API Service261. Define API spec in `.api` file272. Generate: `goctl api go -api xxx.api -dir .`283. Implement logic in `internal/logic/`294. Details: [rest-api-patterns.md](../../references/rest-api-patterns.md)3031### Add New Endpoint321. Add handler, request, response types to `.api`332. Regenerate handler/types with goctl343. Implement logic in `internal/logic/`354. Run checklist: [new-handler-checklist.md](../../checklists/new-handler-checklist.md)3637### Add Middleware381. Implement middleware in `internal/middleware/`392. Register in service context403. Run checklist: [new-middleware-checklist.md](../../checklists/new-middleware-checklist.md)4142## References43- [REST API Patterns](../../references/rest-api-patterns.md) — HTTP endpoints, CRUD, middleware, error handling44- [New API Definition Checklist](../../checklists/new-api-definition-checklist.md)45- [New Handler Checklist](../../checklists/new-handler-checklist.md)46- [New Middleware Checklist](../../checklists/new-middleware-checklist.md)4748---49> Source: [3219378872/zero-powers](https://github.com/3219378872/zero-powers) — distributed by [TomeVault](https://tomevault.io).50<!-- tomevault:4.0:skill_md:2026-06-15 -->
Run npx skillmds@latest add tomevault-io/3219378872-zero-powers-rest-api in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
go-zero REST API It is listed under Integrations & APIs on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.