What problem does it solve?
Working with AT Protocol records and XRPC payloads requires checking that unknown data conforms to Lexicon schemas, and hand-rolled validators or generic tools like Zod do not understand Lexicon semantics such as NSIDs, $type discriminators, CIDs, blobs, and strict datetime rules. This Skill provides the operational knowledge for using the generated ./lexicons/ schema tree and the l builder from @atproto/lex to parse, validate, and construct protocol data correctly.
Core Features & Use Cases
- Schema validation methods: Choose between
$parse, $safeParse, $validate, $safeValidate, $assert, $matches, $isTypeOf, and $build depending on whether you need transformation, narrowing, or cheap $type discrimination.
- Strict vs lenient modes: Control spec conformance with the
strict option for datetime, at-uri, language, and blob constraint handling when reading legacy network data.
- Hand-declared schemas: Use the
l builder (l.object, l.typedObject, l.record, l.query, etc.) for one-off internal shapes or schemas authored before their Lexicon JSON exists.
- Use Case: When the AppView hydrates stored records, use
$matches or $safeValidate instead of $parse so that defaults are not applied and the record still hashes to the CID it was stored under.
Quick Start
Show me how to validate an unknown app.bsky.feed.post record using the generated lexicons schema and handle the failure result.