Files
everything-claude-code/docs/ja-JP/rules/ruby/coding-style.md
Claude ec9ace9c54 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>
2026-05-17 02:31:40 -04:00

47 lines
2.8 KiB
Markdown

---
paths:
- "**/*.rb"
- "**/*.rake"
- "**/Gemfile"
- "**/*.gemspec"
- "**/config.ru"
---
# Ruby コーディングスタイル
> このファイルは [common/coding-style.md](../common/coding-style.md) を Ruby および Rails 固有のコンテンツで拡張します。
## 標準
- プロジェクトが既に古いサポート対象ランタイムを固定していない限り、新しい Rails 開発では **Ruby 3.3+** をターゲットにする。
- 本番環境では起動時間、メモリ、リクエスト/ジョブのスループットを測定した後にのみ **YJIT** を有効にする。
- プロジェクトがその規約を使用している場合、新しい Ruby ファイルに `# frozen_string_literal: true` を追加する。
- 巧妙なメタプログラミングよりも明快な Ruby を優先する。DSL を多用するコードは狭く、テストされた境界の背後に隔離する。
## フォーマットとリンティング
- プロジェクトのチェックイン済み RuboCop 設定を使用する。Rails 8+ アプリでは `rubocop-rails-omakase` から始め、コードベースに実際の規約がある場合にのみカスタマイズする。
- フォーマッタ/リンターのコマンドは binstub またはスクリプトの背後に配置し、CI とローカルの実行を一致させる:
```bash
bundle exec rubocop
bundle exec rubocop -A
```
- 例外が狭く、文書化されており、コードで明確に表現するのが困難でない限り、インラインで cop を無効にしない。
## Rails スタイル
- カスタム構造を追加する前に、Rails の命名規則とディレクトリ規約に従う。
- コントローラはトランスポートに焦点を当てる: 認証、認可、パラメータ処理、レスポンスの形状。
- 再利用可能なドメインロジックは、デフォルトの儀式としてではなく、実際の複雑さに基づいてモデル、concerns、サービスオブジェクト、クエリオブジェクト、またはフォームオブジェクトに配置する。
- グローバルにインストールされたコマンドよりも `bin/rails``bin/rake`、およびチェックイン済み binstub を優先する。
## エラーハンドリング
- 特定の例外を rescue する。広範な `rescue StandardError` ブロックは、再スローするか、運用者に十分なコンテキストを保持する場合を除いて避ける。
- 運用イベントには `ActiveSupport::Notifications` またはアプリのロガーを使用する。コミット済みのアプリケーションコードに `puts``pp``debugger` を残さない。
## 参考
サービス/リポジトリの階層化ガイダンスについてはスキル: `backend-patterns` を参照。