next-intl-app-router
Skill0 starsChanged 3 months agoMITView on GitHub
Comprehensive guidelines for Next.js App Router, next-intl i18n routing, catching unmatched routes, and multi-directional (LTR/RTL) layout setup.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- liuchiawei/agent-skillstheir own version, first seen Feb 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- liuchiawei/agent-skills★ 2same 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.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
All localized pages MUST live inside src/app/[locale]/.
- Very specific: line 75
MUST extract locale from params (handle async params in Next.js 15+).
- Very specific: line 76
MUST validate locale against supported list (['tr', 'en', 'ar']) using notFound() if invalid.
- Very specific: line 77
MUST dynamically set <html lang={locale} dir={isRtlLocale(locale) ?
- Very specific: line 78
MUST wrap the layout with NextIntlClientProvider using messages retrieved via getMessages() from next-intl/server.
- Distinctive: line 82
MUST use Tailwind CSS Logical Properties for alignment to prevent broken layouts when switching between LTR and RTL languages (e.g., …
- Very specific: line 89
MUST import Link, redirect, useRouter, and usePathname from @/i18n/navigation (or next-intl/navigation), NEVER directly from next/link or …
≈ “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.
Files
Next.js App Router + next-intl Complete Skill
1. Directory Structure & File Placement
- Root Directory (
src/app/):page.tsx: Handles root redirects if middleware is bypassed or static export is used. MUST redirect to default locale (/tr).not-found.tsx: Global catch-all 404 page for unmatched routes outside any locale context (e.g.,/unknown.txt).middleware.ts: Handles dynamic locale detection and routing at the edge.
- Locale Directory (
src/app/[locale]/):- All localized pages MUST live inside
src/app/[locale]/. layout.tsx: Root localized layout. Configures htmllanganddir(RTL/LTR).page.tsx: Main localized entry page.error.tsx¬-found.tsx: Must reside inside[locale]to retain language and RTL context during error states.[...rest]/page.tsx: Catch-all route to handle invalid paths inside a locale and triggernotFound().
- All localized pages MUST live inside
2. Root Redirects & Catch-All Page Rules
src/app/page.tsx (Root Page)
import { redirect } from 'next/navigation';
// Executed as fallback for static export or direct root access
export default function RootPage() {
redirect('/tr'); // Default locale is 'tr'
}src/app/not-found.tsx (Global 404 Page)
'use client';
import Error from 'next/error';
// Renders when a non-localized route (e.g. `/unknown.txt`) is requested,
// or when root layout validation fails before entering `[locale]`.
export default function GlobalNotFound() {
return (
<html lang="en">
<body>
<Error statusCode="{404}"/>
</body>
</html>
);
}src/app/[locale]/[...rest]/page.tsx (Unmatched Route Handler)
import { notFound } from 'next/navigation';
export default function CatchAllPage() {
notFound();
}3. Root Layout (src/app/[locale]/layout.tsx) & RTL Support
- MUST extract
localefromparams(handle asyncparamsin Next.js 15+). - MUST validate
localeagainst supported list (['tr', 'en', 'ar']) usingnotFound()if invalid. - MUST dynamically set
<html lang={locale} dir={isRtlLocale(locale) ? 'rtl' : 'ltr'}>(e.g., set dir="rtl" for RTL languages like Arabic, Hebrew, Persian, or Urdu). - MUST wrap the layout with
NextIntlClientProviderusing messages retrieved viagetMessages()fromnext-intl/server.
4. RTL & Tailwind Logical Properties
- MUST use Tailwind CSS Logical Properties for alignment to prevent broken layouts when switching between LTR and RTL languages (e.g., Arabic, Hebrew):
- Margins:
ms-*/me-*(instead ofml-*/mr-*) - Padding:
ps-*/pe-*(instead ofpl-*/pr-*) - Positioning:
start-*/end-*(instead ofleft-*/right-*)
- Margins:
5. Navigation & Data Patterns
- MUST import
Link,redirect,useRouter, andusePathnamefrom@/i18n/navigation(ornext-intl/navigation), NEVER directly fromnext/linkornext/navigation. - Data fetching logic MUST be isolated in
src/lib/data.ts. Server Components should call data functions directly without internal HTTPfetch().
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
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.

