Relearning Kotlin in lazy mode (with sbx)

4 min read

The more I use AI, the more I'm torn about the way we developers use it. Generating entire complex systems while blindly trusting the AI feels more and more reckless to me. Don't forget that precisely because we "trust it so much", everybody recommends running agents inside highly secured sandboxes — because deep down we know the agent can do stupid things... So why wouldn't it do stupid things to your code too?

That said, it remains a fantastic tool for learning and experimenting (and for lazy people too).

For instance, this morning: the urge to get back into Kotlin, gently and without overthinking it. And I used sbx (Docker's new AI agent sandbox) to do it.

My requirements were the following:

  • Install nothing on my machine (except sbx and my IDE), so work exclusively inside sbx
  • Ask the agent to install everything for me in the sandbox
  • Get a small list of simple examples to grasp the basics (generated by the agent)
  • And make the creation of the runtime environment reproducible and usable but without an agent, so by using a kit for an sbx sandbox with the shell template (the goal being to learn to code in Kotlin, but this time with my own brain; a kind of cognitive rehab)

Setting up the environment and the lessons

So I started by creating a working directory, and starting an sbx sandbox with Claude Code:

bash
mkdir learning-kotlin
cd learning-kotlin
sbx run claude

I use Claude Code, but this should theoretically work just as well with other agents

Then I handed this to my agent:

raw
- Install jbang and kotlin so I can take my first steps in kotlin.
- Create an asciidoc file to explain the setup.
- Save all the commands you used to install everything, and then use it to create an sbx kit (kind: sandbox) based on the shell sandbox template.
- Then create 10 lessons to learn the basics of Kotlin, in numbered folders, starting with a 00-hello-world,
- Each lesson's program should be runnable with jbang, and each lesson has a README.
- At the root of the current directory, create a README with the list of lessons and how to run them.

... And I went to make myself a coffee.

A few minutes later I had the following tree:

bash
.
├── 00-hello-world
   ├── hello.kt
   └── README.md
├── 01-variables-and-types
   ├── README.md
   └── variables.kt
├── 02-strings
   ├── README.md
   └── strings.kt
├── 03-conditionals
   ├── conditionals.kt
   └── README.md
├── 04-loops-and-ranges
   ├── loops.kt
   └── README.md
├── 05-functions
   ├── functions.kt
   └── README.md
├── 06-collections
   ├── collections.kt
   └── README.md
├── 07-null-safety
   ├── nullsafety.kt
   └── README.md
├── 08-classes-and-data-classes
   ├── classes.kt
   └── README.md
├── 09-enums-and-sealed-classes
   ├── README.md
   └── sealed.kt
├── kits
   └── kotlin-baby-steps
       ├── files
   └── home
       ├── README.md
       └── spec.yaml
├── README.md
└── SETUP.adoc

Let's stop and remove our sandbox

"Get out" of the sandbox (Ctrl-C twice), then find its name with sbx ls, you should get something like this:

bash
SANDBOX                  AGENT    STATUS    PORTS   WORKSPACE
claude-learning-kotlin   claude   stopped           ...

Remove the sandbox for good:

bash
sbx rm claude-learning-kotlin

Let's start our new playground

Now, if you want to practise Kotlin in a sandboxed environment with all the necessary dependencies, all you have to do is run the following command (still from the same folder):

bash
sbx run --kit ./kits/kotlin-baby-steps/ kotlin-baby-steps

✋ careful though, the automatically generated documentation contains a few mistakes (let's not forget we handed over the wheel to the agent).

Now, in your terminal, you're inside the sbx sandbox shell, and you can check that everything is properly installed:

bash
jbang --version
kotlin -version

And try out the very first lesson:

bash
cd 00-hello-world
jbang hello.kt 
jbang hello.kt "Bob Morane"

And that's it for today. My method can certainly be improved, but it's handy if you need to test, evaluate, learn... new tools or languages in "lazy mode".

Written by

0 Comments

No comments yet. Be the first to comment!

Copyright © 2026k33g_org's BlogPowered by Writizzy