cursorrules

A set of Cursor coding rules for building Arbitrum Stylus smart contracts in Rust, including required library versions, project settings, storage patterns, and public methods.

In plain words
What is it for?
Use it as a reference when creating Cargo projects, configuring Stylus contracts, defining on-chain storage, and writing their public functions.
Why use it?
It reduces mistakes caused by using incompatible Rust, SDK, or dependency versions when starting or maintaining these contracts.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/quantum3-labs/arbuilder/cursorrules
Clone the repo
git clone --depth 1 https://github.com/Quantum3-Labs/ARBuilder

Made for: Cursor.

Per session 896 This file is loaded in full into every session.
When invoked 896 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00896 $0.00896
Opus 5 $0.00448 $0.00448
Sonnet 5 $0.00179 $0.00179
Haiku 4.5 $0.00090 $0.00090

Measured 2d ago against content hash b3b500f205c9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursorrules 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 2d 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.

.cursorrules · 116 lines

How it starts

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

ARBuilder Development Rules for Cursor

Stylus SDK Version Information (CRITICAL - ALWAYS USE THESE)

Current stable versions (as of January 2025):

  • stylus-sdk: 0.9.2 (use this for new projects)
  • alloy-primitives: =0.8.20
  • alloy-sol-types: =0.8.20
  • Rust version: 1.81 (1.82+ may have compatibility issues)
  • cargo-stylus CLI: 0.5.x

Cargo.toml Template

[dependencies]
stylus-sdk = "0.9.2"
alloy-primitives = "=0.8.20"
alloy-sol-types = "=0.8.20"

[lib]
crate-type = ["cdylib"]

[profile.release]
codegen-units = 1
strip = true
lto = true
panic = "abort"
opt-level = "s"

Arbitrum SDK Version Information

  • @arbitrum/sdk: ^4.0.0
  • ethers: ^5.7.0 (NOT v6 - SDK requires ethers v5)

Stylus Contract Best Practices

Required Attributes

#![cfg_attr(not(any(feature = "export-abi", test)), no_std)]
#![cfg_attr(not(test), no_main)]
extern crate alloc;

Storage Pattern

use stylus_sdk::prelude::*;
use alloy_primitives::{U256, Address};

sol_storage! {
    #[entrypoint]
    pub struct MyContract {
        uint256 value;
        mapping(address => uint256) balances;
    }
}

Public Methods

#[public]
impl MyContract {
    pub fn get_value(&self) -> U256 {
        self.value.get()
    }

    pub fn set_value(&mut self, new_value: U256) {
        self.value.set(new_value);
    }
}

Key Constraints

  • 24KB size limit (Brotli-compressed WASM)
  • No floating point operations allowed
  • Yearly reactivation required for deployed contracts
  • Use alloc::vec::Vec instead of std::vec::Vec
  • Use alloc::string::String instead of std::string::String

Common Pitfalls to Avoid

  1. Using std library features (use alloc or core instead)
  2. Floating point math (use fixed-point or integer math)
  3. Forgetting #[entrypoint] attribute on main struct
  4. Not handling storage slots correctly in upgrades
  5. Using Rust 1.82+ (stick to 1.81)

Arbitrum Bridging Best Practices

Read the full file on GitHub · 116 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. 2d ago First seen · 116 lines · 896 tokens per session scan A b3b500f205c9

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository Quantum3-Labs/ARBuilder (24 stars, last pushed 3mo ago), licensed MIT. It adds 896 tokens to every session, about $0.0045 per session on Opus 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-08-30.