Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Prompts For Code And Automation | Prompts for Real Work Tasks
Prompt Engineering for Work

bookPrompts For Code And Automation

Swipe to show menu

You don't need to be a developer to use AI for code-related tasks. And if you are one, AI changes what's possible in your daily workflow in ways that go well beyond autocomplete.

This chapter covers the most practical prompting approaches for three groups: non-technical professionals who need formulas and simple scripts, technical users who want to accelerate their workflow, and anyone who needs to understand code they didn't write.

For Non-Technical Users: Formulas And Simple Scripts

If your relationship with code is limited to Excel formulas or occasional scripts, AI is particularly useful — because these tasks have a clear correct answer and the model handles them well.

Excel and spreadsheet formulas:

Note
Template

Write an Excel formula that [describe what you want to calculate or extract in plain language].

The data is structured as follows: [describe columns, what each contains, and which row the headers are in].

The formula will go in cell [cell reference].

Simple automation without code:

Note
Template

I want to automate the following task: [describe the manual process step by step — what triggers it, what data is involved, what the output should be].

I use [tools: Excel / Google Sheets / Zapier / Make / Notion / other]. Suggest the simplest way to automate this without writing custom code.

An important constraint: always test any formula or automation output on sample data before applying it to real data. AI-generated formulas are usually correct but should be verified — especially for anything involving financial calculations or data transformation.

Screenshot description: A chat window showing two non-technical code prompts side by side (stacked vertically). Top exchange: user sends Write an Excel formula that looks up a client name in column A and returns the total sales value from column C, only for rows where the status in column B is "Closed Won". The formula goes in cell F2. → AI responds with a clean SUMIFS formula with a brief explanation of each argument. Labeled "Plain English description → working formula." Bottom exchange: user sends I manually copy data from a Google Sheet into a Notion database every Monday morning. The Sheet has columns for Name, Status, and Due Date. Suggest the simplest way to automate this without writing code. → AI responds with a clear, step-by-step Zapier or Make automation suggestion with the exact trigger and action to configure. Labeled "Manual process described → automation path identified."

For Developers: Accelerating The Workflow

If you write code professionally, AI handles the parts of your workflow that are time-consuming but not complex:

Generating code from a description:

Note
Template

Write a [language] function that [describe what it should do in plain English].

Input: [describe the input — data type, format, example]

Output: [describe the expected output]

Constraints: [performance requirements, libraries to use or avoid, edge cases to handle]

Include comments explaining the key steps.

Explaining unfamiliar code:

Note
Template

Explain what the following [language] code does, step by step. Assume I understand the problem domain but am not familiar with this specific syntax or library.

[paste code here]

Debugging:

Note
Template

The following [language] code produces this error: [paste error message].

Here is the code: [paste code]

Identify the likely cause and suggest a fix. If there are multiple possible causes, list them in order of likelihood.

Writing tests:

Note
Template

Write unit tests for the following function using [testing framework]. Cover: the happy path, at least two edge cases, and one case that should raise an error.

[paste function here]

What You Should Always Do With AI-Generated Code

AI generates code that looks correct. It is not always correct. Before using any AI-generated code in a production environment:

  • Read it — if you cannot explain what it does line by line, you should not deploy it;
  • Test it — run it against sample inputs, including edge cases and unexpected values;
  • Review it for security — AI-generated code can introduce vulnerabilities, especially in authentication, input handling, and data access;
  • Check the dependencies — AI may suggest libraries that are outdated, deprecated, or not approved in your environment.

Speed is not the goal. Working, secure, maintainable code is.

1. Which of the following is NOT recommended when using AI-generated code in a production environment?

2. For non-technical users, what kind of tasks does AI handle particularly well?

question mark

Which of the following is NOT recommended when using AI-generated code in a production environment?

Select the correct answer

question mark

For non-technical users, what kind of tasks does AI handle particularly well?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 5

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 3. Chapter 5
some-alt