accelint-nextjs-best-practices
Skill25 starsChanged 54 days agoApache-2.0View on GitHub
Next.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use this skill when the task involves:
- Distinctive: line 43
Import optimization (barrel file issues)
- Distinctive: line 56
Do not activate for:
- Distinctive: line 103
Read AGENTS.md for a concise overview of all rules with one-line summaries.
- Distinctive: line 106
When you identify a relevant optimization, load the corresponding reference file for detailed implementation guidance:
- Very specific: line 141
When this skill is invoked for Next.js code review, use the standardized report format:
- Distinctive: line 180
Start operations immediately and use Promise.allSettled()
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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 Best Practices
Comprehensive performance optimization and best practices for Next.js applications, designed for AI agents and LLMs working with Next.js code.
When to Activate This Skill
Use this skill when the task involves:
Writing Next.js Code
- Creating Server Components or Client Components
- Implementing Server Actions with
"use server" - Writing API route handlers
- Setting up data fetching in RSC (React Server Components)
- Implementing Suspense boundaries
- Using Next.js-specific APIs (
headers(),cookies(),after())
Refactoring Next.js Code
- Optimizing server-side data fetching
- Reducing RSC serialization overhead
- Converting sequential to parallel operations
- Restructuring component composition for better performance
- Migrating between Server and Client Components
Performance Optimization
- Eliminating server-side waterfalls
- Reducing response times in API routes and Server Actions
- Minimizing data transfer at RSC boundaries
- Implementing request deduplication with
React.cache() - Using
after()for non-blocking operations
Next.js-Specific Issues
- Authentication/authorization in Server Actions
- RSC serialization duplication problems
- Import optimization (barrel file issues)
- Server vs Client Component decision-making
- Parallel data fetching patterns
Code Review
- Reviewing Next.js code for performance anti-patterns
- Identifying security issues in Server Actions
- Checking proper Server/Client Component boundaries
- Ensuring proper authentication patterns
- Validating Suspense boundary placement
When NOT to Use This Skill
Do not activate for:
- React-specific optimizations (use
accelint-react-best-practicesskill) - Build configuration (webpack, turbopack) unless Next.js-specific
- General TypeScript/JavaScript questions (use
accelint-ts-best-practicesskill) - Deployment/hosting configuration
- Testing setup (use
accelint-ts-testingskill)
Example Trigger Phrases
This skill should activate when users say things like:
Performance Issues:
- "This Next.js API route is slow"
- "My Server Component is blocking the entire page"
- "Optimize this Server Action"
- "The page takes forever to load data"
- "There's a waterfall in my data fetching"
Security Issues:
- "Add authentication to this Server Action"
- "This Server Action needs authorization"
- "Secure this API route"
- "Validate input in this Server Action"
Debugging Issues:
- "Why is my RSC props so large?"
- "This data is being duplicated in the HTML"
- "My imports are slow in development"
- "Should this be a Server or Client Component?"
Code Review:
- "Review this Next.js code for performance issues"
- "Is this Server Action secure?"
- "Can you optimize this data fetching?"
- "Check if this component should be server or client"
Refactoring:
- "Parallelize these data fetches"
- "Reduce the serialization size"
- "Convert this to use Suspense"
- "Optimize this barrel import"
How to Use
This skill uses a progressive disclosure structure to minimize context usage:
1. Start with the Overview (AGENTS.md)
Read AGENTS.md for a concise overview of all rules with one-line summaries.
2. Load Specific Rules as Needed
When you identify a relevant optimization, load the corresponding reference file for detailed implementation guidance:
General Patterns:
- prevent-waterfall-chains.md (1.1)
- parallelize-independent-operations.md (1.2)
- strategic-suspense-boundaries.md (1.3)
Server-Side Performance:
- server-actions-security.md (2.1)
- avoid-duplicate-serialization.md (2.2)
- minimize-serialization.md (2.3)
- parallel-data-fetching.md (2.4)
- react-cache-deduplication.md (2.5)
- use-after-non-blocking.md (2.6)
Misc:
- avoid-barrel-imports.md (3.1)
- server-vs-client-component.md (3.2)
Quick References:
- quick-checklist.md
- compound-patterns.md
Automation Scripts:
- scripts/ - Helper scripts to detect anti-patterns
3. Apply the Pattern
Each reference file contains:
- ❌ Incorrect examples showing the anti-pattern
- ✅ Correct examples showing the optimal implementation
- Explanations of why the pattern matters
- Performance impact metrics
- Related patterns and references
4. Use the Report Template
When this skill is invoked for Next.js code review, use the standardized report format:
Template: assets/output-report-template.md
The report format provides:
- Executive Summary with impact assessment
- Severity levels (Critical, High, Medium, Low) for prioritization
- Impact analysis (performance, security, data transfer, maintainability)
- Categorization (Server Actions, RSC Serialization, Data Fetching, Component Architecture)
- Pattern references linking to detailed guidance in references/
- Summary table for tracking all issues
When to use the report template:
- Skill invoked directly via
/accelint-nextjs-best-practices <path> - User asks to "review Next.js code" or "audit Next.js app" across file(s), invoking skill implicitly
When NOT to use the report template:
- User asks to "fix this Server Action" (direct implementation)
- User asks "what's wrong with this code?" (answer the question)
- User requests specific fixes (apply fixes directly without formal report)
Examples
Example 1: Optimizing Server Action Security
Task: "Add authentication to this Server Action"
Approach:
- Read AGENTS.md overview
- Identify issue: Server Action needs authentication
- Load server-actions-security.md
- Apply authentication pattern with validation
Example 2: Eliminating Waterfalls
Task: "This page loads slowly with multiple fetches"
Approach:
- Read AGENTS.md overview
- Identify issue: Sequential data fetching
- Load prevent-waterfall-chains.md and parallelize-independent-operations.md
- Start operations immediately and use Promise.allSettled()
Example 3: Reducing Serialization
Task: "The HTML response is huge with user data"
Approach:
- Read AGENTS.md overview
- Identify issue: Over-serialization at RSC boundary
- Load minimize-serialization.md
- Pass only necessary fields, transform on client
Additional Resources
Official Next.js documentation:
Other versions1 project uses a version of this.
Word for word · 1
- davidanthonyn/claude-skills★ 0100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
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.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/accelint-design-foundation/AGENTS.mdAGENTS.md
- skills/accelint-eval-architect/AGENTS.mdAGENTS.md
- skills/accelint-nextjs-best-practices/AGENTS.mdAGENTS.md
- skills/accelint-prompt-manager/AGENTS.mdAGENTS.md
- skills/accelint-react-best-practices/AGENTS.mdAGENTS.md
- skills/accelint-react-testing/AGENTS.mdAGENTS.md
- skills/accelint-readme-writer/AGENTS.mdAGENTS.md
- skills/accelint-security-best-practices/AGENTS.mdAGENTS.md
- skills/accelint-skill-manager/AGENTS.mdAGENTS.md
- skills/accelint-skill-manager/references/agents.mdAGENTS.md
- skills/accelint-ts-best-practices/AGENTS.mdAGENTS.md
- skills/accelint-ts-documentation/AGENTS.mdAGENTS.md
- skills/accelint-ts-performance/AGENTS.mdAGENTS.md
- skills/accelint-ts-testing/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- accelint-ac-to-playwrightSkill
- accelint-architecture-docSkill
- accelint-archive-synthesisSkill
- accelint-design-foundationSkill
- accelint-english-managerSkill
- accelint-eval-architectSkill
- accelint-onboard-agentsSkill
- accelint-onboard-openspecSkill
- accelint-persona-reviewSkill
- accelint-prompt-managerSkill
- accelint-qrspi-applySkill
- accelint-qrspi-archiveSkill
- accelint-qrspi-proposeSkill
- accelint-react-best-practicesSkill
- accelint-react-testingSkill
- accelint-readme-writerSkill
- accelint-security-best-practicesSkill
- referencesSkill
- accelint-skill-managerSkill
- accelint-skill-proseSkill
- accelint-tanstack-query-best-practicesSkill
- accelint-ts-audit-allSkill
- accelint-ts-best-practicesSkill
- accelint-ts-documentationSkill
- accelint-ts-performanceSkill
- accelint-ts-testingSkill
- constraints-extractorSkill
- context-driftSkill
- epistemic-mapperSkill
- generate-docsSkill
- jargon-extractorSkill
- pr-descriptionSkill
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.

