Qodoの最適なコーディングルール(プログラミングの作成・修正に関する規則)を読み込み、qodo CLIの管理ルール検索機能を使用します。 具体的には、以下の処理を行います: - 与えられたコーディング課題から意味のある検索条件を生成 - ワークスペース内のマッチングルールを関連度順に取得 - コード作成時にそれらのルールを適用 **次のような場合に使用:** - ユーザーがコードの作成、編集、リファクタリング(既存コードの整理・改善)、またはレビュー(品質確認)を依頼した場合 - 実装計画の策定を開始する場合 - 「ルールを取得」「Qodoルールを読み込み」「コーディングルールを取得」「関連ルールを表示」「ルール検索」といったコマンドが入力された場合 ※ この対話の中で既にルールが読み込まれている場合はスキップします。
Load the coding rules from Qodo most relevant to the current coding task, using the qodo CLI's managed rules search — generate structured semantic queries from the assignment, retrieve the workspace's matching rules ranked by relevance, and apply them while writing the code. Use when the user asks to write, edit, refactor, or review code, when starting implementation planning, or on "get rules", "load qodo rules", "fetch coding rules", "relevant rules", "search rules"; skip if rules are already loaded in this conversation.
qodo コマンドラインツール(CLI)を使用して、現在のタスクに最も関連するワークスペースのコーディング規則を取得してから、コード作成時にそれらを適用します。検索は意味的検索(内容の意味で探す方式)です。返ってくる結果の質は、クエリ(検索文)をどう書くかで決まるため、以下のクエリ形式に正確に従ってください。
以下の詳細なワークフローに従ってください。更新通知を保存し、現在のツール仕様を確認し、絞った意味的検索クエリを構築し、ランク付けされた結果をまとめ、Qodoルールブロックを出力してから、それを適用します。
Qodoコマンドは、成功時でも QODO_NOTICE <json> を標準エラー出力に送信することがあります。code が qodo_skill_update_available の場合、コマンドの結果は保持して現在のタスクを完了させます。その後、通知の steps に従います。まず読み取り専用の確認作業を行い、インストール済みQodoパッケージとスコープ(適用範囲)を確認し、正確なライフサイクル管理者の更新コマンドまたはUI操作を表示し、変更前に一度ユーザーに許可を求めます。ユーザーが辞退した場合、現在のバージョンを使用可能な状態に保ちます。
別のライフサイクル管理者を呼び出したり、プレースホルダーを推測したり、オプションパッケージを暗黙的にインストールしたりしないでください。承認された更新の後、通知で指定されたホストの再起動を求めます。現在のセッションはまだ古いスキルを読み込んでいるかもしれません。
まず下記の「qodo: command not found フォールバック」を使用して実行可能ファイルを確認します。その他のQodoコマンドを実行する前に、<qodo> --version を表示通りに実行してください。追加フラグは付けません。この素のプローブは、古いQodo CLIとの互換性が意図的に保たれています。このスキルにはQodo CLI 0.1.0-next.37以降が必要です。
バージョンが古い場合またはパースできない場合、whoami、login、またはマネージ型ツールを実行しないでください。また、失敗を認証の問題として説明しないでください。スキルがランタイムより新しいこと、そしてランタイムすでに記録されたオリジン(提供元)からの更新コマンドとして qodo update を表示することを説明してから、実行してもよいか一度尋ねます。顧客デプロイメントの場合、その組織が提供する更新オリジンを保持してください。公開サービスに切り替えないでください。承認された更新後、素のバージョンプローブを再実行し、最小要件を満たすときだけ続行します。ユーザーが辞退した場合または更新に失敗した場合、現在のスキルとユーザーファイルを変更せずに停止します。
qodo --version # 互換性チェック — 最初に実行
qodo read whoami --json --skill qodo-get-rules --skill-version 1.1.2 --distribution marketplace --host claude-code
qodo read rules search --query "Name: JWT Authentication Endpoint Validation
Category: Security
Content: Implementing a login endpoint that validates credentials and issues JWT tokens securely" --top-k 20 --scopes "/owner/repo/" --json
qodo read tools rules --json # 正確な安全フラグ(オフラインで表示)
引用符で囲まれた --query 値内の改行はそのまま使用します。複数行の二重引用符文字列は、POSIX sh/bash/zsh およびPowerShellではそのまま動作します。Bash専用の $'…' クォーティングは使用しないでください。(cmd.exe は複数行文字列を表現できません。そこではPowerShellまたはbashから実行してください。)
「qodo: command not found」と表示された? これはPATH(検索パス)の問題で、インストール漏れではありません。GUI起動されたエージェントは最小限のPATHで実行されます。絶対パス ~/.qodo/bin/qodo(または $QODO_HOME が設定されている場合は $QODO_HOME/bin/qodo)で再試行してください。このファイルも見つからない場合だけ、qoodoは実際にインストールされていません。ユーザーにQodoまたは組織の管理者からチェックサム固定されたインストーラコマンドを入手するよう指示してください。インストーラーは https://get.qodo.ai から提供されますが、ダイジェスト(検証値)を勝手に作成したり、インストーラーを直接シェルにパイプしたりしないでください。
サンドボックス認証診断。 サンドボックス環境で qodo read whoami が何らかの理由で失敗した場合(「ログインしていない」を含む)、サンドボックスの外で正確な読み取り専用リトライを実行することをユーザーに承認するよう求めてから、ログインまたはツール更新を推奨してください。キーチェーン(認証情報保存)の失敗は一般的な認証失敗として報告できるため、サンドボックス結果だけは診断に不十分です。その承認はこの単一の診断リトライのみに適用されます。後のコマンドのために再利用したり、永続的な承認を要求したり、後のQodoコマンドを自動的にサンドボックス外に移動させたりしないでください。リトライが成功した場合、通常のコマンドごとの権限チェックを続行します。まだ失敗した場合、通常の認証トラブルシューティングに従います。
すでに読み込まれている? 「Qodo Rules Loaded(Qodoルール読み込み済み)」という表示が対話の前の部分に現れている場合、そのルール適用に直接スキップしてください。再取得しないでください。
認証。 qodo read whoami を実行します。上記のサンドボックスリトライが該当する場合、終了コード0以外→ユーザーに qodo login を実行するよう指示してから停止します。
「ログインしていない」または「ツールカタログがキャッシュされていない」→ログインしていない。whoami が成功しているのに qodo rules で「unknown command(不明なコマンド)」が出た場合は別の失敗です。キャッシュされたカタログがルールツールより古い — qodo tools --refresh を実行して再試行してください。whoami 自体が失敗したときだけ qodo login を求めてください。
リポジトリスコープ(適用範囲、オプション、精度向上)。 リポジトリの origin リモートから、ホスト後の完全なパスを取得し、.git サフィックスを削除します。git@host:a/b と https://host/a/b はどちらも a/b に解析され、より深いホストされたパスはそのまま保持されます(GitLab サブグループ group/subgroup/repo、Azure DevOps org/project/repo — 2セグメントに圧縮しないでください)。/<path>/ としてラップします。ワーキングディレクトリがリポジトリルートの modules/<name>/ サブディレクトリ内にある場合、/<path>/modules/<name>/ に絞ります。リモートなし/解析不可 → --scopes フラグ全体を省略してください(組織全体の検索は機能します)。空のスコープ値を渡さないでください。
2つの構造化クエリを生成します。検索データによると、単一のトピッククエリは、実際のレビューを支配する横断的な標準ルールを体系的に見落とします。各クエリはルール索引方式を反映する3行ブロックです:
Name: <このタスクがトリガーするルールの簡潔な5~10語のタイトル>
Category: <次のいずれか: Security(セキュリティ)、Correctness(正確性)、Quality(品質)、Reliability(信頼性)、Performance(パフォーマンス)、Testability(テスト容易性)、Compliance(規制遵守)、Accessibility(アクセシビリティ)、Observability(可視化)、Architecture(構成)>
Content: <確認または実装すべき内容を1~2文で説明。既知の技術スタックに言及してください>
トピッククエリ — タスクの主な関心事。カテゴリは変更の副作用ではなく目的で選びます(レート制限 → Reliability(信頼性)、Securityではない)。本当に候補のとき Securityを選んでください。すべてをDefaultで Correctness にしないでください。構造的作業は Architecture(構成)、スタイルは Quality(品質)、耐障害性は Reliability(信頼性)、計装は Observability(可視化)です。
横断的クエリ — 組織がすべての変更に適用する標準。デフォルト:
Name: Code Quality and Standards Compliance / Category: Architecture / Content: Module directory structure, type annotations or type safety, structured logging, repository or service layer patterns, dependency injection, and naming conventions — Content をリポジトリのスタックに合わせて調整してください。
決してキーワードリスト、平坦な文、フィラー(「してください」「必要です」)を渡さないでください — 構造化インデックスに対して検索結果が悪いです。
qodo read rules search をクエリごとに1回実行します(可能な場合は並列実行)。各実行で --top-k 20 と --json を付けます。スコープ検出が行われた場合だけ --scopes "$SCOPE" を追加します:
# スコープが検出された場合:
qodo read rules search --query "$TOPIC_QUERY" --top-k 20 --scopes "$SCOPE" --json
qodo read rules search --query "$CROSS_QUERY" --top-k 20 --scopes "$SCOPE" --json
# スコープが検出されない場合、フラグとその値を省略:
qodo read rules search --query "$TOPIC_QUERY" --top-k 20 --json
qodo read rules search --query "$CROSS_QUERY" --top-k 20 --json
マージ:トピック結果を最初に(順序通り)、その後、まだ存在しない横断的結果を追加します。ルール id で重複排除します。トピックルールはタスク固有のガイダンスです。横断的ルールは補足扱いし、タスクから意味的に遠いものは優先度を下げます。
低収穫時のフォールバック: トピッククエリが3つ未満のルールを返す → Content 行を広げて一度だけ再実行してください(その領域の隣接概念を追加。例:認証 → トークン検証、認証情報処理、セッション管理)。マージされたリストが空は有効な結果 です。ルール制約なしで進めてください。エラーとして扱わないでください。
スコープなし検索の注意: --scopes を省略する必要があった場合、結果は組織全体です — 各ルール適用前に、THIS リポジトリ/スタックに合理的に適用されるか確認してください(別のサービス、言語、またはフレームワークに言及するルールは適用されません)。不一致はスキップし、そう説明してください。別のリポジトリの標準を押し付けないでください。
コード作成前に、読み込まれたルールを出力します:
# 📋 Qodo Rules Loaded
Rules loaded: **<N>** (ranked by relevance to your task)
- **<name>** [<SEVERITY if present>]: <content>
...
---
(空の結果:「このタスクに関連するルールが見つかりません。ルール制約なしで進めます。」)その後、返されたすべてのルールを作成するコードに適用します。ルールが重大度(セベリティ)を持つ場合:
| 重大度 | 実装 |
|---|---|
| ERROR(エラー) | 必ず従う — 譲歩の余地なし。逸脱する必要があれば停止してユーザーに尋ねる |
| WARNING(警告) | デフォルトで従う。意図的なスキップは回答で簡潔に説明する |
Use the qodo CLI to fetch the workspace's coding rules most relevant to the task at
hand, then apply them while producing the code. Retrieval is semantic — the quality
of what comes back is decided by how you write the query, so follow the query format
below exactly.
Follow the detailed workflow below: preserve update notices, verify the current tool contract, build focused semantic queries, merge ranked results, print the Qodo rules block, then apply it.
A Qodo command can emit QODO_NOTICE <json> to stderr while still succeeding. When
code is qodo_skill_update_available, keep the command's result and finish the current
task. Then follow the notice's steps: do read-only inventory first, resolve the installed
Qodo package and scope, show the exact lifecycle-owner update command or UI action, and ask
once before any mutation. If the user declines, keep the current version usable.
Never invoke a different lifecycle owner, guess a placeholder, or install an optional package implicitly. After an approved update, ask for the host restart named by the notice; the current session may still have the old skill loaded.
First resolve the executable using the qodo: command not found fallback below. Before any other
Qodo command, run <qodo> --version exactly as shown, with no provenance flags.
This unadorned probe is intentionally compatible with older Qodo CLIs. This skill requires Qodo
CLI 0.1.0-next.37 or newer.
If the version is older or cannot be parsed, do not run whoami, login, or a managed tool and
do not describe the failure as an authentication problem. Explain that the skill is newer than the
runtime, show qodo update as the update command for the runtime's already-recorded origin, and ask
once before running it. For a customer deployment, keep its organization-provided update origin;
never switch it to the public service. After an approved update, rerun the unadorned version probe
and continue only when it satisfies the minimum. If the user declines or the update fails, stop with
the current skill and user files unchanged.
qodo --version # compatibility probe — run this FIRST
qodo read whoami --json --skill qodo-get-rules --skill-version 1.1.2 --distribution marketplace --host claude-code
qodo read rules search --query "Name: JWT Authentication Endpoint Validation
Category: Security
Content: Implementing a login endpoint that validates credentials and issues JWT tokens securely" --top-k 20 --scopes "/owner/repo/" --json
qodo read tools rules --json # exact safe flags (renders offline)
The newlines inside the quoted --query value are literal — a multi-line double-quoted
string works as-is in POSIX sh/bash/zsh and in PowerShell. Don't use Bash-only $'…'
quoting. (cmd.exe can't express multi-line strings — run the command from PowerShell or
bash there.)
qodo: command not found? That's PATH, not a missing install: GUI-launched agents run
shells with a minimal PATH. Retry with the absolute path ~/.qodo/bin/qodo (or
$QODO_HOME/bin/qodo if set) and keep using it. Only if that file is missing too is qodo
actually not installed; tell the user to obtain a checksum-pinned installer command from
Qodo or their organization's administrator. Installers are served from https://get.qodo.ai,
but never invent a digest or pipe an installer directly into a shell.
Sandbox auth diagnostic. In a sandboxed environment, if qodo read whoami fails for any reason
(including Not logged in), ask the user to approve one exact read-only retry of qodo read whoami
outside the sandbox before recommending login or refreshing tools. Keychain failures can be
reported as generic auth failures, so the sandboxed result alone is not diagnostic. That approval
applies only to this single diagnostic retry: do not reuse it, request persistent approval, or move
later Qodo commands outside the sandbox automatically. If the retry succeeds, continue with normal
per-command permission checks. If it still fails, follow the normal auth troubleshooting below.
qodo read whoami. After the sandbox retry above when applicable, a non-zero exit →
tell the user to run qodo login, then stop.
Not logged in / No tool catalog cached → not logged in. An unknown command on
qodo rules while whoami SUCCEEDS is a different failure: the cached catalog predates
the rules tool — run qodo tools --refresh and retry; only ask for qodo login when
whoami itself fails.origin remote,
take the full path after the host and strip a .git suffix — git@host:a/b and
https://host/a/b both parse to a/b, and a deeper hosted path survives intact
(GitLab subgroups group/subgroup/repo, Azure DevOps org/project/repo — don't
collapse to two segments). Wrap as /<path>/. If the cwd is inside a
modules/<name>/ subdirectory of the repo root, narrow to
/<path>/modules/<name>/. No remote / unparseable → omit --scopes entirely
(org-wide search still works); never pass an empty scopes value.Generate two structured queries — retrieval data shows a single topic query systematically misses the cross-cutting standards rules that dominate real reviews. Each query is a three-line block mirroring how rules are indexed:
Name: <concise 5-10 word title of the rule this task would trigger>
Category: <one of: Security, Correctness, Quality, Reliability, Performance, Testability, Compliance, Accessibility, Observability, Architecture>
Content: <1-2 sentences describing what should be checked or enforced; mention the tech stack when known>
Name: Code Quality and Standards Compliance / Category: Architecture / Content: Module directory structure, type annotations or type safety, structured logging, repository or service layer patterns, dependency injection, and naming conventions — adjust Content
to the repo's stack.Run qodo read rules search once per query (in parallel when you can), each with
--top-k 20 and --json. Add --scopes "$SCOPE" only when detection produced a scope:
# With a detected scope:
qodo read rules search --query "$TOPIC_QUERY" --top-k 20 --scopes "$SCOPE" --json
qodo read rules search --query "$CROSS_QUERY" --top-k 20 --scopes "$SCOPE" --json
# Without a detected scope, omit both the flag and its value:
qodo read rules search --query "$TOPIC_QUERY" --top-k 20 --json
qodo read rules search --query "$CROSS_QUERY" --top-k 20 --json
Merge: topic results first (in order), then cross-cutting results not already present —
dedup by rule id. Topic rules are task-specific guidance; treat cross-cutting rules as
supplementary and deprioritize any that are semantically distant from the task.
Low-return fallback: topic query returns < 3 rules → re-run it once with a broadened
Content line (add adjacent concepts for the domain: e.g. auth → token validation,
credential handling, session management) before merging. An empty merged list is a valid
outcome — proceed without rule constraints, never treat it as an error.
Unscoped search caveat: when you had to omit --scopes, the results are org-wide —
before applying each rule, check it plausibly applies to THIS repo/stack (a rule naming a
different service, language, or framework doesn't); skip mismatches and say so rather than
imposing another repo's standards.
Print the loaded rules before writing code:
# 📋 Qodo Rules Loaded
Rules loaded: **<N>** (ranked by relevance to your task)
- **<name>** [<SEVERITY if present>]: <content>
...
---
(Empty result: "No relevant rules found for this task. Proceeding without rule constraints.") Then apply every returned rule to the code you produce. When a rule carries a severity:
| Severity | Enforcement |
|---|---|
| ERROR | Must comply — non-negotiable; if you must deviate, stop and ask the user |
| WARNING | Comply by default; briefly explain any deliberate skip in your response |
| RECOMMENDATION | Apply when appropriate; mention only if it shaped a design decision |
After the code is written, report which rules were applied and which WARNING rules were skipped and why. If none applied, say "No Qodo rules were applicable to this code change."
Use --json, the exact scopes relevant to the task, and the current CLI-provided rules schema.
Stamp the skill/version/distribution provenance on the first Qodo call. This optional skill is
never installed or updated implicitly with the default Qodo package.
An empty result is valid. Preserve authentication, capability, validation, and rate-limit errors; follow the bounded recovery above and continue without invented rules when retrieval cannot safely succeed.
rules search is read-only; it never changes workspace state.原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。