Last updated

GPT / AI

GPT for Code Review

Use ChatGPT to review code, spot bugs, and suggest improvements.

Contents

  1. What AI Code Review Catches
  2. Security Audit Prompt
  3. Script Quality Review
  4. Terraform / Ansible Review
  5. Pro Tips

Use AI to review, audit, and improve your infrastructure code, configs, scripts, and IaC.

What AI Code Review Catches

  • Insecure defaults in nginx, SSH, or firewall configs
  • Hardcoded credentials in scripts
  • Missing error handling and cleanup traps
  • Inefficient patterns (unnecessary subshells, quoting issues)
  • Potential race conditions or privilege escalation risks

Security Audit Prompt

Review this nginx configuration for security issues.
Identify: insecure TLS settings, missing security headers,
server info leakage, or misconfigurations.
For each issue found, explain the risk and suggest a fix.

[paste your nginx.conf here]

Script Quality Review

Review this bash script for:
1. Security vulnerabilities (command injection, unsafe temp files)
2. Error handling gaps
3. Portability issues
4. Performance problems

Rate it 1-10 and list improvements in priority order.

[paste your script]

Terraform / Ansible Review

Review this Terraform module for:
- Overly permissive IAM policies (least-privilege violations)
- Missing resource tagging
- Hardcoded values that should be variables
- Security group rules that are too broad (0.0.0.0/0)

Suggest improvements and flag any showstoppers.

[paste your .tf file]

Pro Tips

  • Ask for severity levels: Critical / High / Medium / Low
  • Ask GPT to rewrite the section after identifying issues
  • Use Claude Code or GitHub Copilot for inline reviews in your editor

FAQ

Can AI replace a human code review?

No, but it is a useful first pass for bugs, security issues and style. A person still decides what to merge.

What should I ask AI to check in code?

Input validation, error handling, hardcoded secrets, injection risks and edge cases.