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:
72
docs/ja-JP/rules/csharp/coding-style.md
Normal file
72
docs/ja-JP/rules/csharp/coding-style.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.cs"
|
||||
- "**/*.csx"
|
||||
---
|
||||
# C# コーディングスタイル
|
||||
|
||||
> このファイルは [common/coding-style.md](../common/coding-style.md) を C# 固有のコンテンツで拡張します。
|
||||
|
||||
## 標準
|
||||
|
||||
- 現在の .NET の規約に従い、nullable 参照型を有効にする
|
||||
- パブリックおよびインターナル API に明示的なアクセス修飾子を優先する
|
||||
- ファイルはそこで定義されている主要な型に合わせて構成する
|
||||
|
||||
## 型とモデル
|
||||
|
||||
- イミュータブルな値のようなモデルには `record` または `record struct` を優先する
|
||||
- ID とライフサイクルを持つエンティティや型には `class` を使用する
|
||||
- サービス境界と抽象化には `interface` を使用する
|
||||
- アプリケーションコードで `dynamic` を避ける; ジェネリクスや明示的なモデルを優先する
|
||||
|
||||
```csharp
|
||||
public sealed record UserDto(Guid Id, string Email);
|
||||
|
||||
public interface IUserRepository
|
||||
{
|
||||
Task<UserDto?> FindByIdAsync(Guid id, CancellationToken cancellationToken);
|
||||
}
|
||||
```
|
||||
|
||||
## イミュータビリティ
|
||||
|
||||
- 共有状態には `init` セッター、コンストラクタパラメータ、イミュータブルコレクションを優先する
|
||||
- 更新された状態を生成する際に入力モデルをインプレースでミューテートしない
|
||||
|
||||
```csharp
|
||||
public sealed record UserProfile(string Name, string Email);
|
||||
|
||||
public static UserProfile Rename(UserProfile profile, string name) =>
|
||||
profile with { Name = name };
|
||||
```
|
||||
|
||||
## 非同期とエラーハンドリング
|
||||
|
||||
- `.Result` や `.Wait()` のようなブロッキング呼び出しよりも `async`/`await` を優先する
|
||||
- パブリックな非同期 API を通じて `CancellationToken` を渡す
|
||||
- 特定の例外をスローし、構造化されたプロパティでログを記録する
|
||||
|
||||
```csharp
|
||||
public async Task<Order> LoadOrderAsync(
|
||||
Guid orderId,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await repository.FindAsync(orderId, cancellationToken)
|
||||
?? throw new InvalidOperationException($"Order {orderId} was not found.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Failed to load order {OrderId}", orderId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## フォーマット
|
||||
|
||||
- フォーマットとアナライザーの修正には `dotnet format` を使用する
|
||||
- `using` ディレクティブを整理し、未使用のインポートを削除する
|
||||
- 読みやすさを保てる場合のみ式本体メンバーを優先する
|
||||
25
docs/ja-JP/rules/csharp/hooks.md
Normal file
25
docs/ja-JP/rules/csharp/hooks.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.cs"
|
||||
- "**/*.csx"
|
||||
- "**/*.csproj"
|
||||
- "**/*.sln"
|
||||
- "**/Directory.Build.props"
|
||||
- "**/Directory.Build.targets"
|
||||
---
|
||||
# C# フック
|
||||
|
||||
> このファイルは [common/hooks.md](../common/hooks.md) を C# 固有のコンテンツで拡張します。
|
||||
|
||||
## PostToolUse フック
|
||||
|
||||
`~/.claude/settings.json` で設定する:
|
||||
|
||||
- **dotnet format**: 編集した C# ファイルを自動フォーマットし、アナライザーの修正を適用する
|
||||
- **dotnet build**: 編集後もソリューションやプロジェクトがコンパイルできることを確認する
|
||||
- **dotnet test --no-build**: 動作変更後に最も近い関連テストプロジェクトを再実行する
|
||||
|
||||
## ストップフック
|
||||
|
||||
- 広範な C# 変更を含むセッションを終了する前に最終的な `dotnet build` を実行する
|
||||
- 変更された `appsettings*.json` ファイルについてシークレットがコミットされないよう警告する
|
||||
50
docs/ja-JP/rules/csharp/patterns.md
Normal file
50
docs/ja-JP/rules/csharp/patterns.md
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.cs"
|
||||
- "**/*.csx"
|
||||
---
|
||||
# C# パターン
|
||||
|
||||
> このファイルは [common/patterns.md](../common/patterns.md) を C# 固有のコンテンツで拡張します。
|
||||
|
||||
## API レスポンスパターン
|
||||
|
||||
```csharp
|
||||
public sealed record ApiResponse<T>(
|
||||
bool Success,
|
||||
T? Data = default,
|
||||
string? Error = null,
|
||||
object? Meta = null);
|
||||
```
|
||||
|
||||
## リポジトリパターン
|
||||
|
||||
```csharp
|
||||
public interface IRepository<T>
|
||||
{
|
||||
Task<IReadOnlyList<T>> FindAllAsync(CancellationToken cancellationToken);
|
||||
Task<T?> FindByIdAsync(Guid id, CancellationToken cancellationToken);
|
||||
Task<T> CreateAsync(T entity, CancellationToken cancellationToken);
|
||||
Task<T> UpdateAsync(T entity, CancellationToken cancellationToken);
|
||||
Task DeleteAsync(Guid id, CancellationToken cancellationToken);
|
||||
}
|
||||
```
|
||||
|
||||
## オプションパターン
|
||||
|
||||
コードベース全体で生の文字列を読み取る代わりに、設定に強く型付けされたオプションを使用する。
|
||||
|
||||
```csharp
|
||||
public sealed class PaymentsOptions
|
||||
{
|
||||
public const string SectionName = "Payments";
|
||||
public required string BaseUrl { get; init; }
|
||||
public required string ApiKeySecretName { get; init; }
|
||||
}
|
||||
```
|
||||
|
||||
## 依存性注入
|
||||
|
||||
- サービス境界でインターフェースに依存する
|
||||
- コンストラクタを集中させる。サービスに依存関係が多すぎる場合は責任を分割する
|
||||
- ライフタイムを意図的に登録する: ステートレス/共有サービスにはシングルトン、リクエストデータにはスコープ、軽量な純粋ワーカーにはトランジエント
|
||||
58
docs/ja-JP/rules/csharp/security.md
Normal file
58
docs/ja-JP/rules/csharp/security.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.cs"
|
||||
- "**/*.csx"
|
||||
- "**/*.csproj"
|
||||
- "**/appsettings*.json"
|
||||
---
|
||||
# C# セキュリティ
|
||||
|
||||
> このファイルは [common/security.md](../common/security.md) を C# 固有のコンテンツで拡張します。
|
||||
|
||||
## シークレット管理
|
||||
|
||||
- API キー、トークン、接続文字列をソースコードに絶対にハードコードしない
|
||||
- ローカル開発には環境変数とユーザーシークレットを使用し、本番環境ではシークレットマネージャーを使用する
|
||||
- `appsettings.*.json` に実際の認証情報を含めない
|
||||
|
||||
```csharp
|
||||
// BAD
|
||||
const string ApiKey = "sk-live-123";
|
||||
|
||||
// GOOD
|
||||
var apiKey = builder.Configuration["OpenAI:ApiKey"]
|
||||
?? throw new InvalidOperationException("OpenAI:ApiKey is not configured.");
|
||||
```
|
||||
|
||||
## SQL インジェクション対策
|
||||
|
||||
- ADO.NET、Dapper、EF Core でのパラメータ化クエリを常に使用する
|
||||
- ユーザー入力を SQL 文字列に絶対に連結しない
|
||||
- 動的クエリ構成を使用する前に並べ替えフィールドとフィルタ演算子を検証する
|
||||
|
||||
```csharp
|
||||
const string sql = "SELECT * FROM Orders WHERE CustomerId = @customerId";
|
||||
await connection.QueryAsync<Order>(sql, new { customerId });
|
||||
```
|
||||
|
||||
## 入力バリデーション
|
||||
|
||||
- アプリケーション境界で DTO を検証する
|
||||
- データアノテーション、FluentValidation、または明示的なガード句を使用する
|
||||
- ビジネスロジックを実行する前に無効なモデル状態を拒否する
|
||||
|
||||
## 認証と認可
|
||||
|
||||
- カスタムトークン解析の代わりにフレームワークの認証ハンドラーを優先する
|
||||
- エンドポイントまたはハンドラー境界で認可ポリシーを適用する
|
||||
- 生のトークン、パスワード、PII を絶対にログに記録しない
|
||||
|
||||
## エラーハンドリング
|
||||
|
||||
- クライアント向けの安全なメッセージを返す
|
||||
- 詳細な例外はサーバー側で構造化されたコンテキストと共にログに記録する
|
||||
- API レスポンスにスタックトレース、SQL テキスト、ファイルシステムパスを露出しない
|
||||
|
||||
## 参考
|
||||
|
||||
より広範なアプリケーションセキュリティレビューチェックリストについてはスキル: `security-review` を参照。
|
||||
46
docs/ja-JP/rules/csharp/testing.md
Normal file
46
docs/ja-JP/rules/csharp/testing.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.cs"
|
||||
- "**/*.csx"
|
||||
- "**/*.csproj"
|
||||
---
|
||||
# C# テスト
|
||||
|
||||
> このファイルは [common/testing.md](../common/testing.md) を C# 固有のコンテンツで拡張します。
|
||||
|
||||
## テストフレームワーク
|
||||
|
||||
- ユニットテストと統合テストには **xUnit** を優先する
|
||||
- 読みやすいアサーションには **FluentAssertions** を使用する
|
||||
- 依存関係のモックには **Moq** または **NSubstitute** を使用する
|
||||
- 統合テストで実際のインフラが必要な場合は **Testcontainers** を使用する
|
||||
|
||||
## テスト構成
|
||||
|
||||
- `tests/` 以下で `src/` 構造を反映させる
|
||||
- ユニット、統合、エンドツーエンドのカバレッジを明確に分離する
|
||||
- 実装の詳細ではなく動作でテストに名前を付ける
|
||||
|
||||
```csharp
|
||||
public sealed class OrderServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task FindByIdAsync_ReturnsOrder_WhenOrderExists()
|
||||
{
|
||||
// Arrange
|
||||
// Act
|
||||
// Assert
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ASP.NET Core 統合テスト
|
||||
|
||||
- API 統合カバレッジには `WebApplicationFactory<TEntryPoint>` を使用する
|
||||
- ミドルウェアをバイパスするのではなく、HTTP を通じて認証、バリデーション、シリアライゼーションをテストする
|
||||
|
||||
## カバレッジ
|
||||
|
||||
- 行カバレッジ 80% 以上を目標とする
|
||||
- ドメインロジック、バリデーション、認証、失敗パスにカバレッジを集中させる
|
||||
- 利用可能な場合はカバレッジ収集を有効にして CI で `dotnet test` を実行する
|
||||
Reference in New Issue
Block a user