원클릭으로
code-review
当用户要求"审查代码"、"代码检查"、"检查bug"、"代码质量检查"、"发现问题"、"重构建议",或者提到"代码审查"、"code review"、"审查"、"检查"时使用此技能。用于代码质量、潜在bug、性能问题、安全漏洞或改进机会的反馈。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
当用户要求"审查代码"、"代码检查"、"检查bug"、"代码质量检查"、"发现问题"、"重构建议",或者提到"代码审查"、"code review"、"审查"、"检查"时使用此技能。用于代码质量、潜在bug、性能问题、安全漏洞或改进机会的反馈。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
This skill should be used when the user requests merging work into main and then deleting all other local and remote branches, keeping only main.
当用户要求"DeepSeek API 集成"、"AI 服务"、"生成回复建议"、"调用 LLM"、"HTTP 请求"、"流式响应"、"连接池优化"、"重试策略",或者提到"DeepSeek"、"API 调用"、"reqwest"、"streaming"时使用此技能。用于 DeepSeek API 集成、HTTP 客户端配置、错误处理、流式响应、连接池优化和 API 密钥管理。
当用户要求"IPC 通信"、"进程通信"、"Agent 协议"、"stdin/stdout"、"JSON 消息"、"Orchestrator 通信"、"消息序列化",或者提到"进程间通信"、"Agent 集成"、"消息协议"时使用此技能。用于实现 Rust Orchestrator 和 Platform Agents 之间的 IPC 通信,包括消息格式定义、序列化、错误处理和性能优化。
macOS Agent 开发规范(Swift + Accessibility API),包括项目结构、Accessibility API 使用、UI Automation、IPC 通信集成、错误处理和测试。
Background knowledge about WeReply project architecture, features, and context. Automatically loaded for AI reference, not directly user-invocable.
Python Agent 开发规范(Windows wxauto v4),包括项目结构、模块化、wxauto 使用、IPC 集成、错误处理、测试和部署。
| name | code-review |
| description | 当用户要求"审查代码"、"代码检查"、"检查bug"、"代码质量检查"、"发现问题"、"重构建议",或者提到"代码审查"、"code review"、"审查"、"检查"时使用此技能。用于代码质量、潜在bug、性能问题、安全漏洞或改进机会的反馈。 |
| version | 2.0.0 |
Comprehensive code review guidance for Tauri + Rust + React applications with focus on quality, security, and maintainability.
This skill provides systematic code review guidance covering:
This skill activates when:
Before diving into code details:
# Check git diff context
git diff main...feature-branch
git log --oneline main..feature-branch
# Verify tests pass
cargo test
npm test
# Check formatting
cargo fmt --check
npm run lint
Questions to answer:
git diff --stat)✅ Correct Tauri Command:
#[tauri::command]
#[specta::specta]
pub async fn get_materials(
state: State<'_, TauriAppState>,
) -> ApiResponse<Vec<Material>> {
with_service(state, |ctx| async move {
ctx.material_service.get_all().await
})
.await
}
Checklist:
#[tauri::command] attribute present#[specta::specta] attribute presentApiResponse<T>with_service helper or proper error handlingawait✅ Good Error Handling:
pub async fn create_formula(&self, dto: CreateFormulaDto) -> Result<Formula> {
// Validate input
if dto.name.is_empty() {
return Err(anyhow!("名称不能为空"));
}
// Check for duplicates
if self.exists_by_name(&dto.name).await? {
return Err(anyhow!("配方名称已存在"));
}
// Create with transaction
let mut tx = self.pool.begin().await?;
let id = self.insert_internal(&dto, &mut tx).await?;
tx.commit().await?;
Ok(self.get_by_id(id).await?)
}
Common Issues to Watch For:
? not used)let _ = result).context() for error chaining✅ Safe SQLx Query:
sqlx::query_as!(
Material,
"SELECT code, name, price FROM materials WHERE code = ?",
code
)
.fetch_one(&pool)
.await
Common Issues:
SELECT * - specify columns explicitlyRed Flags:
// ❌ Blocking async runtime
std::thread::sleep(Duration::from_secs(10));
// ❌ Unnecessary cloning
let data = self.large_data.clone(); // Can use &LargeData
// ❌ Inefficient data structures
let mut items = Vec::new();
for item in huge_list {
if items.contains(&item) { // O(n) lookup
items.push(item);
}
}
// ✅ Use HashSet for O(1) lookups
use std::collections::HashSet;
let mut items = HashSet::new();
Performance Checklist:
Arc vs & referencesrayon for CPU-bound tasks✅ Well-Structured Component:
import React, { useCallback, useMemo } from 'react';
import { message } from 'antd';
interface Props {
formula: Formula;
onUpdate: (id: number) => void;
}
export const FormulaCard: React.FC<Props> = React.memo(({ formula, onUpdate }) => {
const totalCost = useMemo(
() => formula.materials.reduce((sum, m) => sum + m.cost, 0),
[formula.materials]
);
const handleUpdate = useCallback(() => {
onUpdate(formula.id);
}, [formula.id, onUpdate]);
return (
<div>
<h3>{formula.name}</h3>
<p>成本: {totalCost.toFixed(2)}</p>
<Button onClick={handleUpdate}>更新</Button>
</div>
);
});
Checklist:
any)React.memo for performanceuseCallback for callbacks passed as propsuseMemo for expensive calculationsconsole.log (use message instead)✅ Correct Hooks Usage:
export const useFormulas = () => {
const { data, isLoading, error } = useQuery({
queryKey: ['formulas'],
queryFn: () => commands.getFormulas(),
});
const createMutation = useMutation({
mutationFn: (dto: CreateDto) => commands.createFormula(dto),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['formulas'] });
message.success('创建成功');
},
});
return { formulas: data, isLoading, createMutation };
};
Common Issues:
useEffect/useCallbacksetStateinvoke instead of generated commandsType Safety Check:
// ✅ Using generated types
import type { Formula, Material } from '../bindings';
import { commands } from '../bindings';
const result = await commands.getFormula(123);
if (!result.success) {
message.error(result.message);
return;
}
const formula: Formula = result.data; // Type-safe!
Issues to Watch:
as any type assertionsresult.successSQL Injection:
// ❌ VULNERABLE
let query = format!("SELECT * FROM materials WHERE name = '{}'", name);
sqlx::query(&query).fetch_one(&pool).await
// ✅ SAFE
sqlx::query_as!(
Material,
"SELECT * FROM materials WHERE name = ?",
name
)
.fetch_one(&pool).await
Input Validation:
// ❌ No validation
pub fn create_material(name: String, price: f64) -> Result<Material> {
// Direct insert without checks
}
// ✅ With validation
pub fn create_material(name: String, price: f64) -> Result<Material> {
if name.is_empty() || name.len() > 100 {
return Err(anyhow!("无效的原料名称"));
}
if price < 0.0 || price > 10000.0 {
return Err(anyhow!("价格超出合理范围"));
}
// Proceed with creation
}
Desktop App Security:
// ✅ Good test coverage
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_calculate_cost() {
// Normal case
assert_eq!(calculate_cost(&materials), 100.0);
// Edge cases
assert_eq!(calculate_cost(&[]), 0.0);
assert_eq!(calculate_cost(&[single_material]), single_material.cost);
}
#[test]
fn test_negative_proportion_rejected() {
let result = validate_proportion(-10.0);
assert!(result.is_err());
}
}
Checklist:
What to Check:
## 🔴 Critical: [Issue Title]
**Location**: `src/file.rs:42`
**Problem**: [Clear description of the issue]
**Impact**: [Why this matters]
**Suggested Fix**:
```rust
// Show corrected code
### Medium Priority Issues
```markdown
## 🟡 Suggestion: [Title]
**Location**: `src/file.rs:123`
**Current Approach**: [What the code does now]
**Recommendation**: [Better approach]
**Benefits**:
- [Benefit 1]
- [Benefit 2]
## 💡 Nitpick: [Title]
**Location**: `src/file.rs:200`
**Observation**: [Small improvement]
**Why it matters**: [Optional explanation]
| Issue | Pattern | Fix |
|---|---|---|
| Missing unwrap context | .unwrap() | .expect("Descriptive message") or proper error handling |
| Cloning instead of borrowing | .clone() | Use &T reference |
| Blocking async runtime | std::thread::sleep | tokio::time::sleep |
| SQL injection risk | format!("WHERE = {}", val) | Use ? parameter binding |
| N+1 query | Loop with query inside | Use JOIN or batch query |
| Issue | Pattern | Fix |
|---|---|---|
| Console logging | console.log() | Use message component |
| Type assertion | as any | Use proper types |
| Missing deps | useEffect(fn, []) | Add all dependencies |
| Hook in condition | if (condition) { useState() } | Move to top level |
| Key prop issue | key={index} | Use unique ID |
# Run all automated checks
cargo test --all
cargo clippy -- -D warnings
cargo fmt --check
npm test
npm run lint
npm run type-check
# Review changes
git diff main...feature-branch
# View specific file changes
git diff main..feature-branch -- src/file.rs
# Check commit history
git log --oneline main..feature-branch
# Run tests
cargo test
npm test
# Check formatting
cargo fmt --check
npm run lint
Backend (Rust):
- [ ] Tauri command attributes correct
- [ ] Error handling comprehensive
- [ ] SQL queries safe and optimized
- [ ] Performance considerations addressed
- [ ] No blocking calls in async context
Frontend (React):
- [ ] TypeScript types correct
- [ ] Hooks properly used
- [ ] No console.log
- [ ] Error handling with message
- [ ] Performance optimized
Integration:
- [ ] Type-safe command calls
- [ ] Proper error handling
- [ ] Consistent naming
- [ ] specta types generated
Testing:
- [ ] Unit tests present
- [ ] Edge cases covered
- [ ] Integration tests if needed
- [ ] Tests passing
Documentation:
- [ ] Public APIs documented
- [ ] Complex logic explained
- [ ] README updated
Activate this skill when: