Skip to content
Security
Agent

SELF-TEST

This document verifies that the `jwx-dev-v4:guide` skill enables an answering agent to navigate the **scattered** documentation surface — jwx core docs, the examples repo, companion-module docs, and the Go module cache — and synthesize them into correct, compiling jwx code.

From plugin
jwx
2.4k9 skills9 agents

Claude Code

> /plugin marketplace add lestrrat-go/jwx
> /plugin install jwx-dev-v4@jwx-v4

Agent definition

SELF-TEST.md

Self-test: `jwx-dev-v4:guide` documentation retrieval

This document verifies that the `jwx-dev-v4:guide` skill enables an answering agent to navigate the **scattered** documentation surface — jwx core docs, the examples repo, companion-module docs, and the Go module cache — and synthesize them into correct, compiling jwx code.

The skill is intended for end-users who **do not have any of these repos locally checked out**. It must direct agents to the right source for each question and let them combine sources when one source alone is insufficient.

Documentation sources the skill points at

A passing test confirms agents can effectively use:

1. **jwx core narrative docs** — `https://github.com/lestrrat-go/jwx/blob/develop/v4/docs/*.md` 2. **Go module cache** — `$(go env GOMODCACHE)/github.com/lestrrat-go/jwx/v4@<ver>/` (and the same for any companion module the user has imported) 3. **pkg.go.dev** — `https://pkg.go.dev/github.com/lestrrat-go/jwx/v4/...` and `https://pkg.go.dev/github.com/jwx-go/<companion>/v4` 4. **Examples repo (topical index)** — `https://github.com/jwx-go/examples/blob/develop/v4/README.md` and its linked `*_example_test.go` files 5. **Companion-module own READMEs** — `https://github.com/jwx-go/<companion>` (repo root README)

Prerequisites

  • The latest source `agents/plugin/skills/guide/SKILL.md` has been installed and cached. Recipe:
  /plugin uninstall jwx-dev-v4@jwx-v4
  /plugin install jwx-dev-v4@jwx-v4
  /reload-plugins
  • Verify cache matches source:
  diff -q agents/plugin/skills/guide/SKILL.md \
    ~/.claude/plugins/cache/jwx-v4/jwx-dev-v4/<version>/skills/guide/SKILL.md

No output = match.

Setup: fresh-context test session

Do **not** rely on the current Claude session that authored the skill. Either:

  • Launch a fresh `claude` session in a directory that has **no jwx checkout and no prior context**, or
  • Dispatch an `Agent` subagent with `subagent_type: general-purpose` and a self-contained prompt — the subagent inherits tools but not conversation history.

The test agent must have at least: `Skill`, `WebFetch`, `Read`, `Write`, `Edit`, `Bash`. It must not be told the answers; it must be told only the user's question and instructed to use the `jwx-dev-v4:guide` skill.

Required: build a real Go program

For every case, the test agent must **construct a runnable Go program from scratch in a temporary directory** and verify it compiles. This is the load-bearing part of the test — text-only answers are easy to bluff; a `go build` either succeeds or doesn't.

Recipe the agent should follow:

WORKDIR="$(mktemp -d)"
cd "$WORKDIR"
go mod init example.com/jwx-self-test/case-N
# write main.go with all required imports + func main() so it links
# encoding/json/v2 is behind GOEXPERIMENT=jsonv2 on Go 1.26 and in the standard
# library from Go 1.27 on. Probe the toolchain instead of hardcoding a version.
if ! GOEXPERIMENT= go list encoding/json/v2 >/dev/null 2>&1; then
	export GOEXPERIMENT=jsonv2
fi
go mod tidy
go build ./...

The test passes a case only when `go build` exits 0. A successful build proves:

  • Every imported package path is real.
  • Every `package.Symbol` used exists with a compatible signature.
  • Generic call sites have the correct type parameters.

If `go build` fails, the agent iterates: read the error, consult docs again, fix. Up to three fix attempts per case. Report the trajectory.

Network policy

The test agent has network access via `WebFetch` and `go mod tidy`. It must not clone any jwx-related repo (jwx core or companions). For cases that exercise the offline path (Case 5), deny network access entirely after the initial `go mod tidy` and verify the agent recovers via the Go module cache for **both jwx core and the relevant companion** when applicable.

Test cases

Cases are split into two families: **single-source** cases (one doc carries the answer) and **multi-source / index-navigation** cases (the answer requires combining or navigating across sources).

Family A — Single-source retrieval

Case 1 — Custom claim validator (target: `docs/01-jwt.md`)

**User question**: "How do I write a custom validator that checks the `scope` claim contains `read:users` and rejects the token otherwise?"

**Why this requires docs**: SKILL.md doesn't cover `jwt.Validator`/`jwt.WithValidator`. `docs/01-jwt.md` "Use a custom validator" is the source.

**Pass criteria**:

  • `go build` passes.
  • Code uses `jwt.WithValidator` + `jwt.Validator` (or `jwt.ValidatorFunc`).
  • Validator returns a plain `error` (not `jwt.NewValidationError`, which does not exist).
  • No fabricated APIs.

Case 2 — Per-recipient JWE headers (target: `docs/03-jwe.md`)

**User question**: "Encrypt a single JWE for two recipients, each with a different `kid` in its per-recipient header. Each recipient must independently decrypt the message."

**Why this requires docs**: SKILL.md only shows single-recipient `jwe.Encrypt`. Multi-recipient assembly + `jwe.WithJSON` + `jwe.WithPerRecipientHeaders` live in `docs/03-jwe.md`.

**Pass criteria**:

  • `go build` passes.
  • Code uses `jwe.WithJSON()`, `jwe.WithPerRecipientHeaders`, two `jwe.WithKey(...)` calls.
  • Both recipients decrypt successfully (if the test agent runs the program).

Case 3 — Framework integration with Echo (target: `docs/21-frameworks.md`)

**User question**: "Echo middleware that pulls a bearer JWT from `Authorization: Bearer …`, verifies against a JWKS endpoint, stashes the verified token on the request context."

**Why this requires docs**: SKILL.md mentions `docs/21-frameworks.md` exists but contains no Echo-specific guidance.

**Pass criteria**:

  • `go build` passes (Echo + jwkfetch resolve).
  • Middleware calls `jwt.Parse` with `jwt.WithKeySet` from a `jwkfetch.Cache`.
  • Token stored on `echo.Context` for handler use.

Family B — Multi-source / index navigation

Case 4 — ML-DSA signing (target: jwx's `docs/10-extensions.md` **plus** the mldsa co

Read more
@lestrrat-go
Ships withjwx

Go module implementing various JWx (JWA/JWE/JWK/JWS/JWT, otherwise known as JOSE) technologies. If you are using this module in your product or your company, please add your product and/or company name in the Wiki! It really helps keeping up our motivation.

2.4k2 skills9 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
2.4k
Star history of lestrrat-go/jwx on GitHub, a chart by star-history.com

Other agents on jwx.

companion-template-sync

companion-template-syn…

Agent

Pull newest GitHub Actions versions from companion repos back into `.companions/templates/`. Dependabot updates each companion…

@lestrrat-go@lestrrat-goInstall Agent
companions

companions

Agent

Extension modules under `github.com/jwx-go/*` (asmbase64, compsig, ed448, es256k, examples, jwkfetch, jwxfilter, jwxmigrate,…

@lestrrat-go@lestrrat-goInstall Agent
internals

internals

Agent

<!-- Agent-consumed file. Keep terse, unambiguous, machine-parseable. -->

@lestrrat-go@lestrrat-goInstall Agent
packages

packages

Agent

<!-- Agent-consumed file. Keep terse, unambiguous, machine-parseable. -->

@lestrrat-go@lestrrat-goInstall Agent

More agents from other plugins.

dependency-review

dependency-review

Agent

<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> <!--…

@nvidia@nvidiaInstall Agent
0-preflight

0-preflight

Agent

Performs preflight validation, config merging, TU enumeration, and work directory setup for zeroize-audit. Produces…

skills9d8.2k
@trailofbits@trailofbitsInstall Agent
autopilot

autopilot

Agent

Autonomous hunt loop agent. Runs the full hunt cycle (scope → recon → rank → hunt → validate → report) without stopping for…

@awarexone@awarexoneInstall Agent
autopilot

autopilot

Agent

Autonomous hunt loop agent. Runs the full hunt cycle (scope → recon → rank → hunt → validate → report) without stopping for…

@shuvonsec@shuvonsecInstall Agent

Questions about SELF-TEST.

Which coding agents can use SELF-TEST?
SELF-TEST installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.