Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add tursodatabase/turso --skill code-quality -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/code-quality/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/code-quality/

From the same set10

The whole set →
storage-format tursodatabase A reference for the SQLite file format: header, pages, B-trees, cells, overflow, freelist, tied to Turso's storage code. Claude Code CX Codex Cursor +1 1,300installs testing tursodatabase Skill teaches you to write tests for SQL and Rust: choose between .sqltest, TCL and integration formats, run test suites with the right commands. Claude Code CX Codex Cursor +1 1,300installs async-io-model tursodatabase Teaches the agent Turso's cooperative async I/O patterns: explicit state machines, IOResult, and avoiding re-entrancy bugs. Claude Code CX Codex Cursor +1 1,300installs debugging tursodatabase A skill for tracking down tursodb bugs: compare bytecode against SQLite, turn on trace logs, run ThreadSanitizer, replay a seed and measure stack use. Claude Code CX Codex Cursor +1 1,300installs index-knowledge tursodatabase Skill automatically creates hierarchical AGENTS.md documentation for a codebase. Analyzes project structure, scores directory complexity, and generates files with instructions for AI agents. Claude Code CX Codex Cursor +1 1,300installs mvcc tursodatabase Architectural reference for experimental MVCC in Turso: row versioning, snapshot isolation, and known memory limits. Useful when working on database internals. Claude Code CX Codex Cursor +1 1,200installs differential-fuzzer tursodatabase This skill guides Turso differential fuzzer runs and investigates differences against SQLite. Use it when generated SQL may expose correctness bugs. Claude Code CX Codex Cursor +1 1,200installs transaction-correctness tursodatabase Explains how transactions work in Turso: WAL mechanics, checkpointing, crash recovery, and concurrency rules. Claude Code CX Codex Cursor +1 1,200installs

Similar

build-graph tirth8205 Builds or updates a repository knowledge graph for code review. Use it during first setup, after a branch switch, or following a large refactor. Claude Code CX Codex Cursor +1 1,300installs hyperplan code-yeongyu A team of five agents with opposing roles stress-tests a plan. Only what survives the crossfire makes it to the final scheme. Claude Code CX Codex Cursor +1 576installs swiftui-performance-audit official OpenAI Pinpoints SwiftUI runtime issues like frame drops, unresponsive taps, and excessive view body computations. Works code-first and guides Instruments profiling. CX Codex GP ChatGPT 109installs patch official anthropics Generates candidate diffs for verified security findings and writes inert patches for manual review. Claude Code CX Codex Cursor +1 1,100installs triage official anthropics This skill checks scanner findings, removes duplicates, and ranks vulnerabilities by derived exploitability. Use it for a file or directory of raw results. Claude Code CX Codex Cursor +1 1,100installs vuln-scan official anthropics Static vulnerability scanner for source code. Reads a directory, spawns parallel review subagents per focus area, and writes findings to JSON and markdown for triage. Claude Code CX Codex Cursor +1 1,100installs improve-codebase-architecture Matt Pocock This skill scans a codebase for architectural friction, then builds a visual HTML report with refactoring candidates. Use it before a deeper architecture review. Claude Code 1,163,035installs tdd Matt Pocock Guides the red-green TDD loop: ensures tests are written first, keep them at public interfaces, and avoid coupling to implementation details. Claude Code 1,141,062installs

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

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor