nextjs-pages-router
БесплатноБез исполняемых скриптовНе проверенImplement Pages Router data fetching with getServerSideProps, getStaticProps, and API routes in Next.js legacy projects. Use when working in a pages/…
от HoangNguyen0403★ 598 звёзд на GitHubОб этом скилле
Next.js Pages Router (Legacy)
Priority: P0 (CRITICAL)
[!IMPORTANT] project uses Next.js Pages Router (
pages/directory). NOT use App Router features.
Workflow: Add Server-Rendered Page
- Create page file — Add
pages/posts/[id].tsx. - Add data fetching — Export
getServerSidePropsorgetStaticProps+getStaticPaths. - Import service directly — Never fetch your own
/apiroutes from server-side hooks. - Type props — Use
InferGetServerSidePropsType<typeof getServerSideProps>.
getServerSideProps Example
Implementation Guidelines
- Routing Architecture: Use
pages/directory. Use_app.tsxfor global state/layouts and_document.tsxfor custom HTML attributes. Define dynamic routes using brackets[id].tsxor catch-all[...slug].tsx. - Data Fetching (SSR/SSG): Use
getServerSideProps(for every request) orgetStaticProps(at build time) withgetStaticPathsfor dynamic routes. Export these as standaloneasyncfunctions. - Logic Isolation: Never
fetchyour own/apiendpoints from Server-Side hooks. Import service layer or DB logic directly. - Client Hooks: Use
useRouter()fromnext/routerfor navigation and access to query params. Userouter.push()or<Link>for client-side routing. - APIs: Implement API Routes in
pages/api/for server-only logic or webhooks. Standardize responses with appropriate HTTP status codes. - Next.js 15+ Compatibility: cautious of Next.js 15 upgrades; ensure all
getServerSidePropsreturn objects that match expectedPageProps. - Styling: Standardize via CSS Modules (
*.module.css) or Tailwind CSS. Avoid global CSS unless imported in_app.tsx.
Anti-Patterns
- No fetching own /api routes from SSR: Import service layer directly.
- No global CSS outside _app.tsx: Use CSS Modules or Tailwind for scoped styles.
- No App Router features in Pages Router projects: Avoid
app/directory patterns.
References
Установить nextjs-pages-router в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл nextjs-pages-router?
Implement Pages Router data fetching with getServerSideProps, getStaticProps, and API routes in Next.js legacy projects. Use when working in a pages/ directory project, adding SSR/SSG data fetching, or creating API routes.
Как установить скилл nextjs-pages-router?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nextjs-pages-router запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic