Tool .NET Foundations v1.0.0

F# for .NET

Write, review, or modernize F# code in .NET repositories with functional-first design, algebraic data types, pattern matching, pipelines, async workflows, project ordering, and C# interop. USE FOR: F# .fs/.fsproj code; discriminated unions, records, options, results, pattern matching, computation expressions, or functional domain modeling; strongly typed AI-generated .NET code. DO NOT USE FOR: C# language modernization; FSI-only exploratory scripts with no project changes. INVOKES: inspect .fsproj file order and SDK settings, edit F# source and project files, and run dotnet build/test or dotnet fsi validation commands when changes are made.

Trigger On

  • the task touches .fs, .fsx, .fsi, or .fsproj files
  • domain logic benefits from records, discriminated unions, options, results, or exhaustive pattern matching
  • generated code needs a strongly typed functional model instead of nullable primitive state
  • F# code must interoperate with C# or other .NET libraries
  • the repository needs project setup, source ordering, or validation for F# code

Workflow

  1. Inspect the existing .fsproj, .fs, .fsi, and .fsx files to determine compile order, public boundaries, and whether the code is F#-first or C#-facing.
  2. Choose the smallest F# model that represents the invariant: records for named product data, discriminated unions for closed state, option for absence, and Result for expected failures.
  3. Add or edit source files in dependency order, then update the .fsproj compile list before consumers reference the new code.
  4. Review public API shape for .NET interop. Translate F#-specific internal models to DTOs, methods, or Try* patterns when C# callers need a stable surface.
  5. Run dotnet build, targeted tests, and any relevant dotnet fsi probes before returning the final result.

Validate

Run the narrowest relevant checks after changes:

dotnet build
dotnet test
dotnet fsi scripts/check.fsx

If adding a new F# file, also inspect the project file diff to confirm the compile order is deliberate.

Related skills

Use ManagedCode.Communication when a .NET application needs explicit result objects, structured errors, and predictable service or API boundaries instead of exception-driven…

ManagedCode.Communication

Use ManagedCode.MimeTypes when a .NET application needs consistent MIME type detection, extension mapping, and content-type decisions for uploads, downloads, or HTTP responses.

ManagedCode.MimeTypes

Use the Microsoft.Extensions stack correctly across Generic Host, dependency injection, configuration, logging, options, HttpClientFactory, and other shared infrastructure…

Microsoft.Extensions.*