SKIP TO CONTENT

Standards code

Solidity style guide: Solidity rules that people and coding agents can follow

Your Solidity code has no shared rules, so each review argues about naming and layout again. This guide gives one set of rules with examples, and the configs that apply them for people and for coding agents.

Install

Get the code

curl -O https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/.solhint.json
curl -O https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/.prettierrc
curl -O https://raw.githubusercontent.com/Aboudjem/solidity-style-guide/main/.editorconfig

Other ways to install

Install the linters

npm i -D solhint prettier prettier-plugin-solidity

Lint and format

npx solhint 'src/**/*.sol'
npx prettier --write 'src/**/*.sol'

Claude Code skill, from a clone

git clone https://github.com/Aboudjem/solidity-style-guide
mkdir -p .claude/skills && cp -r skill .claude/skills/solidity-style-guide

What it does

  • Gives every rule one Yes example and one No example.
  • Covers naming, layout, formatting, code comments, tests with Foundry, gas and security.
  • Ships a Solhint config, a Prettier config, an EditorConfig file and a GitHub Actions workflow.
  • Ships context files for coding agents: AGENTS.md, CLAUDE.md, llms.txt and .cursorrules.
  • Bundles a Claude Code skill that reviews a repository against the guide.

How it works

  1. 1. Pull the three config files into your project.
  2. 2. Install Solhint, Prettier and the Solidity plugin for Prettier as dev dependencies.
  3. 3. Lint and format your contracts.
  4. 4. Optional: copy the skill into .claude/skills/, then call it by name in Claude Code.

Example

The three commands of the skill inside Claude Code, as the README lists them.

/solidity-style-guide:review           # audit without editing
/solidity-style-guide:review --fix     # apply minimal formatting / naming diffs
/solidity-style-guide:apply-config     # copy solhint/prettier/editorconfig

Limits

  • It is a guide and a set of configs. It is not a security audit, and the guide itself recommends external audits.
  • You copy the skill by hand from a clone. The README gives no one-line installer for it.
  • The guide is pinned to one Solidity version. Check that it matches your compiler.
Good for
A Solidity team, or a coding agent, that needs one written set of rules.
Not for
Finding the security bugs of a contract: use an audit for that.

Questions

What is the Solidity style guide?

It is a practical style guide for Solidity smart contracts. Every rule has a Yes example and a No example, and the configs apply the rules.

How do I use the style guide in Claude Code?

Copy the skill folder of the repository into .claude/skills/solidity-style-guide. Then run /solidity-style-guide:review in Claude Code.

Does the style guide work with Cursor or Codex?

Yes. The README says Cursor, Codex and Aider pick up AGENTS.md and .cursorrules once the files sit at the root of the repository.

Is the Solidity style guide free?

Yes, it is open source under the MIT license.