aot-nextjs-server-first
Audit and refactor a Next.js app so data fetching happens on the server, backend credentials never reach the browser, and client-side fetch waterfalls stop…
Skill by Art-of-Technology
Chalk Labs
Need help deploying aot-nextjs-server-first?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/art-of-technology-aot-nextjs-server-first
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, frontend, backend, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/aot-nextjs-server-first
What's inside
- Skill name
aot-nextjs-server-first- Description
- Audit and refactor a Next.js app so data fetching happens on the server, backend credentials never reach the browser, and client-side fetch waterfalls stop causing UI flicker. Use this skill whenever the user asks to "make requests server side", "hide the API payload", "proxy API calls", "stop the UI flickering", "remove client-side fetching", "move this to RSC", "add a BFF", "run aot-nextjs-server-first", or complains about loading spinners, layout shift, waterfalls, double renders, or a backend URL and token visible in DevTools or the JS bundle. Also trigger when reviewing NEXT_PUBLIC_ environment variables, useEffect fetch calls, route handlers, server actions, App Router data flow, TanStack Query setup, caching and revalidation strategy, or multi-tenant scoping in a Next.js frontend. Even if the user does not say "audit", use this skill when they want Next.js data access reviewed or moved behind the server.
- License
- MIT
- Instructions
- 185 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (4)
- SKILL.md
- app-router.md · references/
- bff-proxy.md · references/
- pages-router.md · references/
SKILL.md (first lines)
# aot-nextjs-server-first
Move a Next.js app to a server-first data model. Find every browser-originated call to the backend, route reads through React Server Components, route interactive traffic through a thin BFF layer, keep credentials server side, and remove the fetch waterfalls that cause flicker. Report first. Refactor only after the user confirms.
Two goals sit behind this work, and they are separate. Keep them separate in the report.
1. Correctness and secrecy. Backend base URLs, service tokens, and internal field shapes stay on the server. A leaked token is exploitable by anyone.
2. Perceived performance. Server-rendered first paint with streamed suspense boundaries removes the mount-spinner-fetch-shift sequence.
## Do not confuse hiding with authorization
State this in the report when the user's stated goal is hiding payloads. An authenticated user reads whatever their session grants, DevTools open or not. Proxying does not change the authorization surface. The controls that matter are DTO shaping, field-level allow lists, and tenant scoping enforced in the query. Treat any finding of the form "sensitive field visible in response" as an authorization or DTO finding, not a transport finding.
## What you produce
A single report:
- Summary: Next.js version, router mode, data libraries detected, counts by severity.
- Findings table: ID, severity, category, `file:line`, one-line issue, one-line fix.
- Per-finding detail with a migration snippet in the codebase's idiom.
- A data flow map: which routes render on the server, which components fetch on the client, and where the backend token is read.
- A migration plan ordered by severity and blast radius.
## Scope before scanning
Infer these. Confirm only what you cannot.
1. Target. Repo root, an app inside a monorepo, or a diff. Default to the working tree.
2. Mode. Report-only, or report then refactor. Default to report-only.
3. Backend topology. Same-process API routes, a separate internal API on a private network, or a third-party API. This decides whether a BFF proxy is needed at all. A same-origin API with cookie auth needs far less proxying than a separate service holding a service token.
## Step 1: Detect the setup
```bash
cat package.json 2>/dev/null | grep -E '"(next|react|@tanstack/react-query|swr|axios|ky|@trpc/client)"'
ls -d app src/app pages src/pages 2>/dev/null
ls next.config.* middleware.* 2>/dev/null
grep -rn "NEXT_PUBLIC_" --include='*.ts' --include='*.tsx' --include='*.env*' . 2>/dev/null | head -50
```
Record router mode. App Router with RSC is the target architecture. Pages Router work routes through `getServerSideProps` and API routes instead; the checklist still applies but the idioms differ. Read `references/app-router.md` for App Router, `references/pages-router.md` for Pages Router.
## Step 2: Scan for browser-originated backend access
```bash
# fetch inside effects: the main flicker source
grep -rn -A6 "useEffect(" --include='*.tsx' --include='*.ts' . 2>/dev/null | grep -nE "fetch\(|axios\.|\.get\(|\.post\(" | head -50
# client components doing network work
grep -rln "'use client'" --include='*.tsx' . 2>/dev/null | xargs grep -ln "fetch(\|axios\|ky(" 2>/dev/null
# backend base URLs and tokens exposed to the bundle
grep -rn "NEXT_PUBLIC_.*\(API\|URL\|TOKEN\|KEY\|SECRET\)" --include='*.ts' --include='*.tsx' . 2>/dev/null
# absolute backend hosts hardcoded in components
grep -rnE "https?://[a-zA-Z0-9.-]+" --include='*.tsx' . 2>/dev/null | grep -v "schema.org\|w3.org" | head -30
# route handlers and server actions already present
ls app/api 2>/dev/null; grep -rln "'use server'" --include='*.ts' --include='*.tsx' . 2>/dev/null
```
Then confirm empirically where possible. If the app builds, grep the client chunks for the backend host and any token-shaped string. A hit in `.next/static` is a 🔴 with proof.
```bash
grep -rl "$(echo BACKEND_HOST_HERE)" .next/static 2>/dev/null | head
```
## Step 3: Review against the checklist
Order reflects impact on a multi-tenant CRM handling PII.
1. Credentials in the bundle. Service tokens, API keys, internal hosts, or basic-auth strings reachable from client code or `NEXT_PUBLIC_*`. Any hit is 🔴.
2. Tenant and ownership scoping. Every server-side read derives tenant and user from the session on the server. Never from a client-supplied `orgId`, header, or query param. A route handler that forwards a client-supplied tenant id is 🔴.
3. Route handler as open proxy. A catch-all handler forwarding arbitrary paths, methods, or upstream URLs from the client is 🔴. Proxies expose an allow list of operations, not a tunnel.
4. Initial reads on the client. Above-the-fold data fetched in `useEffect` or a client query hook instead of the server component. Causes flicker and an extra round trip. 🟠.
5. Fetch waterfalls. Sequential dependent fetches, parent fetch then child fetch on mount. Parallelise on the server, or colocate per-component fetches inside suspense boundaries. 🟠.
6. Missing suspense boundaries and streaming. No `loading.tsx`, no `Suspense` around slow segments, so the whole route blocks or the whole route blinks. 🟠.
7. Layout shift from unreserved space. Skeletons that do not match final dimensions, images without dimensions, lists that grow after hydration. 🟠.
8. Mutations from the client to the backend directly. Writes should go through server actions or a BFF route handler so the token stays server side and revalidation is controlled. 🟠.
9. DTO shaping. Server passes raw upstream entities into client components. Internal fields, cost prices, notes, soft-delete flags, and audit columns cross the boundary. Map to explicit DTOs at the server edge. 🟠.
10. Serialization weight. Large payloads serialized into the RSC stream or into client props when the client needs three fields. Slows first paint. 🟡.
11. Caching and revalidation. Every server fetch declares intent: `cache`, `next.revalidate`, or `no-store`. Unintentional caching of per-user data is a correctness and privacy bug, not a perf nit. Per-user data cached across requests is 🔴.
12. Client cache still available where needed. Search-as-you-type, infinite lists, and optimistic updates need a client cache. Removing TanStack Query wholesale to satisfy a server-first rule makes the UX worse. Flag over-migration as a 🟡 finding against the plan, not against the code.
13. Auth propagation. Session cookie read server side, forwarded upstream as a service token plus asserted user identity. No token minted in the browser.
14. Error and empty states. Server errors surface through `error.tsx` and typed action results, not silent empty arrays that look like no data.
15. Middleware weight. Auth checks in middleware are cheap only if they avoid network calls per request. Flag per-request upstream calls in middleware. 🟡.
16. Request deduplication. Same upstream call issued by multiple server components in one render without dedupe or cache.
Record `file:line`, the concrete effect, and the fix in the codebase's idiom.
## Step 4: Choose the target architecture per data path
Do not apply one rule to every call. Classify each data path and record the classification in the report.
- Initial page reads. Server component calls the upstream directly over the private network with a service token. Never through the browser.
- Mutations. Server actions. Return typed results. Revalidate the affected tags or paths.
- Interactive reads, meaning typeahead, filters, pagination, polling. Thin BFF route handlers under `app/api/bff/*`. Session cookie in, DTO out, tenant scope enforced server side. Client keeps its cache.
- Third-party keyed APIs. Always proxied. No exceptions.
- Public static content. Fetch on the server at build or with a revalidate window.
Two rules to state plainly in the report: zero fetch calls inside `useEffect`, and no `NEXT_PUBLIC_*` beyond genuinely public identifiers such as an analytics site id.
Read `references/bff-proxy.md` before writing any proxy or server action code.
## Step 5: Triage
- 🔴 Critical. Credential or internal host in the bundle. Client-supplied tenant id trusted server side. Open proxy. Per-user data cached across requests.
- 🟠 High. Client-side initial reads, waterfalls, direct client writes to the backend, raw entities crossing the client boundary.
- 🟡 Medium. Caching intent unset, oversized payloads, missing skeleton dimensions, per-request middleware calls.
- 🔵 Low. Naming, colocation, and structural cleanups.
Read the real code before scoring. A `NEXT_PUBLIC_` variable holding a public Stripe publishable key is not a finding. Say so under "Reviewed, not a risk".
## Step 6: Report
Use this exact structure.
```markdown
# Next.js Server-First Audit: <target>From Art-of-Technology/skills, MIT.
More from Art-of-Technology/skills
- 0.529score
aot-ci-cd-optimization
Art-of-Technology
Measure and improve GitHub Actions CI/CD speed through independent parallel checks, cancellation of superseded runs, efficient secret scanning, caching and…
SkillBFreshness: BClaude Code +9 - 0.529score
aot-ci-workflows
Art-of-Technology
Cut wasted GitHub Actions runs in a repo and migrate it onto Art of Technology's shared reusable workflows (node-ci, dotnet-ci, docker-build, release), in two…
SkillBFreshness: BClaude Code +9 - 0.529score
aot-security-audit
Art-of-Technology
Run a security audit on a TypeScript/Node.js or C#/ASP.NET Core codebase and produce a prioritized findings report with concrete fixes.
SkillBFreshness: BClaude Code +9 - 0.529score
aot-skill-audit
Art-of-Technology
Security audit of a third-party agent skill or plugin before anyone at Art of Technology installs it.
SkillBFreshness: BClaude Code +9 - 0.529score
aot-design-review
Art-of-Technology
Review a web UI against visual design, interaction, and accessibility principles, then produce a prioritized findings report with concrete code fixes.
SkillBFreshness: BClaude Code +9 - 0.529score
blog-content-agent
Art-of-Technology
Research trends, analyze a product repository to learn what it does, propose blog topics, write a publication-ready post, optionally generate a banner image…
SkillBFreshness: BClaude Code +9 - 0.529score
aot-release-lifecycle
Art-of-Technology
Enforce the trunk-based release lifecycle across environments.
SkillBFreshness: BClaude Code +9 - 0.524score
aot-ship-loop
Art-of-Technology
Ship a code change through the complete Art of Technology quality loop: committed feature branch, no-mistakes validation, lint and tests, pull request…
SkillBFreshness: BClaude Code +9 - 0.524score
aot-pr-loop
Art-of-Technology
Address Octopus Review feedback on a GitHub pull request in a tight loop until the PR earns a 4+/5 quality score.
SkillBFreshness: BClaude Code +9 - 0.524score
actionable-output
Art-of-Technology
Make every response short, clear, and actionable.
SkillBFreshness: BClaude Code +9 - 0.524score
aot-brief
Art-of-Technology
Shape agent replies for ADHD-friendly scanning and fewer output tokens.
SkillBFreshness: BClaude Code +9 - 0.516score
aot-rundown
Art-of-Technology
Give a concise whole-project status rundown from the current repository and GitHub state.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 31, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Art-of-Technology/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Art-of-Technology
- 0.529score
aot-ci-cd-optimization
Art-of-Technology
Measure and improve GitHub Actions CI/CD speed through independent parallel checks, cancellation of superseded runs, efficient secret scanning, caching and…
SkillBFreshness: BClaude Code +9 - 0.529score
aot-ci-workflows
Art-of-Technology
Cut wasted GitHub Actions runs in a repo and migrate it onto Art of Technology's shared reusable workflows (node-ci, dotnet-ci, docker-build, release), in two…
SkillBFreshness: BClaude Code +9 - 0.529score
aot-design-review
Art-of-Technology
Review a web UI against visual design, interaction, and accessibility principles, then produce a prioritized findings report with concrete code fixes.
SkillBFreshness: BClaude Code +9 - 0.529score
aot-release-lifecycle
Art-of-Technology
Enforce the trunk-based release lifecycle across environments.
SkillBFreshness: BClaude Code +9 - 0.529score
aot-security-audit
Art-of-Technology
Run a security audit on a TypeScript/Node.js or C#/ASP.NET Core codebase and produce a prioritized findings report with concrete fixes.
SkillBFreshness: BClaude Code +9 - 0.529score
aot-skill-audit
Art-of-Technology
Security audit of a third-party agent skill or plugin before anyone at Art of Technology installs it.
SkillBFreshness: BClaude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get aot-nextjs-server-first running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
aot-nextjs-server-first skill. Agent Mart. https://agentmart.dev/skills/art-of-technology-aot-nextjs-server-first (last updated 2026-10-24)