007
無料Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.
日本語の概要は準備中です。原文の説明を表示しています。
Comprehensive PR code review for OneKey monorepo. Use when reviewing PRs, code changes, or diffs — covers security (secrets/PII leakage, supply-chain, AuthN/AuthZ), code quality (hooks, race conditions, null safety, concurrent requests), and OneKey-specific patterns (Fabric crashes, MIUI, BigNumber). Triggers on "review PR", "review this PR", "code review", "check this diff", "审查 PR", "代码审查", "review
インストールする前に、エージェントに与えられる指示の中身を確認できます。
输出语言: 中文
xgit fetch origin && git diff origin/x...HEAD (triple-dot)gh pr checkout <PR_NUMBER> (skip if already on branch)git diff origin/x...HEAD --stat to see change scopereferences/Check if Codex is available by confirming the codex:codex-rescue subagent type can be dispatched. If uncertain, invoke /codex:setup to check readiness.
If available:
Agent(subagent_type="codex:codex-rescue"):
Agent(
subagent_type = "codex:codex-rescue",
prompt = "Review this PR diff for the OneKey crypto wallet monorepo. Focus on:
- Security vulnerabilities (secret leakage, auth bypass, supply-chain risks)
- Runtime bugs (race conditions, null safety, memory leaks)
- Architecture violations (import hierarchy, cross-platform issues)
- Code quality (hooks safety, error handling, performance)
Report each finding with: file:line, severity (Critical/High/Medium/Low), description, fix suggestion.
Diff:
${FULL_DIFF}"
)
{Cross-validated ✅}, auto-promote to 🔵 High confidence[Codex], review manually to assign confidenceIf unavailable: Skip silently. Set "Codex 交叉验证: ⏭️ 未启用" in the report header. Do NOT mention Codex anywhere else.
Collect ALL existing comments on the PR — bot and human — then analyze each with your local codebase context. You have full source access, type system, and dependency graph; most commenters only saw the diff. Use this asymmetry.
Use gh api to get full user metadata (including type field for bot detection):
# Top-level PR reviews (review bodies)
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews \
--jq '[.[] | select(.body != "") | {author: .user.login, is_bot: (.user.type == "Bot"), body: .body, state: .state, association: .author_association}]'
# Inline review comments (file:line annotations)
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments \
--jq '[.[] | {author: .user.login, is_bot: (.user.type == "Bot"), path: .path, line: .line, body: .body, association: .author_association}]'
# General PR comments (issue-level)
gh api repos/{owner}/{repo}/issues/{pr_number}/comments \
--jq '[.[] | {author: .user.login, is_bot: (.user.type == "Bot"), body: .body, association: .author_association}]'
Bot detection — use the user.type == "Bot" field from GitHub API, not hardcoded username lists. This automatically covers any bot (current and future) without maintenance.
If no comments exist, set "PR 评论分析: ⏭️ 无评论" in the report header and skip this section.
For each substantive comment (skip empty approvals, CI status badges, pure formatting):
| Verdict | Meaning | Action |
|---|---|---|
| ✅ Confirmed | Comment identifies a real issue | Include in findings, tag source [<author>] |
| 🔍 Enriched | Real issue, but analysis is shallow or fix is wrong | Include with deeper fix guidance from your codebase knowledge |
| ❌ Noise | Not an issue given full codebase context | Note in "评论误报分析" with brief explanation of why |
| 📋 Already Covered | Your primary review caught it | Cross-validate, boost confidence |
Your local advantages — use them aggressively:
tsc, verify types end-to-endyarn info, changelogs, actual vulnerability reachabilityWhen someone flags something vague, dig into the source to confirm or refute. When a comment misses context (e.g., a function is safely guarded upstream), explain why. When a comment is right, amplify with richer context.
{Cross-validated ✅}, promote to 🔵 High[<author>] tagFor security-related comments (from bots like Snyk/Dependabot or from human reviewers):
Run git diff origin/x...HEAD --name-only and match:
| Changed Files Match | Load |
|---|---|
package.json, lockfiles, node_modules patches, patches/*.patch | [security-and-supply-chain.md] — full supply-chain review |
**/auth/**, **/vault/**, **/signing/**, **/crypto/**, manifest.json, **/manifest/*.js | [security-and-supply-chain.md] — full security review |
Any .ts/.tsx with business logic | [code-quality-patterns.md] — hooks, race conditions, null safety |
.android.ts(x), .ios.ts(x), .native.ts(x), .desktop.ts(x), .ext.ts(x), .web.ts(x), native modules, BigNumber usage | [onekey-platform-patterns.md] — platform crashes & numeric safety |
Shell scripts (.sh), CI workflows (.yml) | [onekey-platform-patterns.md] — build & CI section |
Always check regardless of file type:
.DS_Store, .env, node_modules)@onekeyhq/shared <- FORBIDDEN to import from other OneKey packages
↓
@onekeyhq/components <- ONLY imports shared
↓
@onekeyhq/core <- ONLY imports shared
↓
@onekeyhq/kit-bg <- imports shared, core (NEVER components or kit)
↓
@onekeyhq/kit <- imports shared, components, kit-bg
↓
apps/* <- imports all
# Quick hierarchy violation check on changed files
git diff origin/x...HEAD --name-only | grep -E '\.tsx?$' | \
while IFS= read -r f; do [ -f "$f" ] && grep -l "from.*@onekeyhq" "$f" 2>/dev/null; done | \
while IFS= read -r f; do echo "=== $f ==="; grep "from.*@onekeyhq" "$f"; done
For newly added helpers, hooks, services, components, constants, formatters, validators, or business logic:
| Risk | Patterns | Action |
|---|---|---|
| Critical | **/vault/**, **/signing/**, **/crypto/**, **/core/src/**, hardware wallet SDK | Line-by-line review |
| High | **/auth/**, API endpoints, state management, package.json, manifest.json | Deep review |
| Medium | UI components, platform-specific code, background services | Standard review |
| Low | Comments, type-only, formatting, tests, docs | Scan for anomalies |
MANDATORY — every report must include this scoring table, no exceptions.
Rate the PR on 4 dimensions (1-10 each):
| Dimension | Weight | What to evaluate |
|---|---|---|
| 🔒 安全性 | 35% | Secret leakage, auth bypass, supply-chain risk, input validation |
| 💎 代码质量 | 30% | Hooks safety, error handling, race conditions, null safety, DRY, reuse of existing implementations |
| 🏛️ 架构合理性 | 20% | Import hierarchy, separation of concerns, cross-platform consistency |
| ✅ 完整性 | 15% | Edge cases handled, test coverage, migration paths, docs |
Total Score = weighted average, rounded to 1 decimal.
| Score | Verdict | Action |
|---|---|---|
| 8.0 - 10.0 | ✅ 可直接合入 | No blockers, minor suggestions only |
| 5.0 - 7.9 | ⚠️ 需修改后复审 | Has issues that should be fixed before merge |
| < 5.0 | ❌ 建议打回重做 | Fundamental issues in security or architecture |
Scoring anchors — to keep scores consistent:
MANDATORY — every finding must use exactly one of these three emoji tags. Do NOT use percentages, do NOT use plain text like "高/中/低" without the emoji. Always use this exact format:
| Tag | Meaning | When to use |
|---|---|---|
| 🔵 High | Confirmed, verifiable from code | Clear bug, obvious violation, reproducible |
| 🟠 Medium | Likely issue, needs context | Pattern suggests problem, might be intentional |
| ⚪ Low | Possible issue, needs human check | Heuristic match, depends on business logic |
Cross-validated findings (primary + Codex agree, or primary + PR comment agree) → automatically 🔵 High.
MANDATORY for these categories — if a finding matches one of these, you MUST include a diff patch:
console.error/warn/log → project logger (defaultLogger)Number(decimals))Format — always use this exact structure:
**Auto-fix:**
\```diff
- old code
+ new code
\```
For other findings where the fix is unambiguous and doesn't require business context, also include auto-fix. When in doubt, include it — it's more useful to have a suggested fix than not.
Do NOT generate auto-fix for:
After generating the report, if there are findings that meet the comment threshold:
Comment threshold: 🔴 高 priority (any confidence) OR 🟡 中 priority with 🔵 High confidence. This means:
# Inline comment on specific file:line
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments \
--field body="🟡 **问题标题**: 描述...
**建议修复:**
\`\`\`suggestion
修复代码
\`\`\`
_— Auto-review by Claude_" \
--field path="path/to/file.tsx" \
--field line=42 \
--field side="RIGHT" \
--field commit_id="$(git rev-parse HEAD)"
Rules:
suggestion block when availableCRITICAL: Follow this template exactly. Every section marked [REQUIRED] must appear in every report. Do not skip or reorder sections.
# PR #NUMBER 代码审查报告
## 审查概要 [REQUIRED]
- **变更范围**: X 个文件, +Y / -Z 行
- **风险等级**: Critical / High / Medium / Low
- **涉及平台**: Extension / Mobile / Desktop / Web
- **Codex 交叉验证**: ✅ 已启用 / ⏭️ 未启用
- **PR 评论分析**: ✅ 已分析 (N 条评论, 其中 M 条来自 Bot) / ⏭️ 无评论
## 评分 [REQUIRED — NEVER SKIP THIS SECTION]
| 维度 | 得分 | 说明 |
|------|------|------|
| 🔒 安全性 | X/10 | 简要说明 |
| 💎 代码质量 | X/10 | 简要说明 |
| 🏛️ 架构合理性 | X/10 | 简要说明 |
| ✅ 完整性 | X/10 | 简要说明 |
| **总分** | **X.X/10** | **✅ 可直接合入 / ⚠️ 需修改后复审 / ❌ 建议打回** |
## Codex 交叉验证摘要 [REQUIRED if Codex was used, OMIT if not]
| 发现 | Primary | Codex | 状态 |
|------|---------|-------|------|
| 问题描述 | Yes/No | Yes/No | 交叉验证 / 仅 Primary / 仅 Codex |
## PR 评论分析 [REQUIRED if comments exist, OMIT if none]
| 来源 | 类型 | 发现 | 判定 | 说明 |
|------|------|------|------|------|
| Snyk | 🤖 Bot | 依赖漏洞 CVE-XXXX | ✅ Confirmed | 漏洞路径在 OneKey 中可达 |
| @reviewer | 👤 Human | 缺少 null check | 🔍 Enriched | 实际需要在上游 hook 中处理 |
| Devin | 🤖 Bot | 变量命名建议 | ❌ Noise | 命名符合项目规范 |
### 评论误报分析 [OMIT if no noise findings]
- **[来源] 误报**: 具体说明为什么这不是问题(引用源码上下文)
## 发现的问题 [REQUIRED]
### [🔴 高] [🔵 High] 问题标题 {Cross-validated ✅}
**文件**: `path/to/file.tsx:42`
**类型**: 安全 / 构建 / 运行时 / 性能 / 规范
**描述**: 问题是什么,为什么有风险
**Auto-fix:**
\```diff
- old code
+ new code
\```
---
### [🟡 中] [🟠 Medium] 问题标题
**文件**: `path/to/file.tsx:18`
**类型**: 运行时
**描述**: ...
**修复建议**: ...
---
## 修改清单 [REQUIRED]
| 优先级 | 置信度 | 文件 | 类型 | 描述 | Auto-fix |
|--------|--------|------|------|------|----------|
| 🔴 高 | 🔵 High | file1.tsx:42 | 安全 | 描述 | ✅ |
| 🟡 中 | 🟠 Medium | file2.tsx:18 | 运行时 | 描述 | — |
## 测试建议 [REQUIRED]
1. 测试场景
2. 测试场景
## GH 评论操作 [REQUIRED if qualifying findings exist, OMIT if none]
以下问题(🔵 High 置信度 + 🟡 中及以上)建议直接评论到 PR:
- [ ] 问题1 — `file.tsx:42`
- [ ] 问题2 — `file.tsx:88`
> 确认后将通过 `gh` CLI 发送 inline comments。
| Priority | Criteria | Action |
|---|---|---|
| 🔴 高 | Build failure, security vulnerability, data loss, crash | Must fix before merge |
| 🟡 中 | Runtime bug, incorrect behavior, maintainability | Should fix before merge |
| 🟢 低 | Nice-to-have, minor inconsistency | Can fix in follow-up |
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.
日本語の概要は準備中です。原文の説明を表示しています。
Guides the creation of agile user stories and Gherkin feature files. Use when the user wants to create a user story, write acceptance criteria, define Gherkin scenarios, or author BDD feature files. This should trigger for requests such as Create a user story; Write a user story; I need to write a user story. Part of cursor-rules-java project
日本語の概要は準備中です。原文の説明を表示しています。
Facilitates conversational discovery to create Architectural Decision Records (ADRs) for non-functional requirements using the ISO/IEC 25010:2023 quality model. Use when the user wants to document quality attributes, NFR decisions, security/performance/scalability architecture, or design systems with measurable quality criteria. This should trigger for requests such as Create ADR for Non-functional requirements; Document Non-functional requirements; Capture Non-functional requirements; Generate Non-functional requirements in an ADR. Part of cursor-rules-java project
日本語の概要は準備中です。原文の説明を表示しています。
Run a health check on an existing project: dependency audit, security scan, test runner detection, CI/CD evaluation, and missing configuration analysis. Maps the three execution gates (pre/in/post) from /10x-bootstrapper to an assessment framework for existing codebases. Reads optional context/foundation/stack-assessment.md from /10x-stack-assess to focus checks on identified gaps. Writes context/foundation/health-check.md with findings, prioritized fixes, and an agent-readiness verdict. Use when the user has an existing project and wants to verify its health before working with an agent. Trigger phrases: "health check", "check my project", "audit my project", "is my project healthy", "sprawdź projekt", "audyt projektu", "health-check", "project health". Use AFTER /10x-stack-assess (brownfield chain), BEFORE agent onboarding (m1-l4).
日本語の概要は準備中です。原文の説明を表示しています。
You MUST use this when building projects end-to-end. Orchestrates all 12 team roles — automatically switches between CTO, architect, PM, engineers, SRE, security, DBA, QA, and EM based on the current phase of work. Starts with brainstorming before any implementation.
日本語の概要は準備中です。原文の説明を表示しています。
Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, container image build (Jib), build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. This should trigger for requests such as Add Maven plugins in pom.xml; Improve Maven plugins in pom.xml. Part of cursor-rules-java project
日本語の概要は準備中です。原文の説明を表示しています。