本文へ移動
cccskills
無料GitHub で公開

fsi

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 CLI, test, or build target. INVOKES: run dotnet fsi, edit .fsx scripts, load project or source files, and validate snippets against the target SDK.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md6.5 KB
  • manifest.json86 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

F# Interactive

Trigger On

  • the task asks for F# Interactive, FSI, .fsx, or dotnet fsi
  • a quick typed experiment is needed before changing compiled project code
  • a script should reference NuGet packages directly with #r "nuget: ..."
  • an investigation needs quick access to F# type inference, pattern matching, or pipelines
  • a repeatable one-file probe is better than a temporary project

Do Not Use For

  • long-lived application code that needs a compiled .fsproj
  • production automation that should be versioned as a CLI, test project, or build target
  • C# script work
  • package restore from untrusted sources

Quick Start

Run an interactive REPL:

dotnet fsi

Run a script:

dotnet fsi scripts/check.fsx

Create a Unix executable script when that fits the repo:

#!/usr/bin/env -S dotnet fsi

printfn "Hello from FSI"
chmod +x scripts/check.fsx
./scripts/check.fsx

On Windows, run scripts with dotnet fsi scripts/check.fsx.

Workflow

  1. Decide whether the request is a disposable REPL probe, a repeatable .fsx script, or code that should be promoted to a compiled F# project.
  2. Put repeatable work in an .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.
  3. Keep package references pinned when the script should be reproducible, and use only trusted NuGet feeds or local feeds derived from __SOURCE_DIRECTORY__.
  4. Run the script with dotnet fsi from a clean shell, passing the same arguments the user or CI will use.
  5. Promote the script to an .fsproj when it needs tests, distribution, project references, or long-term CI coverage.

Current Upstream Notes

  • The September 2026 F# Interactive reference keeps 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.
  • Use repeatable .fsx files with explicit #r "nuget: ..." and #load directives once an experiment affects a repository task; do not rely on hidden REPL state.

Interactive Session Rules

  • End REPL submissions with ;;.
  • Multi-line input is allowed; FSI evaluates when it receives ;;.
  • Previously evaluated values stay in the session, so do not rely on hidden session state in scripts.
  • Use .fsx files for repeatability once an experiment matters.
let square x = x * x;;

[ 1 .. 5 ] |> List.map square;;

Script Patterns

Read And Summarize Text

Use ordinary .NET APIs directly from F# scripts.

open 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}"

Write A Checked Output File

Keep script outputs deterministic and fail early when required inputs are missing.

open 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)

Reference NuGet Packages

Pin package versions for repeatable scripts. Only use package sources the repo trusts.

#r "nuget: Newtonsoft.Json, 13.0.3"

open Newtonsoft.Json

let payload = {| Name = "Ada"; Kind = "sample" |}
let json = JsonConvert.SerializeObject(payload)

printfn $"{json}"

FSI does not use referenced package build targets during restore by default. Enable them only when a trusted package requires them; pin the version and test from a fresh process:

#r "nuget: FSharp.Data, 6.6.0, usepackagetargets=true"

Keep usepackagetargets=false or omit the option for ordinary references. This controls package restore behavior; it does not turn an .fsx script into a compiled project.

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.

let localFeed =
    System.IO.Path.Combine(__SOURCE_DIRECTORY__, "../artifacts/packages")
    |> System.IO.Path.GetFullPath

#i $"nuget: {localFeed}"

Split Scripts With Load

#load evaluates another script and exposes it through the generated module name.

// MathHelpers.fsx
let square x = x * x
// Check.fsx
#load "MathHelpers.fsx"
open MathHelpers

printfn $"%d{square 12}"

Promote To A Project

Move from FSI to a compiled project when:

  • the script has multiple dependencies, tests, or distribution needs
  • startup time or restore behavior matters
  • C# or other .NET callers need a stable assembly
  • the code needs CI coverage beyond a smoke run

Start with:

dotnet new console -lang "F#" -o tools/Probe
dotnet build tools/Probe/Probe.fsproj

Validate

Use the simplest command that proves the script still runs:

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

Sources

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Route gh-aw workflow design/create/debug/upgrade requests to the right prompts.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Use a repo-root `.editorconfig` to configure free .NET analyzer and style rules. Use when a .NET repo needs rule severity, code-style options, section layout, or analyzer ownership made explicit. USE FOR: the repo needs a root .editorconfig; analyzer severity and style ownership are unclear; the team wants one source of truth for rule configuration. DO NOT USE FOR: choosing analyzers with no config change; formatting-only execution with no config ownership question. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I/O with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Symbolicate the .NET runtime frames in an Android tombstone file. Extracts BuildIds and PC offsets from the native backtrace, downloads debug symbols from the Microsoft symbol server, and runs llvm-symbolizer to produce function names with source file and line numbers. USE FOR triaging a .NET MAUI or Mono Android app crash from a tombstone, resolving native backtrace frames in libmonosgen-2.0.so or libcoreclr.so to .NET runtime source code, or investigating SIGABRT, SIGSEGV, or other native signals originating from the .NET runtime on Android. DO NOT USE FOR pure Java/Kotlin crashes, managed .NET exceptions that are already captured in logcat, or iOS crash logs. INVOKES Symbolicate-Tombstone.ps1 script, llvm-symbolizer, Microsoft symbol server.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS). Extracts UUIDs and addresses from the native backtrace, locates dSYM debug symbols, and runs atos to produce function names with source file and line numbers. Automatically downloads .dwarf symbols from the Microsoft symbol server using Mach-O UUIDs. USE FOR triaging a .NET MAUI or Mono app crash from an .ips file on any Apple platform, resolving native backtrace frames in libcoreclr or libmonosgen-2.0 to .NET runtime source code, retrieving .ips crash logs from a connected iOS device or iPhone, or investigating EXC_CRASH, EXC_BAD_ACCESS, SIGABRT, or SIGSEGV originating from the .NET runtime. DO NOT USE FOR pure Swift/Objective-C crashes with no .NET components, or Android tombstone files. INVOKES Symbolicate-Crash.ps1 script, atos, dwarfdump, idevicecrashreport.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Design or review .NET solution architecture across modular monoliths, clean architecture, vertical slices, microservices, DDD, CQRS, and cloud-native boundaries without over-engineering. USE FOR: .NET architecture choices; layer and domain boundary review; service decomposition; clean architecture, vertical slice, DDD, CQRS, and modular monolith decisions. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

managedcode のスキルをすべて見る

このスキルの問題を報告する