APIエンドポイントの追加・変更で、DTO、入力検証、OpenAPI仕様、MCPツールの説明や公開範囲を揃え、エージェントからも扱いやすいAPIに整えます。
- APIエンドポイントを追加したいとき
- DTOと入力検証を整えたいとき
- MCPツールとしてAPIを公開したいとき
連携チェックが保存したユーザーやリソースごとの結果を、共通サービス経由で機能に取り込み、必要な項目を検証して画面向けのデータに整える方法を案内します。
How to reuse ANY integration check's results in a feature via the universal CheckResultsService (apps/api integration-platform). Use whenever a feature needs data produced by an integration check — "show 2FA status on People", "surface AWS S3 findings in X", "reuse a check's results", "per-user/per-resource results from a connected integration", "which integrations feed task T". Read this BEFORE writing your own IntegrationCheckResult / CheckRunRepository query — don't hand-roll it.
実行スコア 未検証
インストール方法を見る連携チェックが記録した結果を、機能から共通のCheckResultsServiceを通じて読み取る方法を案内します。接続済み連携の候補を調べたり、特定の接続・チェックの最新の実行結果を取得したり、タスクに紐づくチェック結果を取得したりできます。ユーザーやバケットなどのリソース種別で絞り込み、返された結果を機能側で解釈して画面表示用に整える流れも説明します。結果のevidenceは機能側でzodスキーマを使って検証する方針です。
People画面に従業員ごとの2FA状態を表示したい場合や、AWS S3の暗号化結果、端末の準拠状況など、既存の連携チェック結果を別の機能で再利用したい場合に向いています。独自に結果テーブルを問い合わせる前に、共通の取得方法を確認できます。
CheckResultsServiceを提供するapps/apiのIntegrationPlatformModuleを利用する構成が前提です。結果が空の場合はデータなしとして扱います。
この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Integration checks (2FA, AWS S3 encryption, device posture, …) all write per-resource
results to one table (IntegrationCheckResult). CheckResultsService is the single,
universal, read-only way to get those results into any feature. It is deliberately
feature-agnostic: it fetches results and hands them back in a stable envelope, and it
does not know or care what the data means.
Service = fetch the results (generic). Feature = interpret + map + present.
If you're about to query IntegrationCheckResult or CheckRunRepository directly from a
new feature — stop. Use this service instead.
apps/api/src/integration-platform/services/check-results.service.tsIntegrationPlatformModule — inject it into any feature module.two-factor-source.controller.ts.Use it whenever a feature needs the output of an integration check:
// 1. Discover sources: which connected integrations can feed a task, + connection state.
listSourcesBoundToTask(organizationId, taskTemplateId): Promise<CheckSourceInfo[]>
// 2. The primitive: full results of a check's latest REAL run for ONE connection.
getLatestResultsByCheck({ organizationId, connectionId, checkId, resourceType? }): Promise<CheckResultRow[]>
// 3. Convenience: results for a task-bound check from a chosen source (provider slug).
// Resolves task -> check and slug -> connection for you.
getLatestResultsForTask({ organizationId, taskTemplateId, sourceSlug, resourceType? }): Promise<CheckResultRow[]>
Notes:
inconclusive/held and whose connection isn't
disconnected. Held runs (our-side self-heal) never leak to a feature.resourceType filters rows (e.g. 'user', 'bucket'). Omit to get all.Checks about PEOPLE (employee access, 2FA/MFA, training) follow a standard emission shape — this section is the canonical definition of it:
evidence.resourceType: 'user' (exactly this string).resourceId = the person's email, lowercased + trimmed. Fallback username || id
only when the provider genuinely exposes no email (such rows won't join to members —
acceptable, still visible in evidence views).evidence carries what the provider knows: email, name, role, isAdmin,
status, lastLogin, plus a checkedAt timestamp.So a feature joining check results to org members does exactly this — no parsing, no AI:
const rows = await checkResults.getLatestResultsForTask({
organizationId, taskTemplateId, sourceSlug, resourceType: 'user',
});
const forMember = rows.filter((r) => r.resourceId === member.email.toLowerCase());
If a source returns zero 'user' rows, its check hasn't been normalized to the standard
yet (or genuinely has no per-person data) — render that as "no per-person data from this
source", and fix the CHECK to emit the shape above. Never work around it by parsing
aggregate evidence in the feature.
interface CheckResultRow {
resourceId: string; // provider-native id: email (2FA), bucket ARN (S3), repo, …
resourceType: string; // 'user' | 'bucket' | …
passed: boolean; // did this resource pass the check
title: string;
description: string | null;
evidence: Prisma.JsonValue; // ← check-SPECIFIC payload. The service does NOT interpret it.
collectedAt: Date;
runId: string;
connectionId: string;
}
The evidence rule (important): the envelope is universal; the check-specific data lives
in evidence as raw JSON. The service never types or interprets it. Your feature validates
evidence at its own edge with a zod schema and reads only the fields it understands:
const TwoFaEvidence = z.object({ isEnrolledIn2Sv: z.boolean() });
const parsed = TwoFaEvidence.safeParse(row.evidence);
// use parsed.data.isEnrolledIn2Sv — never `as any`
For a simple pass/fail feature you often don't even need evidence — just use row.passed
and row.resourceId (that's all 2FA needs).
Say a feature wants "which AWS S3 buckets failed encryption":
CheckResultsService to your feature's constructor (the module
already exports it; import IntegrationPlatformModule if your module doesn't already).listSourcesBoundToTask or your own connection lookup):
const rows = await this.checkResults.getLatestResultsByCheck({
organizationId,
connectionId,
checkId: 'aws-s3-encryption', // the check's manifest id
resourceType: 'bucket',
});
…or, if your feature lets the user PICK a source for a task (like 2FA does), use
getLatestResultsForTask with the task template id and the chosen sourceSlug.resourceId/passed, validate evidence with zod, shape
the response your UI needs. Do not add feature logic to the service.two-factor-source.controller.spec.ts).The People-tab 2FA column is consumer #1. Study it end to end:
two-factor-source.controller.ts
available-2fa-sources → listSourcesBoundToTask(org, TASK_TEMPLATES.twoFactorAuth)two-factor-statuses → getLatestResultsForTask({ org, taskTemplateId: twoFactorAuth, sourceSlug: org.twoFactorSource, resourceType: 'user' }), then maps resourceId→email
(lowercased) and passed→enabled/missing. Emails with no row are resolved to
"Not provided" on the client, never a false "missing".Organization.twoFactorSource column, the
enabled/missing interpretation). The generic fetch is all in the service.evidence with zod in your feature. No as any.IntegrationCheckResult / CheckRunRepository directly from a feature.user (or email-keyed) rows — that's per-check. If a
chosen source's check emits a different resourceType or a non-mappable resourceId, your
feature should degrade gracefully (e.g. "Not provided"), not crash.Which integration an org uses for a purpose (e.g. Organization.twoFactorSource) is
feature-owned config, mirroring employeeSyncProvider / deviceSyncProvider. Add a column
per feature. (If a 3rd/4th feature needs it, consider generalizing selection then — not
before.)
まだレビューはありません。使ってみた感想をお寄せください。
ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。
まだコメントはありません。最初のコメントを書いてみませんか。
APIエンドポイントの追加・変更で、DTO、入力検証、OpenAPI仕様、MCPツールの説明や公開範囲を揃え、エージェントからも扱いやすいAPIに整えます。
既存コードのデザインシステム利用状況を調べ、旧UI部品やlucide-reactのアイコンを@trycompai/design-systemの部品・Carbonアイコンへ置き換えるスキルです。
指定されたファイルのフックやAPI利用を点検し、禁止パターンをSWRやapiClientなどの指定方式へ修正するための監査手順と実装規約をまとめています。
NestJSのAPIとフロントエンドを調べ、権限チェックや監査ログのルール違反を修正するための確認項目を示します。
権限で表示や操作が変わるコンポーネントの単体テストを点検し、不足分の追加や失敗の修正を行って、管理者と閲覧専用ユーザーの動作を確かめます。
Better Authを使ったTypeScript認証の設定を支援し、データベース接続、セッション管理、メール認証、OAuth、プラグインやセキュリティ項目を整理します。