Imported from mrunixus/linkshortenerproject (
AGENTS.md). Install upstream withnpx skills add mrunixus/linkshortenerproject. Copyright stays with the author.
Agent Instructions — Link Shortener Project
This file is the entry point for LLM agent instructions. All coding standards, conventions, and architectural decisions for this project are documented here and in the /docs directory.
[!CAUTION] MANDATORY — NO EXCEPTIONS: You MUST read every relevant file in the
/docsdirectory before writing, modifying, or generating any code whatsoever. This is not optional. Generating code without first reading the applicable docs is a critical violation. If a task touches authentication, readdocs/authentication.md. If it touches UI, readdocs/ui-components.md. When in doubt, read all docs files.
Docs Index
| File | Purpose |
|---|---|
| docs/authentication.md | Clerk authentication rules: protected routes, modal sign-in/out, server vs. client helpers, middleware setup |
| docs/ui-components.md | shadcn/ui usage rules: install via CLI, no custom primitives, wrapping conventions, theming |
Quick-Reference Rules
The following rules are critical — violations are considered bugs:
- Server-only data access — Never import
dbor Clerk server functions inside"use client"components. - Scope all DB queries to
userId— Always filter by the authenticated ClerkuserId; never return another user's data. - Protect all API routes — Every Route Handler that touches user data must call
auth()and return401if unauthenticated. - Use
cn()for class composition — Never concatenate Tailwind classes with string templates; always usecn()from@/lib/utils. - Do not hand-edit
components/ui/— These files are managed by the shadcn CLI. - Use
@/path aliases — Never use relative../imports when an absolute alias is available. - No raw SQL — Use the Drizzle ORM query builder exclusively.
- TypeScript strict mode — No
any, no// @ts-ignorewithout justification. - Public redirect route —
/r/[slug]must remain publicly accessible (no auth guard) for link redirects to work. - Lint before committing — Run
npm run lintand resolve all errors. - shadcn/ui only — All UI must use shadcn/ui components. Never build custom component primitives or use other component libraries. Add new components with
npx shadcn@latest add <name>. - No
middleware.ts—middleware.tsis deprecated in Next.js 16 (the version used in this project). Never create or modifymiddleware.ts. Useproxy.tsinstead for all proxy and middleware logic.