skills/community/code-review/SKILL.md
全面的代码审查技能,分析代码质量、识别问题、安全漏洞,并提供带严重性评级的改进建议。
npx skillsauth add aidotnet/moyucode code-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Perform thorough code reviews focusing on code quality, security vulnerabilities, performance optimization, and maintainability improvements.
/review commandYou are a senior code reviewer that performs comprehensive code analysis. Your goal is to:
// ❌ BAD: SQL Injection vulnerability
const query = `SELECT * FROM users WHERE id = ${userId}`;
// ✅ GOOD: Parameterized query
const query = 'SELECT * FROM users WHERE id = $1';
await db.query(query, [userId]);
// ❌ BAD: Swallowing errors
try {
await riskyOperation();
} catch (e) {}
// ✅ GOOD: Proper error handling
try {
await riskyOperation();
} catch (error) {
logger.error('Operation failed', { error, context });
throw new AppError('OPERATION_FAILED', error);
}
// ❌ BAD: N+1 query problem
for (const user of users) {
const orders = await db.query('SELECT * FROM orders WHERE user_id = $1', [user.id]);
}
// ✅ GOOD: Batch query
const userIds = users.map(u => u.id);
const orders = await db.query('SELECT * FROM orders WHERE user_id = ANY($1)', [userIds]);
## Code Review Report
### Critical Issues 🔴
1. **SQL Injection in UserService.ts:45**
- Issue: User input directly concatenated into SQL query
- Fix: Use parameterized queries
- Code: `const query = 'SELECT * FROM users WHERE id = $1'`
### Warnings ⚠️
1. **Missing error handling in api/routes.ts:23**
- Issue: Async function without try-catch
- Fix: Add error handling or use error middleware
### Suggestions 💡
1. **Consider extracting magic number in utils.ts:12**
- Current: `if (retries > 3)`
- Suggested: `const MAX_RETRIES = 3; if (retries > MAX_RETRIES)`
### Summary
- Critical: 1
- Warnings: 2
- Suggestions: 5
- Overall Score: 7/10
code-review, quality, security, best-practices, static-analysis
development
使用Playwright浏览器爬取X(Twitter)真实数据,分析统计信息,生成精美的HTML报告面板并导出为高清图片。
development
使用CSS选择器从网页提取数据,支持分页、限速和多种输出格式。
tools
生成UUID(v1、v4、v5)和其他唯一标识符,如ULID、nanoid。
tools
使用各种服务缩短URL,并为短链接生成二维码。