
AI assistants help with writing code, finding bugs and explaining code. Using the output without understanding it still causes trouble.
What are they good at?
- Excel macros, small Python scripts, spreadsheet formulas.
- Explaining what an error message means.
- Walking through existing code line by line.
- Translating from one language to another.
Elements of a good prompt
I use Python 3. Write a script that renames all .jpg files in a folder
to "holiday_001.jpg", "holiday_002.jpg" and so on.
First it should only print what it would do (dry-run mode),
and only rename for real if I confirm. Explain the code line by line.This prompt names the language, the goal, a safety measure (dry run) and asks for explanation.
Debugging
Paste the error as it is and include the code:
When I run this code I get this error: [error text]
Code: [code]
Explain the cause of the error and give corrected code.Before running the code
- Try to understand it. Read the explanation; do not run code you do not understand.
- Back up your files. Test code that deletes or renames in a copy folder first.
- Test on a small sample. Try 5 rows before thousands.
- Be careful with code that downloads or installs. Do not install libraries you cannot verify.
- Never put passwords and keys in code. Do not paste real credentials to the assistant either.
Common problems
- Functions that do not exist: the assistant may invent a library function (see our hallucination guide).
- Outdated code: libraries change; state the version number.
- Drift in long chats: start a new conversation and paste the current code.
Using it to learn
Ask for hints instead of the solution: "Do not write the answer, just tell me which steps to follow." That way you really learn.
Conclusion
AI speeds up coding; checking it is your responsibility. Start with small, reversible tasks.
Step-by-step example: a small Python script to clean Excel data
Goal: lower-case the email column in a CSV file and remove duplicates.
- Give the assistant context:
I'm using Python 3 and pandas. customers.csv has an "email" column.
Lower-case this column, strip leading/trailing spaces, remove duplicates
and save the result as clean.csv. Explain the code line by line and
print a clear message if an error occurs.- Run the resulting code first on a copy of the file; don't touch the original.
- Verify the result by hand with a few sample rows.
- Ask about any line you don't understand: "What exactly does this line do?"
This method both solves the job and teaches coding (for the idea of automation instead of Excel see also our automation tools guide).
What not to give the AI
- Don't paste secrets such as passwords, API keys or customer data into the prompt; use sample/made-up data (see our AI and privacy guide).
- Check your organisation's policy before sharing in-house source code.
- Review the output against the risk of copying licensed code (see our copyright guide).
Frequently asked questions
Does AI always write correct code? No. It can produce code that looks like it works but gives wrong results or contains security holes. Test it, and for important work have a developer review it.
Which language should I start with? Python for data and automation, JavaScript for the web, VBA/Office Scripts for Excel are good starts.
I get an error in the code, what do I do? Paste the full error message and the code together; say which version and operating system you use.
Will AI coding replace programmers? It speeds up routine parts; design, testing and responsibility still belong to people (see our AI and careers guide).
How do I run code safely? Try it in a virtual environment or test folder after taking a backup; for commands that delete/change files ask for a "dry-run mode."
Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.