次のような場合に使用: ユーザーがfluent(ServiceNowの開発フレームワーク)、ServiceNow、またはnow-SDKに言及した場合、あるいはfluent アプリケーション内での編集を依頼された場合(プロジェクトのルートにnow.config.jsonが存在することで識別されます)。また、ユーザーがライブインスタンスの実データが必要な場合 — sys_idの検索、テーブルのカラムやスキーマの確認、レコードの存在確認、選択肢の値の取得、ロールやスコープ情報の確認といった作業に使用します。
Use whenever the user mentions fluent, ServiceNow, or the now-sdk, OR when the user prompts for edits within a fluent application (identified by a now.config.json at the project root). Also use when the user needs live instance data — looking up a sys_id, inspecting table columns or schema, checking whether a record already exists, fetching choice values, or reading role or scope info.
条件: プロジェクトルート(ファイルツリーの最上位)に now.config.json ファイルが存在すること(npm プロジェクトにおける package.json と同じ役割です。現在のフォルダから上の階層へ探索し、見つかったそれぞれを別々の独立したプロジェクトとして扱います)
対応: そのプロジェクトに対して以下のオリエンテーションを実行してください。ドキュメントはプロジェクトごとにインストールされた @servicenow/sdk のバージョンと一緒に更新されます。あるプロジェクトで実施した内容は別のプロジェクトに引き継がれません。同じセッション内でも、異なる now.config.json に触れるたびに、毎回これを実行し直してください。
npx @servicenow/sdk explain quickstart --list --format=raw
npx @servicenow/sdk explain fluent-language --list --format=raw
npx @servicenow/sdk --help
両方のリストが必要です。fluent-language は quickstart の一部ではなく、別の情報を含みます。
--list 実行結果の全トピックを読み、加えて keys-file をトピック名を指定して読んでください(どちらのリストに含まれるか不確定なため)。複数の方法でアクセスできるトピックでも、一度だけ読めば十分です。スキップしないでください。最初に --peek を使わないでください。これらは既に範囲を絞って提供されているため、最初に確認する行為は不要な手順で、安全対策ではありません:npx @servicenow/sdk explain <トピック名> --format=raw
npx @servicenow/sdk explain keys-file --format=raw
.now.ts ファイルから Table() / BusinessRule() / Record() の定義を削除しないといった安全上の重要ルールも含みます(削除は keys.ts を通じた アップグレード時の削除として伝播させる必要があり、コードだけでは分かりません)。後で不確実な点が生じたら、記憶に頼らず、該当トピックに対して --peek を実行し直してください:npx @servicenow/sdk explain <トピック名> --peek --format=raw
ルール: 初めてあるサブコマンドを使う前に、必ず npx @servicenow/sdk <サブコマンド名> --help を最初に実行してください。トップレベルの --help ではサブコマンド一覧は表示されますが、フラグの詳細は表示されません。フラグ名を推測で使わないでください。
ルール: quickstart トピック以外は、フルテキストを開く前に必ず --peek で確認してください(quickstart トピックはオリエンテーションで既にカバー済みのため、確認なしに直接読んでください)。
explain コマンド(--peek と --list を含む)は、参照専用のドキュメント検索で、実行による副作用がありません。実行前にユーザーに確認を求めないでください。タスクの一部として自動的に確認・読取を進めてください。
利用可能な全トピックをタグ付きで表示:
npx @servicenow/sdk explain --list --format=raw
トピックを検索し、全マッチ結果の説明を表示:
npx @servicenow/sdk explain <検索語> --list --peek --format=raw
トピックの概要を確認:
npx @servicenow/sdk explain <トピック名> --peek --format=raw
フルテキストを読むことが確実になったら、次のように開いてください:
npx @servicenow/sdk explain <トピック名> --format=raw
BusinessRule、Table、Acl、Flow、ScriptInclude、ClientScript、UiPolicybuild、transform、deploy、auth といった作業フローnaming(命名規則)、structure(構造)、scoping(範囲設定)、file-layout(ファイル配置)手順:検索(--list)→ 確認(--peek)→ フルテキスト読取。関連トピックごとに繰り返してください。fluent の動作は複数トピックに分かれることが多いため、一つで止めると不完全な理解に終わります。
npx @servicenow/sdk explain <検索語> --list --format=rawnpx @servicenow/sdk explain <トピック名> --peek --format=rawnpx @servicenow/sdk explain <トピック名> --format=rawexplain コマンドは @servicenow/sdk バージョン 4.6.0 以上でのみ利用可能です。見つからない場合はアップグレードしてくださいNo documentation found for "<トピック名>" — トピック名が間違っている、--list で検索し直してくださいNo match for "<トピック名>" — 別の検索語を使ってみてくださいquery コマンドは @servicenow/sdk バージョン 4.8.0 以上でのみ利用可能です。見つからない場合は、インストール済みバージョンを確認し、ユーザーにアップグレードを促してください。
query を実行する前に、サブコマンドのヘルプを実行して正確なフラグ名を確認してください。トップレベルの --help ではサブコマンドのフラグは表示されないため、推測で使わないでください:
npx @servicenow/sdk query --help
その後、より詳しい内容を知るため、使用ガイドとエンコード済みクエリ形式のガイドを読んでください:
npx @servicenow/sdk explain query --format=raw
npx @servicenow/sdk explain encoded-query-guide --format=raw
フィルタリングに必須のフラグは -q / --query です。全てのクエリ呼び出しにはテーブル名と共に必要です。
機械が読める JSON 形式での出力を得るため、常に -o json フラグを含めてください。
npx @servicenow/sdk query <テーブル名> -q '<クエリ>' -o json
ルール: クエリ出力はライブインスタンスのデータ(実際のデータベース情報)であり、ドキュメントではありません。quickstart トピックのようにプロジェクト知識として保持しないでください。現在のタスクに限定した範囲として扱ってください。
Condition: the project root contains now.config.json (same role as package.json for an npm project — walk up from cwd to find it, and treat each one found as a distinct fluent project, not a nested copy of another).
Action: run the orientation below for that project. Docs are versioned together with the @servicenow/sdk version installed per-project — orientation done for one project does NOT transfer to another. Re-run this for every distinct now.config.json you touch, even within the same session.
Step 1 — run all three:
npx @servicenow/sdk explain quickstart --list --format=raw
npx @servicenow/sdk explain fluent-language --list --format=raw
npx @servicenow/sdk --help
Both lists are required — fluent-language is not a subset of quickstart.
Step 2 — read every topic returned by both --list calls in full, plus keys-file by name (not reliably tagged into either list). Read each topic once even if reachable multiple ways. Do not skip any. Do not --peek first — they are already pre-scoped, so peeking first is redundant overhead, not a safety step:
npx @servicenow/sdk explain <topic> --format=raw
npx @servicenow/sdk explain keys-file --format=raw
Step 3 — treat this content as required working knowledge for the rest of this project's session. Do not re-derive fluent conventions from guesswork once they've been covered here — this includes safety-critical rules such as never deleting a Table()/BusinessRule()/Record() definition from a .now.ts file without confirming with the user first (deletion may need to propagate as an upgrade-time delete via keys.ts, which the code alone can't reveal). If uncertain later, re-run --peek on the specific topic rather than relying on memory:
npx @servicenow/sdk explain <topic> --peek --format=raw
Rule: before using any subcommand for the first time, run npx @servicenow/sdk <subcommand> --help first — --help at the top level lists subcommands but not their flags. Never guess flag names.
Rule: never open a full topic without --peek first, except quickstart topics (covered in Getting oriented above — read those directly, no peek needed).
explain (including --peek and --list) is read-only documentation lookup with no side effects. Do not ask the user for confirmation before running it — peek and read relevant topics automatically as part of the task.
To show all available topics with their related tags:
npx @servicenow/sdk explain --list --format=raw
To search for topics, showing the descriptions of all matches:
npx @servicenow/sdk explain <topic> --list --peek --format=raw
To preview a topic:
npx @servicenow/sdk explain <topic> --peek --format=raw
Once you are certain you want to read the full topic, open it like this:
npx @servicenow/sdk explain <topic> --format=raw
BusinessRule, Table, Acl, Flow, ScriptInclude, ClientScript, UiPolicybuild, transform, deploy, authnaming, structure, scoping, file-layoutStep order: search (--list) → peek (--peek) → read full topic. Repeat for every relevant topic — fluent behavior is often split across multiple topics, so stopping at one risks an incomplete picture.
npx @servicenow/sdk explain <search-term> --list --format=rawnpx @servicenow/sdk explain <topic> --peek --format=rawnpx @servicenow/sdk explain <topic> --format=rawexplain is only available in @servicenow/sdk versions >= 4.6.0 — upgrade if the command is not found.No documentation found for "<topic>" — wrong topic name, try --listNo match for "<topic>" — use a different search termquery is only available in @servicenow/sdk versions >= 4.8.0. If the command is not found, check the installed version and inform the user to upgrade.
Before writing any query call, run the subcommand help to get the exact flag names — the top-level --help does not show subcommand flags, so do not guess:
npx @servicenow/sdk query --help
Then read the full usage guide and encoded query format guide for deeper context:
npx @servicenow/sdk explain query --format=raw
npx @servicenow/sdk explain encoded-query-guide --format=raw
The required flag for filtering is -q / --query. Every query call needs it along with the table name.
Always include the -o json flag to output machine-readable json.
npx @servicenow/sdk query <table> -q '<query>' -o json
Rule: query output is live instance data, not documentation. Do not retain it as project knowledge the way quickstart topics are retained — treat it as scoped to the current task only.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。