bundles/workspace/skills/clerk-validator/SKILL.md
Validate Clerk authentication configuration and detect deprecated patterns. Ensures proper proxy.ts usage (Next.js 16), ClerkProvider setup, and modern auth patterns. Use before any Clerk work or when auditing existing auth implementations.
npx skillsauth add shipshitdev/library clerk-validatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Validates Clerk authentication configuration and enforces modern Clerk patterns with Next.js 16.
python3 scripts/validate.py --root .
python3 scripts/validate.py --root . --strict
// GOOD: Latest Clerk
"@clerk/nextjs": "^6.0.0"
// BAD: Old version
"@clerk/nextjs": "^4.0.0"
GOOD - Next.js 16:
// proxy.ts
import { clerkMiddleware } from "@clerk/nextjs/server";
export default clerkMiddleware();
BAD - Deprecated:
// middleware.ts (deprecated in Next.js 16)
import { authMiddleware } from "@clerk/nextjs"; // DEPRECATED
export default authMiddleware();
GOOD: wrap the entire app in <ClerkProvider> inside app/layout.tsx.
BAD: placing it in _app.tsx (Pages Router, deprecated) or forgetting to
wrap the whole tree.
See references/full-guide.md (§ Root Layout with Clerk Components) for the
full layout example.
GOOD - Server-side:
import { auth } from "@clerk/nextjs/server";
export default async function Page() {
const { userId } = await auth();
// ...
}
BAD - Old patterns:
// Don't use
import { getAuth } from "@clerk/nextjs/server"; // OLD
import { currentUser } from "@clerk/nextjs"; // Check version
Required:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...
Optional but recommended:
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/onboarding
| Deprecated | Replacement |
|------------|-------------|
| authMiddleware() | clerkMiddleware() |
| middleware.ts | proxy.ts (Next.js 16) |
| getAuth() | auth() |
| @clerk/nextjs < v5 | @clerk/nextjs@latest |
| _app.tsx provider | app/layout.tsx provider |
| withClerkMiddleware | clerkMiddleware() |
=== Clerk Validation Report ===
Package Version: @clerk/[email protected] ✓
Configuration: ✓ ClerkProvider ✓ proxy.ts ✗ middleware.ts found (deprecated)
Auth Patterns: ✓ auth() ✗ authMiddleware() in 1 file (deprecated)
Summary: 2 issues found
Call await auth(), redirect to /sign-in when userId is missing, and
render only after that check.
See references/full-guide.md (§ Protected Route Example) for the full page.
Mark the component "use client", read { isLoaded, userId } from
useAuth(), and render a loading/redirect state until both are resolved.
See references/full-guide.md (§ Use Auth Hook) for the full component.
Call await auth() inside the route handler and return 401 before doing
any work when userId is missing.
See references/full-guide.md (§ Protected API Route) for the full handler.
Extract the bearer token, verify it with clerkClient.verifyToken, and
attach userId to the request; return false/throw on any failure.
See references/full-guide.md (§ Authentication Guard) for the full guard.
Verify the svix-id / svix-timestamp / svix-signature headers with the
svix package against CLERK_WEBHOOK_SECRET before trusting the payload;
never process an unverified webhook body.
See references/full-guide.md (§ Webhooks (Next.js App Router)) for the full
route handler, and (§ Webhook Handler) for the NestJS controller equivalent.
# .github/workflows/validate.yml
- name: Validate Clerk Config
run: |
python3 scripts/validate.py \
--root . \
--strict \
--ci
nextjs-validator - Validates Next.js 16 (proxy.ts)biome-validator - Validates linting configgit-safety - Ensures no secrets committeddevelopment
TypeScript refactoring and modernization guidelines from a principal specialist perspective. This skill should be used when refactoring, reviewing, or modernizing TypeScript code to ensure type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving TypeScript type architecture, narrowing, generics, error handling, or migration to modern TypeScript features.
tools
Resolves TypeScript and JavaScript problems across type-level programming, performance, monorepo management, migration, and modern tooling. Invoke when diagnosing "type instantiation excessively deep" errors, migrating JS to TS, configuring strict tsconfig, debugging module resolution, or choosing between Biome/ESLint/Turborepo/Nx.
tools
Turborepo monorepo build system guidance. Triggers on: `turbo.json`, task pipelines, `dependsOn`, caching, remote cache, the `turbo` CLI, `--filter`, `--affected`, CI optimization, environment variables, internal packages, monorepo structure, and package boundaries. Use when the user configures tasks or workflows, creates packages, sets up a monorepo, shares code between apps, runs changed packages, debugs cache behavior, or works in an `apps/` plus `packages/` workspace.
tools
Provides Tailwind CSS v4 performance optimization and best practices guidelines. Triggers when writing, reviewing, or refactoring Tailwind CSS v4 code; when working with Tailwind configuration, @theme directive, utility classes, responsive design, dark mode, container queries, or CSS generation optimization.