- Home
- Skills
- Testing & Debugging
- adversarial code critic
adversarial code critic
Adversarial critic for code and system designs that uses evidence-based auditing to hunt for P0/P1 defects.
Free
adversarial code critic
Example session with this skill installed
核查这个 MSPM0 的电机驱动函数,它在高负载下偶尔会停转。代码如下:[代码片段]
- Read your context and instructions
- Compiled the adversarial code critic
评审结论(第 1 轮)
总体判断:不达标
现状(这份代码现在是什么)
当前实现是一个基于 PWM 的基础直流电机开环控制器。它通过 GPIO 翻转实现换向,并在主循环内通过延迟函数处理简单的加减速逻辑。
P0 致命(必须改)
- driver.c:42 —
delay_ms(100)在中断服务程序(ISR)中被调用。
为什么是问题:阻塞式延迟在 ISR 中运行会锁死系统总线,导致看门狗超时复位或丢失关键传感器脉冲,这是高负载停转的直接诱因。
建议:移除 ISR 内的延迟,改用定时器中断或状态机轮询逻辑。
P1 重要(应该改)
- driver.c:12 —
PWM_Duty变量未加volatile修饰且无临界区保护。
为什么是问题:主循环修改占空比时若被中断打断,可能导致写入半字错误,造成占空比瞬间跳变至非法值。
建议:增加__disable_irq()保护或声明为原子操作。
P2 待验证(不确定但隐患较大,需你实测/查证确认)
- 硬件层 — 电机反向电动势(BEMF)可能超过了驱动芯片的耐压值。
需验证:请用示波器测量电机堵转/急停时的 Vout 引脚峰值,确认续流二极管选型是否满足功率要求。
P3 可选(建议放过)
- driver.c:5 — 宏定义
SPEED_MAX建议改为const uint16_t以增强类型安全。
建议:仅为风格优化,建议优先修复 P0/P1。
下一步
等你改代码 / 等你反驳 / 等你验收(说「pass」)
Connects securely to your tools. The creator never sees your data.
About this skill
Code reviews often fail because reviewers are too polite or miss deep architectural flaws. This skill adopts an adversarial stance to stress-test your code, documentation, or system designs. It assumes your work has defects until proven otherwise, hunting for P0 fatal errors and P1 critical bugs that others miss.
What it does
- Evidence-based auditing identifies specific flaws with exact
file:linereferences to prevent vague feedback. - Dimensional analysis evaluates hard errors, promise-fulfillment gaps, and real-world environmental risks.
- Severity grading prioritizes P0 (fatal) and P1 (important) issues while flagging P2 items for manual verification.
- Iterative feedback loop drives a "criticize-rework-recriticize" cycle until the work meets high-reliability standards.
- Baseline alignment forces a clear definition of intent versus reality to ensure the final product matches its claims.
How it works
- Set the Baseline: You provide the context of what the artifact is meant to achieve.
- Adversarial Review: The agent scans the artifact using specialized checklists and web-retrieved best practices.
- Structured Reporting: You receive a categorized list of P0 to P3 issues with clear evidence and advice.
- Iterative Refinement: You submit fixes or rebuttals; the agent validates the fix and scans for new regressions.
Frameworks & tools
Built for Embedded C (MSPM0, K230), PCB design, mathematical modeling (CUMCM/MathModel), and general technical documentation. It utilizes WebSearch to supplement static checklists with live industry standards.
Why this beats prompting it yourself
Standard prompts tend to be agreeable or generic. This skill is hardcoded to be stubborn and evidence-driven, refusing to "pass" work that contains P0 or P1 risks. It prevents over-engineering by explicitly rejecting unnecessary P3 changes once core reliability is achieved.
Use cases
- Auditing embedded firmware for race conditions, deadlocks, or resource leaks.
- Validating PCB layout and schematic design against manufacturing constraints.
- Reviewing technical proposals to ensure claims match the actual implementation.
- Stress-testing mathematical models for boundary condition failures.
Known limitations
Does not accept P0/P1 claims without specific code or document evidence. P2 items require manual user verification as they represent unverified high-risk hypotheses.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 17 days ago
- Free with an Agensi account
- Software
Git
Permissions
What's inside
Creator
aholic-liberation
thanks
Frequently Asked Questions
New in Testing & Debugging
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.