How to get started with prompt engineering

Are you ready to become an 'AI psychologist'? Now is the time to get in on the ground floor of this lucrative new career. Here's how to do it.

1 2 Page 2
Page 2 of 2
  • Provide concrete tasks one at a time: Break up your prompt into discrete tasks.
  • Add more context: Before starting the actual question, add context in the details and specify the role the AI will play.
  • Provide content with a clear separator: Make it the parts of the prompt clear. For example, say, "my code is in italics" or "my code is in quotes."
  • Don’t switch the context: Stick to the context that is related to your conversation. If you are asking the AI to debug front-end code, talk about front-end code. Avoid talking about anything unrelated to your context.

Now, let's see these tips in action. Here's the example from Kumar.

As front-end developers, we have a number of React components and CSS to make an amazing UI experience. Sometimes we have to change the CSS, but that can be tricky. Here's an example where we used developer prompts to get amazing results.

Problem: Given a list of customer logos, rotate them in a circular way on the front end.

Prompt: You are an awesome front-end engineer. You are going to help me write some JavaScript and CSS code for my requirements following the guidelines mentioned.

Guidelines:
My code is in React. So stick to the React coding standard.
Create a separate section for CSS.
Don’t complicate the code. Make it easy to understand.
Write React code that is responsive to the screen size of mobile and desktop devices.
Don’t assume anything—ask follow-up questions if needed.

Requirements: I have a React component that renders customer logos in the sheet. I want to change my React component such that the list starts rotating in a circular way. Take a look at my code written in the quote section and modify it to make it rotate in a circular way.


```
  const HorizontalList = ({ items }) => {
  const style = {
    display: 'inline-block',
    margin: '0 10px'
  };

  return (
    <div>
      {items.map((item, index) => (
        <span key={index} style={style}>
          {item}
        </span>
      ))}
    </div>
  );
};


```

In the spirit of prompt engineering, we encourage you to input this prompt into your LLM of choice, check the results, and then see if you can refine it. Good luck!

The future of prompt engineering

Where prompt engineering goes from here is anybody's guess. In fact, you could argue that the true dream of generative AI is that specialized prompt engineering knowledge won't ultimately be necessary. "We're getting indications that OpenAI is attempting to push the technology in a direction where prompts require less engineering," says AIPRM's King. "I think in the long term it'll be a lot easier to get what you want out of generative AI tools, and more tools will integrate and abstract the functionality, so it won't need to be someone's full-time job anymore."

That said, people have been dreaming of easy, frictionless interactions with computers since the early days of COBOL, and it never quite works out. Learning how to talk to generative AI will likely be a lucrative new skill for software developers for years to come.

Copyright © 2023 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2