Cameron Kelliher

AI Prompt Diff

AI chats 43

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

    120
  • Helix Loader

    Helix Loader

    101
  • AI Streaming Text

    AI Streaming Text

    53
  • AI Tool Call

    AI Tool Call

    47
  • Glitch Text Loader

    Glitch Text Loader

    45
  • Signal Bars Loader

    Signal Bars Loader

    44
  • AI Conversation Tree

    AI Conversation Tree

    36
  • AI Routing Indicator

    AI Routing Indicator

    35

More in AI chats

View all
  • AI Actions

    AI Actions

    341
  • Aquarium Prompt

    Aquarium Prompt

    58
  • Commit

    Commit

    34
  • Cost Meter

    Cost Meter

    48
  • Research Report

    Research Report

    2
  • Agent Chat

    Agent Chat

    19
  • Streaming Text

    Streaming Text

    25
  • Color Picker

    Color Picker

    174