Auto-generated tile from GitHub (10 skills)
92
94%
Does it follow best practices?
Impact
92%
1.16xAverage score across 44 eval scenarios
Advisory
Suggest reviewing before use
A platform engineering team is building an internal API gateway in Fastify that sits in front of several microservices. Tokens for this gateway are issued by a third-party identity provider (the company uses Auth0). The team needs a reusable request hook that validates incoming bearer tokens on every protected request, rejecting expired or tampered tokens before they ever reach the service handlers.
In addition, since sessions can last days, the gateway must support access token refresh. The identity provider supports refresh token rotation — meaning each refresh call may return a new refresh token, and the old one becomes invalid immediately. The token refresh utility must handle this correctly to avoid locking users out.
Environment variables available at runtime: JWT_PUBLIC_KEY (PEM-encoded public key from the identity provider), EXPECTED_ISSUER, EXPECTED_AUDIENCE.
Produce the following files for a TypeScript Fastify project:
hooks/verifyToken.ts — the token verification hook used to guard routesroutes/api.ts — at least one protected route that uses the hook (e.g. a /me endpoint returning the token subject)utils/tokenRefresh.ts — the refresh token utility functionThe code should be ready to drop into a Fastify project. Do not include actual key material — read everything from environment variables.
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
skills
documentation
fastify
init
linting-neostandard-eslint9
node
nodejs-core
rules
oauth
octocat
snipgrapher