Prompt Engineering

GUIDE TO CRAFTING EFFECTIVE PROMPTS FOR WEBSITE STYLE REPLICATION

March 6, 20245 min read
GUIDE TO CRAFTING EFFECTIVE PROMPTS FOR WEBSITE STYLE REPLICATION

This guide outlines how to structure prompts for Large Language Models (LLMs) like Cursor AI, Claude, or V0, aiming to replicate or emulate the visual styles of websites. The proposed structure employs bracket tags to facilitate clear segmentation and comprehension.

Initial Prompt

Use the following structure when requesting the replication of a website's styles:

<context>
Provide brief context about the project or the need for the prompt.
Example:
"I need to replicate the exact visual styles of website X for a quick prototype."
</context>

<task>
Clearly describe what the model should do:
- "Precisely copy the visual style (colors, typography, layout, etc.)."
- "Create a simplified version while retaining essential visual elements."
</task>

<details>
Specify additional relevant details, such as:
- "Functionalities are not needed, only visual styles."
- "Styles should be responsive for mobile devices."
</details>

<examples> (optional)
Optionally, provide links or screenshots:
- "Exact style reference: www.example.com"
- "Additional images from the original site"
</examples>

<technologies> (optional)
Indicate specific technologies you wish to use:
- "React with Tailwind CSS"
- "Pure HTML and CSS, without frameworks"
- "Styles in individual components without inline-styles"
</technologies>

<rules> (optional)
Set guidelines or specific restrictions:
- "Do not use inline styles."
- "Follow BEM methodology for class naming."
- "Must be compatible with mobile devices (responsive)."
- "Do not include JavaScript."
</rules>

<avoid> (optional)
Specify elements or practices to avoid:
- "Avoid using excessive animations that may affect user experience."
- "Do not include low-resolution images."
</avoid>

Feedback Prompt

Use this structure when requesting corrections or improvements to the initially generated result:

<feedback>
Clearly list the necessary improvements:
- "The typography does not match exactly; use the exact font from the original site."
- "The background color is incorrect; use the exact hex values."
- "The layout is not responsive on mobile devices; please fix it."
</feedback>

<priority> (optional)
Specify the order of importance for corrections:
- "Correct mobile styles first."
- "Prioritize accuracy in colors and typography over animations."
</priority>

Feature Prompt

Use this structure when you need to add new features or functionalities to the result:

<feature>
Clearly describe the new feature to implement:
- "Add an animated dropdown menu."
- "Include hover effects on buttons."
- "Integrate a testimonials section not present in the original site."
</feature>

<examples> (optional)
Provide concrete examples of the expected result:
- "Example of animated menu: www.example.com/menu"
- "Screenshot of the expected button hover effect"
</examples>

<reason> (optional)
Explain the reason for adding the new feature:
- "Specific client request to improve user experience."
- "Necessary to align the design with current UI practices."
</reason>

<avoid> (optional)
Clearly state what should not be done:
- "Do not use overly complex animations that affect performance."
- "Avoid excessive use of JavaScript for simple effects."
</avoid>

Example of a Complete Prompt

Here's an example of how to use these structures together for a real-world request:

<context>
I need to replicate the visual style of Linktree for a personal portfolio page.
</context>

<task>
Create a simplified version of Linktree's interface that maintains the clean, 
minimalist aesthetic while adapting it for a tech portfolio.
</task>

<details>
- The page should include a list of links to my projects and social media.
- Each link should be a button with hover effects.
- Include a profile picture at the top.
- The layout should be mobile-first and responsive.
</details>

<examples>
- Reference site: https://linktr.ee/
- I want a similar gradient background effect.
</examples>

<technologies>
- Next.js
- Tailwind CSS
- Static site generation (SSG)
</technologies>

<rules>
- Follow BEM methodology for class naming.
- Must be responsive for all devices.
- Use smooth animations for hover states.
</rules>

<avoid>
- No excessive animations that could distract from the content.
- Don't use inline styles.
</avoid>

Benefits of Structured Prompts

Following this structured approach offers several advantages:

  • Clarity: The model clearly understands what you're asking for
  • Precision: You get more accurate results that match your requirements
  • Efficiency: Reduces back-and-forth iterations to get the desired output
  • Consistency: Establishes a standard format for your team to follow

By using these structured prompts, you'll maximize the precision and usefulness of the responses generated by LLMs when trying to replicate website styles.