Skip to content
Back to skills

Next Js Patterns

ASecurity

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

  • 416 stars
  • 0 votes
  • 1 copy
  • 5 views
  • Added February 7, 2026
developmentgonextjsapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add aiskillstore/marketplace --skill next-js-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Next Js Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Next Js Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aiskillstore-next-js-patterns/badge)](https://www.skillsdirectory.com/skills/aiskillstore-next-js-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: next-js-patterns
description: Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.
---

# Next.js Patterns

## App Router
We use the Next.js 15 App Router located in `app/`.

### Pages
- **Location**: `app/[route]/page.tsx`
- **Component**: Default export function.
- **Client vs Server**: Use `"use client"` directive at the top for components requiring state (`useState`, `useEffect`) or browser APIs. otherwise default to Server Components.

### Layouts
- **Location**: `app/layout.tsx` (Root), `app/[route]/layout.tsx` (Nested).
- **Purpose**: Wrappers for pages, holding navigation, fonts, and metadata.

## Navigation
- Use `Link` from `next/link` for internal navigation.
- Use `useRouter` from `next/navigation` for programmatic navigation (inside Client Components).

```tsx
import Link from "next/link";
import { useRouter } from "next/navigation";

// Link
<Link href="/dashboard">Dashboard</Link>

// Router
const router = useRouter();
router.push('/login');
```

## Data Fetching
- **Server Components**: Fetch directly using `await fetch()` or DB calls.
- **Client Components**: Use `useEffect` or SWR/TanStack Query (if added later). Currently using standard `fetch` in `useEffect`.

## Font Optimization
- We use `next/font/google` (e.g., Poppins) in `app/layout.tsx`.
- Variable fonts are passed to `body` className.

## Metadata
- Define `export const metadata: Metadata = { ... }` in `page.tsx` or `layout.tsx` for SEO.

Files in this skill

  • SKILL.md1.5 KB
  • skill-report.json10.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…