add-handler

add-handler is a skill for Claude Code 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 Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit 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.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/muhammadusmangm/claude-code-best-practices/add-handler
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.

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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-handler

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00052 $0.00754
Opus 5.5 $0.00021 $0.00302
Sonnet 5.5 $0.00010 $0.00151
Haiku 4.5 $0.00005 $0.00075

Measured 1mo ago against content hash 21c779f2364f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 (97 stars, last pushed 1mo ago), licensed MIT. It adds 52 tokens to every session and 754 once invoked, about $0.0002 per session on Opus 5.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

qa-api-testing-contracts

Tests API contracts for REST, GraphQL, gRPC, AsyncAPI, and webhooks. Use when adding schema validation or breaking-change gates (Pact, can-i-deploy, oasdiff, buf); not API design.

vasilyu1983/AI-Agents-public · 53 tokens

proof-api

Build API test suites — endpoint testing, contract testing, load testing for REST/GraphQL/gRPC APIs. Use when asked to "test this API", "API tests", "endpoint testing", "contract tests", or "load test".

tonone-ai/tonone · 51 tokens

architecture-patterns

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or…

wshobson/agents · 65 tokens

web3-testing

Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking. Use when testing Solidity contracts, setting up blockchain test suites, or validating DeFi protocols.

wshobson/agents · 46 tokens

screen-reader-testing

Test web applications with screen readers including VoiceOver, NVDA, and JAWS. Use when validating screen reader compatibility, debugging accessibility issues, or ensuring assistive technology support.

wshobson/agents · 39 tokens

event-store-design

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

wshobson/agents · 33 tokens