borghei/Claude-Skills / engineering/senior-frontend
senior-frontend
VerifiedScaffold Next.js 16 or React + Vite 8 apps, generate components with tests and stories, and flag heavy bundle dependencies. Use when starting a React project, adding components or hooks, or reviewing frontend code or performance.
assets/templates/scaffold/files/require_auth.tsx
View on GitHubimport type { ReactNode } from 'react';
import { useAuth } from '@/lib/auth';
interface RequireAuthProps {
children: ReactNode;
/** Rendered when no session token is present. */
fallback?: ReactNode;
}
// A UI gate only: it hides screens from signed-out users but protects no data.
// Anyone can edit client code, so the API must verify the token on every request.
export function RequireAuth({ children, fallback }: RequireAuthProps) {
const { isAuthenticated } = useAuth();
if (!isAuthenticated) {
return (
<>
{fallback ?? (
<p className="p-8 text-center">
Please{' '}
<a className="underline" href="/login">
sign in
</a>{' '}
to continue.
</p>
)}
</>
);
}
return <>{children}</>;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |