add-react-page

Build list+create React pages with API fetchers, React Query, routing, and Playwright tests.

6.7k|2.0k|Updated Aug 20, 2021
One-click install
npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill add-react-page
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-react-page
Source: https://github.com/fullstackhero/dotnet-starter-kit/tree/main/.agents/skills/add-react-page
Command: npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill add-react-page

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new list+create UI screen usually triggers scattered, error-prone work across API clients, pages, routing, permissions, and end-to-end tests; this Skill provides a consistent frontend implementation path so you can add screens without breaking app conventions.

Core Features & Use Cases

  • Hands-on API module wiring: Hand-write DTO/params/input types and thin apiFetch functions with correct query casing per app (admin PascalCase vs dashboard camelCase).
  • Production-ready page patterns: Create a named-export page that uses React Query with hierarchical queryKey and placeholderData: keepPreviousData, plus the right list+create UI structure (separate pages for admin, dialog-based editors for dashboard).
  • Mutation correctness and cache updates: Implement race-safe mutations using mutate(arg) and invalidate queries on success, surfacing errors via consistent toast handling.
  • Route registration with the right guardrails: Register the lazy-loaded route via lazyNamed, using <RouteGuard perms={[...]}> for admin and suspense-only routing for dashboard.
  • Permission mirroring and Playwright coverage (admin): Add the permission constant in src/lib/permissions.ts when needed and include a scoped, shell+page-mocked Playwright test.

Quick Start

Add the Skill to create a list+create screen for your resource in the React app by following each step for the correct app variant (admin vs dashboard) including API types, the named-export page, the route registration, and the Playwright test.

Frequently Asked Questions about add-react-page

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new list and create page in React using React Query?

To add a list and create page in React, wire API fetchers and React Query list rendering into your routing. Use hierarchical queryKey structures with placeholderData: keepPreviousData and implement mutation-driven create flows with cache invalidation.

What's the best way to structure React Query mutations for a create form?

The best way to structure React Query mutations for a create form is using race-safe mutate(arg) calls and invalidating queries on success. Surface errors consistently via toast handling to maintain app conventions.

Does this React page scaffolding approach support both admin and dashboard routing?

Yes, this React page scaffolding supports both admin and dashboard routing. Admin screens use separate pages with RouteGuard perms, while dashboard screens use dialog-based editors with suspense-only routing.

How do I register a lazy-loaded React route with permission guards?

To register a lazy-loaded React route with permission guards, use lazyNamed routing and wrap admin routes with RouteGuard perms arrays. Add the permission constant in permissions.ts when needed for the operator area.

How do I write Playwright tests for a new React screen with API mocking?

To write Playwright tests for a new React screen, include a scoped shell and page-mocked test. Use API mocking and seeding to validate the list and create flows end-to-end for the admin operator area.