Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use F# Interactive (`dotnet fsi`) for .NET exploration, scriptable experiments, package-backed .fsx workflows, quick data transforms, and reproducible command-line probes. USE FOR: .fsx scripts, F# REPL work, #r nuget references, #load composition, interactive type exploration, and small strongly typed experiments before moving code into a project. DO NOT USE FOR: production application code that needs compiled project structure; C# scripting; long-lived automation better expressed as a normal C
.claude/skills/managedcode-fsi/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | 23% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 15% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 41% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 74% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 98% | 0% |
.fsx, or dotnet fsi#r "nuget: ...".fsprojRun an interactive REPL:
bashdotnet fsi
Run a script:
bashdotnet fsi scripts/check.fsx
Create a Unix executable script when that fits the repo:
fsharp#!/usr/bin/env -S dotnet fsi printfn "Hello from FSI"
bashchmod +x scripts/check.fsx ./scripts/check.fsx
On Windows, run scripts with dotnet fsi scripts/check.fsx.
.fsx script, or code that should be promoted to a compiled F# project..fsx file immediately. Add all required #r, #load, open, input path, and package source directives to the script instead of relying on hidden REPL state.__SOURCE_DIRECTORY__.dotnet fsi from a clean shell, passing the same arguments the user or CI will use..fsproj when it needs tests, distribution, project references, or long-term CI coverage.dotnet fsi as the supported command-line entry point for interactive sessions and .fsx scripts; it does not turn hidden REPL state into a reproducible workflow..fsx files with explicit #r "nuget: ..." and #load directives once an experiment affects a repository task; do not rely on hidden REPL state.;;.;;..fsx files for repeatability once an experiment matters.fsharplet square x = x * x;; [ 1 .. 5 ] |> List.map square;;
Use ordinary .NET APIs directly from F# scripts.
fsharpopen System open System.IO let summarize path = File.ReadLines path |> Seq.filter (String.IsNullOrWhiteSpace >> not) |> Seq.countBy (fun line -> line.Split(' ')[0]) |> Seq.sortByDescending snd |> Seq.truncate 10 |> Seq.toList for key, count in summarize "input.log" do printfn $"{key}: {count}"
Keep script outputs deterministic and fail early when required inputs are missing.
fsharpopen System open System.IO let input = "data/items.txt" let output = "artifacts/items.normalized.txt" if not (File.Exists input) then failwith $"Missing input file: {input}" Directory.CreateDirectory(Path.GetDirectoryName output) |> ignore File.ReadLines input |> Seq.map (fun line -> line.Trim()) |> Seq.filter (String.IsNullOrWhiteSpace >> not) |> Seq.distinct |> Seq.sort |> fun lines -> File.WriteAllLines(output, lines)
Pin package versions for repeatable scripts. Only use package sources the repo trusts.
fsharp#r "nuget: Newtonsoft.Json, 13.0.3" open Newtonsoft.Json let payload = {| Name = "Ada"; Kind = "sample" |} let json = JsonConvert.SerializeObject(payload) printfn $"{json}"
Use #i only when an additional feed is required. Local feed paths must be absolute; construct them from __SOURCE_DIRECTORY__ instead of committing personal paths.
fsharplet localFeed = System.IO.Path.Combine(__SOURCE_DIRECTORY__, "../artifacts/packages") |> System.IO.Path.GetFullPath #i $"nuget: {localFeed}"
#load evaluates another script and exposes it through the generated module name.
fsharp// MathHelpers.fsx let square x = x * x
fsharp// Check.fsx #load "MathHelpers.fsx" open MathHelpers printfn $"%d{square 12}"
Move from FSI to a compiled project when:
Start with:
bashdotnet new console -lang "F#" -o tools/Probe dotnet build tools/Probe/Probe.fsproj
Use the simplest command that proves the script still runs:
bashdotnet fsi scripts/check.fsx dotnet fsi scripts/check.fsx -- arg1 arg2
For scripts that reference packages, run from a clean shell at least once so hidden REPL state cannot mask missing #r, #load, or open directives.
Other measured skills in the registry, with their headline benchmark lift.