Creating Screens
Developmentcreating-screensCreating Screens is an Agent Skill for development published in the artsy/eigen repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Add new screens and routes to Eigen React Native app. Guides you through creating simple screens (no data fetching) or Relay screens (with GraphQL). Use this when adding screens, routes, or navigating components. Triggers on "add a screen", "create a new route", "add a Relay screen", "setup screen with data", or screen creation tasks.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/artsy/eigen/blob/HEAD/.claude/skills/creating-screens/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/creating-screens, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Creating Screens in Eigen
Use this checklist to track your work:
- [ ] Confirm the component/folder name and the desired route
- [ ] Create the correct type of screen
- [ ] Write a test for the new screen (using `/eigen-testing` skill)
- [ ] Ensure the test passes (`yarn test [test file]`)
- [ ] Run linter (`yarn lint [pending files]`)
- [ ] Run formatter (`yarn prettier -w [pending files]`)
Simple Screen (No GraphQL)
- Create
/src/app/Scenes/FeatureName/ScreenName.tsxusingassets/simple-screen-template.tsx - Register route in
/src/app/Navigation/routes.tsx
Relay Screen (With GraphQL)
- Create
/src/app/Scenes/FeatureName/ScreenName.tsxusingassets/relay-screen-template.tsx - Register route in
routes.tsxwithqueriesandprepareVariables
Route Registration
// Simple screen
{
path: "/my-screen",
name: "MyScreen",
Component: MyScreen,
options: { screenOptions: { headerShown: false } },
}
// Relay screen
{
path: "/entity/:id",
name: "EntityScreen",
Component: EntityScreenQueryRenderer,
queries: [EntityScreenQuery],
prepareVariables: [({ id }) => ({ id })],
options: { screenOptions: { headerShown: false } },
}
Note: [Android only]: If you want to enable deep linking for your new screen, add the route to src/main/AndroidManifest.xml.
...
<data android:pathPrefix="/my-screen" />
...
Critical Rules
- Location:
/src/app/Scenes/FeatureName/ScreenName.tsx - Naming conventions:
Foo.tsxnotFooScreen.tsx - Route order: Specific routes before generic (e.g.,
/artist/:idbefore/:slug) - Relay queries: Include
@relay_test_operationdirective - Null check: Always check
if (!data.entity) return nullin QueryRenderer - Tests: Always ensure there is a passing test
- Code quality: Always ensure new files are linted and formatted