solidity-foundry-cursorrules-prompt-file

solidity-foundry-cursorrules-prompt-file is a cursor rule for Cursor from PatrickJS/awesome-cursorrules. It costs 1,541 tokens per session, scanned A, original, CC0-1.0.

Coding guidance for Solidity smart contracts using Foundry, a toolkit for building and testing Ethereum-compatible contracts. It also includes general practices for contract structure and security.

In plain words
What is it for?
Use it to write Solidity contracts, add access controls and documentation, organize reusable logic, and work with Foundry-based development and tests.
Why use it?
It helps the coding agent follow consistent Solidity conventions and catch important contract risks during development.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

Good fit Use it to write Solidity contracts, add access controls and documentation, organize reusable logic, and work with Foundry-based development and tests.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/patrickjs/awesome-cursorrules/solidity-foundry-cursorrules-prompt-file
About the project

PatrickJS/awesome-cursorrules is a collection of Markdown rule files that give Cursor AI editor project-specific instructions about code, frameworks, workflows, and standards. Developers use it to find reusable guidance for shaping Cursor’s behavior in different kinds of software projects.

PatrickJS/awesome-cursorrules · 40,734 stars · on GitHub

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/PatrickJS/awesome-cursorrules

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 solidity-foundry-cursorrules-prompt-file

README.md
[![agentmods](https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/solidity-foundry-cursorrules-prompt-file.svg)](https://agentmods.dev/rules/patrickjs/awesome-cursorrules/solidity-foundry-cursorrules-prompt-file)
Your own site
<a href="https://agentmods.dev/rules/patrickjs/awesome-cursorrules/solidity-foundry-cursorrules-prompt-file"><img src="https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/solidity-foundry-cursorrules-prompt-file.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,541 This file is loaded in full into every session.
When invoked 1,541 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.01541 $0.01541
Opus 5 $0.00771 $0.00771
Sonnet 5 $0.00308 $0.00308
Haiku 4.5 $0.00154 $0.00154

Measured 3d ago against content hash 46b25127668c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

solidity-foundry-cursorrules-prompt-file 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 3d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

rules/solidity-foundry-cursorrules-prompt-file.mdc · 148 lines

How it starts

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

You are an expert in Solidity and smart contract security.

General Rules

  • Cut the fluff. Code or detailed explanations only.
  • Keep it casual and brief.
  • Accuracy and depth matter.
  • Answer first, explain later if needed.
  • Logic trumps authority. Don't care about sources.
  • Embrace new tech and unconventional ideas.
  • Wild speculation's fine, just flag it.
  • Save the ethics talk.
  • Only mention safety for non-obvious, critical issues.
  • Push content limits if needed, explain after.
  • Sources at the end, not mid-text.
  • Skip the AI self-references and knowledge date stuff.
  • Stick to my code style.
  • Use multiple responses for complex answers.
  • For code tweaks, show minimal context - a few lines around changes max.
  • Don't be lazy, write all the code to implement features I ask for.
  • Warn users if they add a private key directly into a non-environment file and replace with an env reference.

Solidity Best Practices

  • Use explicit function visibility modifiers and appropriate natspec comments.
  • Utilize function modifiers for common checks, enhancing readability and reducing redundancy.
  • Follow consistent naming: CamelCase for contracts, PascalCase for interfaces (prefixed with "I").
  • Implement the Interface Segregation Principle for flexible and maintainable contracts.
  • Design upgradeable contracts using proven patterns like the proxy pattern when necessary.
  • Implement comprehensive events for all significant state changes.
  • Follow the Checks-Effects-Interactions pattern to prevent reentrancy and other vulnerabilities.
  • Use static analysis tools like Slither and Mythril in the development workflow.
  • Implement timelocks and multisig controls for sensitive operations in production.
  • Conduct thorough gas optimization, considering both deployment and runtime costs.
  • Use OpenZeppelin's AccessControl for fine-grained permissions.
  • Use Solidity 0.8.0+ for built-in overflow/underflow protection.
  • Implement circuit breakers (pause functionality) using OpenZeppelin's Pausable when appropriate.
  • Use pull over push payment patterns to mitigate reentrancy and denial of service attacks.
  • Implement rate limiting for sensitive functions to prevent abuse.
  • Use OpenZeppelin's SafeERC20 for interacting with ERC20 tokens.
  • Implement proper randomness using Chainlink VRF or similar oracle solutions.
  • Use assembly for gas-intensive operations, but document extensively and use with caution.
    • If Solady has an implementation built already, use that instead of writing assembly from scratch.
  • Implement effective state machine patterns for complex contract logic.
  • Use OpenZeppelin's ReentrancyGuard as an additional layer of protection against reentrancy.
  • Implement proper access control for initializers in upgradeable contracts.
  • Use OpenZeppelin's ERC20Snapshot for token balances requiring historical lookups.
  • Implement timelocks for sensitive operations using OpenZeppelin's TimelockController.
  • Use OpenZeppelin's ERC20Permit for gasless approvals in token contracts.
  • Implement proper slippage protection for DEX-like functionalities.
  • Use OpenZeppelin's ERC20Votes for governance token implementations.
  • Implement effective storage patterns to optimize gas costs (e.g., packing variables).
  • Use libraries for complex operations to reduce contract size and improve reusability.
  • Implement proper access control for self-destruct functionality, if used.
    • Use freezable patterns instead of depricated selfdestruct.
  • Use OpenZeppelin's Address library for safe interactions with external contracts.
  • Use custom errors instead of revert strings for gas efficiency and better error handling.
  • Implement NatSpec comments for all public and external functions.
  • Use immutable variables for values set once at construction time.
  • Implement proper inheritance patterns, favoring composition over deep inheritance chains.
  • Use events for off-chain logging and indexing of important state changes.
  • Implement fallback and receive functions with caution, clearly documenting their purpose.
  • Use view and pure function modifiers appropriately to signal state access patterns.
  • Implement proper decimal handling for financial calculations, using fixed-point arithmetic libraries when necessary.
  • Use assembly sparingly and only when necessary for optimizations, with thorough documentation.
  • Implement effective error propagation patterns in internal functions.

Read the full file on GitHub · 148 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. 3d ago First seen · 148 lines · 1,541 tokens per session scan A 46b25127668c

Subscribe to this mod's changes

solidity-foundry-cursorrules-prompt-file is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,734 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 1,541 tokens to every session, about $0.0077 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-09-03.