Writing a Life Cycle Action script means knowing a scripting language, the target you're running against, and Skillable's own conventions for how an LCA script talks back to the lab — a lot to hold in your head before you've automated anything. The Life Cycle Action Script Assistant is a chat panel inside the LCA script editor that generates and refines scripts from a description of what you want to happen, and it already understands the format an LCA script has to take. This article covers how to prompt it well, how to iterate on what it produces, and what to check before you accept a script.
Best Practices for the Life Cycle Action Script Assistant
The assistant knows how to write an LCA script. It doesn't know your lab, and it doesn't know when you want the script to run — so those are the two things every prompt should carry.
- Name the life cycle event in your prompt. The same task produces a different script depending on when it fires: at Pre-Build the environment is still deploying, at Tearing Down it's about to be destroyed. Say "at First Displayable" and the assistant can write for what will actually exist.
- Set the target and language before you generate. The assistant tailors the script to what it runs against, so a cloud subscription and a Windows VM produce different output. Configure these in the editor first rather than describing them in the prompt.
- Describe your lab, because the assistant can't see it. VM names, credentials, resource groups, instruction set contents — none of it is visible to the assistant. Anything the script must reference comes from your prompt or from an
@labreplacement token. - Use several focused prompts rather than one long one. A sequence of prompts produces a script that's easier to read, regenerate and fix. Each prompt is preserved, so you can adjust one and regenerate rather than rewriting everything.
- Ask for error handling, then confirm you got it. This matters more for LCAs than for most scripts: an uncaught error in a cloud platform or custom script triggers the platform's retry behaviour, re-running the script every 60 seconds for up to 30 minutes. A generated script that fails silently can create duplicate resources for half an hour.
- Say if the script has to return true or false. The Repeat setting depends on a boolean return, and the assistant won't produce one unless you ask. Mention it whenever the script is polling for something to become ready.
- Say what the script should hand back to the lab. If the point of the script is a lab variable or a notification, name it — the assistant knows the commands, but not your intent.
- Ask it not to write output. LCA scripts shouldn't emit data. If generated output includes console writes, ask for them removed.
- Read the script before you accept it. An LCA runs unattended against a live lab at a specific moment. A script nobody has read is a script nobody can debug when a learner's lab fails.
Who Uses the Assistant, and When
Lab Developers use the assistant in Skillable Studio while adding or editing a Life Cycle Action. It runs at authoring time only — it plays no part in executing the script when a lab launches, and learners never see it.
Reach for it when:
- You're automating something for the first time. LCAs are where many Lab Developers first meet scripting, and a working draft is a far better starting point than a blank editor.
- You know the outcome but not the syntax. You want a variable set before the instructions render, or a service started once a VM is up, and you'd rather describe that than look up how.
- An existing script has stopped working. Paste the error from the lab instance log into the chat and ask for a fix.
- You're moving a script to a different target. A script written for a Windows VM can be reworked for a container or a cloud subscription through the chat.
- You need the Skillable-specific parts. Setting a lab variable, sending a notification, returning a value for Repeat — the assistant knows the shapes these take.
How the Assistant Works in Skillable Studio
The assistant is a chat panel in the LCA script editor, beside the script itself. You describe what you want, it generates a script, and you choose whether to put it into the editor — nothing is written to your script until you accept it. After that you keep refining in the same conversation.
It replaces the earlier prompt-based generation flow, which produced a script in one pass from a set of prompts rather than a conversation.
The editor around it — the info pane, Read Me and Source tabs, resizing and full screen — is covered in Dual Pane Script Editor. One part is worth knowing here: the Source tab keeps the prompts behind the current script, so you can edit a prompt and regenerate instead of starting again. Regenerating replaces the script, so save anything you've hand-edited first.
The assistant appears when you add or edit a Life Cycle Action that executes a script — in a virtual machine, in a container, in a cloud platform, or as a custom script. Actions that send a web request, notification or email have no script, and no assistant. Select Build with Script Assistant to start; the panel is labelled Assistant in the editor.
[FIGURE 1 — the LCA script editor with the assistant panel open beside the script pane.]
What the assistant already understands
The assistant knows the format an LCA script has to take. That's the main difference from generating a script in a general-purpose AI tool, and it's why you don't need to explain Skillable's conventions in your prompt — the platform commands for setting a lab variable and sending a notification, and the return-value convention the Repeat setting relies on.
[VERIFY — confirm the exact scope of the format awareness before publishing: which commands and conventions are covered, and whether it varies by target or language.]
Everything specific to your lab still has to come from you. The assistant has no view of your environment, so it will invent names and paths if you don't supply them.
Prompting for a specific event
Life cycle events are the single most useful thing to include in a prompt, because they determine what exists when the script runs. A script that's correct at First Displayable can fail at Pre-Build for no reason other than timing. The full list of events and what each one means is in Life Cycle Actions — name the one you've selected, in the prompt.
One consequence worth knowing: a lab variable has to be set before anything references it. Ask for a variable at Tearing Down and it will never resolve in the instructions. See Defining Variables.
Worked example
A lab needs the learner's assigned resource group name to appear in the instructions. Rather than looking up the command, describe the outcome, the timing and the target:
"At First Displayable, targeting the Azure subscription with PowerShell: read the resource group in the subscription and set it as a lab variable called
rgNameso the instructions can reference it. Handle the case where no resource group exists yet."
That prompt carries all three things the assistant needs — event, target, and what to hand back to the lab — so what comes back is a script that queries the subscription, sets the variable with the platform command, and handles the empty case. Accept it, then reference @lab.Variable(rgName) in your instructions.
[FIGURE 2 — the generated script in the editor with the originating prompt visible in the Source tab.]
To extend it, continue the conversation — "also send the learner a notification once the variable is set" — rather than writing a new prompt from scratch. Iterating is cheaper and usually produces better scripts than one long prompt.
[FIGURE 3 — optional: the same script after a follow-up prompt.]
Next Steps
The assistant writes the script; it doesn't configure the action. Once you've accepted a script, set the action's own options — Blocking, Delay, Timeout, Repeat, Retries and Error Action — in Life Cycle Actions. Blocking and Repeat in particular need to match what you asked the assistant for: Repeat won't work unless the script returns a boolean.
If the script is one you'll want in other labs, publish it to the Script Library from the editor's command menu once the lab profile is saved.
Related Topics
- Life Cycle Actions — events, actions, targets, languages and the settings that govern how a script runs.
- Dual Pane Script Editor — the editor the assistant sits in, including the Source tab and the generated Read Me.
- Automated Script Activity Assistant — the equivalent for scripts that validate a learner's work.
- Defining Variables — setting variables in an LCA and using them later in the lab.
- Using the Script Library — reusing a script across labs, and publishing one you've generated.
- Effective AI Prompting — writing prompts that produce consistent results.
- Skillable AI — the wider AI capability set and how models are made available to an organization.