relay-best-practices
Skill by meta
Relay best practices is a skill that guides AI assistants in writing idiomatic Relay code for React components. It is meant for developers who use Relay for data fetching.
Install relay-best-practices
Built from the published package, never by AI.
git clone --depth 1 https://github.com/meta/relay /tmp/relay && mkdir -p ~/.claude/skills && cp -r /tmp/relay/skills/relay-best-practices ~/.claude/skills/relay-best-practicesRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/meta/relay /tmp/relay && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/relay/skills/relay-best-practices ~/.gemini/antigravity-cli/skills/relay-best-practicesAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install relay-best-practices in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill gives opinionated guidance on Relay patterns for React. It covers fragments, queries, mutations, pagination, error handling and common anti-patterns. It tells the assistant which Relay documentation pages to read before writing code, and points to the separate relay-performance skill for performance topics.
It explains the core Relay ideas: co-location, data masking, composition, render-as-you-fetch and the normalized store. It also covers running the Relay compiler and the relay ESLint rules. The skill is published by Meta and is aimed at developers who write, modify, review or debug Relay components.
Written from the project's SKILL.md and checked against it.
What it can do
- FragmentsGuidance on co-locating data needs in component fragments and passing fragment references.
- QueriesGuidance on where queries belong, favoring route entrypoints over hooks.
- MutationsGuidance on spreading fragments into mutation responses to keep data in sync.
- PaginationGuidance on the @argumentDefinitions, @refetchable and @connection pattern.
- Error handlingGuidance on @throwOnFieldError and @catch for field errors and nullability.
- Anti-pattern reviewWarns against copying Relay data into React state and other common mistakes.
What you need
- A project that uses Relay with React
- Relay compiler (npx relay-compiler)
Try asking
- Review my Relay component for common anti-patterns
- Write a paginated list using usePaginationFragment
- Explain how useFragment differs from useLazyLoadQuery
Good to know
- Opinionated guidance, not a full API reference
- Doc links need relay-runtime v20.1.1 or later, or fetching the docs from GitHub for older versions
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/relay-best-practices/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md18 KB
Alternatives to relay-best-practices
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
relay-best-practices: common questions
What is the relay-best-practices skill for?
It gives AI assistants guidance on writing, modifying, reviewing and debugging Relay code in React components. It covers fragments, queries, mutations and pagination.
Does it cover Relay performance?
Performance topics such as query placement, @defer and fetch policies are covered by the companion relay-performance skill, according to the source.
Where does the Relay documentation come from?
The skill points to LLM-friendly docs in node_modules/relay-runtime/llm-docs for v20.1.1 and later. For older versions, the source says to fetch the same files from the Relay GitHub repository.
How do I install relay-best-practices?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is relay-best-practices free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is relay-best-practices safe to use?
It scores 88 of 100. Grades: maintenance A, licence A, 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 relay-best-practices?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
