Ai Code Reviewのロゴ

Ai Code Review

組織
RedHatProductSecurity
ai-code-review

Security-focused review of AI-generated or AI-assisted code. Use when reviewing code produced by AI coding assistants, auditing AI-generated patches, verifying AI-assisted contributions before merge, or when a review needs to account for failure modes specific to AI code generation.

Add to TypingMind

概要

公開者RedHatProductSecurity
リポジトリprodsec-skills
スキル名ai-code-review
スター
56
フォーク
9
同梱ファイル
指示のみ
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    RedHatProductSecurityがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Ai Code Review」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/ai-code-review
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RedHatProductSecurity/prodsec-skills.git /tmp/prodsec-skills
mkdir -p .claude/skills
cp -r /tmp/prodsec-skills/ge-core/ai-code-review .claude/skills/ai-code-review
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでAi Code Reviewを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にAi Code Reviewを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Ai Code Reviewは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

AI-Generated Code Security Review

Security review checklist and methodology for code produced by AI coding assistants (Claude, Copilot, Cursor, Gemini, or any LLM-based tool). AI-generated code has characteristic failure modes that differ from human-written code and require specific review attention.

When to Use

  • Reviewing PRs or patches marked with Assisted-by: or Generated-by: attribution
  • Auditing code known or suspected to be AI-generated
  • As a supplementary checklist during any code review where AI assistance was used
  • Verifying AI-generated security fixes or test code

When NOT to Use

  • General code review without AI involvement (use module/skills/differential-review/SKILL.md)
  • Reviewing AI model behavior or prompt injection (use module/skills/prompt-injection-mitigation/SKILL.md)
  • Evaluating AI tool security posture (use module/skills/third-party-model-security/SKILL.md or module/skills/file-protection/SKILL.md)

AI-Specific Failure Modes

AI code generation has characteristic error patterns that differ from typical human mistakes. Review for these specifically:

1. Hallucinated APIs and symbols

LLMs confidently generate calls to functions, methods, flags, configuration keys, or library features that do not exist. These compile or parse without errors but fail at runtime, or worse, silently do nothing.

Detection:

  • Verify every imported module, function call, and configuration key against the actual codebase and library documentation
  • Check that method signatures match (argument count, types, return values)
  • Search the project for the symbol: rg "function_name" — if it only appears in the new code, it may be hallucinated
  • Check library version: AI may reference APIs from a different version than what the project uses

Security impact: A hallucinated security function (e.g., a nonexistent sanitize_input() call) provides zero protection while giving the appearance of safety.

2. Plausible-but-wrong logic

AI generates code that reads naturally and appears correct but contains subtle logical errors — inverted conditions, off-by-one errors, wrong comparison operators, or incorrect state transitions. These are harder to catch than obviously broken code because they pass casual reading.

Detection:

  • Trace every conditional branch: does the True branch do what the variable name and context suggest?
  • Check comparison operators: < vs <=, == vs !=, and vs or
  • Verify loop bounds and termination conditions
  • Check that error handling goes to the right branch (reject vs allow)

Security impact: An inverted authorization check (if user.is_admin instead of if not user.is_admin) grants access to everyone. The code reads plausibly either way.

3. Pattern drift from project conventions

AI generates code that follows general best practices but diverges from the specific patterns, idioms, and conventions of the project. This introduces inconsistency that makes the codebase harder to audit and may bypass project-specific security mechanisms.

Detection:

  • Compare the new code against existing code doing similar things in the same project
  • Check that the same base classes, decorators, middleware, and utility functions are used
  • Verify that project-specific security patterns (custom validators, auth decorators, logging wrappers) are used instead of generic alternatives

Security impact: Using a generic auth check instead of the project's custom auth decorator may skip logging, rate limiting, or additional validation that the project relies on.

4. Incomplete error handling

AI often generates a working happy path but handles errors with generic catch-all blocks, swallowed exceptions, or missing cleanup. Error paths are where security vulnerabilities hide.

Detection:

  • Check every try/catch, except, or error return: does it handle the error meaningfully or just log and continue?
  • Verify that partial state is rolled back on failure
  • Check that error responses do not leak internal details (stack traces, file paths, SQL queries, internal IPs)
  • Verify that resources (connections, file handles, locks) are released on all code paths

Security impact: A swallowed authentication error may allow an unauthenticated request to proceed. A missing rollback may leave the system in an inconsistent state exploitable by a subsequent request.

5. Stale or incorrect dependency usage

AI training data has a cutoff. Generated code may use deprecated APIs, insecure defaults from older library versions, or patterns that were correct in a previous version but are now vulnerable.

Detection:

  • Check the project's actual dependency versions against what the AI code assumes
  • Look for deprecated function calls or removed APIs
  • Verify that security-relevant defaults match the current library version (e.g., TLS version, hash algorithm defaults)

Security impact: Using a deprecated crypto API with known weaknesses, or relying on a default that changed from insecure to secure (or vice versa) between versions.

6. Abandoned scaffolding

AI generates unfinished-work comments, placeholder implementations, commented-out code blocks, or "temporary" workarounds that are intended to be replaced but get committed as-is.

Detection:

  • Search (case-insensitively) for todo, fixme, hack, temporary, xxx markers
  • Look for commented-out code blocks
  • Check for placeholder values (e.g., a password assigned changeme, a secret key assigned development)
  • Verify that all functions have real implementations, not pass or return None stubs

Security impact: A placeholder secret, a disabled validation, or a stub authentication function shipped to production.

Review Checklist

For each AI-generated or AI-assisted change:

Verification

  • All function calls, imports, and config keys verified against the actual codebase and dependency versions
  • No hallucinated APIs or symbols
  • Method signatures match (argument count, types, returns)

Logic correctness

  • Every conditional branch traced and verified
  • Comparison operators correct (< vs <=, == vs !=)
  • Authorization checks grant/deny the correct direction
  • Loop termination conditions correct

Project consistency

  • Uses project-specific security patterns (not generic alternatives)
  • Matches existing code style, base classes, and idioms
  • Uses the same error handling patterns as surrounding code

Error handling

  • No swallowed exceptions on security-relevant paths
  • Partial state rolled back on failure
  • Error responses do not leak internal details
  • Resources released on all code paths

Completeness

  • No to-do/fix-me/hack markers left in security-critical code
  • No placeholder secrets or credentials
  • No commented-out code that should be either deleted or uncommented
  • No stub implementations (pass, return None, throw new NotImplementedException())

Security tests

  • Tests actually fail before the fix (not tautologies)
  • Assertions verify the security property, not just "no exception"
  • Test credentials match the real threat model
  • Mock objects do not mask the behavior being tested

Output Format

For each finding:

FieldContent
CategoryHallucinated API / Plausible-but-wrong / Pattern drift / Incomplete error handling / Stale dependency / Abandoned scaffolding
LocationFile and line range
FindingWhat is wrong or risky
EvidenceWhy you believe it (missing symbol, inverted logic, project pattern not followed)
SeverityCritical / High / Medium / Low / Nit
SuggestionConcrete fix

Relationship to Other Skills

  • module/skills/differential-review/SKILL.md — General security-focused code review. This skill adds AI-specific failure modes on top.
  • module/skills/fp-check/SKILL.md — When an AI-generated security finding is itself suspect, use fp-check to verify it.
  • module/skills/inconsistency-detection/SKILL.md — AI-generated code that drifts from project patterns creates exactly the kind of inconsistency this technique detects.

よくある質問

AIスキル「Ai Code Review」では何ができますか?

Security-focused review of AI-generated or AI-assisted code. Use when reviewing code produced by AI coding assistants, auditing AI-generated patches, verifying AI-assisted contributions before merge, or when a review needs to account for failure modes specific to AI code generation.

TypingMindでAi Code Reviewを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Ai Code Reviewはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにAi Code Reviewをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/ai-code-reviewを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Ai Code Reviewを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Ai Code Reviewで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもAi Code Reviewを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Ai Code Review」は無料ですか?

はい。RedHatProductSecurityがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇