Cameron Kelliher

AI Prompt Diff

AI chats 45

About

Compound component that compares two system prompts with unified or side-by-side diff views, added/removed line highlighting, line numbers, and copy buttons.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds AI Prompt Diff to your project and fits it to your theme.

Code

How AI Prompt Diff is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
  AiPromptDiff,
  AiPromptDiffHeader,
  AiPromptDiffViewToggle,
  AiPromptDiffContent,
  AiPromptDiffCopyButton,
} from "@/components/ui/prompt-diff";

const before = `You are a helpful assistant.
Answer questions concisely.
Be friendly and professional.`;

const after = `You are a senior software engineer assistant.
Answer questions with code examples when relevant.
Be friendly, professional, and thorough.
Always explain your reasoning.`;

export default function PromptDiffDemo() {
  return (
    <div className="mx-auto w-full max-w-2xl p-6">
      <AiPromptDiff before={before} after={after}>
        <AiPromptDiffHeader title="Prompt Changes">
          <AiPromptDiffViewToggle />
          <AiPromptDiffCopyButton variant="after" />
        </AiPromptDiffHeader>
        <AiPromptDiffContent />
      </AiPromptDiff>
    </div>
  );
}

Dependencies

More by Cameron Kelliher

View all
  • AI Chain of Thought

    AI Chain of Thought

    122
  • Helix Loader

    Helix Loader

    104
  • AI Streaming Text

    AI Streaming Text

    55
  • AI Tool Call

    AI Tool Call

    49
  • Glitch Text Loader

    Glitch Text Loader

    46
  • Signal Bars Loader

    Signal Bars Loader

    45
  • Upstash Leaderboard

    Upstash Leaderboard

    40
  • AI Conversation Tree

    AI Conversation Tree

    39

More in AI chats

View all
  • AI Actions

    AI Actions

    351
  • Aquarium Prompt

    Aquarium Prompt

    113
  • Agent Chat

    Agent Chat

    21
  • Message With Header And Delivery Status

    Message With Header And Delivery Status

    60
  • Research Report

    Research Report

    7
  • Tool Web Fetch

    Tool Web Fetch

    4
  • Color Picker

    Color Picker

    201
  • Suggestions

    Suggestions

    40