关于 rnv
rnv 是一项 Agent 技能,通过四阶段 CoVe 流程将初稿、独立核验和最终结果分开,适用于需要明确检查实现与结论的任务。
主要功能
- 01四阶段核验流程
- 02初稿与核验分离
- 03生成待核验清单
- 04对抗式核验提示
- 05按技术栈分类的清单
适用场景
- 01审查有状态或异步代码
- 02检查数据库与身份验证改动
- 03扩展简单任务提示
- 04核验数据转换的边界情况
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ aaarnv/ claude-skills --skill rnv安装后在 Claude Code 中输入/rnv确认已加载。
附带文件checklists.mdtemplates.md
详细介绍
Chain-of-Verification(CoVe)系统
你正在使用 CoVe 模式——一种严谨的验证框架,通过将生成与验证分离来消除幻觉和细微错误。
核心原则
“LLM 辅助的代码审查,而非由 LLM 生成代码。” 生成成本很低,正确性取决于验证。
四阶段 CoVe 协议
收到任何任务时,你都必须按顺序执行全部 4 个阶段:
═══════════════════════════════════════════════════════════════
阶段 1:初始方案(未经验证的草稿)
═══════════════════════════════════════════════════════════════
针对 $ARGUMENTS 生成尽可能完善的方案。
阶段 1 的规则:
- 提供完整且可运行的实现
- 此输出是有意标记为不可信的
- 不要自我审查或含糊其辞——尽你所能作答
- 明确标记为
[UNVERIFIED DRAFT]
## [UNVERIFIED DRAFT]
[Your initial implementation here]
═══════════════════════════════════════════════════════════════
阶段 2:制定验证计划
═══════════════════════════════════════════════════════════════
不要重新解决问题,列出所有需要验证的事项。
使用以下模板创建检查清单:
## Verification Plan
### Critical Claims to Verify
- [ ] Claim 1: [specific assertion from Stage 1]
- [ ] Claim 2: [specific assertion from Stage 1]
### API/Library Correctness
- [ ] [API name]: [specific usage to verify]
- [ ] [Library]: [version compatibility, correct method signature]
### Edge Cases
- [ ] [Edge case 1]: [what could break]
- [ ] [Edge case 2]: [what could break]
### Concurrency & State
- [ ] [Race condition risk]: [where it could occur]
- [ ] [State mutation]: [potential issues]
### Type Safety
- [ ] [Type assertion 1]: [verify correctness]
- [ ] [Implicit any or unsafe cast]: [location]
### Environment Assumptions
- [ ] [Runtime]: [Node version, browser, etc.]
- [ ] [Database]: [engine, isolation level]
- [ ] [Dependencies]: [version requirements]
### Performance Claims
- [ ] [Complexity claim]: [O(n), O(n log n), etc.]
- [ ] [Memory usage]: [any concerns]
### Security Considerations
- [ ] [Input validation]: [where needed]
- [ ] [Injection risks]: [SQL, XSS, command]
- [ ] [Auth/authz]: [any assumptions]
═══════════════════════════════════════════════════════════════
阶段 3:独立验证
═══════════════════════════════════════════════════════════════
重要:不要依赖阶段 1 的推理。请独立验证每一项。
对于检查清单中的每一项,请提供:
## Independent Verification
### ✓ PASSED | ✗ FAILED | ⚠ WARNING
#### [Item Name]
- **Verdict**: ✓ PASSED / ✗ FAILED / ⚠ WARNING
- **Evidence**: [Concrete proof or counterexample]
- **If Failed**: [Specific fix required]
应使用的验证技巧:
-
基于约束的验证
- 根据明确的环境约束进行验证
- 检查版本兼容性
- 验证类型正确性
-
对抗性验证
- 尝试构造会导致代码失效的输入
- 重点关注:竞态条件、差一错误、空值路径、过期闭包
-
差分推理
- 与朴素方法或暴力方法进行比较
- 说明权衡
-
逐行语义审查(针对关键路径)
- 说明每一行的作用
- 标记删除后不会影响行为的行
═══════════════════════════════════════════════════════════════
阶段 4:最终验证方案
═══════════════════════════════════════════════════════════════
只有完成所有验证后,才能给出最终结果。
## [VERIFIED SOLUTION]
### Changes from Draft
- [Change 1]: [Why it was needed]
- [Change 2]: [Why it was needed]
### Verification Summary
- Total items checked: [N]
- Passed: [X]
- Failed & Fixed: [Y]
- Warnings acknowledged: [Z]
### Final Implementation
[Corrected code here]
### Remaining Caveats
- [Any known limitations]
- [Assumptions that couldn't be verified]
惰性提示词转换
当用户提供懒省事或简单的提示词时,自动使用以下模板扩展:
用户说:“添加一个删除按钮”
CoVe 转换为:
Task: Add a delete button to [inferred component/location]
Stage 1 - Initial Solution:
- Implement the delete button with proper UI
- Add click handler with confirmation
- Call appropriate API/mutation
- Handle loading/error states
- Update cache/state after deletion
Stage 2 - Verification Plan:
- [ ] Button placement follows design system
- [ ] Confirmation prevents accidental deletion
- [ ] API endpoint exists and is correct
- [ ] Optimistic update handles rollback on failure
- [ ] Cache invalidation is complete
- [ ] Loading state prevents double-clicks
- [ ] Error state is user-friendly
- [ ] Accessibility (aria-label, keyboard nav)
Stage 3 - Independent Verification:
[Verify each item]
Stage 4 - Final Verified Solution:
[Corrected implementation]
特定技术栈的验证检查清单
React / Next.js
- [ ] useEffect dependency array is complete
- [ ] useMemo/useCallback dependencies are correct
- [ ] No stale closures in event handlers
- [ ] Keys are stable and unique
- [ ] Server/Client component boundary is correct
- [ ] Suspense boundaries handle loading
- [ ] Error boundaries catch failures
TanStack Query / React Query
- [ ] Query keys are consistent and follow pattern
- [ ] Mutations invalidate correct queries
- [ ] Optimistic updates have proper rollback
- [ ] Stale time / cache time are appropriate
- [ ] Infinite queries handle page boundaries
- [ ] Prefetching doesn't cause waterfalls
tRPC
- [ ] Procedure types match (query vs mutation)
- [ ] Input validation is complete (Zod schema)
- [ ] Error handling uses TRPCError
- [ ] Context has required auth/session
- [ ] Batching is considered for multiple calls
Prisma / Database
- [ ] Transactions wrap related operations
- [ ] Isolation level is appropriate
- [ ] N+1 queries are avoided (include/select)
- [ ] Unique constraints are enforced
- [ ] Cascade deletes are intentional
- [ ] Indexes exist for query patterns
TypeScript
- [ ] No `any` types (explicit or implicit)
- [ ] Null/undefined handled properly
- [ ] Type narrowing is sound
- [ ] Generics are constrained appropriately
- [ ] Return types are explicit for public APIs
Async / Concurrency
- [ ] Promise.all used for independent operations
- [ ] Race conditions are prevented
- [ ] Cleanup functions in useEffect
- [ ] AbortController for cancellable requests
- [ ] Debounce/throttle where appropriate
阶段 3 的对抗性提示词
使用以下提示词对阶段 1 的方案进行压力测试:
异步代码
Attempt to construct a sequence of events that would cause:
1. Race condition between two concurrent calls
2. Stale data displayed after mutation
3. Memory leak from uncancelled subscription
4. Deadlock or infinite loop
状态管理
Attempt to reach an invalid state by:
1. Rapid successive user actions
2. Network failure mid-operation
3. Component unmount during async operation
4. Browser back/forward navigation
API 端点
Attempt to break this endpoint with:
1. Missing or malformed input
2. Unauthorized access
3. SQL/NoSQL injection
4. Excessive payload size
5. Concurrent conflicting requests
React 组件
Attempt to cause incorrect rendering by:
1. Props changing faster than render cycle
2. Parent re-rendering with same props
3. Context value changing mid-render
4. Suspense boundary resolution order
何时使用 CoVe
始终用于:
- 任何有状态的代码
- 并发/异步逻辑
- 数据库操作
- 身份验证/授权
- 财务计算
- 存在边界情况的数据转换
仅在以下情况跳过:
- 简单的一行代码
- 纯样式修改
- 一次性原型
- README/文档更新
示例:完整的 CoVe 流程
用户提示词:“为用户表格添加分页”
阶段 1:[UNVERIFIED DRAFT]
// Initial implementation
const { data, fetchNextPage, hasNextPage } = useInfiniteQuery({
queryKey: ['users'],
queryFn: ({ pageParam = 0 }) => fetchUsers({ offset: pageParam, limit: 20 }),
getNextPageParam: (lastPage) => lastPage.nextOffset,
})
阶段 2:验证计划
- [ ] Query key includes filter/sort params
- [ ] Offset calculation is correct at boundaries
- [ ] Loading state shown during fetch
- [ ] Empty state handled
- [ ] Error state handled
- [ ] Total count displayed correctly
- [ ] Page size is configurable
- [ ] URL state synced with pagination
- [ ] Keyboard navigation works
- [ ] Screen reader announces page changes
阶段 3:独立验证
✗ FAILED: Query key includes filter/sort params
- Evidence: queryKey is just ['users'], doesn't include filters
- Fix: queryKey: ['users', { filters, sort }]
✗ FAILED: URL state synced with pagination
- Evidence: Page state is local, lost on refresh
- Fix: Use URL search params or router state
✓ PASSED: Offset calculation
- Evidence: getNextPageParam correctly returns nextOffset from API
⚠ WARNING: Total count displayed
- Evidence: API returns total but we don't display it
- Recommendation: Show "Page X of Y" or "Showing 1-20 of 156"
阶段 4:[VERIFIED SOLUTION]
// Corrected implementation with all fixes applied
const [searchParams, setSearchParams] = useSearchParams()
const page = Number(searchParams.get('page')) || 0
const { data, fetchNextPage, hasNextPage, isLoading, error } = useInfiniteQuery({
queryKey: ['users', { filters, sort, page }],
queryFn: ({ pageParam = page }) => fetchUsers({
offset: pageParam * PAGE_SIZE,
limit: PAGE_SIZE
}),
getNextPageParam: (lastPage, allPages) =>
lastPage.hasMore ? allPages.length : undefined,
})
// Sync to URL
const goToPage = (newPage: number) => {
setSearchParams({ page: String(newPage) })
}
与 /wavybaby 集成
/wavybaby 会自动为非简单任务调用 CoVe。你也可以在需要验证、但不需要完整 wavybaby 工具包分析时,直接调用 /cove。
/wavybaby [task] → native dispatch + skill discovery + CoVe
/cove [task] → just the 4-stage verification protocol
现在针对以下内容执行 CoVe 协议:$ARGUMENTS
评论
支持 Markdown