mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-18 14:53: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:
58
docs/ja-JP/rules/python/fastapi.md
Normal file
58
docs/ja-JP/rules/python/fastapi.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
paths:
|
||||
- "**/app/**/*.py"
|
||||
- "**/fastapi/**/*.py"
|
||||
- "**/*_api.py"
|
||||
---
|
||||
# FastAPI ルール
|
||||
|
||||
FastAPI プロジェクトでは、一般的な Python ルールと併せてこれらのルールを使用してください。
|
||||
|
||||
## 構造
|
||||
|
||||
- アプリの構築は `create_app()` に配置する。
|
||||
- ルーターは薄く保つ; 永続化とビジネスロジックはサービスまたは CRUD ヘルパーに移動する。
|
||||
- リクエストスキーマ、更新スキーマ、レスポンススキーマは分離する。
|
||||
- データベースセッションと認証は依存関係に配置する。
|
||||
|
||||
## 非同期
|
||||
|
||||
- I/O を実行するエンドポイントには `async def` を使用する。
|
||||
- 非同期エンドポイントからは非同期データベースクライアントと HTTP クライアントを使用する。
|
||||
- 非同期ルートから `requests`、同期 SQLAlchemy セッション、またはブロッキングファイル/ネットワーク操作を呼び出さない。
|
||||
|
||||
## 依存性注入
|
||||
|
||||
```python
|
||||
@router.get("/users/{user_id}")
|
||||
async def get_user(
|
||||
user_id: str,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
...
|
||||
```
|
||||
|
||||
ルートハンドラ内で `SessionLocal()` や長寿命クライアントを作成しない。
|
||||
|
||||
## スキーマ
|
||||
|
||||
- レスポンスモデルにパスワード、パスワードハッシュ、アクセストークン、リフレッシュトークン、内部認証状態を含めない。
|
||||
- アプリケーションデータを返すエンドポイントには `response_model` を使用する。
|
||||
- 手書きのバリデーションの代わりに、Pydantic でルールを表現できる場合はフィールド制約を使用する。
|
||||
|
||||
## セキュリティ
|
||||
|
||||
- CORS オリジンは環境固有にする。
|
||||
- ワイルドカードオリジンと認証情報付き CORS を組み合わせない。
|
||||
- JWT の有効期限、発行者、オーディエンス、アルゴリズムを検証する。
|
||||
- 認証および書き込み負荷の高いエンドポイントにレート制限を適用する。
|
||||
- ログから認証情報、Cookie、Authorization ヘッダー、トークンを除去する。
|
||||
|
||||
## テスト
|
||||
|
||||
- `Depends` で使用される正確な依存関係をオーバーライドする。
|
||||
- テスト後に `app.dependency_overrides` をクリアする。
|
||||
- 非同期アプリケーションには非同期テストクライアントを優先する。
|
||||
|
||||
スキル: `fastapi-patterns` を参照してください。
|
||||
Reference in New Issue
Block a user