code-quality — Claude Code skill: correctness rules and Rust patterns
Correctness rules, Rust patterns, and anti-over-engineering guidance for coding agents working in your repo.
npx skills add tursodatabase/turso --skill code-quality -a claude-codeWhat code-quality does
The code-quality skill from tursodatabase gives agents a set of rules to apply when writing code. The core principle is blunt: crash beats corrupt, especially for a production database.
It bans workarounds and quick hacks. Agents must handle all errors, assert invariants, and crash on invalid state instead of continuing undefined. For Rust it pushes exhaustive pattern matching, enums over sentinel strings, and fewer heap allocations.
There is a specific rule for index mutations: double-check ordering against SQLite, because wrong ordering causes index inconsistencies that slip through easily. The skill also demands deleting unused code completely and avoiding premature abstraction.
What it helps with
- make the agent handle every error instead of swallowing edge cases
- add asserts on invariants where code silently fails today
- remove if-else branches where one path should never happen
- cut over-engineering: needless abstractions, docstrings on unchanged code
- check index mutation ordering against SQLite
Example prompts for the agent
- Review this diff against the code-quality skill
- Write the conflict resolution path using code-quality rules
- Check this Rust code for invariant violations per code-quality
How to install code-quality
1Skills CLI (Vercel)
npx skills add tursodatabase/turso --skill code-quality -a claude-code2Manually: put the files in place
~/.claude/skills/code-quality/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/code-quality/
1Skills CLI (Vercel)
npx skills add tursodatabase/turso --skill code-quality -a codex2Manually: put the files in place
.agents/skills/code-quality/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add tursodatabase/turso --skill code-quality -a cursor2Manually: put the files in place
.cursor/skills/code-quality/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install tursodatabase/turso code-quality2Manually: put the files in place
.github/skills/code-quality/SKILL.md1Skills CLI (Vercel)
npx skills add tursodatabase/turso --skill code-quality -a gemini-cli2Platform CLI
gemini skills install https://github.com/tursodatabase/turso --path .claude/skills/code-qualityManually: put the files in place
.devin/skills/code-quality/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add tursodatabase/turso --skill code-quality -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set10
The whole set →Similar
Questions about code-quality
How do I install code-quality in Claude Code?
Run npx skills add tursodatabase/turso --skill code-quality -a claude-code. The skill lands at ~/.claude/skills/code-quality/SKILL.md.
What does code-quality do?
It sets correctness rules for the agent: handle all errors, assert invariants, crash on invalid state. It also adds Rust patterns and pushes back on over-engineering.
Which languages does this skill cover?
The patterns are written for Rust. The correctness and anti-over-engineering rules apply to any language.
Source text
SKILL.md · MIT
---
name: code-quality
description: General Correctness rules, Rust patterns, comments, avoiding over-engineering. When writing code always take these into account
---
# Code Quality Guide
## Core Principle
Production database. Correctness paramount. Crash > corrupt.
## Correctness Rules
1. **No workarounds or quick hacks.** Handle all errors, check invariants
2. **Assert often.** Never silently fail or swallow edge cases
3. **Crash on invalid state** if it risks data integrity. Don't continue in undefined state
4. **Consider edge cases.** On long enough timeline, all possible bugs will happen
## Rust Patterns
- Make illegal states unrepresentable
- Exhaustive pattern matching
- Prefer enums over strings/sentinels
- Minimize heap allocations
- Write CPU-friendly code (microsecond = long time)
## If-Statements
Wrong:
```rust
if condition {
// happy path
} else {
// "shouldn't happen" - silently ignored
}
```
Right:
```rust
// If only one branch should ever be hit:
assert!(condition, "invariant violated: ...");
// OR
return Err(LimboError::InternalError("unexpected state".into()));
// OR
unreachable!("impossible state: ...");
```
Use if-statements only when both branches are expected paths.
## Comments
- Don't add code comments, except for rust `SAFETY` comments.
## Avoid Over-Engineering
- Only changes directly requested or clearly necessary
- Don't add features beyond what's asked
- Don't add docstrings/comments to unchanged code
- Don't add error handling for impossible scenarios
- Don't create abstractions for one-time operations
- Three similar lines > premature abstraction
## Index Mutations
When code involves index inserts, deletes, or conflict resolution, double-check the ordering against SQLite. Wrong ordering causes index inconsistencies. and easy to miss.
## Ensure understanding of IO model
- [Async IO model](../async-io-model/SKILL.md)
## Cleanup
- Delete unused code completely
- No backwards-compat hacks (renamed `_vars`, re-exports, `// removed` comments)
## Single-use helpers
If a helper function has no meaning outside of a single use case, move it inside the function that uses it:
```rust
fn do_something() {
something_specific();
fn something_specific() {
}
}
```
© tursodatabase · MIT · tursodatabase/turso