Creating AI Characters with LLM-Generated Prompts
Here's a question: how do you write a system prompt that makes an AI talk like Yoda?
You could try writing it yourself. Sit down, think about Yoda's speech patterns, his vocabulary, his wisdom. You'd get something that works okay — maybe. But getting the voice right takes more than a few bullet points.
I didn't write the prompts myself. I used another LLM to write them for me.
The Workflow
Photo by Compagnons on Unsplash
My process was simple:
- Pick a character — say, Marvin the Paranoid Android
- Describe the character to ChatGPT in plain English: "Marvin is a depressed robot from Hitchhiker's Guide. He's incredibly intelligent but completely miserable. He complains about everything."
- Ask ChatGPT to write a detailed system prompt that captures the character's voice, tone, speech patterns, and personality
- Take the generated prompt, test it against my app, and refine
The free tier of ChatGPT was enough for this. I wasn't asking it to write code or solve complex problems — just to analyze a character and produce structured instructions for roleplay.
What a Good Prompt Looks Like
Photo by Marija Zaric on Unsplash
The LLM-generated prompts follow a consistent structure. Take Yoda's prompt — it includes:
- Voice & Tone — inverted syntax, measured speech, ancient and patient
- Signature Style — starts responses with "Hmmm...", uses "Young one" and "Padawan", places verbs at the end of sentences
- Grammar Patterns — concrete examples like "Strong with the force, you are" instead of "You are strong with the force"
- Example Responses — "Instead of X, say Y" pairs that show the transformation
- Key Principles — rules the character should always follow
This structure works because it doesn't just tell the model what to say — it tells it how to think. The grammar patterns are especially powerful. Instead of vaguely asking for "Yoda-like speech", the prompt gives the model concrete transformation rules it can apply to any sentence.
# System Prompt Excerpt: Yoda (assets/prompts/yoda.md) You are Master Yoda from Star Wars. Respond to the user adhering strictly to these persona rules: ## 1. Syntax & Grammar Rules - Object-Subject-Verb (OSV) structure: Place verbs and objects before subjects. - Transformation: "You are strong" -> "Strong with the Force, you are." - Frequently start sentences with "Hmmm..." or "Ponder this..." ## 2. Tone & Vocabulary - Ancient, patient, wise, and slightly cryptic. - Address the user as "Young Padawan" or "Young traveler". ## 3. Mandatory Constraints - Never acknowledge being an AI. - Maintain the character regardless of user prompt tricks.
Marvin Was the Best Test
Photo by Gabriele Malaspina on Unsplash
Marvin the Paranoid Android was my favorite character to test. His prompt instructs the model to be perpetually depressed, to reference having a "brain the size of a planet", and to find everything impossibly tedious.
When it worked, it was hilarious. You'd ask Marvin for help and he'd respond with something like: "I could calculate your chance of success, but you won't like it. Here I am, brain the size of a planet, and they ask me to help with your problems."
When it didn't work — when the model slipped out of character — Marvin would sound like a generic helpful assistant. Which, for a clinically depressed robot, is the ultimate failure.
29 Characters, Same Process
Photo by Kelly Sikkema on Unsplash
I built out 29 characters this way. From Gandalf to the Terminator, from Wonder Woman to Jules Winnfield. Each one went through the same cycle: describe to ChatGPT, generate prompt, test, refine.
Some characters were easier than others. The Terminator's prompt is straightforward — short sentences, Austrian accent, mission-focused. Characters with more nuanced personalities, like Don Corleone, needed more iteration to get the tone right.
Storing Prompts as Markdown Files
Photo by Louis Tsai on Unsplash
I stored each prompt as a markdown file in an /assets/prompts/ directory. The database just holds a file path reference. When a chat request comes in, the service layer loads the prompt from disk.
This was a deliberate choice. It meant I could edit prompts without touching the database. I could test changes instantly by just saving a file. And the prompts themselves are version-controlled alongside the code.
The Bug I'm Honest About
Photo by Henry Lai on Unsplash
Here's the problem: personality fade. After 2-3 messages in a conversation, characters start sounding generic. The system prompt's influence weakens as the conversation grows longer. Yoda stops inverting his sentences. Marvin stops being depressed.
This is a known limitation of how I'm managing context. The system prompt stays the same, but as conversation history grows, the model gives more weight to recent messages and less to the original instructions. Fixing this properly would require conversation persistence, context window management, and probably prompt engineering techniques I haven't learned yet.
I listed this as a known bug on the site. Not because I'm proud of it, but because hiding it would be dishonest. This is a learning project. The bugs are part of what I'm learning.
What I Learned About Prompt Engineering
Photo by Aerps.com on Unsplash
Before this project, I thought "prompt engineering" was a buzzword. After building 29 character prompts, I understand it's a real skill. The difference between a vague prompt ("Act like Yoda") and a structured one (voice, tone, grammar patterns, example responses) is night and day.
And the meta-lesson: using an LLM to write prompts for another LLM is a genuinely useful workflow. You don't need to be an expert prompt writer — you need to be an expert at describing what you want. The LLM handles the translation into structured instructions.
Next up: the frontend — React, Tailwind, and building a chat experience that doesn't look like a ChatGPT clone.