Learn AI. Do. Grow.
← All modules

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

  1. Describe input, desired output, and the boundaries of the script.

  2. Ask for a small, understandable piece of code.

  3. Try normal and anomalous fictitious input before real use.

Remember: Understand and test what the code does before you trust it. Open het volledige schema ↗

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 situation

A 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.

Ende, your light pink practice buddy

The fictitious source is included. Only when selecting ‘Let Ende answer’ do you send your assignment to the AI service. Do not use private data.

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

Your result

No answer yet

Present your assignment to Ende.
Read the answer, change one thing, and compare.

You remain in control

What do you want to improve in your next attempt?

My own check

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.

A script and a folder of documents. Illustration for the question.

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

Code for a small task. Illustration for the question.

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.

A question? I'll help you on your way.

Drag Aldo to move it. Use the arrow keys on Aldo with the keyboard, Enter to save the position and Escape to cancel.