askill
ui-page-standards

ui-page-standardsSafety 95Repository

New page checklist: metadata, loading/error states, component states, form completeness, mobile-first, SEO, API routes. Use when creating or auditing Next.js pages.

2 stars
1.2k downloads
Updated 2/19/2026

Package Files

Loading files...
SKILL.md

UI Page Standards

Use when creating a new page.tsx, route segment, or auditing existing pages.

Page Metadata (MANDATORY for New Pages)

Required Exports

  • Every new page.tsx MUST export metadata (static) or generateMetadata (dynamic)
  • NEVER ship a page with default/empty Next.js metadata

Required Fields

FieldRequirement
titleUnique, descriptive. Format: "Page Title | Site Name" or per project template
description150-160 characters, compelling, includes primary keyword
openGraph.titleMatch or extend the page title
openGraph.descriptionMatch or extend the page description
openGraph.imagesAt least one image, 1200x630px (standard) or 1200x1200px (square)
openGraph.type'website', 'article', or appropriate type
twitter.card'summary_large_image'
twitter.titleMatch the page title
twitter.descriptionMatch the page description
twitter.imagesMatch the link preview image

Link Preview Image

Every page needs a preview image for social sharing (Slack, Twitter, iMessage, LinkedIn).

  • Check if the project already has a default preview image (/app/opengraph-image.png or similar)
  • If a project default exists, reference it
  • If a route-specific image makes sense, add opengraph-image.png (static) or opengraph-image.tsx (dynamic) in the route segment
  • If no image exists and you don't know what to use: ASK THE USER. Do not skip it, do not use a placeholder.
  • Standard dimensions: 1200x630px

Static vs Dynamic

  • Static page with known content: use metadata export object
  • Dynamic route with params (e.g., [slug]): use generateMetadata({ params }) function

New Page Checklist

When creating a new page, the builder MUST also create or verify:

FilePurposeWhen to skip
loading.tsxLoading skeleton matching the page layoutStatic pages with no data fetching
error.tsxUser-friendly error boundary with retry actionNever -- every page needs error handling
Navigation linkPage must be reachable from existing UIOnly if page is accessed via direct URL (e.g., callback pages)
MetadataTitle, description, openGraph, twitter, preview imageNever

Rules:

  • loading.tsx skeleton MUST mirror the page's layout structure (not a generic spinner)
  • error.tsx MUST show a user-friendly message with a "Try Again" button that calls reset()
  • Navigation: check if the page should appear in the site's primary nav, sidebar, or footer. If unsure, ASK THE USER.
  • For nested routes: check if breadcrumbs are appropriate

Component States

Every data-driven component MUST handle three states:

StateWhat to showAnti-pattern
LoadingSkeleton matching final layout, OR spinner with contextBlank screen, no indicator
EmptyFriendly message explaining no data + action (e.g., "No posts yet. Create your first post.")Blank screen, empty table with just headers
ErrorUser-friendly message + retry action. NEVER show raw error messages or stack traces to users.White screen, console.error only, generic "Something went wrong" with no action

Rules:

  • Loading skeletons must match the final layout shape (same heights, widths, spacing)
  • Empty states must have an action when possible (create, import, change filters)
  • Error states must offer retry. For persistent errors, offer an alternative path.
  • Use Suspense boundaries at appropriate levels (page-level for main content, component-level for independent sections)
  • If using React Server Components: errors in server components bubble to nearest error.tsx. The builder must ensure one exists.

Form Completeness

Every form MUST have:

RequirementImplementationAnti-pattern
Client-side validationRequired fields marked, format validation (email, phone, URL), min/max length. Use Zod, react-hook-form, or HTML5 validation per project conventions.No validation, console.log errors
Visible error messagesError text shown next to the field that has the error. Use aria-describedby for accessibility.Errors only in console, alert() boxes, errors at top with no field association
Submit loading stateButton shows loading indicator during submission. Button text preserved (not replaced with spinner only).No feedback during submission
Double-submit preventionDisable submit button while request is in-flight.User clicks 3 times, 3 records created
Success feedbackToast notification, inline success message, or redirect. User must KNOW it worked.Form submits, nothing visible changes
Unsaved changes warningFor important forms (multi-step, long forms): warn before navigation. Not needed for simple search/filter forms.User fills 10 fields, accidentally navigates away

Rules:

  • Validation messages must be specific ("Email must include @") not generic ("Invalid input")
  • Server-side validation is ALSO required for security -- client-side is for UX only
  • For server actions: use useFormStatus() for pending state, useFormState() for error handling
  • For API routes: validate input with Zod or similar, return structured errors
  • If you don't know what validation rules to apply: ASK THE USER.

Mobile-First

Every UI change must work on mobile:

RuleSpecifics
Touch targetsMinimum 44x44px for interactive elements (buttons, links, inputs)
No horizontal overflowTest at 320px width minimum. No content should require horizontal scrolling.
Readable textMinimum 16px for body text on mobile. No text below 14px.
NavigationMust be usable on mobile (hamburger menu, bottom nav, or collapsible sidebar)
Forms on mobileInputs must be full-width or near full-width. Use appropriate input types (type="email", type="tel") for mobile keyboards.
ImagesMust scale properly. Use sizes prop for responsive images.
SpacingReduce section spacing on mobile (see typography-spacing skill mobile column).

Rules:

  • The builder's Design Intent MUST include a "Mobile Approach" section stating how the layout adapts
  • If a design looks good on desktop but would clearly break on mobile, the builder must address it proactively

Structured Data and SEO

When creating pages that represent entities (articles, products, FAQs, events, organizations):

Page TypeJSON-LD SchemaWhen to add
Article/Blog postArticle or BlogPostingAlways for content pages
ProductProduct with offersAlways for e-commerce
FAQFAQPage with questionsWhen page has Q&A format
Organization/AboutOrganizationHomepage or about page
EventEventEvent listing pages
BreadcrumbBreadcrumbListNested pages with breadcrumb UI

Rules:

  • JSON-LD goes in a <script type="application/ld+json"> tag
  • In Next.js App Router: use the metadata export or generateMetadata to include JSON-LD
  • Canonical URLs: every page should have a canonical URL. Use metadata.alternates.canonical
  • If you don't know the schema type for a page: ASK THE USER.
  • This is NOT required for utility pages (settings, login, admin dashboards, etc.)

API Route Patterns

When creating or modifying Next.js API routes (route.ts files):

RequirementImplementation
Input validationValidate request body/params with Zod or similar. Return 400 with specific error messages.
Consistent error formatAll errors return: { error: string, details?: object }. Never return raw error objects or stack traces.
Proper HTTP status codes200 success, 201 created, 400 bad request, 401 unauthorized, 403 forbidden, 404 not found, 500 internal error.
Error handlingWrap handler in try/catch. Log server errors (don't swallow). Return user-safe error messages.
Type safetyRequest and response types defined. Use Zod .parse() or .safeParse() for runtime validation.

Rules:

  • Never expose internal error messages to clients (security risk)
  • For authenticated routes: check auth FIRST, before any other logic
  • For mutations: consider idempotency (especially for payment-related routes)

Site Infrastructure

Check that these exist when working on a new Next.js project:

FilePurposeRequired?
app/sitemap.ts or app/sitemap.xmlSearch engine discoveryYes for public sites
app/robots.ts or public/robots.txtCrawler instructionsYes for public sites
app/favicon.ico or app/icon.tsxBrowser tab iconYes always
app/apple-icon.pngiOS home screen iconRecommended
app/manifest.ts or public/manifest.jsonPWA manifestOnly if PWA
app/opengraph-image.tsx or default preview imageDefault link previewYes

Rules:

  • Don't create these automatically -- ASK if the project needs them
  • For existing projects: check what exists and only flag what's missing
  • This is a ONE-TIME check, not a per-page check

Dark Mode / Theme Considerations

When implementing or touching theme/color-related code:

IssuePrevention
Flash of wrong theme (FOUC)Use <script> in <head> to set theme class BEFORE React hydrates. Or use next-themes.
Images that need dark variantsUse <picture> with prefers-color-scheme media query, or CSS filter: invert() for simple icons
Hardcoded colorsAll colors must come from design tokens / CSS custom properties that change with theme
Third-party embedsSome embeds don't respect dark mode. Note as known limitation.

Rules:

  • Only applies when the project HAS dark mode or the task is adding dark mode
  • If adding dark mode: use next-themes or a similar battle-tested solution
  • Test both themes before declaring done

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

94/100Analyzed 2/23/2026

Highly comprehensive Next.js UI page standards skill with excellent structure, detailed tables, specific requirements (dimensions, character counts), and clear guidance. Covers metadata, loading/error states, component states, forms, mobile-first, SEO, API routes, and site infrastructure. Includes appropriate tags, clear "Use when" section, and proper frontmatter. Located in dedicated skills folder, indicating reusability. No significant penalties apply.

95
95
90
95
95

Metadata

Licenseunknown
Version-
Updated2/19/2026
Publisheradilkalam

Tags

apisecuritytesting