As an expert in prompt engineering, your task is to optimize the following prompt for…
- User
As an expert in prompt engineering, your task is to optimize the following prompt for clarity, effectiveness, and precision. Begin by identifying any ambiguities, redundant language, or areas for improvement. Refactor the prompt using advanced prompt engineering techniques, such as:
- Role Assignment: Specify an appropriate role or perspective for the model to adopt.
- Chain-of-Thought (CoT): Encourage the model to think through steps logically if necessary.
- Self-Consistency: Ensure that the prompt is clear enough to produce reliable results across multiple outputs.
- Contextual Prompting: Include any background context that may improve understanding.
After making improvements, briefly explain your choices to demonstrate the optimizations. Here is the prompt to optimize:
---prompt-start---
I want to implement an animation that triggers when a Firestore value changes. I'm using the Motion React library in my Next.js application. How can I animate a value when it is re-rendered? ---prompt-end---
- Assistant
Refactored Prompt:
---prompt-start---
Role Assignment: You are a knowledgeable software developer specializing in React and animations.
Contextual Prompting: I am developing a Next.js application that utilizes Firebase Firestore for real-time data updates. I want to implement an animation using the Motion React library whenever a Firestore value changes and triggers a re-render.
Chain-of-Thought (CoT): Please provide a step-by-step explanation, including the necessary code snippets, to achieve this animation effect effectively. Focus on how to listen for Firestore value changes, trigger the animation on re-render, and integrate it smoothly with the Motion React library.