devlearn-next

Guide Next.js App Router implementation with file-based routing and component boundaries.

1|Updated May 24, 2026
One-click install
npx skills add https://github.com/mrdulasolutions/DevLearn --skill devlearn-next
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: devlearn-next
Source: https://github.com/mrdulasolutions/DevLearn/tree/main/devlearn-next
Command: npx skills add https://github.com/mrdulasolutions/DevLearn --skill devlearn-next

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It fixes confusion and mistakes when teaching or implementing Next.js App Router projects, especially around routing, server vs client components, and data fetching.

Core Features & Use Cases

  • App Router file-based routing: Maps app/ folders to URL paths and explains page.tsx and layout.tsx roles.
  • Server/client boundary clarity: Guides when to keep files as Server Components (default) versus when to add 'use client' for interactivity.
  • Data fetching and API patterns: Covers server fetch, route.ts handlers for mutations, and optional Server Actions for form-driven workflows.
  • Environment variable safety: Explains process.env vs NEXT_PUBLIC_* and reinforces restarting dev after .env changes.
  • Deploy handoffs: Points to the correct DevLearn lifecycle skills for deployment and post-ship verification.

Quick Start

Teach your agent to update your Next.js App Router by converting a specific route segment in app/ (using page.tsx and layout.tsx) while choosing the correct Server vs Client boundary for any interactivity.

Frequently Asked Questions about devlearn-next

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

FAQPage Schema
How do I structure Next.js App Router routes using page.tsx and layout.tsx?

Next.js App Router maps folders inside the `app/` directory to URL paths. You define UI using `page.tsx` for route content and `layout.tsx` for shared wrapping components across nested segments.

When do I need to add 'use client' to a server component in Next.js?

Add the `'use client'` directive when a component requires interactivity, state, or browser APIs. Keep components as Server Components by default to leverage server-side data fetching and reduce client bundle size.

What is the correct way to fetch data in Next.js server components?

Data fetching in Next.js server components can use the native `fetch` API directly. This allows caching and revalidation configuration at the request level without needing extra client-side fetching libraries.

How do I handle API mutations with route.ts handlers in the App Router?

Use `route.ts` files within the `app/` directory to create route handlers for API mutations. This approach processes requests like standard web APIs and works well alongside server components.

Do I need to restart the dev server after changing Next.js environment variables?

Yes, you must restart your development server after changing `.env` files. Next.js loads environment variables at startup, so updates to `process.env` or `NEXT_PUBLIC_*` will not apply until restart.

What is the difference between process.env and NEXT_PUBLIC_ variables in Next.js?

`NEXT_PUBLIC_` variables are exposed to the browser, while standard `process.env` variables remain server-only. This boundary ensures sensitive secrets stay secure within server components and route handlers.