Logo di Ai Code Review

Ai Code Review

Organizzazione
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.

Panoramica

Pubblicato daRedHatProductSecurity
Repositoryprodsec-skills
Nome della skillai-code-review
Stelle
56
Fork
9
File inclusi
Solo istruzioni
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da RedHatProductSecurity su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Ai Code Review in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/ai-code-review
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Ai Code Review in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Ai Code Review non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Ai Code Review non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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.

Domande frequenti

Cosa fa la skill IA 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.

Perché usare Ai Code Review su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Ai Code Review è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Ai Code Review in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/ai-code-review. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Ai Code Review?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Ai Code Review?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Ai Code Review: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Ai Code Review è gratuita?

Sì. È pubblicata su GitHub da RedHatProductSecurity con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇