lex-schema
Skill by bluesky-social
Validates, parses, constructs and types AT Protocol data against Lexicon schemas using @atproto/lex and @atproto/lex-schema. Written for developers working with generated ./lexicons/ trees in TypeScript.
Install lex-schema
Built from the published package, never by AI.
git clone --depth 1 https://github.com/bluesky-social/atproto /tmp/atproto && mkdir -p ~/.claude/skills && cp -r /tmp/atproto/.agents/skills/lex-schema ~/.claude/skills/lex-schemaRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/bluesky-social/atproto /tmp/atproto && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/atproto/.agents/skills/lex-schema ~/.gemini/antigravity-cli/skills/lex-schemaAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The lex-schema skill guides an AI assistant through validating, parsing, constructing and typing AT Protocol data with Lexicon schemas from @atproto/lex and @atproto/lex-schema. It covers the accessors on generated namespaces, such as $parse, $safeParse, $validate, $matches and $build, and explains when parse mode may change a value compared with validate mode. It also covers the strict option, which defaults to true, and how to declare schemas by hand with the l builder.
It is aimed at developers writing TypeScript code that checks unknown records or XRPC payloads against AT Protocol Lexicons. The skill points to other skills for codegen setup (lex-setup) and for value types such as CIDs, bytes, blobs and branded strings (lex-data).
Written from the project's SKILL.md and checked against it.
What it can do
- Validate unknown dataChecks whether an unknown record or XRPC payload conforms to a Lexicon schema using $validate, $matches and related methods.
- Parse with defaultsUses $parse and $safeParse to return output-typed values, filling in withDefault defaults where they apply.
- Construct typed recordsBuilds record literals with $build, which sets $type and types the result but does not validate it.
- Discriminate by typeUses $isTypeOf to compare $type values in loops over already-validated unions.
- Loosen checksExplains strict: false and how it relaxes datetime, at-uri, language and blob checks for legacy data.
- Declare schemas by handShows how to write schemas with the l builder when no Lexicon JSON exists yet.
- Handle XRPC accessorsDescribes $lxm, $Params, $Input, $Output and $Message accessors on generated query, procedure and subscription namespaces.
What you need
- @atproto/lex-schema package
- @atproto/lex package
- Generated ./lexicons/ tree from lex build
Try asking
- Check whether this unknown record matches app.bsky.feed.post using $safeParse.
- Build a new app.bsky.feed.post record with $build and a current datetime.
- Declare a small Lexicon-style schema with the l builder for an internal object.
Good to know
- The generated ./lexicons/ tree is regenerated by lex build and should not be edited.
- $build applies no defaults and runs no checks, so parse untrusted input afterwards.
- strict: false relaxes several AT Protocol checks and should be used only where legacy data requires it.
- Does not cover codegen setup, CIDs, bytes, blobs or CBOR and JSON encoding.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/lex-schema/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to lex-schema
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
lex-schema: common questions
What is the difference between $parse and $validate?
$parse can return a different value, for example with defaults applied or bytes normalized. $validate treats any transformation as a failure, so success means the input already conformed as-is.
What does strict mode control?
Strict mode, the default, checks data against the AT Protocol spec. Setting strict to false accepts looser datetimes, unvalidated at-uri record keys, and legacy blob references.
Can I use this skill to set up code generation?
No. The skill says codegen setup is covered by lex-setup, and value types such as CIDs and blobs are covered by lex-data.
How do I install lex-schema?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is lex-schema free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is lex-schema safe to use?
It scores 78 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to lex-schema?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
