http-rest-endpoints
Create HTTP handlers and REST endpoints following shrtner project standards.
Skill by pedromsmoreira
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/pedromsmoreira-http-rest-endpoints
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/http-rest-endpoints
What's inside
- Skill name
http-rest-endpoints- Description
- Create HTTP handlers and REST endpoints following shrtner project standards. Use when creating new handlers, endpoints, or modifying existing HTTP routes. Applies to handlers, routers, and HTTP-related code.
- License
- MIT
- Instructions
- 123 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# HTTP and REST Endpoint Development
Quick reference for creating HTTP handlers and REST endpoints in the shrtner project. For comprehensive standards and detailed patterns, see `../../rules/http-rest-standards.mdc`.
## Quick Checklist
When creating a new handler:
1. ✅ Return `func(w http.ResponseWriter, r *http.Request)` (higher-order function pattern)
2. ✅ Use `serializer := JSON` and `respond()` function
3. ✅ Use appropriate HTTP status codes (200, 201, 204, 400, 404, 409, 500)
4. ✅ Use custom error types from `handlers/errors.go`
5. ✅ Pass `context.Background()` to repository calls
6. ✅ Register route in `internal/shrtner/http/router.go` with `.Methods()`
7. ✅ Extract path parameters using `mux.Vars(r)`
8. ✅ Validate query parameters and return 400 on invalid input
## Common Patterns
**Handler skeleton:**
```go
func Create(dns string, repository data.Create) func(w http.ResponseWriter, r *http.Request) {
serializer := JSON
return func(w http.ResponseWriter, r *http.Request) {
// 1. Decode request body
var body UrlMetadata
err := serializer.Decode(w, r, &body)
if err != nil {
respond(w, r, http.StatusBadRequest, NewBadRequestError("could not decode the request body", details), serializer)
return
}
// 2. Validate input
if body.Original == "" {
respond(w, r, http.StatusBadRequest, NewBadRequestError("[original] property should not be empty", nil), serializer)
return
}
// 3. Business logic (domain layer)
u, err := url.New(body.Original, body.ExpirationDate)
if err != nil {
respond(w, r, http.StatusInternalServerError, NewInternalServerError("an error occurred"), serializer)
return
}
// 4. Repository call (always use context.Background())
cUrl, err := repository.Create(context.Background(), u)
if err != nil {
logrus.WithField("error", err.Error()).Warning("conflict")
respond(w, r, http.StatusConflict, NewConflictError(err.Error()), serializer)
return
}
// 5. Success response
rBody := &UrlMetadata{
Original: cUrl.Original,
Short: fmt.Sprintf("%s/%s", dns, cUrl.Short),
ExpirationDate: cUrl.ExpirationDate,
DateCreated: cUrl.DateCreated,
}
respond(w, r, http.StatusCreated, rBody, serializer)
}
}
```
**Path parameters:**
```go
params := mux.Vars(r)
id := params["id"]
```
**Query parameters with validation:**
```go
qPage := defaultPageNumber
qSize := defaultPageSize
if r.URL.Query().Has("page") {
qPage = r.URL.Query().Get("page")
}
if r.URL.Query().Has("size") {
qSize = r.URL.Query().Get("size")
}
p, err := strconv.Atoi(qPage)
if err != nil {
respond(w, r, http.StatusBadRequest, NewBadRequestErrorWithoutDetails(fmt.Sprintf("[page] was %v. Must be an integer.", qPage)), serializer)
return
}
s, err := strconv.Atoi(qSize)
if err != nil {
respond(w, r, http.StatusBadRequest, NewBadRequestErrorWithoutDetails(fmt.Sprintf("[size] was %v. Must be an integer.", qSize)), serializer)
return
}
```
## Status Code Quick Reference
- `200 OK` - Successful GET
- `201 Created` - Successful POST
- `204 No Content` - Successful DELETE
- `400 Bad Request` - Validation errors
- `404 Not Found` - Resource not found
- `409 Conflict` - Duplicate resources
- `500 Internal Server Error` - Server errors
## Error Types
```go
NewBadRequestError("message", details)
NewBadRequestErrorWithoutDetails("message")
NewConflictError(err.Error())
NewNotFoundError(r.URL.Path)
NewInternalServerError("message")
```
## Additional Resources
- **Full standards**: `../../rules/http-rest-standards.mdc` - Complete shrtner-specific HTTP/REST standards
- **General REST principles**: `../rest-api-design/SKILL.md` - General REST design patterns and principles
- **Router configuration**: See rule file for `internal/shrtner/http/router.go` setup
- **Error types**: See rule file for all error constructors (`NewBadRequestError`, `NewConflictError`, etc.)From pedromsmoreira/ai-configs, MIT.
More from pedromsmoreira/ai-configs
- 0.497score
conventional-commits
pedromsmoreira
Formats and validates commit messages per Conventional Commits (header grammar, optional body and footers, breaking changes).
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
go-backend
pedromsmoreira
Implements and modifies Go backend services for this project—gRPC handlers, services, domain logic, repositories, and Protocol Buffers—following idiomatic Go…
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
rest-api-design
pedromsmoreira
Designs REST and HTTP endpoints for this project—URL structure, HTTP methods, status codes, request/response patterns, error handling, and versioning.
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
git-commit
pedromsmoreira
Creates git commits safely with Conventional Commits messages.
SkillCFreshness: C★ 1Claude Code +9 - 0.496score
tdd-workflow
pedromsmoreira
Detailed TDD workflow with examples, rationales, and anti-patterns.
SkillCFreshness: C★ 1Claude Code +9 - 0.492score
database-migrations
pedromsmoreira
Creates and manages PostgreSQL schema migrations with golang-migrate for this project.
SkillCFreshness: C★ 1Claude Code +9 - 0.492score
frontend-react
pedromsmoreira
Builds React 18+ and TypeScript UI for this project—components, Material-UI, Zustand, React Query, and REST API integration.
SkillCFreshness: C★ 1Claude Code +9 - 0.492score
user-stories
pedromsmoreira
Writes user stories, acceptance criteria, and backlog items for this project.
SkillCFreshness: C★ 1Claude Code +9 - 0.467score
testing
pedromsmoreira
Implements Test-Driven Development for this project—unit tests, integration tests with testcontainers, mocks, and regression tests.
SkillCFreshness: C★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- May 9, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/pedromsmoreira/ai-configs
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from pedromsmoreira
- 0.497score
conventional-commits
pedromsmoreira
Formats and validates commit messages per Conventional Commits (header grammar, optional body and footers, breaking changes).
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
go-backend
pedromsmoreira
Implements and modifies Go backend services for this project—gRPC handlers, services, domain logic, repositories, and Protocol Buffers—following idiomatic Go…
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
rest-api-design
pedromsmoreira
Designs REST and HTTP endpoints for this project—URL structure, HTTP methods, status codes, request/response patterns, error handling, and versioning.
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
git-commit
pedromsmoreira
Creates git commits safely with Conventional Commits messages.
SkillCFreshness: C★ 1Claude Code +9 - 0.496score
tdd-workflow
pedromsmoreira
Detailed TDD workflow with examples, rationales, and anti-patterns.
SkillCFreshness: C★ 1Claude Code +9 - 0.492score
database-migrations
pedromsmoreira
Creates and manages PostgreSQL schema migrations with golang-migrate for this project.
SkillCFreshness: C★ 1Claude Code +9
Cite this page
http-rest-endpoints skill. Agent Mart. https://agentmart.dev/skills/pedromsmoreira-http-rest-endpoints (last updated 2026-10-24)