agentleFS
AboudjemAboudjem/solidity-style-guide/llms.txt

solidity-style-guide

llms.txt32 starsChanged 8 months agoMITView on GitHub

A practical Solidity style guide for writing consistent, safe, and gas-aware smart contracts. Targets Solidity 0.8.34 with coverage of ERC-7201 namespaced storage, transient storage, custom errors in require, named imports, NatSpec, and Foundry testing conventions. The canonical source is README.md. This file is a machine-friendly index for LLMs.

The file

We split this llms.txt into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the latest stable Solidity (0.8.34 at time of writing).

    line 27
  2. Very specific:

    Use named imports: import {X} from "./X.sol";.

    line 29
  3. Very specific:

    Use custom errors, including inside require(cond, CustomError()) (≥ 0.8.26).

    line 30
  4. Very specific:

    Always write explicit types: uint256, not uint.

    line 32

≈ “Common” is an estimate: at least 1 in 5 of the 1,484 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
llms.txt
# Solidity Style Guide

> A practical Solidity style guide for writing consistent, safe, and gas-aware smart contracts. Targets Solidity 0.8.34 with coverage of ERC-7201 namespaced storage, transient storage, custom errors in `require`, named imports, NatSpec, and Foundry testing conventions.

The canonical source is `README.md`. This file is a machine-friendly index for LLMs.

## Docs

- [README](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/README.md): full guide with ✅ / ❌ Solidity examples for every rule.
- [AGENTS.md](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/AGENTS.md): instructions for coding agents editing or applying the guide.
- [CLAUDE.md](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/CLAUDE.md): Claude Code–specific notes.
- [CONTRIBUTING](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/CONTRIBUTING.md): how to propose new rules.
- [SECURITY](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/SECURITY.md): disclosure policy.

## Tooling configs (copy-paste ready)

- [.solhint.json](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/.solhint.json): Solhint rules matching the guide.
- [.prettierrc](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/.prettierrc): prettier-plugin-solidity config (120 cols, 4 spaces, double quotes).
- [.editorconfig](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/.editorconfig): editor defaults.

## Skill package

- [skill/SKILL.md](https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/skill/SKILL.md): Claude Code skill for applying the guide on any Solidity repo.

## Core rules (one-liners)

- Use the latest stable Solidity (**0.8.34** at time of writing).
- Pin `pragma solidity 0.8.34;` in deployable contracts; use `^0.8.20` in libraries.
- Use **named imports**: `import {X} from "./X.sol";`.
- Use **custom errors**, including inside `require(cond, CustomError())` (≥ 0.8.26).
- **ERC-7201 namespaced storage** for upgradeable contracts.
- Always write explicit types: `uint256`, not `uint`.
- Internal / private identifiers start with `_`.
- Constants `SNAKE_UPPER_CASE`, private constants `_SNAKE_UPPER_CASE`.
- Max line length 120, 4-space indent, LF, UTF-8.
- One contract / interface / library per file, name matching filename.
- Foundry test naming: `test_Description`, `testFuzz_Description`, `test_RevertWhen_Description`, `invariant_Property`.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.