/atproto-skills:atproto-lexiconfrom atproto-skills
Authors, validates, and invokes AT Protocol lexicons (JSON schema layer) for records and XRPC methods in Rust, TypeScript, or Go. Covers NSID grammar, AT-URI, $type dispatch, strongRef vs blob refs, XRPC wire format, validation strictness, and backward-compatible change planning.
Ships in atproto-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
An AT Protocol lexicon is a JSON document that declares the shape of one record type or one XRPC method. Every record's $type, every XRPC path, and every ref between them ties back to an NSID. The lexicon is the protocol's type system; validation against it is the contract between clients, servers, and the repository layer.
This skill routes to per-language guides for Rust, TypeScript, and Go, sitting on top of a language-neutral spec in shared/.
{lexicon: 1, id: <nsid>, revision?, defs: {...}}. Primary types (record, query, procedure, subscription) live under main. Secondary types can use any name.shared/nsid.md.$type — required on every record. Bare NSID implies #main. Used for union dispatch. Missing $type = invalid record.shared/at-uri.md.{uri, cid} where cid is a plain string, not a cid-link. Common bug source.{$type:"blob", ref:{$link:<cid>}, mimeType, size}. Legacy {cid, mimeType} only accepted with an opt-in lenient flag./xrpc/<nsid> path. GET for queries, POST for procedures, WebSocket for subscriptions. Errors as {error, message}. Subscription frames are two concatenated DAG-CBOR objects per WS binary message.ALLOW_LEGACY_BLOB and ALLOW_LENIENT_DATETIME are the typical lenient opt-ins.Full normative rules: shared/lexicon-spec.md, shared/nsid.md, shared/at-uri.md, shared/record-model.md, shared/xrpc-wire.md, shared/backward-compat.md. Fixtures: shared/test-vectors.md. Cross-language differences: shared/divergence-matrix.md.
Before generating or reviewing any lexicon / XRPC / record code, determine the target language from project files or the file being edited:
Cargo.toml, *.rs, any mention of atproto-lexicon / atproto-client / atproto-record / atproto-jetstream → Rust — read from rust/.package.json, tsconfig.json, *.ts, *.tsx, imports of @atproto/lexicon / @atproto/xrpc / @atproto/xrpc-server / @atproto/api / @atproto/lex-cli → TypeScript — read from typescript/. Also *.js/*.jsx when there is no .ts present.go.mod, *.go, imports of github.com/bluesky-social/indigo/atproto/lexicon / atproto/data / xrpc / api/atproto / api/agnostic / events → Go — read from go/.Prefer the file being edited over the repo root when they disagree: a .go consumer inside a TypeScript monorepo still means Go for that task.
If multiple languages are present and the task does not point at one unambiguously, ask which one applies. Never mix lexicon libraries across languages in generated code.
If an unsupported language is detected (Python, Java, Swift, …), point the user at shared/lexicon-spec.md, shared/record-model.md, and shared/xrpc-wire.md for the wire format, and offer indigo/atproto/lexicon (Go) as the most complete reference implementation to transliterate from.
For every lexicon / records / XRPC task:
shared/*.md first. They are short and define the rules your code must enforce.{lang}/authoring.md{lang}/validation.md{lang}/xrpc-client.md$type dispatch → {lang}/records.md{lang}/README.mdshared/divergence-matrix.md whenever porting between languages or reviewing cross-stack interop. The legacy-blob shape, BlobRef-class-vs-plain-object, and the Go two-stack (data.Blob vs. lex/util.LexBlob) split are the highest-frequency traps.Always prefer the official library over hand-rolling: atproto-lexicon + atproto-client in Rust, @atproto/lexicon + @atproto/xrpc in TypeScript, indigo/atproto/lexicon + indigo/xrpc in Go.
┌──────────────────────────────┐
Lexicon (JSON) ───▶ │ {lexicon:1, id:<nsid>, │
authoring / resolve │ revision, defs:{main,...}} │
└──────────────────────────────┘
│
▼
┌──────────────────────────────┐
Catalog ──────────▶ │ Lexicons / BaseCatalog — │
(runtime) │ resolves <nsid>[#def] → def │
└──────────────────────────────┘
│ validates ↓ ↓ schemas XRPC
▼ ▼
┌──────────────────────────────┐ ┌──────────────────────────────┐
Record value ──────▶ │ {$type:<nsid>, ...fields...} │ │ XRPC transport │
(record def) │ DAG-CBOR → CID stability │ │ GET/POST/WS @ /xrpc/<nsid> │
└──────────────────────────────┘ │ JSON in/out; frames on WS │
└──────────────────────────────┘
Validation runs at both ends: on write (strict, reject unknowns) and on read (lenient, tolerate unknowns from older producers). The catalog is shared across both paths.
High-frequency failure modes; full detail in shared/divergence-matrix.md:
cid is a string, not a cid-link. Emitting {$link: ...} for strongRef.cid produces a different CID. See shared/record-model.md §3.{$type:"blob", ref:{$link}, mimeType, size} is the only shape for new writes. Legacy {cid, mimeType} is accepted on read only with ALLOW_LEGACY_BLOB / AllowLegacyBlob / equivalent.BlobRef is a class in TypeScript. Plain-object blobs fail assertValidRecord. Construct with new BlobRef(cid, mime, size).atproto/data (modern) and lex/util (legacy, still emitted by generated code). Convert at the boundary between validator and generated code.xrpc.Client.Do arg order (Go). (ctx, kind, inpenc, method, params, body, out) — kind before method. Easy to invert.@atproto/xrpc Subscription export has moved. Regrep node_modules on version bumps.$type. Default to open.$type missing on a record. Strict validators reject; lenient validators have nothing to dispatch on. Never omit.app.bsky.* facets, richtext, embeds, threadgates — point users at the Bluesky appview or @atproto/api README rather than trying to cover them here.Prefer these MCP tools when the goal is to compute or validate rather than teach an implementation how:
lexicon-garden → describe_lexicon(nsid), validate_lexicon(doc), invoke_xrpc(method, params, input?), create_record_cid(record), transmogrify_record(record), check_compatibility(old, new).atpmcp → get_lexicon(nsid), validate_lexicon_schema(doc), validate_xrpc(method, params, input?), get_record(uri), invoke_xrpc(method, params, input?), generate_tid(), create_record_cid(record), parse_facets(text), transmogrify_record(record).For record-side helpers (TIDs, AT-URI parsing), prefer in-language libraries — see the per-language records.md. For lexicon authoring or compatibility review, lexicon-garden is the fastest way to validate without spinning up a stack.
atproto-lexicon/
├── SKILL.md # this file — router
├── shared/
│ ├── lexicon-spec.md # lexicon doc structure + validation rules
│ ├── nsid.md # NSID grammar and reserved prefixes
│ ├── at-uri.md # AT-URIs in records and refs
│ ├── record-model.md # $type, strongRef, blob refs
│ ├── xrpc-wire.md # HTTP + WebSocket wire format
│ ├── backward-compat.md # breaking-vs-non-breaking matrix
│ ├── test-vectors.md # canonical fixtures
│ └── divergence-matrix.md # cross-language differences
├── rust/
│ ├── README.md # atproto-lexicon / atproto-client setup
│ ├── authoring.md # BaseCatalog, load_directory, refs
│ ├── validation.md # validate_record, ValidateFlags, DataValue
│ ├── xrpc-client.md # Auth::{None,DPoP,AppPassword}, atproto-jetstream
│ └── records.md # ATURI, Tid, strongRef, Blob, typed dispatch
├── typescript/
│ ├── README.md # @atproto/{lexicon,xrpc,xrpc-server,api,lex-cli}
│ ├── authoring.md # Lexicons, lex-cli gen-api
│ ├── validation.md # assertValidRecord, BlobRef class, ValidationError
│ ├── xrpc-client.md # XrpcClient, AtpAgent, createServer, Subscription
│ └── records.md # AtUri, TID, BlobRef, strongRef
└── go/
├── README.md # indigo/atproto/lexicon + xrpc + events
├── authoring.md # BaseCatalog, LoadDirectory, lexgen
├── validation.md # ValidateRecord, ValidateFlags
├── xrpc-client.md # xrpc.Client.Do, api/atproto, HandleRepoStream
└── records.md # data.Blob vs lex/util.LexBlob, typed dispatch
All reachable from the tree above. Listed here for quick grep:
shared/lexicon-spec.md, shared/nsid.md, shared/at-uri.md, shared/record-model.md, shared/xrpc-wire.md, shared/backward-compat.md, shared/test-vectors.md, shared/divergence-matrix.mdrust/README.md, rust/authoring.md, rust/validation.md, rust/xrpc-client.md, rust/records.mdtypescript/README.md, typescript/authoring.md, typescript/validation.md, typescript/xrpc-client.md, typescript/records.mdgo/README.md, go/authoring.md, go/validation.md, go/xrpc-client.md, go/records.mdgo/README.md (opens in a new tab)go/authoring.md (opens in a new tab)go/records.md (opens in a new tab)go/validation.md (opens in a new tab)go/xrpc-client.md (opens in a new tab)rust/README.md (opens in a new tab)rust/authoring.md (opens in a new tab)rust/records.md (opens in a new tab)rust/validation.md (opens in a new tab)rust/xrpc-client.md (opens in a new tab)shared/at-uri.md (opens in a new tab)shared/backward-compat.md (opens in a new tab)shared/divergence-matrix.md (opens in a new tab)shared/lexicon-spec.md (opens in a new tab)shared/nsid.md (opens in a new tab)shared/record-model.md (opens in a new tab)shared/test-vectors.md (opens in a new tab)shared/xrpc-wire.md (opens in a new tab)typescript/README.md (opens in a new tab)typescript/authoring.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
TypeScript, Rust, Go
npx claudepluginhub ngerakines/atproto-skills --plugin atproto-skillsOther plugins' skills for the same job