Tomasz Godzik
VirtusLab
Maintainer of multiple Scala tools including Metals, Bloop, Scalameta, Munit, Mdoc and parts of the Scala 3 compiler.
Release officer for Scala LTS versions
Part of the Scala Core team as coordinator and VirtusLab representative
Part of the moderation team
How smart are LLMs really
Prompting 101
Context Engineering
Your new work environment
Approaches to working with LLMs
Questions
LLMs has fallen into well known paths
What is it that modern LLMs really generate?
text that COULD be the answer
Opinions differ, but LLMs are getting better.
What modern LLMs really are?
autocomplete on steroids super-soldier serum
Something more?
The hype can get too much at times though.
The hype can get too much at times though.
> Create a simple todo app
> Create a simple todo app
Obviously not
You are a javafx / scalafx expert tasked with creating a simple todo app using Scala 3. Use scala-cli to set up, run and test the project.
You are a javafx / scalafx expert tasked with creating a simple todo app using Scala 3. Use scala-cli to set up, run and test the project.
persona
task
context
You are a javafx / scalafx expert tasked with creating a simple todo app using Scala 3. Use scala-cli to setup, run and test the project. Here’s a snippet of Scalafx specific APIs you can use:
// Aggregate operator
val r1, r2, r3 = new Rectangle()
r1.width <== max(r2.width, r3.width)
// Conditional binding
r2.fill <== when (r2.hover) choose Red otherwise Blue
// Complex boolean + string concat
val tf = new TextField { text = "Hello" }
val lbl = new Label()
lbl.text <== when (r1.hover || r2.hover)
...
Persona competence sizing: expert vs regular - allows to limit the amount of concerns the LLM will try to juggle with.
In-context learning: few-shot prompting > zero-shot prompting for output fitting the precise requirements
Bias management: it’s always good to watch how your prompt is biasing the model - maybe the solution you have in mind is not the best one?
Prompt chaining: Each conversation produces artifacts for the next prompt
Reasoning models: Ask the model to explain it's reasoning, default in some models.
Meta prompting: Prompt to create new prompts for later models
Agentic simulations: Make agents fulfill some persona and simulate things like recruitment calls etc.
Some of the existing techniques made it into tools.
The more people come up with the more the tooling catches up.
The ideas are basically endless.
When the conversation gets reused for new tasks, the previous results end up confusing the model’s attention mechanisms
When the input provided with the initial prompt is big enough, it will confuse the model and lead it astray from the original task.
More data in context, just gets attached before the prompt and uses more tokens, which cost money.
1. Provide only the information (and capabilities) necessary to execute the task at hand
2. Prefer to work in shorter conversations that don’t reach the full size of the available context window
3. Use compaction and external progress tracking to distill and preserve important decisions and insights> Summarize the current decisions and progress so that we can use it in another conversationUse local files for tracking specification and TODOs for the agents to pick up.
Always provide the same prefix, each LLM query is cached
If you change it will need to recalculate everything
This cache will only be available for a time
ask: does not change anything, used for exploration
plan: create documents need for further work, any specification timeline etc.
agent: actually apply changes, test code, compile until the results are satifactory
ask: does not change anything, used for exploration
plan: create documents need for further work, any specification timeline etc.
agent: actually apply changes, test code, compile until the results are satifactory
Most of the time you will use
They can use a variety of tools to enrich their context and verify the results of their work.
Every development tool might be useful for you, but some might need work.
One of the more popular tools to improve the output of LLMs
MCP uses Json RPC, so each possible request and response is represented by json schema
Model Context Protocol is very similar to Language Server Protocol, but instead of people it's for agents.
Host with MCP Client
MCP protocol
MCP protocol
MCP protocol
MCP Server 1
MCP Server 2
MCP Server 2
Local Data Source 1
Local Data Source 2
Web API
compilation: compile-full, compile-module, compile-file test: test analysis: glob-search, inspect, get-docs, get-usages utility: import-build, format-file, find-dep, run-scalafix-rule, list-scalafix-rules
Instead of ingesting the entire context, create smaller tool to change codebase or extract information.
Using typed languages like Scala makes it significantly more efficient.
// ./skills/getDocsFor.scala
import metals.mcp.*
@main
def main(nameToLookFor: String) =
val allMatching = globSearch(fullyQualifiedName, None)
val fqcns = allMatching.split("\n")
val result = fqcns.map{
fullName => getDocs(fullName)
}.mkString("\n")
println(result)
}
---
name: your-skill-name
description: Brief description of what this Skill does and when to use it
---
# Your Skill Name
## Instructions
[Clear, step-by-step guidance for Claude to follow]
## Examples
[Concrete examples of using this Skill]# Glob search
## Quick start
Run the script if you want to return users entire
documentation based on specific glob
(part of the name user is looking for)
```bash
scala-cli search-script.scala
```
These scripts could be added as skills to you company repo.
Some of the scripts could improve CI as it doesn't require a lot of code.
Automize any manual work even if normally wrting a script would take longer than the work
These are projects that we previously written using normal engineering practises and we want to add feature or fix bugs.
Might be harder to use LLMs in, tasks should be scoped, all data available that the LLM afent might need.
Provide as many tools as needed to make sure the context is spot on.
A lot depends on the complexity and the existing quality of the code.
We can also build something from scratch with LLMs in mind.
Makes it possible to create small to mid project almost automatically with guidelines from the developer
Exploration
Product planning
Component analysis
Implementation
Full product ideaFull project specificationSpecification with all modules plannedHalf a year ago was not feasable, but becoming more and more
It is more expensive and complex to monitor
But can for example be used to implement multiple components at the same time or make product exploration faster
Verify if the code is maintainable, extendable and optimal.
Make sure your prompts are sound and context provided is well scoped.
You need to know your domain to be able to verify the output, use tools to improve that
Bluesky: @tgodzik.bsky.social
Mastodon: fosstodon.org/@tgodzik
Discord: tgodzik