Agent skill
compact-reviewer:critical-issues
Use when reviewing Compact contracts for bugs, logic errors, assertion issues, type mismatches, dead code, unreachable paths, or control flow problems.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/critical-issues
SKILL.md
Critical Issues Skill
Detection of bugs, logic errors, and correctness issues in Compact smart contracts.
When to Use
This skill activates for queries about:
- Bug detection and logic errors
- Assertion problems
- Type mismatches
- Dead code and unreachable paths
- Control flow issues
- State management bugs
Trigger words: bug, logic error, assertion, unreachable, dead code, type mismatch, correctness
Quick Reference
Common Bug Categories
| Category | Severity | Example |
|---|---|---|
| Assertion always fails | 🔴 Critical | assert x < y where x ≥ y always |
| Assertion always passes | 🟠 High | Redundant check that's always true |
| Unreachable code | 🟡 Medium | Code after unconditional return |
| Type mismatch | 🔴 Critical | Wrong type in comparison |
| Integer overflow | 🟠 High | Unbounded arithmetic |
| Off-by-one | 🟠 High | Loop bounds errors |
Bug Detection Patterns
// ❌ Assertion that always fails
export circuit verify(x: Uint<64>, y: Uint<64>): [] {
assert x > y; // Called with x = 0
assert x <= y; // Contradictory assertions
}
// ❌ Dead code after return
export circuit process(): Uint<64> {
return 42;
const x = 1; // Never executes
}
// ❌ Off-by-one error
export circuit fill_array(): [] {
for i in 0..100 {
items[i + 1].write(0); // Skips index 0, overflows at 100
}
}
Review Process
1. Assertion Analysis
For each assertion:
- Determine if condition can ever be true/false
- Check for contradictory assertions
- Verify assertion is meaningful
Patterns to flag:
assert true- Uselessassert false- Circuit always failsassert x && !x- Contradiction- Assertion after assignment that makes it always pass
2. Control Flow Analysis
Trace all execution paths:
- Identify unreachable code
- Check all branches return appropriate values
- Verify loop bounds
Patterns to flag:
- Code after
return ifwith identical branches- Loops that never execute (
for i in 0..0) - Infinite loops (if possible)
3. Type Correctness
Verify type usage:
- Comparisons between compatible types
- Arithmetic within bounds
- Array/map access with correct index types
4. State Consistency
Check ledger operations:
- Read-before-write patterns
- Inconsistent state updates
- Missing initialization
References
- Common Bugs - Catalog of Compact-specific bugs
- Logic Error Patterns - Detection patterns
Related Skills
- security-review - Security vulnerabilities
- compact-core/language-reference - Type system
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?