Get the FREE Ultimate OpenClaw Setup Guide →

atomic-page

Scanned
npx machina-cli add skill andireuter/skills-webapp/atomic-page --openclaw
Files (1)
SKILL.md
1.3 KB

Atomic Design: PAGE (React Functional Components)

You are creating a PAGE: a route-level component that binds UI to real data and app concerns.

Hard rules

  1. Functional components only.
  2. Orchestration lives here:
    • Data fetching (via the project’s standard: loaders, query libs, server components, etc.)
    • Side effects (analytics, navigation, subscriptions) in useEffect or framework equivalents
  3. Keep UI reusable:
    • Prefer pushing rendering into templates/organisms; keep pages thin.
  4. Error/loading states:
    • Must have consistent handling aligned with the repo’s conventions.
  5. Performance:
    • Avoid waterfall fetching; colocate queries where the project expects.
    • Memoize expensive derived data with useMemo when justified.

Output expectations

  • Provide:
    1. Page.tsx
    2. Page.test.tsx (routing + async states, if applicable)
    3. A brief note explaining which layer owns which responsibility (page vs template vs organism).

Recommended folder conventions

  • src/pages/<PageName>/... (or framework equivalent)

Source

git clone https://github.com/andireuter/skills-webapp/blob/main/skills/atomic-page/SKILL.mdView on GitHub

Overview

A PAGE is a React functional component that acts as the route-level container, binding templates and organisms to real app data and routing. It handles data loading, orchestration, and side effects, keeping UI concerns thin by delegating rendering to templates/organisms. It also enforces consistent error and loading states and aims to colocate queries for performance.

How This Skill Works

Built as a functional component that orchestrates data loading using the project’s standard loaders or query libraries. It passes data down to templates/organisms, while managing side effects (analytics, navigation, subscriptions) in useEffect or framework equivalents. It ensures consistent error/loading states per repo conventions and uses useMemo to memoize expensive derived data when justified.

When to Use It

  • When a route-level page must bind real app data to UI via templates/organisms
  • When the page coordinates multiple data sources with colocated queries
  • When consistent, centralized error and loading states are required for a route
  • When you need to run analytics, navigation, or subscription side effects on the page
  • When you want to keep UI components reusable by keeping the Page thin and delegating rendering

Quick Start

  1. Step 1: Create src/pages/<PageName>/Page.tsx as a functional Page component
  2. Step 2: Implement data loading using the project’s loaders/query libs and pass data to templates/organisms
  3. Step 3: Add routing+async state tests in Page.test.tsx and document which layer owns which responsibility

Best Practices

  • Keep the Page thin; push rendering into templates/organisms and minimize UI logic in the Page
  • Use the project’s standard data-loading approach (loaders, query libs) for data fetching
  • Place side effects (analytics, navigation, subscriptions) in useEffect or framework equivalents
  • Ensure error/loading states follow repo conventions for consistency
  • Memoize expensive derived data with useMemo and avoid unnecessary re-renders

Example Use Cases

  • UserProfilePage binds real user data to a ProfileTemplate and UserCard organism
  • ProductDetailPage loads product data and pricing, rendered through a ProductTemplate
  • DashboardPage orchestrates multiple widgets (organisms) and fetches stats without waterfall calls
  • SettingsPage fetches user preferences and applies analytics on mount
  • BlogPostPage fetches post and author data, rendering via a BlogLayout template

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers