agentleFS
MohammadShehadehMohammadShehadeh/agent-skills/skills/nextjs-page/SKILL.md

nextjs-page

Skill2 starsChanged 15 days agoMITView on GitHub

Build a Next.js App Router page, route group, or landing section the agent-craft way — a thin server page composing section components, client code only in leaves, metadata through the root title template and a buildPageMetadata function, routes registered in one typed config. Use whenever the user asks for a new page, route, landing or marketing section, hero, pricing or about page, layout, route group, SEO metadata, or sitemap entry, even when they only say "add a page for X".

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. oscarcitoz/ai-engine★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository9 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every Next.js routing and metadata rule lives here.

    line 8
  2. Distinctive:

    The page file only composes sections: No business logic, no markup beyond layout.

    line 12
  3. Distinctive:

    Keep the tree page → section → primitive.

    line 44
  4. Very specific:

    Use the framework's file conventions (loading.tsx, error.tsx, not-found.tsx, sitemap.ts, robots.ts, route handlers) instead of hand-rolling …

    line 51
  5. Very specific:

    Every page has description, openGraph, twitter, and alternates.canonical.

    line 57
  6. Distinctive:

    Every section that loads data has a loading, empty, and error state.

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

agent-craft Next.js Page

Every Next.js routing and metadata rule lives here. Load agent-craft:conventions for the rules that apply to all code; its components.md holds the server/client boundary rules.

Gates

  • The page file only composes sections. No business logic, no markup beyond layout.
  • No layout wrapper or section base component invented for one page. Use the repo's container, otherwise a plain <section>.
  • No route added without registering it in the repo's typed routes config, when it has one.

1. The page

A thin server component, export default function (Next.js requires the default export):

// app/(marketing)/page.tsx
export const metadata = buildPageMetadata({
  title: 'Pricing',
  description: 'Plans for every team size.',
  path: '/pricing',
});

export default function PricingPage() {
  return (
    <>
      <section><PricingHero /></section>
      <section><PricingTable /></section>
    </>
  );
}

Wrap sections in the repo's layout or container component when one exists.

2. Sections

  • Server components, colocated with the route; moved to shared components/ only when a second route uses them.
  • A section's markup is readable in its own file: content as a typed as const array in that file, data fetched by the section that renders it.
  • Keep the tree page → section → primitive.
  • Interactivity goes in a leaf: a section stays a server component and renders a small 'use client' child.

3. Routing

  • Route groups (folder) organize by domain without changing URLs ((marketing), (dashboard)), each with its own layout.tsx.
  • A route folder owns its feature code (see agent-craft:feature). Only code shared across routes goes to top-level folders.
  • Use the framework's file conventions (loading.tsx, error.tsx, not-found.tsx, sitemap.ts, robots.ts, route handlers) instead of hand-rolling them.
  • Navigation and sitemap.ts both read one typed routes config; a path is written once.

4. Metadata

  • The root layout sets metadataBase: new URL(siteConfig.url) (relative Open Graph and canonical URLs break without it) and title: { template: '%s - Site Name', default: 'Site Name — tagline' }. Pages set a bare title; the home page omits it and gets default.
  • Every page has description, openGraph, twitter, and alternates.canonical.
  • Once three pages repeat the same metadata shape, build it with one plain function:
// lib/page-metadata.ts
interface PageMetadataInput {
  title: string;
  description: string;
  path: string;
}

export const buildPageMetadata = ({ title, description, path }: PageMetadataInput): Metadata => ({
  title,
  description,
  alternates: { canonical: path },
  openGraph: { title, description, url: path, images: ['/og.jpg'] },
  twitter: { card: 'summary_large_image', title, description },
});
  • JSON-LD is a plain <script> with < escaped:
<script
  type="application/ld+json"
  dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd).replace(/</g, '\\u003c') }}
/>

5. Verify

  • rg "'use client'" <route folder> matches only leaf components, never page.tsx, layout.tsx, or a section.
  • rg "export default" <route folder> matches only Next.js file conventions.
  • Every section that loads data has a loading, empty, and error state.
  • The rendered <title> goes through the root template, and the canonical URL is absolute.
  • The route appears in navigation and sitemap.ts without a second hardcoded path.
  • The repo's typecheck and lint scripts pass.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.