code-review
審查程式碼安全性與效能
也可從以下取得: ANcpLua,21pounder,davila7,getsentry,21pounder,Doyajin174,Cain96,Bind,Joseph OBrien,Claude Assistant,Joseph OBrien
程式碼變更可能引入安全漏洞和效能問題,日後修復成本高昂。此技能自動對修改的檔案進行全面的程式碼審查,檢查 OWASP Top 10 問題、N+1 查詢以及程式碼品質問題。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「code-review」。 審查修改的檔案是否存在安全問題
預期結果:
- ## 程式碼審查結果
- ### 發現的嚴重問題
- 1. user_service.py:42 存在 SQL 注入
- - 原始字串串接允許 SQL 注入
- - 修復方法:使用 SQLAlchemy ORM 的參數化查詢
- 2. post_service.py:78 存在 N+1 查詢
- - 迴圈中的延遲載入導致 101 次查詢
- - 修復方法:使用 selectinload(User.posts) 進行預先載入
- ### 建議改進
- - 考慮在外鍵上新增索引
- - 為使用者驗證新增輸入驗證
正在使用「code-review」。 檢查資料庫程式碼中的效能問題
預期結果:
- ## 效能審查
- ### 偵測到的 ORM 問題
- - app/models/user.py:15 - posts 關聯缺少預先載入
- - app/services/report.py:42 - 迴圈內的查詢導致 N+1 模式
- ### 優化建議
- - 在使用者查詢中新增 joinedload(User.posts)
- - 將查詢移出迴圈並使用批次載入
- - 考慮在頻繁查詢的欄位上新增資料庫索引
正在使用「code-review」。 審查 OWASP Top 10 漏洞
預期結果:
- ## 安全稽核結果
- ### 注入風險
- - 身份驗證失效:未配置工作階段逾時
- - 不安全的反序列化:對不受信任的資料使用 pickle.loads()
- ### XSS 漏洞
- - 範本對使用者輸入使用 innerHTML(3 個位置)
- ### 建議
- - 將使用者資料的 innerHTML 替換為 textContent
- - 對所有資料庫操作使用參數化查詢
安全審計
安全Pure documentation skill with no executable code. All 207 static findings are false positives. The skill is a guide for reviewing code - it contains code examples of vulnerabilities (SQL injection, command injection) as teaching examples, not actual malicious implementations. The only executable file is a git helper script with safe read-only operations.
風險因素
⚡ 包含腳本 (1)
📁 檔案系統存取 (1)
品質評分
你能建構什麼
提交前程式碼審查
在提交前審查所有修改的檔案,及早發現安全問題和效能問題。
自動化安全掃描
系統性地檢查程式碼變更是否存在 OWASP Top 10 漏洞,無需手動檢查。
程式碼品質執行
確保所有變更一致地遵循專案標準和編碼慣例。
試試這些提示
Review the modified files in this repository for security vulnerabilities and performance issues.
Perform a security review on changed files. Focus on OWASP Top 10 issues like SQL injection, XSS, and broken authentication.
Analyze the modified files for performance issues. Look for N+1 queries, inefficient loops, and missing database indexes.
Conduct a comprehensive code review on all changed files. Check security, performance, code quality, and project standards. Provide detailed findings with fix recommendations.
最佳實務
- 每次提交前審查變更以及早發現問題
- 在合併前立即修復嚴重的安全問題
- 將審查輸出作為團隊的學習機會
避免
- 跳過簡單變更的審查
- 忽略小功能的效能警告
- 依賴項變更時不更新安全檢查
常見問題
哪些 AI 工具支援此技能?
它會檢查哪些安全問題?
它會修改我的程式碼嗎?
我的程式碼資料安全嗎?
它可以審查任何程式語言嗎?
與 SonarQube 或其他工具相比如何?
開發者詳情
授權
MIT
引用
main
檔案結構