mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-18 06:43:05 +08:00
docs: add native Japanese translation of ECC documentation (ja-JP)
Translate everything-claude-code repository to Japanese including: - 17 root documentation files - 60 agent documentation files - 80 command documentation files - 99 rule files across 18 language directories (common, angular, arkts, cpp, csharp, dart, fsharp, golang, java, kotlin, perl, php, python, ruby, rust, swift, typescript, web) - 199 skill documentation files Total: 455 files translated to Japanese with: - Consistent terminology glossary applied throughout - YAML field names preserved in English (name, description, etc.) - Code blocks and examples untouched (comments translated) - Markdown structure and relative links preserved - Professional translation maintaining technical accuracy This translation expands ECC accessibility to Japanese-speaking developers and teams. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
112
docs/ja-JP/rules/fsharp/coding-style.md
Normal file
112
docs/ja-JP/rules/fsharp/coding-style.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.fs"
|
||||
- "**/*.fsx"
|
||||
---
|
||||
# F# コーディングスタイル
|
||||
|
||||
> このファイルは [common/coding-style.md](../common/coding-style.md) を F# 固有のコンテンツで拡張します。
|
||||
|
||||
## 標準
|
||||
|
||||
- 標準的な F# の規約に従い、正確性のために型システムを活用する
|
||||
- デフォルトでイミュータビリティを優先する。パフォーマンス上の理由がある場合のみ `mutable` を使用する
|
||||
- モジュールを焦点を絞り、凝集性を保つ
|
||||
|
||||
## 型とモデル
|
||||
|
||||
- ドメインモデリングにはクラス階層よりも判別共用体を優先する
|
||||
- 名前付きフィールドを持つデータにはレコードを使用する
|
||||
- プリミティブ型に対する型安全なラッパーには単一ケース共用体を使用する
|
||||
- 相互運用またはミュータブルなステートが必要でない限り、クラスの使用を避ける
|
||||
|
||||
```fsharp
|
||||
type EmailAddress = EmailAddress of string
|
||||
|
||||
type OrderStatus =
|
||||
| Pending
|
||||
| Confirmed of confirmedAt: DateTimeOffset
|
||||
| Shipped of trackingNumber: string
|
||||
| Cancelled of reason: string
|
||||
|
||||
type Order =
|
||||
{ Id: Guid
|
||||
CustomerId: string
|
||||
Status: OrderStatus
|
||||
Items: OrderItem list }
|
||||
```
|
||||
|
||||
## イミュータビリティ
|
||||
|
||||
- レコードはデフォルトでイミュータブル。更新には `with` 式を使用する
|
||||
- ミュータブルなコレクションよりも `list`、`map`、`set` を優先する
|
||||
- ドメインロジックで `ref` セルとミュータブルフィールドを避ける
|
||||
|
||||
```fsharp
|
||||
let rename (profile: UserProfile) newName =
|
||||
{ profile with Name = newName }
|
||||
```
|
||||
|
||||
## 関数スタイル
|
||||
|
||||
- 大きなメソッドよりも小さく合成可能な関数を優先する
|
||||
- パイプ演算子 `|>` を使用して読みやすいデータパイプラインを構築する
|
||||
- if/else チェーンよりもパターンマッチングを優先する
|
||||
- null の代わりに `Option` を使用する。失敗する可能性のある操作には `Result` を使用する
|
||||
|
||||
```fsharp
|
||||
let processOrder order =
|
||||
order
|
||||
|> validateItems
|
||||
|> Result.bind calculateTotal
|
||||
|> Result.map applyDiscount
|
||||
|> Result.mapError OrderError
|
||||
```
|
||||
|
||||
## 非同期とエラーハンドリング
|
||||
|
||||
- .NET の非同期 API との相互運用には `task { }` を使用する
|
||||
- F# ネイティブの非同期ワークフローには `async { }` を使用する
|
||||
- パブリック非同期 API を通じて `CancellationToken` を伝播する
|
||||
- 予期されるエラーには例外ではなく `Result` とRailway指向プログラミングを優先する
|
||||
|
||||
```fsharp
|
||||
let loadOrderAsync (orderId: Guid) (ct: CancellationToken) =
|
||||
task {
|
||||
let! order = repository.FindAsync(orderId, ct)
|
||||
return
|
||||
order
|
||||
|> Option.defaultWith (fun () ->
|
||||
failwith $"Order {orderId} was not found.")
|
||||
}
|
||||
```
|
||||
|
||||
## フォーマット
|
||||
|
||||
- 自動フォーマットには `fantomas` を使用する
|
||||
- 意味のある空白を優先する。不要な括弧を避ける
|
||||
- 未使用の `open` 宣言を削除する
|
||||
|
||||
### open 宣言の順序
|
||||
|
||||
`open` 文を4つのセクションに空行で区切ってグループ化し、各セクション内は辞書順で並べる:
|
||||
|
||||
1. `System.*`
|
||||
2. `Microsoft.*`
|
||||
3. サードパーティの名前空間
|
||||
4. ファーストパーティ / プロジェクトの名前空間
|
||||
|
||||
```fsharp
|
||||
open System
|
||||
open System.Collections.Generic
|
||||
open System.Threading.Tasks
|
||||
|
||||
open Microsoft.AspNetCore.Http
|
||||
open Microsoft.Extensions.Logging
|
||||
|
||||
open FsCheck.Xunit
|
||||
open Swensen.Unquote
|
||||
|
||||
open MyApp.Domain
|
||||
open MyApp.Infrastructure
|
||||
```
|
||||
26
docs/ja-JP/rules/fsharp/hooks.md
Normal file
26
docs/ja-JP/rules/fsharp/hooks.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.fs"
|
||||
- "**/*.fsx"
|
||||
- "**/*.fsproj"
|
||||
- "**/*.sln"
|
||||
- "**/*.slnx"
|
||||
- "**/Directory.Build.props"
|
||||
- "**/Directory.Build.targets"
|
||||
---
|
||||
# F# フック
|
||||
|
||||
> このファイルは [common/hooks.md](../common/hooks.md) を F# 固有のコンテンツで拡張します。
|
||||
|
||||
## PostToolUse フック
|
||||
|
||||
`~/.claude/settings.json` で設定する:
|
||||
|
||||
- **fantomas**: 編集された F# ファイルを自動フォーマット
|
||||
- **dotnet build**: 編集後にソリューションまたはプロジェクトが引き続きコンパイルされることを確認する
|
||||
- **dotnet test --no-build**: 動作の変更後に最も近い関連テストプロジェクトを再実行する
|
||||
|
||||
## Stop フック
|
||||
|
||||
- 広範な F# の変更を伴うセッションを終了する前に最終的な `dotnet build` を実行する
|
||||
- 変更された `appsettings*.json` ファイルに対して警告を出し、シークレットがコミットされないようにする
|
||||
111
docs/ja-JP/rules/fsharp/patterns.md
Normal file
111
docs/ja-JP/rules/fsharp/patterns.md
Normal file
@@ -0,0 +1,111 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.fs"
|
||||
- "**/*.fsx"
|
||||
---
|
||||
# F# パターン
|
||||
|
||||
> このファイルは [common/patterns.md](../common/patterns.md) を F# 固有のコンテンツで拡張します。
|
||||
|
||||
## エラーハンドリングのための Result 型
|
||||
|
||||
予期されるエラーには例外の代わりに Railway指向プログラミングで `Result<'T, 'TError>` を使用する。
|
||||
|
||||
```fsharp
|
||||
type OrderError =
|
||||
| InvalidCustomer of string
|
||||
| EmptyItems
|
||||
| ItemOutOfStock of sku: string
|
||||
|
||||
let validateOrder (request: CreateOrderRequest) : Result<ValidatedOrder, OrderError> =
|
||||
if String.IsNullOrWhiteSpace request.CustomerId then
|
||||
Error(InvalidCustomer "CustomerId is required")
|
||||
elif request.Items |> List.isEmpty then
|
||||
Error EmptyItems
|
||||
else
|
||||
Ok { CustomerId = request.CustomerId; Items = request.Items }
|
||||
```
|
||||
|
||||
## 欠損値のための Option
|
||||
|
||||
null の代わりに `Option<'T>` を優先する。変換には `Option.map`、`Option.bind`、`Option.defaultValue` を使用する。
|
||||
|
||||
```fsharp
|
||||
let findUser (id: Guid) : User option =
|
||||
users |> Map.tryFind id
|
||||
|
||||
let getUserEmail userId =
|
||||
findUser userId
|
||||
|> Option.map (fun u -> u.Email)
|
||||
|> Option.defaultValue "unknown@example.com"
|
||||
```
|
||||
|
||||
## ドメインモデリングのための判別共用体
|
||||
|
||||
ビジネスの状態を明示的にモデル化する。コンパイラが網羅的なハンドリングを強制する。
|
||||
|
||||
```fsharp
|
||||
type PaymentState =
|
||||
| AwaitingPayment of amount: decimal
|
||||
| Paid of paidAt: DateTimeOffset * transactionId: string
|
||||
| Refunded of refundedAt: DateTimeOffset * reason: string
|
||||
| Failed of error: string
|
||||
|
||||
let describePayment = function
|
||||
| AwaitingPayment amount -> $"Awaiting payment of {amount:C}"
|
||||
| Paid (at, txn) -> $"Paid at {at} (txn: {txn})"
|
||||
| Refunded (at, reason) -> $"Refunded at {at}: {reason}"
|
||||
| Failed error -> $"Payment failed: {error}"
|
||||
```
|
||||
|
||||
## コンピュテーション式
|
||||
|
||||
コンピュテーション式を使用して、失敗する可能性のある順次操作を簡略化する。
|
||||
|
||||
```fsharp
|
||||
let placeOrder request =
|
||||
result {
|
||||
let! validated = validateOrder request
|
||||
let! inventory = checkInventory validated.Items
|
||||
let! order = createOrder validated inventory
|
||||
return order
|
||||
}
|
||||
```
|
||||
|
||||
## モジュールの構成
|
||||
|
||||
- 関連する関数をクラスではなくモジュールにグループ化する
|
||||
- 名前の衝突を防ぐために `[<RequireQualifiedAccess>]` を使用する
|
||||
- モジュールは小さく、単一の責任に集中させる
|
||||
|
||||
```fsharp
|
||||
[<RequireQualifiedAccess>]
|
||||
module Order =
|
||||
let create customerId items = { Id = Guid.NewGuid(); CustomerId = customerId; Items = items; Status = Pending }
|
||||
let confirm order = { order with Status = Confirmed(DateTimeOffset.UtcNow) }
|
||||
let cancel reason order = { order with Status = Cancelled reason }
|
||||
```
|
||||
|
||||
## 依存性注入
|
||||
|
||||
- 依存関係を関数パラメータまたはレコード of 関数として定義する
|
||||
- 主に .NET ライブラリとの境界でのみインターフェースを使用する
|
||||
- パイプラインへの依存関係注入には部分適用を優先する
|
||||
|
||||
```fsharp
|
||||
type OrderDeps =
|
||||
{ FindOrder: Guid -> Task<Order option>
|
||||
SaveOrder: Order -> Task<unit>
|
||||
SendNotification: Order -> Task<unit> }
|
||||
|
||||
let processOrder (deps: OrderDeps) orderId =
|
||||
task {
|
||||
match! deps.FindOrder orderId with
|
||||
| None -> return Error "Order not found"
|
||||
| Some order ->
|
||||
let confirmed = Order.confirm order
|
||||
do! deps.SaveOrder confirmed
|
||||
do! deps.SendNotification confirmed
|
||||
return Ok confirmed
|
||||
}
|
||||
```
|
||||
76
docs/ja-JP/rules/fsharp/security.md
Normal file
76
docs/ja-JP/rules/fsharp/security.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.fs"
|
||||
- "**/*.fsx"
|
||||
- "**/*.fsproj"
|
||||
- "**/appsettings*.json"
|
||||
---
|
||||
# F# セキュリティ
|
||||
|
||||
> このファイルは [common/security.md](../common/security.md) を F# 固有のコンテンツで拡張します。
|
||||
|
||||
## シークレット管理
|
||||
|
||||
- ソースコードに API キー、トークン、接続文字列をハードコードしない
|
||||
- ローカル開発には環境変数とユーザーシークレットを使用し、本番環境ではシークレットマネージャーを使用する
|
||||
- `appsettings.*.json` に実際の認証情報を含めない
|
||||
|
||||
```fsharp
|
||||
// BAD
|
||||
let apiKey = "sk-live-123"
|
||||
|
||||
// GOOD
|
||||
let apiKey =
|
||||
configuration["OpenAI:ApiKey"]
|
||||
|> Option.ofObj
|
||||
|> Option.defaultWith (fun () -> failwith "OpenAI:ApiKey is not configured.")
|
||||
```
|
||||
|
||||
## SQL インジェクション対策
|
||||
|
||||
- ADO.NET、Dapper、または EF Core でパラメータ化クエリを常に使用する
|
||||
- ユーザー入力を SQL 文字列に連結しない
|
||||
- 動的クエリ合成を使用する前に、並び替えフィールドとフィルター演算子を検証する
|
||||
|
||||
```fsharp
|
||||
let findByCustomer (connection: IDbConnection) customerId =
|
||||
task {
|
||||
let sql = "SELECT * FROM Orders WHERE CustomerId = @customerId"
|
||||
return! connection.QueryAsync<Order>(sql, {| customerId = customerId |})
|
||||
}
|
||||
```
|
||||
|
||||
## 入力バリデーション
|
||||
|
||||
- 型を使用してアプリケーション境界で入力を検証する
|
||||
- 検証済みの値には単一ケース判別共用体を使用する
|
||||
- 無効な入力がドメインロジックに入る前に拒否する
|
||||
|
||||
```fsharp
|
||||
type ValidatedEmail = private ValidatedEmail of string
|
||||
|
||||
module ValidatedEmail =
|
||||
let create (input: string) =
|
||||
if System.Text.RegularExpressions.Regex.IsMatch(input, @"^[^@]+@[^@]+\.[^@]+$") then
|
||||
Ok(ValidatedEmail input)
|
||||
else
|
||||
Error "Invalid email address"
|
||||
|
||||
let value (ValidatedEmail v) = v
|
||||
```
|
||||
|
||||
## 認証と認可
|
||||
|
||||
- カスタムトークン解析ではなくフレームワークの認証ハンドラーを優先する
|
||||
- エンドポイントまたはハンドラー境界で認可ポリシーを強制する
|
||||
- 生のトークン、パスワード、PII をログに記録しない
|
||||
|
||||
## エラーハンドリング
|
||||
|
||||
- クライアントに返す安全なメッセージを返す
|
||||
- 詳細な例外はサーバーサイドで構造化コンテキストと共にログに記録する
|
||||
- API レスポンスにスタックトレース、SQL テキスト、ファイルシステムパスを公開しない
|
||||
|
||||
## 参考資料
|
||||
|
||||
より広範なアプリケーションセキュリティレビューチェックリストはスキル `security-review` を参照。
|
||||
62
docs/ja-JP/rules/fsharp/testing.md
Normal file
62
docs/ja-JP/rules/fsharp/testing.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.fs"
|
||||
- "**/*.fsx"
|
||||
- "**/*.fsproj"
|
||||
---
|
||||
# F# テスト
|
||||
|
||||
> このファイルは [common/testing.md](../common/testing.md) を F# 固有のコンテンツで拡張します。
|
||||
|
||||
## テストフレームワーク
|
||||
|
||||
- F# フレンドリーなアサーションのために **xUnit** と **FsUnit.xUnit** を優先する
|
||||
- 明確な失敗メッセージを持つクォーテーションベースのアサーションには **Unquote** を使用する
|
||||
- プロパティベーステストには **FsCheck.xUnit** を使用する
|
||||
- 依存関係のモックには **NSubstitute** または関数スタブを使用する
|
||||
- インテグレーションテストで実際のインフラが必要な場合は **Testcontainers** を使用する
|
||||
|
||||
## テストの構成
|
||||
|
||||
- `tests/` 配下に `src/` の構造を反映させる
|
||||
- ユニット、インテグレーション、エンドツーエンドのカバレッジを明確に分離する
|
||||
- 実装の詳細ではなく、振る舞いでテストに名前を付ける
|
||||
|
||||
```fsharp
|
||||
open Xunit
|
||||
open Swensen.Unquote
|
||||
|
||||
[<Fact>]
|
||||
let ``リクエストが有効な場合、PlaceOrder は成功を返す`` () =
|
||||
let request = { CustomerId = "cust-123"; Items = [ validItem ] }
|
||||
let result = OrderService.placeOrder request
|
||||
test <@ Result.isOk result @>
|
||||
|
||||
[<Fact>]
|
||||
let ``アイテムが空の場合、PlaceOrder はエラーを返す`` () =
|
||||
let request = { CustomerId = "cust-123"; Items = [] }
|
||||
let result = OrderService.placeOrder request
|
||||
test <@ Result.isError result @>
|
||||
```
|
||||
|
||||
## FsCheck を使ったプロパティベーステスト
|
||||
|
||||
```fsharp
|
||||
open FsCheck.Xunit
|
||||
|
||||
[<Property>]
|
||||
let ``注文合計が負になることはない`` (items: OrderItem list) =
|
||||
let total = Order.calculateTotal items
|
||||
total >= 0m
|
||||
```
|
||||
|
||||
## ASP.NET Core インテグレーションテスト
|
||||
|
||||
- API インテグレーションカバレッジには `WebApplicationFactory<TEntryPoint>` を使用する
|
||||
- ミドルウェアをバイパスするのではなく、HTTP を通じて認証、バリデーション、シリアライゼーションをテストする
|
||||
|
||||
## カバレッジ
|
||||
|
||||
- 80%以上の行カバレッジを目標とする
|
||||
- ドメインロジック、バリデーション、認証、失敗パスのカバレッジに重点を置く
|
||||
- 利用可能な場合はカバレッジ収集を有効にして CI で `dotnet test` を実行する
|
||||
Reference in New Issue
Block a user