civiltekk-nextjs-skill
darellchua2/civiltekk-opencode-claude-skills/skills/civiltekk-nextjs-skill/SKILL.md
Next.js engineering, four routes. scaffold: scaffold standardized Next.js 16 demos — shadcn, Tailwind v4, src directory with path aliases, React Compiler, Tekk-prefixed components. runtime-diagnosis: next-devtools-mcp — Next.js 16+ runtime diagnosis via MCP (get_errors, get_logs, get_routes, server actions); config and workflows. image-usage: proper Next.js 16 Image component usage with configuration for remote domains, responsive images, and breaking changes from previous versions. threejs: Three.js + Next.js (App Router, React 19) integration — SSR pitfalls, GLSL bundling, hydration, WebGL context loss, R3F/drei, WebXR, companion-library decision tree; version detection first.
What's in it
- What I do
- Runtime-diagnosis availability gate (hard)
- Side files (load rules)
- Routes
- Boundaries
- Agent behavior rules
- Return Contract
---
name: civiltekk-nextjs-skill
description: >-
Next.js engineering, four routes. scaffold: scaffold standardized Next.js
16 demos — shadcn, Tailwind v4, src directory with path aliases, React
Compiler, Tekk-prefixed components. runtime-diagnosis: next-devtools-mcp —
Next.js 16+ runtime diagnosis via MCP (get_errors, get_logs, get_routes,
server actions); config and workflows. image-usage: proper Next.js 16
Image component usage with configuration for remote domains, responsive
images, and breaking changes from previous versions. threejs: Three.js +
Next.js (App Router, React 19) integration — SSR pitfalls, GLSL bundling,
hydration, WebGL context loss, R3F/drei, WebXR, companion-library decision
tree; version detection first.
license: Apache-2.0
compatibility: opencode
metadata:
pattern: "mcp-diagnosis, image-implementation"
category: Framework-Specific
---
Consolidates nextjs-standard-setup-skill + nextjs-devtools-mcp-skill +
nextjs-image-usage-skill + threejs-nextjs-skill (#604). Alias: formerly
those four skills.
## What I do
Next.js 16 engineering across four routes:
1. **Detect the route** (§Routes) — explicit > inferred > ask-once.
Explicit: the request names the activity ("create next.js app",
"scaffold next.js", "new next.js demo" → `scaffold`; "next.js errors",
"debug next.js", "server action not working", "nextjs mcp" →
`runtime-diagnosis`; `<img>` in Next 16 code, "remote image domains",
"images.remotePatterns" → `image-usage`; "three.js", "R3F", "drei",
"WebGL canvas", "WebXR" → `threejs`). Inferred: the artifact shape (a
new project or a house-structure standardization → `scaffold`; a
running app's errors/routes/logs/metadata → `runtime-diagnosis`; image
tags or image config → `image-usage`; 3D/WebGL scene code → `threejs`).
Ambiguous ("make this Next.js app work") → ask once per run, then
proceed on the answer.
2. **Load the route's values file** (§Side files) and apply its contract.
The §Runtime-diagnosis availability gate below applies BEFORE any
`runtime-diagnosis` MCP call — it lives here, not in a values file.
3. The routes compose — a scaffold pass applies route `image-usage` rules
from the start (`next/image` everywhere); a diagnosis on a Three.js app
walks `runtime-diagnosis` then `threejs` for scene-specific pitfalls.
Load per request, not all four up front.
## Runtime-diagnosis availability gate (hard)
`runtime-diagnosis` MCP tools work ONLY when ALL of these hold — check
before the first tool call, not after a failure:
| Requirement | Status |
|-------------|--------|
| Next.js 16+ (built-in `/_next/mcp` endpoint) | project dependency |
| Running Next.js dev server (`npm run dev`) | required for live features |
| `next-devtools` server in `opencode.json` `mcp.servers` | required for MCP tool access |
| `permissions` rule `{ "action": "next-devtools*", "resource": "*", "effect": "allow" }` | **no rule by default** — user must opt in |
If ANY requirement is unmet, MCP tools return connection errors — that is
an environment gap, not an app bug; do not retry-loop it.
**File-based fallback (always available, no MCP needed):**
- **Routes:** glob `app/**/page.{tsx,ts,jsx,js}` and `app/**/route.{tsx,ts,jsx,js}` + `pages/**/*.{tsx,ts,jsx,js}` for Pages Router
- **Page metadata:** read page files directly to detect `'use client'` directives and `export const metadata`
- **Server Actions:** grep for `'use server'` to locate action files
- **Errors:** cannot be replicated — instruct the user to share error output or enable MCP
The exact `opencode.json` config values, tool inventory, and workflows
live in `references/devtools-mcp.md` (load it once the gate passes, or to
guide the user through enabling the server).
## Side files (load rules)
| Read | When | Use |
|------|------|-----|
| `references/setup.md` | route `scaffold` | house-standard bootstrap command, `src/` layout, Tekk naming/export rules, React Compiler, project OpenCode LSP wiring |
| `references/devtools-mcp.md` | route `runtime-diagnosis` (gate passed, or guiding enablement) | `opencode.json` config values, the 6 MCP tools, diagnosis/route/audit workflows, common MCP failures and fixes |
| `references/image.md` | route `image-usage` | `<img>` → `<Image />` auto-convert policy, Next 16 breaking-change table, `remotePatterns` config, failure → fix map |
| `references/threejs.md` | route `threejs` | version-detection-first rule + dated version matrix, version-sensitive areas, pitfall catalog (SSR / hydration / bundler / dispose), companion-library decision tree |
Side files carry VALUES only; this file carries the METHOD plus the
availability gate and file-based fallback above.
## Routes
| Situation | Route |
|-----------|-------|
| "create next.js app", "next.js setup", "scaffold next.js", "new next.js project", "initialize next.js"; standardizing an existing project onto the house structure | `scaffold` |
| "next.js errors", "nextjs debugging", "debug next.js", "next.js build failing", "server action not working", "next.js hydration error", "nextjs mcp"; route mapping, page/project metadata, project audits | `runtime-diagnosis` |
| Any `<img>` tag in (or proposed for) Next.js 16 code; remote images fail to load / `next/image` config errors; external image domains or responsive layouts; migrating from Next.js 13/14/15 | `image-usage` |
| Three.js / R3F / drei / WebXR in a Next.js App Router + React 19 project; SSR failures, GLSL bundling under Turbopack, hydration mismatches, WebGL context loss | `threejs` |
| Ambiguous | ask once (§What I do step 1), then route |
## Boundaries
- The four routes were formerly peer skills that cross-referenced each
other (the setup member pointed at the image member; the image and
Three.js rules interact) — that boundary is internal now; the
route table above is the boundary logic.
- Internal exception: inside drei `<Html>` portals, plain `<img>` is
sanctioned (route `threejs` pitfall `next-image-inside-drei-html`) —
route `image-usage`'s auto-convert rule does not apply there.
- React correctness/perf (hooks/render anti-patterns, bundle size,
re-renders) → `civiltekk-react-quality-skill`; unit tests →
`civiltekk-test-generation-skill` (route `nextjs`); AWS Amplify deployment →
`amplify-nextjs-deployment-skill`; accessibility →
`accessibility-a11y-skill`; Python backend equivalent →
`civiltekk-python-backend-skill` (route `scaffold`).
- `nextjs-specialist-subagent` is the agent that loads this skill by mode
(scaffolding → `scaffold`, diagnosis → `runtime-diagnosis`, audit →
`runtime-diagnosis` over routes/metadata).
## Agent behavior rules
- **Version-sensitive claims first** (`threejs`): never give
version-specific code before confirming versions — follow
`references/threejs.md` §Version detection first. Generic architectural
guidance (e.g. "use `'use client'`") is safe without versions; concrete
imports/JSX are not.
- **Auto-convert, don't ask** (`image-usage`): when an `<img>` tag is
proposed in Next.js 16 code, convert it per the house rule without
asking — the conversion policy is not a decision point.
- **Gate before calling** (`runtime-diagnosis`): run the availability gate
§above before the first MCP tool call; on failure, fall back to
file-based inspection and note the limitation in the Return Contract.
- Headless/CI: no asks — read the route from the delegation prompt, use a
documented default, or return `Status: partial` with the gap.
## Return Contract
```
**Status:** [success | partial | failed]
**Output:** [file path(s) / key result, one line]
**Summary:** route `{route}` — [2–3 sentences max]
**Issues:** [blockers, incl. MCP availability gaps, or "None"]
```
More agent context in darellchua2/civiltekk-opencode-claude-skills
120 other files this repository gives its agents, the first 60 shown.
AGENTS.md
Skill
- accessibility-a11y-skillskills/accessibility-a11y-skill/SKILL.md
- agent-introspection-debugging-skillskills/agent-introspection-debugging-skill/SKILL.md
- amplify-nextjs-deployment-skillskills/amplify-nextjs-deployment-skill/SKILL.md
- authentication-authorization-skillskills/authentication-authorization-skill/SKILL.md
- autodesk-aps-skillskills/autodesk-aps-skill/SKILL.md
- autoresearch-code-skillskills/autoresearch-code-skill/SKILL.md
- autoresearch-core-skillskills/autoresearch-core-skill/SKILL.md
- autoresearch-ml-skillskills/autoresearch-ml-skill/SKILL.md
- autoresearch-research-skillskills/autoresearch-research-skill/SKILL.md
- aws-iac-safety-skillskills/aws-iac-safety-skill/SKILL.md
- blast-radius-skillskills/blast-radius-skill/SKILL.md
- cad-bambu-labs-skillskills/cad-bambu-labs-skill/SKILL.md
- cad-dxf-skillskills/cad-dxf-skill/SKILL.md
- cad-gcode-skillskills/cad-gcode-skill/SKILL.md
- cad-generation-skillskills/cad-generation-skill/SKILL.md
- cad-implicit-skillskills/cad-implicit-skill/SKILL.md
- cad-redraw-skillskills/cad-redraw-skill/SKILL.md
- cad-sdf-skillskills/cad-sdf-skill/SKILL.md
- cad-sendcutsend-skillskills/cad-sendcutsend-skill/SKILL.md
- cad-srdf-skillskills/cad-srdf-skill/SKILL.md
- cad-step-parts-skillskills/cad-step-parts-skill/SKILL.md
- cad-urdf-skillskills/cad-urdf-skill/SKILL.md
- cad-viewer-skillskills/cad-viewer-skill/SKILL.md
- changelog-python-cliff-skillskills/changelog-python-cliff-skill/SKILL.md
- civil-3d-skillskills/civil-3d-skill/SKILL.md
- civiltekk-api-spec-skillskills/civiltekk-api-spec-skill/SKILL.md
- civiltekk-context-optimization-skillskills/civiltekk-context-optimization-skill/SKILL.md
- civiltekk-diagram-skillskills/civiltekk-diagram-skill/SKILL.md
- civiltekk-documentation-inline-skillskills/civiltekk-documentation-inline-skill/SKILL.md
- civiltekk-documentation-sync-skillskills/civiltekk-documentation-sync-skill/SKILL.md
- civiltekk-git-commits-skillskills/civiltekk-git-commits-skill/SKILL.md
- referencesskills/civiltekk-opencode-creation-skill/references/skill.md
- civiltekk-opencode-creation-skillskills/civiltekk-opencode-creation-skill/SKILL.md
- civiltekk-opentofu-skillskills/civiltekk-opentofu-skill/SKILL.md
- civiltekk-ponytail-audit-skillskills/civiltekk-ponytail-audit-skill/SKILL.md
- civiltekk-pr-workflow-skillskills/civiltekk-pr-workflow-skill/SKILL.md
- civiltekk-python-backend-skillskills/civiltekk-python-backend-skill/SKILL.md
- civiltekk-react-quality-skillskills/civiltekk-react-quality-skill/SKILL.md
- civiltekk-requirements-specs-skillskills/civiltekk-requirements-specs-skill/SKILL.md
- civiltekk-startup-docs-skillskills/civiltekk-startup-docs-skill/SKILL.md
- civiltekk-test-generation-skillskills/civiltekk-test-generation-skill/SKILL.md
- civiltekk-zai-media-skillskills/civiltekk-zai-media-skill/SKILL.md
- clean-architecture-skillskills/clean-architecture-skill/SKILL.md
- clean-code-skillskills/clean-code-skill/SKILL.md
- code-smells-skillskills/code-smells-skill/SKILL.md
- complexity-management-skillskills/complexity-management-skill/SKILL.md
- construction-bd-skillskills/construction-bd-skill/SKILL.md
- continuous-learning-skillskills/continuous-learning-skill/SKILL.md
- coverage-readme-workflow-skillskills/coverage-readme-workflow-skill/SKILL.md
- database-migration-skillskills/database-migration-skill/SKILL.md
- deprecated-code-cleanup-skillskills/deprecated-code-cleanup-skill/SKILL.md
- design-patterns-skillskills/design-patterns-skill/SKILL.md
- dev-uat-promotion-skillskills/dev-uat-promotion-skill/SKILL.md
- docker-containerization-skillskills/docker-containerization-skill/SKILL.md
- docling-mcp-skillskills/docling-mcp-skill/SKILL.md
- docx-creation-skillskills/docx-creation-skill/SKILL.md
- domain-modeling-skillskills/domain-modeling-skill/SKILL.md
- email-drafter-skillskills/email-drafter-skill/SKILL.md
- error-resolver-workflow-skillskills/error-resolver-workflow-skill/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

