Deep dive · module 79 of 100
AI for code and scripts
Let AI help with small scripts or code, and always test.
After this lesson
You use AI for code suggestions and test the result before using it.
In view · Step by step
Code first goes through a test
Describe input, desired output, and the boundaries of the script.
Ask for a small, understandable piece of code.
Try normal and anomalous fictitious input before real use.
Part 1 of 3 · Small task
Your preference for less movement is on. Choose each part yourself.
Ask for explanation
Do not just have AI provide code, but also explain what it does.
Always test
Run the code in a safe environment and check the result.
Small pieces
Ask for small, understandable pieces of code instead of a full program.
New practice example
From explanation to a usable result.
AI code is a proposal that you must check with suitable test data and limited permissions.
Fictional practice situationA fictitious script must find duplicate rows in a practice file. The AI proposal also includes an instruction to overwrite the original file.
View a possible solution
This is how it can be done
First, use a copy with fictitious rows. Let the script only show a report with the duplicates found. Also test an empty file and two nearly identical names. Only then decide if a separate export is necessary.
Why this works
A working example does not prove that edge cases or write actions are safe. The requested result was to find, not to automatically delete.
Make it slightly more difficult
Design three small test files and note beforehand which result you expect. Do not use real customer data for the first trial.
Extra practice, at your own pace. You do not need to submit anything. This does not count towards an automatic assessment.
Your workplace · learning by doing
Make something. See what changes.

Checking the AI connection… You can already view the written example.

Present your assignment to Ende.
Read the answer, change one thing, and compare.
Previously held
New version
You remain in control
What do you want to improve in your next attempt?
On this device only. AI answers remain only in this page memory. This is self-review, not a grade.
Why this approach works
A working example does not prove that edge cases or write actions are safe. The requested result was to find, not to automatically delete.
A step further
Design three small test files and note beforehand which result you expect. Do not use real customer data for the first trial.
A prompt to get you started
Write a short script that [task]. Explain what each step does in comments. Use only standard functions.
Apply it
AI writes a script that renames files. You want to run it on the only copy of important documents.
Which approach best fits this situation?
- Run it immediately on the only copy.
- First test on copies with a preview and check the expected changes.
- Remove error messages so the script continues uninterrupted.
With JavaScript, you can check your approach and receive immediate feedback.
Test your insight
What should you always do with code generated by AI?
- Deploy it directly into production.
- Test and understand before you use it.
- Nothing.
Extra practice
Describe a small task where you would ask AI for a script and how you would test it.
A script that renames files. Testing with a copy of the files.

