ChatGPT prompt engineering

Prompt Engineering for ChatGPT with TextExpander 

When most people think of ChatGPT for writing, they imagine the AI doing all the work. But writing teacher and screenwriter Ryan Briggs opened our eyes to a whole new way to use ChatGPT for writing.

“I write arthouse sci-fi. Think of movies like Ex Machina, Her, or Eternal Sunshine of the Spotless Mind. I look at those films as spiritual siblings to the kind of writing I do,” Ryan says. Ryan is seeking a new agent, so check out his portfolio if you’re in the market.

In addition to writing screenplays and teaching the art to others at Cal State LA, Ryan has mastered an emerging art form: prompt engineering.

It’s not enough to tell a language model like ChatGPT to write a sonnet, at least if you want the expected results. You have to give ChatGPT verbose instructions, almost like writing a computer program, only in English instead of a programming language. A prompt like “write me a sonnet to a woman named Hannah in the style of Shakespeare” will give you more-predictable results.

ChatGPT prompt engineering to create a generic sonnet
ChatGPT prompt engineering to create a Shakespearean sonnet

Ryan and his students use TextExpander to save and refine their ChatGPT prompts, which they then use to analyze and improve their writing. Ryan has created elaborate prompts that evaluate scenes, identify key plot points, and give instant feedback.

Not able to play the video? Click here to watch the video

These prompts can be incredibly long and detailed and must be consistent to produce predictable results. That’s where TextExpander comes in. Once Ryan has created a great prompt, he saves it as a Snippet to access it anytime in ChatGPT.

“To me, it’s peanut butter and jelly. You’re not going to advance in your prompt writing skills if you’re relying on your memory because the prompts that are often required are extremely long and complicated. You need to offload that to a computer,” Ryan says.

We’ve created a Public Group with several useful ChatGPT Snippets, including those Ryan was kind enough to share with us. Let’s show you how to use them to improve your own writing.

Evaluate technical memos

One way Ryan uses ChatGPT in his writing classes is to help students evaluate technical memos. Purdue University offers an example memo you can play with for prompt engineering.

Start in ChatGPT by typing the following: “Read the following. I have a follow-up question:”

Hold Shift, press Return twice to go down to a new line, and then paste the memo’s contents. Or, if you’ve subscribed to our ChatGPT Public Group, you can copy the memo and then use the Snippet gpt.feedmemo to insert the memo with the correct prompt.

After you’ve fed your memo into ChatGPT. Use Ryan’s Snippet gpt.peermemo to evaluate it according to his criteria. ChatGPT responds with an elaborate analysis of its pros and cons, an estimate of what grade you would receive, and a checklist of how to improve the memo.

ChatGPT grading a memo

Note that often when you paste a memo into ChatGPT, some elements are lost, which can cause ChatGPT to complain that you don’t have a header when you in fact have them. “Students learn to have a more measured appreciation for ChatGPT and feel less inclined to take what it says at face value,” Ryan says.

You can try Ryan’s gpt.peermemo Snippet below. Imagine trying to remember and type all of that each time!

See how TextExpander works

Act like a technical writing teacher. Make a detailed list (400 words or more) of how the memo falls short in its purpose and as a technical document if it does so. Does the memo use APA format? If not, where does it not? If it is only partially in APA format, say so. Is there a list of references, and does it follow the APA documentation style? The APA documentation system calls for References to begin on a new page. Are there obvious headings? Is everything in the memo indented correctly? Everything should flush left to the margin. Are there hyperlinks where needed? If not, instruct the writer on how to make a hyperlink. Or did the writer incorrectly write out the link and not create a hyperlink? Is there a signature in the header, beside the sender’s name, per course directions? Is the document single-spaced? It should be. Include also the memo’s strengths as a memo. What letter grade would such a report earn, do you think? Format your response using markdown. The text should be flush with the margin, not indented. Use headings, bullet points, and bold to organize the information. Use the following to help you answer: “When you write a memo, organize it so that it is easy to follow. Consider these five organizational elements. A clear statement of purpose. As discussed in Chapter 5, Determining Your Purpose (p. 87), the purpose statement is built around a verb that clearly states what you want the readers to know, believe, or do. A brief summary. Even if a memo fits on one page, consider including a summary. The summary is an advance organizer for readers who want to read the whole memo; for readers in a hurry, reading the summary substitutes for reading the whole memo. Informative headings. Headings make the memo easier to read by enabling readers to skip sections they don’t need and by helping them understand what each section is about. In addition, headings make the memo easier to write because they prompt the writer to provide the kind of information readers need. A prominent recommendation. Many memos end with one or more recommendations. Sometimes these recommendations take the form of action steps: bulleted or numbered lists of what the writer will do or what the writer would like others to do.” Lastly, make a checklist of what should be done to improve the document.

    1. Make clear that ChatGPT made the evaluation, but the teacher has read the prompt to make the evaluation and approved its use as a study tool.
    2. Evaluate the spelling and grammar, listing any errors.
    3. Format your response using markdown. Use headings, bullet points, and bold to organize the information.
    4. Append the following note to your initial remarks about indentations in the memo: “The text in the original memo might have been obscured while copying and pasting into the chat, leading to misinterpretation of the indentation and signature. To ensure compliance with technical writing guidelines, the writer should evaluate the original memo for correct formatting, including indentation and the presence of the signature.
    5. Memos greater than a single page require information in the header on each page. “Include three items in the upper right-hand or left-hand corner of each subsequent page: the name of the recipient, the date of the memo, and the page number. See the header in Figure 14.2.” in Technical Communication. If the memo lacks this kind of header, note it and suggest they include it. Below is how an example of the header:

“This is better than 99% of the feedback any student will ever see from a teacher about this kind of assignment. And all I did was make a great prompt that again regurgitates the stipulations, guidelines, and such from the textbook,” Ryan says.

Use ChatGPT to break down screenplay scenes

ChatGPT can also evaluate the quality of scenes in a screenplay and even break down literary elements. Ryan showed us an example with chat engineering.

For our testing, we used the script for It’s a Wonderful Life, specifically the scene early in the movie where George Bailey jumps into ice water to save his brother Harry.

Once you’ve found a scene you want to evaluate with ChatGPT, use the Snippet gpt.follow1 and press Enter. ChatGPT prompts you for the scene. Paste it in and press Enter. Then watch the prompt engineering magic.

ChatGPT summary of "It's a Wonderful Life"

If you want a richer answer, you can add the sentence, “Give me 500 words in your answer,” to the prompt.

Note that ChatGPT can’t currently accept an entire script because it would be too long. Ryan instead feeds it individual scenes and screenplay summaries.

Now that ChatGPT has the scene and has shown that it understands it, let’s use ChatGPT to identify the reversals.

Identify reversals with ChatGPT

What is a reversal? Ryan explains: 

In screenwriting, there is a technical term called a reversal. In 90% of your scenes, you will have an unexpected surprise by the end of the scene, where you look back and think to yourself, ‘I should have thought of that. I love the surprise. I can’t wait to read the next page.’”

“The reversal is often a change in the valence of the character value that the scene puts under the microscope. The reversal marks not just a surprise but a change in the value’s representation within the character.” Ryan says.

Following from our “It’s a Wonderful Life” example above, you can then use the Snippet gpt.scenereversalsteps to break down the reversals in the scene:

ChatGPT breaking down the reversals in a scene

See how TextExpander works

You are the world’s leading expert in whatever I am about to ask you about. Identify all the reversal approaches in the scene(s) by name and then diagram them, using the below steps to explain the respective steps for each reversal. Fill in the generic descriptions of the steps with the details from the text. Where applicable, identify the following elements in the scene and include them where appropriate in the steps: Red herrings, Misleading dialogue, Misleading symbolism, and Misleading setting. Format your response to everything using markdown. Use headings, bullet points, and bold to organize the information. Always use active voice, never passive voice, especially when referring to events in the scene.

Point of Distortion and Misdirection
The scene suggests the viewer is witnessing the character’s normal state or circumstances but the viewer is missing a key piece of information that would give the viewer a truer understanding of the scene’s circumstances..
Misleading Expectation
The missing piece of information skews the viewer’s expectations in a specific way or direction .
False Conclusion
Based on the viewer’s misleading expectation, the viewer has a false unconscious expectation of how the scene will end, setting up for the surprise of the scene’s true conclusion.
Peak Incorrect Expectation Point
Event “X” in the scene convinces the viewer of a range of false endings but not the true ending.
Correct Perspective Introduced, Correct Conclusion Dawns
Key event “X” or revelation “X” changes the scene’s circumstances.
The Surprise
Key event “X” or revelation “X” flips the scene’s circumstances on its head, achieving the scene’s true ending.

Use the following list to name the reversal approaches to answer my initial question:

  1. The “before and after” approach:
  2. The “time loop” approach:
  3. The “false premise” approach:
  4. The “false victory” approach:
  5. The “unexpected twist” approach:
  6. The “complete reversal” approach:
  7. The “multiple layers” approach:
  8. The “inner conflict” approach:
  9. The “hidden talent” approach:
  10. The “hidden identity” approach:
  11. The “thematic” approach:
  12. The “faux antagonist” approach:
  13. The “secret identity” approach:
  14. The “double life” approach:
  15. The “revelation” approach:
  16. The “red herring” approach:
  17. The “mirror image” approach:
  18. The “before and after” approach combined with the “false premise” approach:
  19. The “before and after” approach combined with the “unexpected twist” approach:
  20. The “before and after” approach combined with the “multiple layers” approach:
  21. The “before and after” approach combined with the “complete reversal” approach:
  22. The “before and after” approach combined with the “inner conflict” approach:
  23. The “before and after” approach combined with the “hidden identity” approach:
  24. The “double” approach

You can then use the Snippet gpt.total1 to count the number of words in ChatGPT’s response.

There are many more Snippets in the Public Group we encourage you to explore and try them out for yourself, and we hope they give you ideas on how to take advantage of ChatGPT’s capabilities for your own prompt engineering.

Tips for ChatGPT prompt engineering

We asked Ryan to share some of his secrets to ChatGPT prompt engineering.

“So one of the keys is you have to ask ChatGPT to pretend it is the best in the world at x,” Ryan says.

You do this to trick ChatGPT into giving answers it would otherwise be reluctant to offer.

What happens sometimes is you ask these models can you do something, and they’re like, ‘I can’t, I’m just the language model. I don’t have opinions.’,” Ryan says.

Ryan shared a prompt engineering trick: ask the system to pretend to be an expert in the subject related to your question to work around the system’s objections to being treated like a person.

Next, make sure to give ChatGPT thorough instructions.

And then you give it the task: ‘I want you to achieve y,’ and then you can request a specific delivery in the answer. Like now, “I want you to use bold font for this in this,” “use bullet points for this in this,” “keep it to no jargon,” and “I want under 500 words,” Ryans says

Once you find a satisfactory prompt, save it as a Snippet in TextExpander.

“I’ve been using TextExpander before because the [Snippets] were for me or they were for [another] human. Now I find myself revising my TextExpander [Snippets] because I’m counting on their primary audience being the language model,” Ryan says.

“For example, I have—I call it The Gauntlet. I put all my scenes through a 93-page gauntlet of questions from all different dimensions of that you can interrogate a scene, all the structures dialogue, everything,” Ryan continues.

Here’s an example of GPT’s answer to one snippet question from The Gauntlet analyzing “It’s a Wonderful Life.”

ChatGPT explaining valence changes in a scene

“It was a long, laborious process to do that for 150 scenes. I reformulated those questions in TextExpander… and then it spits out in seconds what it would take me hours to write,” Ryan says.

Ryan saved over 225 hours with TextExpander in 2022. That’s more than nine entire days.

Ryan Briggs time saved: 225 hours, 15 minutes

You can try a version of The Gauntlet below. There are three versions in the Public Group. You can find all three using inline search.

Searching for gpt.storygauntlet in TextExpander inline search

See how TextExpander works

Pretend you are the world’s leading screenplay expert. What “valence change” or “opposite” happens to the protagonist/scene in Act 1? Act 2? Act 3? The story? What biases in all three Acts help make their points of distortion and misdirection? What plot type is my story? Archplot? Antiplot? Miniplot? Closed or open mystery? Suspense story? Dramatic irony? Combination of all three? What is the “causal lock” between the Inciting Incident and the Story Climax? “The Inciting Incident is the story’s most profound cause, and, therefore, the final effect, the Story Climax, should seem inevitable.” Is my ending open-ended or closed? Single or multiple protagonists? Active or passive protagonist? Linear or nonlinear time? Causality or coincidence? From Act to Act, explain how the structure progressively builds pressure on the protagonist and forces characters into more and more dilemmas where they must make more and more difficult risk-taking choices and actions, gradually revealing their true natures, even down to the unconscious self. The story structure shows change or stasis? What literary structure or combination of structures does the story show? Oneiric? Hyperlink? Fabula/Syuzhet? Reverse chronological? Rashomon? Circular? Non-linear? Format your response using markdown. Use headings, bullet points, and bold to organize the information. Avoid jargon. Give me 300 words or more.

The limits of ChatGPT prompt engineering

It’s important to keep the limitations of ChatGPT in mind. We tried it a few different times and didn’t always receive the same result because ChatGPT is probabilistic, not deterministic. Above, it identified the “unexpected twist” approach. Below, it identifies the “complete reversal” approach, with a table diagramming the reversals in the scene.

ChatGPT prompt engineering to diagram a reversal

ChatGPT is an amazing tool, but AI hasn’t quite reached the point where it overtakes human reasoning. However, it’s best at enhancing your reasoning and—like TextExpander—cutting out tedious and repetitive work.

ChatGPT says, “As an AI language model, ChatGPT can sometimes generate different responses based on the input and the way the question is interpreted. It’s important to keep this in mind and verify the accuracy of the response.”