plugins/compact-reviewer/skills/best-practices/SKILL.md
Use when reviewing Compact contracts for idiomatic patterns, learning recommended practices, or identifying common mistakes to avoid in Midnight smart contract development.
npx skillsauth add aaronbassett/midnight-knowledgebase compact-reviewer:best-practicesInstall 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.
Guidance on idiomatic Compact patterns and common mistakes to avoid.
This skill activates for queries about:
Trigger words: best practices, idiomatic, convention, pattern, recommended, should, ought
| Pattern | Good | Avoid |
|---------|------|-------|
| Authorization | require_owner() helper | Inline auth in every circuit |
| Constants | Named constants | Magic numbers |
| Error handling | Descriptive assertions | Silent failures |
| State access | Controlled via helpers | Direct ledger access everywhere |
| Naming | verb_noun for circuits | Cryptic abbreviations |
// ❌ Missing language pragma
// Should be at the top of every file
export circuit example(): [] { }
// ✅ With pragma
pragma language_version >= 0.18.0;
export circuit example(): [] { }
// ❌ Not using Counter for counts
ledger count: Cell<Uint<64>>;
export circuit increment(): [] {
count.write(count.read() + 1);
}
// ✅ Using Counter ADT
ledger count: Counter;
export circuit increment(): [] {
count.increment(1);
}
Check file structure:
Verify appropriate types:
Check against idioms:
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.