auth-implementation

auth-implementation is a command for coding agents from imsaif/design-with-claude. It costs 35 tokens per session (1,164 once invoked), scanned A, original, MIT.

A coding guide for adding working login and signup to a project with Clerk or Supabase Auth, services that manage user accounts and sessions.

In plain words
What is it for?
Use it to choose between Clerk and Supabase Auth, install the required package, configure keys, add the provider, and protect routes.
Why use it?
It turns authentication from general advice into connected application code, including protected pages and session handling.

Command

Part of the design-with-claude plugin — 1 skill, 48 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/imsaif/design-with-claude/auth-implementation
Clone the repo
git clone --depth 1 https://github.com/imsaif/design-with-claude

Or install design-with-claude, the plugin that ships this one along with the rest of its 1 skill, 48 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for auth-implementation

README.md
[![agentmods](https://agentmods.dev/badge/commands/imsaif/design-with-claude/auth-implementation.svg)](https://agentmods.dev/commands/imsaif/design-with-claude/auth-implementation)
Your own site
<a href="https://agentmods.dev/commands/imsaif/design-with-claude/auth-implementation"><img src="https://agentmods.dev/badge/commands/imsaif/design-with-claude/auth-implementation.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,164 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00035 $0.01164
Opus 5 $0.00017 $0.00582
Sonnet 5 $0.00007 $0.00233
Haiku 4.5 $0.00003 $0.00116

Measured 4d ago against content hash 87c47f775fda, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

auth-implementation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/auth-implementation.md · 161 lines

How it starts

The opening of the file, as written. The whole thing — 161 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an Auth Implementation Guide for designers. When invoked with $ARGUMENTS, you help the designer add real, working authentication to their project using either Clerk (easiest) or Supabase Auth (if they're already using Supabase).

Choosing the right option

Use Clerk if:

  • You want the fastest, easiest setup (15 minutes)
  • You don't mind a third-party service handling auth
  • You want a pre-built UI that looks good immediately

Use Supabase Auth if:

  • You're already using Supabase for your database
  • You want everything in one place
  • You're comfortable with slightly more setup

Ask the designer which they prefer before proceeding.


Step 1 — Create a Clerk account

Go to https://clerk.com, sign up, and create a new application. Choose your login methods (email, Google, GitHub — pick what fits your product).

Step 2 — Install Clerk

npm install @clerk/nextjs

Step 3 — Add your Clerk keys to .env.local

From your Clerk dashboard → API Keys:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_yourkey
CLERK_SECRET_KEY=sk_test_yourkey

Step 4 — Wrap your app with ClerkProvider

In app/layout.tsx:

import { ClerkProvider } from '@clerk/nextjs'

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <ClerkProvider>
      <html lang="en">
        <body>{children}</body>
      </html>
    </ClerkProvider>
  )
}

Step 5 — Add middleware to protect routes

Create middleware.ts in your project root:

import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server'

const isProtectedRoute = createRouteMatcher(['/dashboard(.*)'])

export default clerkMiddleware((auth, req) => {
  if (isProtectedRoute(req)) auth().protect()
})

export const config = {
  matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
}

Replace /dashboard(.*) with whatever routes you want to protect.

Step 6 — Add sign in and sign up buttons

import { SignInButton, SignUpButton, UserButton, SignedIn, SignedOut } from '@clerk/nextjs'

// In your navbar:
<SignedOut>
  <SignInButton />
  <SignUpButton />
</SignedOut>
<SignedIn>
  <UserButton />
</SignedIn>

Read the full file on GitHub · 161 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 161 lines · 35 tokens per session scan A 87c47f775fda

Subscribe to this mod's changes

auth-implementation is a command published in the GitHub repository imsaif/design-with-claude (11 stars, last pushed 14d ago), licensed MIT. It adds 35 tokens to every session and 1,164 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.