smithery.ai

fsharp-csharp-bridge

F# Domain/Application層とC# Infrastructure/Web層の型変換パターンを自律的に適用。F#↔C#境界コード実?

First seen Mar 22, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Allowed toolsRead, Grep
Declared agents claude-code

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,256 B
  • docs SUMMARY.md 297 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

F#↔C# Type Conversion Patterns

概要

このSkillは、F# Domain/Application層とC# Infrastructure/Web層の境界で発生する型変換パターンを自律的に適用します。Phase B1 Step7で確立・実証された4つの変換パターンを提供します。

使用タイミング

Claudeは以下の状況でこのSkillを自律的に使用すべきです:

  1. F#↔C#境界コード実装時

- Contracts層のTypeConverter実装 - Blazor ServerコンポーネントからF# Applicationサービス呼び出し - C# Infrastructure層からF# Domainモデル変換

  1. 型変換エラー発生時

- IsOkアクセスエラー - Record型のRead-onlyプロパティエラー - Discriminated Unionのパターンマッチングエラー - Option型のnull参照エラー

  1. 契約層作業時

- contracts-bridge Agent作業時の自動参照 - DTOとDomainモデル間の変換実装時

4つの型変換パターン

1. F# Result型 ↔ C# 統合パターン

詳細: [patterns/result-conversion.md](./patterns/result-conversion.md)

概要:

  • IsOk/ResultValueアクセスパターン(推奨)
  • NewOk/NewError生成パターン
  • Railway-oriented Programming統合

典型的なエラー: Error CS1061: 'FSharpResult<T, E>' does not contain a definition for 'IsOk'

2. F# Option型 ↔ C# 統合パターン

詳細: [patterns/option-conversion.md](./patterns/option-conversion.md)

概要:

  • Some/None生成パターン
  • IsSome/Valueアクセスパターン
  • null許容型変換パターン

典型的なエラー: Option型のnull参照エラー

3. F# Discriminated Union ↔ C# 統合パターン

詳細: [patterns/du-conversion.md](./patterns/du-conversion.md)

概要:

  • switch式パターンマッチング
  • Role型(Discriminated Union)のC#統合
  • Enumとの違い(重要)

典型的なエラー: Error CS0246: The type or namespace name 'Role' could not be found

4. F# Record型 ↔ C# 統合パターン

詳細: [patterns/record-conversion.md](./patterns/record-conversion.md)

概要:

  • コンストラクタベース初期化パターン(必須)
  • camelCaseパラメータ使用
  • Read-onlyプロパティ対応

典型的なエラー: Error CS0200: Property or indexer cannot be assigned to -- it is read only

品質基準

このSkillを適用した実装は以下を満たすべきです:

  • ✅ 型安全性: コンパイル時型チェック完全通過
  • ✅ 実行時安全性: null参照例外ゼロ
  • ✅ パフォーマンス: 不要な変換オーバーヘッドなし
  • ✅ 可読性: F#/C#それぞれの慣用句に準拠

Phase B1での実証結果

  • 実装箇所: 36ファイル(Contracts層7ファイル・Web層3コンポーネント)
  • 修正エラー数: 36件の型変換エラーを完全解決
  • 品質評価: 97/100点(Clean Architecture準拠)
  • 成功率: 100%(0 Warning/0 Error達成)

関連Agents

  • contracts-bridge: F#↔C#境界実装専門Agent(このSkillの知見を活用)
  • csharp-web-ui: Blazor Server実装時にこのSkillを参照
  • csharp-infrastructure: Infrastructure層実装時にこのSkillを参照

注意事項

  1. F# Record型は不変型: C#のオブジェクト初期化子は使用不可
  2. Discriminated UnionはEnumではない: switch式でパターンマッチング必須
  3. Option型はnullではない: IsSome/Noneチェック必須
  4. Result型は例外ではない: IsOk/ErrorValueで明示的処理

参考資料

  • Phase B1 Step7実装記録: Doc/08Organization/Completed/PhaseB1/Step07_完了報告.md
  • contracts-bridge Agent定義: .claude/agents/contracts-bridge.md
  • techstackand_conventionsメモリー: F#↔C# 型変換パターンセクション