add-handler

add-handler is a skill for Claude Code, Codex from MuhammadUsmanGM/claude-code-best-practices. It costs 52 tokens per session (754 once invoked), scanned A, original, MIT.

A coding workflow for adding an HTTP endpoint—the URL and code that handle a web request—across the project's model, storage, service, and API layers.

In plain words
What is it for?
Use it when adding a route, handler, or endpoint to a Go service. It helps create the related code, connect the route, and run build and test checks.
Why use it?
It prevents new endpoints from skipping required layers or differing from the project's existing style. It also adds tests for successful requests and invalid input.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/muhammadusmangm/claude-code-best-practices/add-handler
Any agent
npx skills add MuhammadUsmanGM/claude-code-best-practices --skill add-handler
Clone the repo
git clone --depth 1 https://github.com/MuhammadUsmanGM/claude-code-best-practices

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-handler

README.md
[![agentmods](https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/add-handler.svg)](https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/add-handler)
Your own site
<a href="https://agentmods.dev/skills/muhammadusmangm/claude-code-best-practices/add-handler"><img src="https://agentmods.dev/badge/skills/muhammadusmangm/claude-code-best-practices/add-handler.svg" alt="Measured on agentmods" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 754 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00052 $0.00754
Opus 5 $0.00026 $0.00377
Sonnet 5 $0.00010 $0.00151
Haiku 4.5 $0.00005 $0.00075

Measured 4d ago against content hash 21c779f2364f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add-handler scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

starters/go/.claude/skills/add-handler/SKILL.md · 84 lines

How it starts

The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add Handler

Add a new HTTP handler across the layers the project already uses. Don't invent a layer that isn't there.

Steps

  1. Clarify once (if not given): method + path, what it does, and the response shape.
  2. Read one existing handler in internal/api/ and its matching test and service function. Mirror the style: error handling, context usage, response helpers.
  3. Edit files in this order:
    • internal/model/<resource>.go — domain type, if new.
    • internal/store/<resource>.go — store method signature on the interface and the concrete implementation. Stop here if the operation doesn't need storage.
    • internal/service/<resource>.go — the service function. Takes a context, returns the domain type and an error. No http imports.
    • internal/api/<resource>.go — the handler. Decodes input, calls the service, maps errors to status codes, encodes output.
    • internal/api/<resource>_test.go — a table-driven test exercising happy path and one input-validation failure.
  4. Wire the route in the router setup (usually cmd/<service>/main.go or internal/api/router.go) only if adding a new path.
  5. Run go build ./... then go test ./internal/api/... and report the outcome.

Default shape

// internal/api/widgets.go
func (s *Server) createWidget(w http.ResponseWriter, r *http.Request) {
    var in WidgetCreate
    if err := json.NewDecoder(r.Body).Decode(&in); err != nil {
        http.Error(w, "invalid body", http.StatusBadRequest)
        return
    }
    widget, err := s.svc.CreateWidget(r.Context(), in)
    if err != nil {
        s.writeErr(w, err)  // maps domain errors to status codes
        return
    }
    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(http.StatusCreated)
    _ = json.NewEncoder(w).Encode(widget)
}
// internal/api/widgets_test.go
func TestCreateWidget(t *testing.T) {
    cases := []struct {
        name       string
        body       string
        wantStatus int
    }{
        {"happy", `{"name":"gizmo"}`, http.StatusCreated},
        {"empty name", `{"name":""}`, http.StatusBadRequest},
    }
    for _, tc := range cases {
        t.Run(tc.name, func(t *testing.T) {
            // ...
        })
    }
}

Read the full file on GitHub · 84 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 84 lines · 52 tokens per session scan A 21c779f2364f

Subscribe to this mod's changes

add-handler is a skill published in the GitHub repository MuhammadUsmanGM/claude-code-best-practices (76 stars, last pushed 2mo ago), licensed MIT. It adds 52 tokens to every session and 754 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

weather-fetcher

Instructions for fetching current weather temperature data for Dubai, UAE from Open-Meteo API.

shanraisshan/claude-code-best-practice · 21 tokens

claude-md-review

Audit a CLAUDE.md file for the patterns that actually degrade Claude Code's output — vagueness, unnamed files, stale facts, and bloat. Use when asked to review, audit, improve, shrink, or fix a CLAUDE.md, and when a project's results feel inconsistent or Claude keeps rediscovering the same context.

wesammustafa/Claude-Code-Everything-You-Need-to-Know · 69 tokens

best-practices

Searchable knowledge base of 152+ programming best practices across 30+ languages and frameworks. BM25-powered search over curated resources from industry leaders (Google, Airbnb, Uber, Mozilla, Shopify, OWASP).

dereknguyen269/programing-best-practices · 0 tokens

JavaScript Tooling

Development tools, linting, and testing for JavaScript projects.

HoangNguyen0403/agent-skills-standard · 18 tokens

common-product-requirements

Standardize PRD discovery and drafting for product scope, user outcomes, requirement IDs, and acceptance criteria. Use when creating PRD, product requirements, feature specification, or acceptance criteria plan.

HoangNguyen0403/agent-skills-standard · 44 tokens

common-security-standards

Enforce universal security protocols for safe, resilient software. Use when implementing authentication, encryption, authorization, input validation, secret management, or any security-sensitive feature across any language or framework.

HoangNguyen0403/agent-skills-standard · 43 tokens