Imported from tony-maxcontact/linkshortener (
AGENTS.md). Install upstream withnpx skills add tony-maxcontact/linkshortener. Copyright stays with the author.
This is NOT the Next.js you know
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ before writing any code. Heed deprecation notices.
Agent Instructions — Link Shortener
This file is the entry point for LLM coding agents working in this repository. Read the linked docs files before writing or modifying any code.
⚠️ MANDATORY — READ DOCS BEFORE WRITING ANY CODE ⚠️
BLOCKING REQUIREMENT: You MUST read every relevant file from the
/docsdirectory BEFORE generating, modifying, or suggesting any code. This is not optional. Failure to read the docs first will result in incorrect implementations that violate project conventions.Do not rely on training data for Next.js, Tailwind v4, or Clerk v7 — all have breaking changes not reflected in your training data. The docs are the source of truth.
For detailed guidelines on specific topics, refer to the modular documentation in the /docs directory.
Identify ALL topics relevant to the task, then read EVERY corresponding doc file before writing a single line of code.
| Topic | File | Read Before... |
|---|---|---|
| Authentication, route protection, auth UI | docs/05-authentication.md | Any auth, middleware, or protected route code |
| UI components, shadcn/ui usage | docs/06-ui-components.md | Any component, layout, or styling code |
Non-Negotiable Rules
- Read docs first — no exceptions. Before writing any code, use
read_fileto load every relevant doc from/docs. Do not skip this step, do not skim. Read the full file. - Read before writing. Read the relevant doc(s) above before generating any code. Do not rely on training data alone for Next.js, Tailwind v4, or Clerk v7 — all have breaking changes.
- App Router only. No
pages/directory. NogetServerSideProps,getStaticProps, or API Routes. paramsis a Promise. Alwaysawait paramsandawait searchParamsin page components.- Auth on every mutation. Every Server Action must call
auth()and verifyuserIdbefore touching the database. - Ownership checks. Always verify the authenticated user owns a resource before update or delete.
- No raw SQL. Use the Drizzle query builder via
dbfrom@/db. - No custom auth. Never implement session handling, password storage, or JWT logic — Clerk owns this.
- Modal auth only. Sign in and sign up must use
mode="modal"on Clerk's buttons — no dedicated auth pages. - ⚠️ USE PROXY.TS, NOT MIDDLEWARE.TS.
middleware.tsis deprecated in this project. All routing logic, auth protection, and redirects must be implemented inproxy.ts. Never modify or referencemiddleware.ts. - Protected routes.
/dashboardrequires authentication; unauthenticated access must be blocked in proxy. - Homepage redirect. Authenticated users visiting
/must be redirected to/dashboardin proxy. cn()for class merging. Never concatenate Tailwind class strings — usecn()from@/lib/utils.- shadcn components via CLI. Add new UI components with
npx shadcn add <component>, not by hand. - No secrets in code. All environment variables live in
.env.local. Never hardcode credentials.