plugins/compact-reviewer/skills/critical-issues/SKILL.md
Use when reviewing Compact contracts for bugs, logic errors, assertion issues, type mismatches, dead code, unreachable paths, or control flow problems.
npx skillsauth add aaronbassett/midnight-knowledgebase compact-reviewer:critical-issuesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Detection of bugs, logic errors, and correctness issues in Compact smart contracts.
This skill activates for queries about:
Trigger words: bug, logic error, assertion, unreachable, dead code, type mismatch, correctness
| 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 |
// ❌ 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
}
}
For each assertion:
Patterns to flag:
assert true - Uselessassert false - Circuit always failsassert x && !x - ContradictionTrace all execution paths:
Patterns to flag:
returnif with identical branchesfor i in 0..0)Verify type usage:
Check ledger operations:
tools
Use when setting up Midnight development environment, installing Compact compiler and developer tools, configuring proof server, verifying prerequisites, or getting started with Midnight development.
tools
--- name: midnight-tooling:midnight-debugging description: Use when encountering Midnight errors like "compact: command not found", "ERR_UNSUPPORTED_DIR_IMPORT", version mismatches, proof server failures, "@midnight-ntwrk" package errors, or compilation failures. --- # Midnight Environment Debugging Expert knowledge for identifying and resolving common Midnight development toolchain issues. ## Diagnostic Approach When encountering Midnight-related errors, follow this systematic approach: 1.
tools
Use when checking Midnight version compatibility, understanding pragma language_version, verifying compiler and runtime version relationships, or troubleshooting version mismatch errors between Midnight components.
tools
Use when setting up CI/CD for Midnight projects, configuring GitHub Actions for Compact contract compilation, running TypeScript tests in CI, validating version consistency, or automating contract builds.