Agent skill
nextjs-best-practices
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/nextjs-best-practices
SKILL.md
---name: nextjs-best-practices description: Guidelines for building scalable, SEO-friendly applications with Next.js (App Router). license: MIT metadata: author: AI Group version: "1.0.0" category: Software_Engineering compatibility:
- system: Next.js 14+
- system: React 18+ allowed-tools:
- read_file
- replace
- write_file
keywords:
- nextjs-best-practices
- automation
- biomedical measurable_outcome: execute task with >95% success rate. ---"
Next.js Best Practices
This skill outlines the standards for developing modern web applications using the Next.js App Router. It covers server components, data fetching, caching strategies, and route handling.
When to Use This Skill
- Project Setup: Initializing a new Next.js project.
- Architecture Design: Deciding between Server vs. Client Components.
- Optimization: Improving Core Web Vitals, LCP, and CLS.
- SEO Strategy: Implementing Metadata API and sitemaps.
Core Capabilities
- App Router Architecture: structuring
app/,layout.tsx,page.tsx, andloading.tsx. - Server Actions: Handling form submissions and mutations without API routes.
- Data Fetching: Implementing
fetchwith caching tags and revalidation strategies. - Middleware: Authentication and request processing at the edge.
Workflow
- Determine Component Type: Default to Server Components. "Use Client" only for interactivity (hooks, event listeners).
- Plan Data Access: Fetch data directly in Server Components where possible.
- Implement Metadata: specific exportable
metadataobjects for SEO. - Handle Errors: Use
error.tsxandglobal-error.tsxfor graceful degradation.
Example Usage
User: "Create a blog post page that fetches data from a CMS."
Agent Action:
- Reads
references/rules.md. - Generates
app/blog/[slug]/page.tsxas an async Server Component. - Uses
generateStaticParamsfor SSG.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?