code-style

code-style is a cursor rule for Cursor from quinnjr/skia-rs. It costs 626 tokens per session, scanned A, original, Apache-2.0.

A set of coding rules for Rust projects that follow Skia, a 2D graphics library. It covers naming, supported Rust versions, public-item documentation, examples, and error handling.

In plain words
What is it for?
It helps write or review Rust code for naming, API documentation, examples, error types, and compatibility with Skia's C++ API.
Why use it?
Shared conventions make a codebase easier to read, review, and keep compatible with the library it follows. The rules also reduce inconsistent public APIs and missing documentation.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It helps write or review Rust code for naming, API documentation, examples, error types, and compatibility with Skia's C++ API.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/quinnjr/skia-rs/code-style
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/quinnjr/skia-rs

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-style

README.md
[![agentmods](https://agentmods.dev/badge/rules/quinnjr/skia-rs/code-style/github.svg)](https://agentmods.dev/rules/quinnjr/skia-rs/code-style)
Your own site
<a href="https://agentmods.dev/rules/quinnjr/skia-rs/code-style"><img src="https://agentmods.dev/badge/rules/quinnjr/skia-rs/code-style/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-style

Your own site · 80×15
<a href="https://agentmods.dev/rules/quinnjr/skia-rs/code-style"><img src="https://agentmods.dev/badge/rules/quinnjr/skia-rs/code-style.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 626 This file is loaded in full into every session.
When invoked 626 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00626 $0.00626
Opus 5.5 $0.00250 $0.00250
Sonnet 5.5 $0.00125 $0.00125
Haiku 4.5 $0.00063 $0.00063

Measured 1mo ago against content hash 48049c93b29a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-style scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/code-style.mdc · 99 lines

How it starts

The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Style & Conventions

Rust Edition & Version

  • Edition: 2024
  • MSRV: 1.85
  • All code must compile on stable Rust

Naming Conventions

  • Follow Skia's naming where possible for API compatibility
  • Use snake_case for functions and variables
  • Use PascalCase for types and traits
  • Prefix internal/private items with underscore only when necessary
  • Crate names: skia-rs-{module} (hyphenated)
  • Module imports: skia_rs_{module} (underscored)

Type Aliases

// Core type alias - matches Skia's SkScalar
pub type Scalar = f32;

Documentation

  • All public items MUST have doc comments
  • Use //! for module-level documentation
  • Include examples in doc comments for complex APIs
  • Reference corresponding Skia types/functions in docs
/// A 2D point with floating-point coordinates.
///
/// Corresponds to Skia's `SkPoint`.
///
/// # Examples
/// ```
/// use skia_rs_core::Point;
/// let p = Point::new(10.0, 20.0);
/// assert_eq!(p.length(), (500.0_f32).sqrt());
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Default)]
#[repr(C)]
pub struct Point {
    pub x: Scalar,
    pub y: Scalar,
}

Error Handling

  • Use thiserror for error types
  • Prefer Option<T> over Result<T, E> for simple failure cases (matching Skia patterns)
  • Never panic in library code except for invariant violations
  • Use debug_assert! for development-time checks

Memory & Performance

  • Use #[repr(C)] for FFI-compatible structs
  • Derive bytemuck::{Pod, Zeroable} for types that need zero-copy operations
  • Use SmallVec for small, stack-allocated collections
  • Prefer &self over &mut self where possible
  • Avoid allocations in hot paths
use bytemuck::{Pod, Zeroable};

#[derive(Debug, Clone, Copy, Pod, Zeroable)]
#[repr(C)]
pub struct Color(pub u32);

Inline Hints

  • Use #[inline] for small, frequently-called methods
  • Use #[inline(always)] sparingly, only for critical hot paths
  • Let the compiler decide for complex functions

Read the full file on GitHub · 99 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 99 lines · 626 tokens per session scan A 48049c93b29a

Subscribe to this mod's changes

code-style is a cursor rule published in the GitHub repository quinnjr/skia-rs (36 stars, last pushed 29d ago), licensed Apache-2.0. It adds 626 tokens to every session, about $0.0025 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.