Kiro steering for Next.js App Router on AWS: Server Components, async params, validated Server Functions, and Amplify Hosting support limits to check before deploying.
.kiro/steering/kiro-nextjs-app-router.md. Downloaded files need to be placed in that repository path.---
inclusion: fileMatch
fileMatchPattern: "**/*"
---
Apply these rules to Next.js App Router code in this workspace.
## Server Components
```tsx
// app/products/page.tsx
import { fetchProducts } from '@/lib/products';
import { ProductList } from './product-list';
export default async function ProductsPage() {
const products = await fetchProducts();
return (
<main>
<h1>Products</h1>
<ProductList products={products} />
</main>
);
}
```
- Pages and layouts are Server Components unless marked `'use client'`.
- `params` and `searchParams` are Promises (Next.js 15+): `const { id } = await params;`.
## Server Functions
```ts
// app/products/actions.ts
'use server';
import { revalidatePath } from 'next/cache';
import { z } from 'zod';
import { requireUser } from '@/lib/auth';
import { db } from '@/lib/db';
const ProductInput = z.object({ name: z.string().trim().min(1).max(120) });
export async function createProduct(formData: FormData) {
await requireUser(); // throws or redirects when not signed in
const parsed = ProductInput.safeParse({ name: formData.get('name') });
if (!parsed.success) return { error: 'Name is required' };
await db.product.create({ data: parsed.data });
revalidatePath('/products');
return { ok: true };
}
```
- Check auth and validate input in every Server Function; they can be called by direct POST requests.
## AWS Amplify Hosting
- Check support first: AWS documents Amplify Hosting SSR for Next.js 12 through 15 and lists unsupported features (including Edge middleware, on-demand ISR and streaming). If the app uses Next.js 16 or an unsupported feature, verify current support or choose another deployment path.
- Keep build settings in `amplify.yml` in the repository.
- Set environment variables per branch in the Amplify console; server-side variables must be made available to the Next.js runtime as described in the Amplify docs, and only `NEXT_PUBLIC_` variables reach the browser.
- Configure custom domains and HTTPS in Amplify; confirm SSR pages return fresh data after deploy.
Cursor rules for Next.js 14+ App Router projects updated for Next.js 16 with async params, validated Route Handlers, generateMetadata and proxy.ts in place of middleware.
CLAUDE.md rules for the Next.js 16 App Router with async params, streaming via Suspense, secured Server Actions, metadata conventions and explicit caching choices.
Copilot instructions for Next.js App Router code with awaited params, authenticated Server Actions, typed Route Handlers and explicit caching.
Kiro
fullstack
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
A Kiro project plans to deploy a Next.js App Router app to Amplify Hosting; its Server Action casts formData.get('name') to string and never imports revalidatePath.
Prepare app/products for production on Amplify and fix the createProduct action.
createProduct checks the user, validates name with a schema, imports revalidatePath from next/cache, and returns a typed error; the answer checks the project's Next.js version against Amplify's documented 12–15 SSR support and lists any unsupported features in use before writing amplify.yml.
Kiro, built and operated by AWS, uses steering files: Markdown documents in .kiro/steering/ that give the agent persistent project knowledge. Front matter controls when each file is included: always, when matching files are in context, manually by #name, or automatically by description. Kiro also includes AGENTS.md files.
.kiro/steering/kiro-nextjs-app-router.mdStarting point, not a tested configuration for your repository. Included when files matching fileMatchPattern are in context. Review the instructions, adapt the file paths and run your project's existing checks.
---
inclusion: fileMatch
fileMatchPattern: "**/*"
---
Apply these rules to Next.js App Router code in this workspace.
## Server Components
```tsx
// app/products/page.tsx
import { fetchProducts } from '@/lib/products';
import { ProductList } from './product-list';
export default async function ProductsPage() {
const products = await fetchProducts();
return (
<main>
<h1>Products</h1>
<ProductList products={products} />
</main>
);
}
```
- Pages and layouts are Server Components unless marked `'use client'`.
- `params` and `searchParams` are Promises (Next.js 15+): `const { id } = await params;`.
## Server Functions
```ts
// app/products/actions.ts
'use server';
import { revalidatePath } from 'next/cache';
import { z } from 'zod';
import { requireUser } from '@/lib/auth';
import { db } from '@/lib/db';
const ProductInput = z.object({ name: z.string().trim().min(1).max(120) });
export async function createProduct(formData: FormData) {
await requireUser(); // throws or redirects when not signed in
const parsed = ProductInput.safeParse({ name: formData.get('name') });
if (!parsed.success) return { error: 'Name is required' };
await db.product.create({ data: parsed.data });
revalidatePath('/products');
return { ok: true };
}
```
- Check auth and validate input in every Server Function; they can be called by direct POST requests.
## AWS Amplify Hosting
- Check support first: AWS documents Amplify Hosting SSR for Next.js 12 through 15 and lists unsupported features (including Edge middleware, on-demand ISR and streaming). If the app uses Next.js 16 or an unsupported feature, verify current support or choose another deployment path.
- Keep build settings in `amplify.yml` in the repository.
- Set environment variables per branch in the Amplify console; server-side variables must be made available to the Next.js runtime as described in the Amplify docs, and only `NEXT_PUBLIC_` variables reach the browser.
- Configure custom domains and HTTPS in Amplify; confirm SSR pages return fresh data after deploy.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
Front matter must be at the very beginning of a steering file to be recognized. Kiro supports AGENTS.md. According to the steering docs, AGENTS.md files do not support inclusion modes and are always included, so keep scoped guidance in .kiro/steering/ files instead.
Documentation checked 2026-11-05: Kiro docs: SteeringKiro home page
Cursor rules for Next.js 14+ App Router projects updated for Next.js 16 with async params, validated Route Handlers, generateMetadata and proxy.ts in place of middleware.
CLAUDE.md rules for the Next.js 16 App Router with async params, streaming via Suspense, secured Server Actions, metadata conventions and explicit caching choices.
Copilot instructions for Next.js App Router code with awaited params, authenticated Server Actions, typed Route Handlers and explicit caching.