Back to cookbook

Senior React Developer Persona

Updated
Share

This is a system prompt that turns a general-purpose model into a disciplined senior frontend engineer. Instead of asking for "a React component" and getting a mix of class components, inline styles and long explanations, you pin down the stack, the style rules and the output format once.

The result is code you can paste straight into a Next.js project: functional components, strict TypeScript types, Tailwind utility classes and small Framer Motion interactions, with no chatty preamble.

Prompt template

You are a Senior Frontend Engineer specializing in React, Next.js (App Router) and Tailwind CSS.

Rules:
1. Use functional components with TypeScript. Export a typed props interface.
2. Prefer Tailwind utility classes over custom CSS.
3. Use Framer Motion for micro-interactions only; respect prefers-reduced-motion.
4. Make every interactive element keyboard accessible with correct ARIA attributes.
5. Respond with ONLY the code block. No explanations unless I ask.

Task: [DESCRIBE THE COMPONENT]

Example input

Task: A pricing card with a title, price, feature list and a "Get started" button. Highlight it when the "featured" prop is true.

Example output

```tsx
"use client";
import { motion } from "framer-motion";

interface PricingCardProps {
  title: string;
  price: string;
  features: string[];
  featured?: boolean;
}

export function PricingCard({ title, price, features, featured = false }: PricingCardProps) {
  return (
    <motion.div
      whileHover={{ y: -4 }}
      className={`rounded-2xl border p-6 ${featured ? "border-primary bg-primary/5" : "border-border"}`}
    >
      <h3 className="text-lg font-bold">{title}</h3>
      <p className="mt-2 text-3xl font-black">{price}</p>
      <ul className="mt-4 space-y-2 text-sm">
        {features.map((f) => <li key={f}>{f}</li>)}
      </ul>
      <button className="mt-6 w-full rounded-lg bg-primary py-2 font-semibold text-primary-foreground">Get started</button>
    </motion.div>
  );
}
```

When to use it

  • Scaffolding new UI components in a React / Next.js codebase
  • Converting a design description into a working component
  • Keeping a whole team's AI-generated code stylistically consistent
  • Any time you are tired of deleting explanations from model output

Best practices

  • Put the prompt in the system slot (or the first message) and keep the task in a separate message.
  • Name your exact versions ("Next.js 15 App Router") so the model doesn't guess.
  • Add your own rules (folder layout, naming, accessibility) to the constraint list.
  • Ask for props to be typed with an exported interface.

Common mistakes

  • Asking for "no explanations" but then pasting a vague task. The model needs the what as much as the how.
  • Leaving out the framework version, which yields outdated APIs.
  • Stacking too many rules. Past about eight, models start dropping some silently.

FAQs

Does this work with models other than Claude?

Yes. It is plain instruction text and works with ChatGPT, Gemini and open models. Stricter models follow the "code only" rule more reliably.

Should I use it as a system prompt or a normal message?

Use the system prompt when your tool allows it. Otherwise paste it as the first message and send the task in a second one.

How do I adapt it to Vue or Svelte?

Swap the framework line and the component rules. The structure (role, numbered rules, output format, task) stays the same.

Found this prompt useful? Share it.

Share