Token导航 LogoToken导航TokenDH.com
研究检索敏感数据clawhub未标认证来源可访问clear审计提醒

production-code-audit生产代码审核

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

4,134

周安装

174

GitHub Stars

公开资料未说明

下载量

1,448
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:production-code-audit(生产代码审核)
来源仓库:https://github.com/solomonneas/production-code-audit
安装命令:
openclaw skills install production-code-audit
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install production-code-audit

简介

深度扫描代码库并生成优先修复的综合审计报告。

  • 支持架构分析与漏洞排查,可选应用更改。
  • 适合安全审计与依赖风险检查场景。production-code-audit 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 安装命令:openclaw skills install production-code-audit。
  • 不能将工具输出直接作为最终结论,需人工复核。

SKILL.md

name
production-code-audit
version
1.1.0
description
Deep-scan a codebase, understand its architecture and patterns, then produce a comprehensive audit report with prioritized fixes. Optionally apply changes on a feature branch with a PR for review. Covers security, performance, error handling, logging, testing, and documentation.

Production Code Audit

Overview

Analyze a codebase to understand its architecture, patterns, and purpose, then produce a detailed audit report with prioritized findings. Optionally apply fixes on a dedicated branch for review via pull request. This skill scans for issues across security, performance, architecture, and quality.

Safety & Workflow

Important: This skill operates in two modes: 1. Audit mode (default): Read-only scan that produces a report. No files are modified. 2. Fix mode: When the user explicitly requests fixes, create a new branch (e.g., audit/production-hardening), apply changes there, and open a draft PR for review. Never push directly to main. Secrets handling: If hardcoded secrets are discovered, flag them in the report with file and line number. Do NOT remove or commit secrets. Advise the user to rotate the credential and use environment variables. Never log or exfiltrate secret values. Test execution: Only run tests in a sandboxed or CI environment. Ask the user before executing tests locally if the project has external dependencies (databases, APIs, etc.).

When to Use This Skill

  • Use when user says "audit my codebase" or "make this production-ready"
  • Use when preparing for production deployment
  • Use when code needs to meet corporate/enterprise standards

How It Works

Step 1: Codebase Discovery

Scan and understand the codebase:

  1. Read source files - Scan project files (respect .gitignore, skip node_modules/vendor/dist)
  2. Identify tech stack - Detect languages, frameworks, databases, tools
  3. Understand architecture - Map out structure, patterns, dependencies
  4. Identify purpose - Understand what the application does
  5. Find entry points - Locate main files, routes, controllers
  6. Map data flow - Understand how data moves through the system

Step 2: Comprehensive Issue Detection

Scan line-by-line for all issues:

Architecture Issues:

  • Circular dependencies
  • Tight coupling
  • God classes (>500 lines or >20 methods)
  • Missing separation of concerns
  • Poor module boundaries
  • Violation of design patterns

Security Vulnerabilities:

  • SQL injection (string concatenation in queries)
  • XSS vulnerabilities (unescaped output)
  • Hardcoded secrets (API keys, passwords in code)
  • Missing authentication/authorization
  • Weak password hashing (MD5, SHA1)
  • Missing input validation
  • CSRF vulnerabilities
  • Insecure dependencies

Performance Problems:

  • N+1 query problems
  • Missing database indexes
  • Synchronous operations that should be async
  • Missing caching
  • Inefficient algorithms (O(n²) or worse)
  • Large bundle sizes
  • Unoptimized images
  • Memory leaks

Code Quality Issues:

  • High cyclomatic complexity (>10)
  • Code duplication
  • Magic numbers
  • Poor naming conventions
  • Missing error handling
  • Inconsistent formatting
  • Dead code
  • TODO/FIXME comments

Testing Gaps:

  • Missing tests for critical paths
  • Low test coverage (<80%)
  • No edge case testing
  • Flaky tests
  • Missing integration tests

Production Readiness:

  • Missing environment variables
  • No logging/monitoring
  • No error tracking
  • Missing health checks
  • Incomplete documentation
  • No CI/CD pipeline

Step 3: Fixes and Optimizations (Fix Mode Only)

When the user explicitly requests fixes, apply them on a new branch:

git checkout -b audit/production-hardening
  1. Refactor architecture - Break up god classes, fix circular dependencies
  2. Fix security issues - Use parameterized queries, flag secrets for rotation, add validation
  3. Optimize performance - Fix N+1 queries, add caching, optimize algorithms
  4. Improve code quality - Reduce complexity, remove duplication, fix naming
  5. Add missing tests - Write tests for untested critical paths
  6. Add production infrastructure - Logging, monitoring, health checks
  7. Optimize everything - Bundle size, images, database queries
  8. Add documentation - README, API docs, architecture docs

Step 4: Verify and Report

After making all changes:

  1. Run all tests to ensure nothing broke
  2. Verify all security issues are fixed
  3. Measure performance improvements
  4. Generate comprehensive report
  5. Provide before/after metrics

Examples

Example 1: Autonomous Codebase Transformation

User: @production-code-audit make this production-ready

AI: I'll scan your entire codebase and transform it to production-grade quality.

**Phase 1: Discovering Codebase** (analyzing 247 files)
- Detected: Node.js + Express + PostgreSQL + React
- Architecture: MVC pattern with REST API
- Purpose: E-commerce platform
- Entry points: server.js, src/index.tsx

**Phase 2: Scanning for Issues** (line-by-line analysis)

Found 127 issues:
- 🔴 CRITICAL: 8 issues
- 🟠 HIGH: 23 issues  
- 🟡 MEDIUM: 41 issues
- 🔵 LOW: 55 issues

**Phase 3: Fixing Issues Automatically**

🔴 CRITICAL FIXES (8/8 completed):

1. ✅ Fixed SQL injection in UserRepository.findByEmail()
   - Before: String concatenation in query
   - After: Parameterized query with $1 placeholder

2. ✅ Removed hardcoded database password from config/database.ts
   - Before: password: 'SuperSecret123!'
   - After: password: process.env.DB_PASSWORD

3. ✅ Added authentication to admin routes
   - Before: No auth middleware
   - After: authenticateToken + requireRole('admin')

4. ✅ Fixed weak password hashing (MD5 → bcrypt)
   - Before: crypto.createHash('md5')
   - After: bcrypt.hash(password, 12)

5. ✅ Fixed circular dependency: OrderService ↔ PaymentService
   - Before: Direct imports causing cycle
   - After: Event-based decoupling with EventBus

6. ✅ Added input validation to all API endpoints
   - Before: No validation
   - After: Zod schemas validating all inputs

7. ✅ Fixed authentication bypass in auth middleware
   - Before: next() called on missing token
   - After: Returns 401 error

8. ✅ Fixed mass assignment vulnerability in UserController
   - Before: Accepts all fields from req.body
   - After: Whitelist of allowed fields only

🟠 HIGH PRIORITY FIXES (23/23 completed):

9. ✅ Fixed N+1 query in OrderService.getOrdersWithItems()
   - Before: Loop with individual queries (2.8s)
   - After: Single query with joins (45ms)
   - Performance: 98% improvement

10. ✅ Refactored UserService god class (850 lines → 4 focused services)
    - UserAuthenticationService (login, logout, password)
    - UserProfileService (CRUD operations)
    - UserNotificationService (email, SMS)
    - UserPermissionService (roles, permissions)

11. ✅ Added Redis caching for product queries
    - Before: Database query every request
    - After: Cache with 1-hour TTL
    - Performance: 95% faster

12. ✅ Optimized bundle size
    - Before: 850KB (gzipped: 280KB)
    - After: 380KB (gzipped: 120KB)
    - Improvement: 55% reduction

13. ✅ Added database indexes
    - orders(user_id, status, created_at)
    - products(category, price)
    - Query performance: 98% improvement

[... 11 more high-priority fixes ...]

🟡 MEDIUM PRIORITY FIXES (41/41 completed):
[... all medium fixes ...]

🔵 LOW PRIORITY IMPROVEMENTS (55/55 completed):
[... all low improvements ...]

**Phase 4: Adding Production Infrastructure**

✅ Added structured logging (Winston)
✅ Added error tracking (Sentry)
✅ Added health check endpoints (/health, /ready)
✅ Added monitoring (Prometheus metrics)
✅ Added rate limiting (Redis-based)
✅ Added API documentation (Swagger/OpenAPI)
✅ Added comprehensive README
✅ Added deployment guide
✅ Added CI/CD pipeline (.github/workflows)

**Phase 5: Verification**

✅ All tests passing (1,247 tests)
✅ Test coverage: 42% → 87%
✅ Security scan: 0 vulnerabilities
✅ Performance: API response time 3.2s → 180ms
✅ Bundle size: 850KB → 380KB
✅ Lighthouse score: 62 → 94

**TRANSFORMATION COMPLETE**

Your codebase is now production-ready with enterprise-grade quality:

📊 Metrics:
- Issues fixed: 127/127 (100%)
- Test coverage: 87% (target: 80%+)
- API performance: 94% improvement
- Security: OWASP Top 10 compliant
- Code quality: Grade A-

📁 Files changed: 89 files
📝 Lines changed: +3,247 / -1,892

🚀 Ready for production deployment!

Example 2: Automatic Security Hardening

User: @production-code-audit secure this codebase

AI: Scanning for security vulnerabilities...

**Security Scan Complete**

Found 15 security issues:
- 🔴 CRITICAL: 5
- 🟠 HIGH: 7
- 🟡 MEDIUM: 3

**Fixing all security issues automatically...**

🔴 CRITICAL (5/5 fixed):

1. ✅ SQL Injection in UserRepository
\`\`\`typescript
// Before (VULNERABLE)
const query = \`SELECT * FROM users WHERE email = '\${email}'\`;

// After (SECURE)
const query = 'SELECT * FROM users WHERE email = $1';
await db.query(query, [email]);
\`\`\`

2. ✅ Hardcoded Secrets Removed
\`\`\`typescript
// Before (INSECURE)
const JWT_SECRET = 'my-secret-key-123';

// After (SECURE)
const JWT_SECRET = process.env.JWT_SECRET;
if (!JWT_SECRET) throw new Error('JWT_SECRET required');
\`\`\`

3. ✅ Authentication Added to Admin Routes
\`\`\`typescript
// Before (VULNERABLE)
router.delete('/api/admin/users/:id', deleteUser);

// After (SECURE)
router.delete('/api/admin/users/:id',
  authenticateToken,
  requireRole('admin'),
  deleteUser
);
\`\`\`

4. ✅ Password Hashing Upgraded
\`\`\`typescript
// Before (WEAK)
const hash = crypto.createHash('md5').update(password).digest('hex');

// After (STRONG)
const hash = await bcrypt.hash(password, 12);
\`\`\`

5. ✅ Input Validation Added
\`\`\`typescript
// Before (VULNERABLE)
const user = await db.user.create({ data: req.body });

// After (SECURE)
const schema = z.object({
  email: z.string().email(),
  password: z.string().min(12),
  name: z.string().min(2).max(100)
});
const validated = schema.parse(req.body);
const user = await db.user.create({ data: validated });
\`\`\`

**Security Status:**
- ✅ OWASP Top 10: Compliant
- ✅ SQL Injection: Protected
- ✅ XSS: Protected
- ✅ CSRF: Protected
- ✅ Authentication: Secure
- ✅ Secrets: Environment variables
- ✅ Dependencies: No vulnerabilities

🔒 Codebase is now secure and production-ready!

Example 3: Performance Optimization

User: @production-code-audit optimize performance

AI: Analyzing performance bottlenecks...

**Performance Analysis Complete**

Current metrics:
- API response time: 3.2s (target: <200ms)
- Page load time: 8.5s (target: <2s)
- Bundle size: 850KB (target: <200KB)

**Optimizing automatically...**

✅ Fixed N+1 queries (3.2s → 180ms - 94% faster)
✅ Added Redis caching (95% cache hit rate)
✅ Optimized database indexes (98% faster queries)
✅ Reduced bundle size (850KB → 380KB - 55% smaller)
✅ Optimized images (28MB → 3.2MB - 89% smaller)
✅ Implemented code splitting
✅ Added lazy loading
✅ Parallelized async operations

**Performance Results:**

| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| API Response | 3.2s | 180ms | 94% |
| Page Load | 8.5s | 1.8s | 79% |
| Bundle Size | 850KB | 380KB | 55% |
| Image Size | 28MB | 3.2MB | 89% |
| Lighthouse | 42 | 94 | +52 points |

🚀 Performance optimized to production standards!

Best Practices

✅ Do This

  • Scan Everything - Read all files, understand entire codebase
  • Fix Automatically - Don't just report, actually fix issues
  • Prioritize Critical - Security and data loss issues first
  • Measure Impact - Show before/after metrics
  • Verify Changes - Run tests after making changes
  • Be Comprehensive - Cover architecture, security, performance, testing
  • Optimize Everything - Bundle size, queries, algorithms, images
  • Add Infrastructure - Logging, monitoring, error tracking
  • Document Changes - Explain what was fixed and why

❌ Don't Do This

  • Don't Ask Questions - Understand the codebase autonomously
  • Don't Wait for Instructions - Scan and fix automatically
  • Don't Report Only - Actually make the fixes
  • Don't Skip Files - Scan every file in the project
  • Don't Ignore Context - Understand what the code does
  • Don't Break Things - Verify tests pass after changes
  • Don't Be Partial - Fix all issues, not just some

Autonomous Scanning Instructions

When this skill is invoked, automatically:

  1. Discover the codebase:

- Use listDirectory to find all files recursively - Use readFile to read every source file - Identify tech stack from package.json, requirements.txt, etc. - Map out architecture and structure

  1. Scan line-by-line for issues:

- Check every line for security vulnerabilities - Identify performance bottlenecks - Find code quality issues - Detect architectural problems - Find missing tests

  1. Fix everything automatically:

- Use strReplace to fix issues in files - Add missing files (tests, configs, docs) - Refactor problematic code - Add production infrastructure - Optimize performance

  1. Verify and report:

- Run tests to ensure nothing broke - Measure improvements - Generate comprehensive report - Show before/after metrics

Do all of this without asking the user for input.

Common Pitfalls

Problem: Too Many Issues

Symptoms: Team paralyzed by 200+ issues Solution: Focus on critical/high priority only, create sprints

Problem: False Positives

Symptoms: Flagging non-issues Solution: Understand context, verify manually, ask developers

Problem: No Follow-Up

Symptoms: Audit report ignored Solution: Create GitHub issues, assign owners, track in standups

Production Audit Checklist

Security

  • [ ] No SQL injection vulnerabilities
  • [ ] No hardcoded secrets
  • [ ] Authentication on protected routes
  • [ ] Authorization checks implemented
  • [ ] Input validation on all endpoints
  • [ ] Password hashing with bcrypt (10+ rounds)
  • [ ] HTTPS enforced
  • [ ] Dependencies have no vulnerabilities

Performance

  • [ ] No N+1 query problems
  • [ ] Database indexes on foreign keys
  • [ ] Caching implemented
  • [ ] API response time < 200ms
  • [ ] Bundle size < 200KB (gzipped)

Testing

  • [ ] Test coverage > 80%
  • [ ] Critical paths tested
  • [ ] Edge cases covered
  • [ ] No flaky tests
  • [ ] Tests run in CI/CD

Production Readiness

  • [ ] Environment variables configured
  • [ ] Error tracking setup (Sentry)
  • [ ] Structured logging implemented
  • [ ] Health check endpoints
  • [ ] Monitoring and alerting
  • [ ] Documentation complete

Audit Report Template

# Production Audit Report

**Project:** [Name]
**Date:** [Date]
**Overall Grade:** [A-F]

## Executive Summary
[2-3 sentences on overall status]

**Critical Issues:** [count]
**High Priority:** [count]
**Recommendation:** [Fix timeline]

## Findings by Category

### Architecture (Grade: [A-F])
- Issue 1: [Description]
- Issue 2: [Description]

### Security (Grade: [A-F])
- Issue 1: [Description + Fix]
- Issue 2: [Description + Fix]

### Performance (Grade: [A-F])
- Issue 1: [Description + Fix]

### Testing (Grade: [A-F])
- Coverage: [%]
- Issues: [List]

## Priority Actions
1. [Critical issue] - [Timeline]
2. [High priority] - [Timeline]
3. [High priority] - [Timeline]

## Timeline
- Critical fixes: [X weeks]
- High priority: [X weeks]
- Production ready: [X weeks]

Related Skills

  • @code-review-checklist - Code review guidelines
  • @api-security-best-practices - API security patterns
  • @web-performance-optimization - Performance optimization
  • @systematic-debugging - Debug production issues
  • @senior-architect - Architecture patterns

Additional Resources


Pro Tip: Schedule regular audits (quarterly) to maintain code quality. Prevention is cheaper than fixing production bugs!

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

92.45%
按下载量换算1,339

安全审计

VirusTotal

可疑

ClawScan

可疑

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills