次のような場合に使用: - ユーザーが「fluent」「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 のバージョンと連動しているため、1つのプロジェクトで実行した準備は他のプロジェクトには引き継がれません。同じセッション内でも、異なる 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 を、全文読んでください。複数の方法で到達可能なトピックも1回だけ読みます。スキップはしません。事前に --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 はサブコマンドのリストを表示しますが、フラグはリストしません。フラグ名を推測で指定しないでください。
ルール: --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 の動作は複数のトピック間に分散していることが多いため、1つで止めると不完全な理解に陥ります。
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 による自動翻訳です。