360 Secure SkillHub
360 安全技能中心

Code Inspector

针对 AI 生成的 Python 代码做静态检查的命令行工具,覆盖硬编码密钥、不安全 eval/exec、可变默认参数、裸 except 等 8 类问题,按严重程度分级并给出 0-100 生产就绪评分,支持扫描文件或从标准输入读取,分析在本地完成。

minirr890112-byte
minirr890112-byte
热度 16.00
最近更新 2026-06-18 23:00:07
分类:开发依赖:代码执行 / 读写文件应用场景:代码审查 / 调试排错 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add code-inspector
Metadata
name
code-inspector
description
Scan AI-generated code for bugs before deploying — 8 static analysis checks from critical (hardcoded secrets, unsafe eval) to low (unused imports). Production-readiness score 0-100. Because AI code looks fine until it isn't.
version
1.2.0
author
minirr890112-byte
license
MIT
metadata
{"hermes":{"tags":["Code-Review","Static-Analysis","Security","AI-Code","Quality","CLI","Python"],"homepage":"https://github.com/minirr890112-byte/code-inspector"}}

code-inspector

Problem → Solution

The problem: AI generates code that compiles and looks correct. But it silently drops edge case handling, hardcodes secrets, catches exceptions with bare except/pass, and uses mutable defaults. You deploy it. It breaks. Reddit is full of "I let Claude loose and it broke the entire site" stories.

The solution: One command scans any Python file for 8 categories of AI-code bugs. Critical → High → Medium → Low severity. Production-readiness score 0-100. Don't deploy AI code blind.

Quick Start

pip install git+https://github.com/minirr890112-byte/code-inspector.git

code-inspector app.py           # scan a file
cat app.py | code-inspector     # scan from pipe

What It Checks

Check Severity Example
Hardcoded secrets 🔴 critical api_key = "sk-abc123"
Unsafe eval/exec 🔴 critical eval(user_input)
Infinite loops 🔴 critical append-while-iterating
Mutable defaults 🟠 high def fn(items=[])
Shadowed builtins 🟠 high list = [1,2,3]
Bare except/pass 🔴 critical except: pass
Deep nesting 🟡 medium 5+ nested loops
Unused imports ⚪ low AST-based detection

Scoring

90-100: 🟢 PRODUCTION-READY
70-89:  🟡 NEEDS REVIEW
50-69:  🟠 HIGH RISK
0-49:   🔴 DO NOT DEPLOY

⭐ Star this repo if AI code has ever broken your production: github.com/minirr890112-byte/code-inspector