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.
npx skills add jkaninda/okapi-skills --skill middlewaregit clone --depth 1 https://github.com/jkaninda/okapi-skillsWrote 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.
[](https://agentmods.dev/skills/jkaninda/okapi-skills/middleware)<a href="https://agentmods.dev/skills/jkaninda/okapi-skills/middleware"><img src="https://agentmods.dev/badge/skills/jkaninda/okapi-skills/middleware.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01340 |
| Opus 5 | $0.00000 | $0.00670 |
| Sonnet 5 | $0.00000 | $0.00268 |
| Haiku 4.5 | $0.00000 | $0.00134 |
Grade A, and why
middleware 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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 148 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Okapi Middleware
Middleware and MiddlewareFunc are type aliases of HandlerFunc — func(*Context) error. Inside a middleware, call c.Next() to pass control down the chain. Anything before c.Next() runs on the way in, anything after runs on the way out.
func custom(c *okapi.Context) error {
start := time.Now()
err := c.Next()
log.Printf("Request took %v", time.Since(start))
return err
}
o.Use(custom)
Signature change (v0.5.0). Middleware is no longer
func(next HandlerFunc) HandlerFunc. Drop the outer wrapper and replacenext(c)withc.Next():// Before (v0.4.x) // After (v0.5.0+) func mw(next okapi.HandlerFunc) okapi.HandlerFunc { func mw(c *okapi.Context) error { return func(c *okapi.Context) error { err := c.Next() err := next(c) return err return err } } }A middleware that needs configuration returns a closure with the new signature:
func RateLimit(rps int) okapi.Middleware { return func(c *okapi.Context) error { ... } }.
Built-in Middleware
| Middleware | Purpose |
|---|---|
okapi.LoggerMiddleware |
Structured access logging (method, URL, IP, status, duration, referer, UA). Skips WebSocket upgrades and SSE streams. Enabled in okapi.Default(). |
okapi.RequestID() |
Reads X-Request-ID or generates a UUID; stores in context ("request_id") and echoes the header. |
okapi.BasicAuth{...}.Middleware |
Basic auth — constant-time compare; sends WWW-Authenticate on failure. |
okapi.JWTAuth{...}.Middleware |
JWT validation (HS256 / RS256 / JWKS), claims expression DSL, claim forwarding. |
okapi.BodyLimit{MaxBytes: 1<<20}.Middleware |
Rejects requests larger than MaxBytes with 413. |
okapi.Cors{...}.CORSHandler |
CORS preflight + headers (wildcards, credentials, expose headers, max-age). Usually attached via WithCors(). |
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.
- 8d ago First seen · 148 lines · 0 tokens per session scan A 85f974475040
middleware is a skill published in the GitHub repository jkaninda/okapi-skills (3 stars, last pushed 22d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,340 tokens. 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-31.
Other skills, from other repositories
af-xdp
AFXDP skill for high-performance XDP sockets. Use when creating AFXDP sockets, configuring UMEM and XSK rings, XDPREDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AFXDP, xskumem, XDPREDIRECT, libbpf xsk, or zero-copy XDP.
go-services
Operational skill for Go HTTP services: modules, idiomatic handlers, context cancellation, middleware, testing, and lean deployable binaries.
golang-graphql
Implements GraphQL APIs in Golang using gqlgen or graphql-go. Apply when building GraphQL servers, designing schemas, writing resolvers, handling subscriptions, or integrating GraphQL with existing Go HTTP services. Also apply when the codebase imports github.com/99designs/gqlgen or github.com/graph-gophers/graphql-go.
golang-pro
Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming…
golang-grpc
Provides gRPC usage guidelines, protobuf organization, and production-ready patterns for Golang microservices. Use when implementing, reviewing, or debugging gRPC servers/clients, writing proto files, setting up interceptors, handling gRPC errors with status codes, configuring TLS/mTLS, testing with bufconn, or…
golang-swagger
Golang OpenAPI/Swagger documentation with swaggo/swag — annotation comments (@Summary, @Param, @Success, @Router, @Security), swag init code generation, framework integrations (gin, echo, fiber, chi, net/http), security definitions (Bearer/JWT, OAuth2, API key), and struct tags (swaggertype, enums, example…