agentleFS
OpenZeppelinOpenZeppelin/openzeppelin-contracts-upgradeable/CLAUDE.md

openzeppelin-contracts-upgradeable

CLAUDE.md1.2k starsChanged 24 days agoMITView on GitHub

This repository is a Solidity smart contract library: reusable abstract contract and library implementations meant to be inherited and extended by downstream projects. It is not a deployed product. Most conventions exist because code here is a base for others: functions must be overridable, argument types must not constrain inheritors, and the public API must not force a particular call context on child contracts. Read GUIDELINES.md first — it is the human contributor spec and authoritative. This file is for…

1 other project uses a version of this.

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 2 mentionsMay 2026: 0 mentionsJun 2026: 3 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 2 mentionsOct 2026: 4 mentionsNov 2026: 6 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the OpenZeppelin/openzeppelin-contracts-upgradeable repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about OpenZeppelin/openzeppelin-contracts-upgradeable

The biggest 5 of 51 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 51

Talked about on GitHub and Stack Overflow (51 times).

On GitHub · 50

45 more on GitHub
  • Other versions1 project uses a version of this.

    Word for word · 1

    1. OpenZeppelin/openzeppelin-contracts★ 27k100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this CLAUDE.md into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Read GUIDELINES.md first — it is the human contributor spec and authoritative.

    line 5
  2. Very specific:

    Before preparing a contribution, also read CONTRIBUTING.md thoroughly.

    line 7
  3. Distinctive:

    If a lint rule already catches it, don't waste tokens explaining it — fix and move on.

    line 53
  4. Very specific:

    File header version line: don't add or edit the // OpenZeppelin Contracts (last updated vX.Y.Z) (path) line — release tooling …

    line 59
  5. Very specific:

    Inheritance order is globally consistent: if you change an is A, B, C list, run npm run compile && npm run test:inheritance before pushing.

    line 62
  6. Distinctive:

    Changesets: every PR that changes contract behavior needs one.

    line 63
  7. Very specific:

    Procedurally generated files: never hand-edit a file whose header says "procedurally generated from <template>".

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md 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
CLAUDE.md

openzeppelin-contracts — Claude project guide

This repository is a Solidity smart contract library: reusable abstract contract and library implementations meant to be inherited and extended by downstream projects. It is not a deployed product. Most conventions exist because code here is a base for others: functions must be overridable, argument types must not constrain inheritors, and the public API must not force a particular call context on child contracts.

Read GUIDELINES.md first — it is the human contributor spec and authoritative. This file is for what is specific to Claude-assisted work, plus the conventions not fully documented elsewhere.

Before preparing a contribution, also read CONTRIBUTING.md thoroughly. Non-trivial changes must be discussed in an issue before a PR is opened.

Repo map

PathPurpose
contracts/Library source. Subdirectory layout (token/ERC20/, access/, utils/, …) mirrors the public API.
contracts/mocks/Mocks used by tests. Mirrors contracts/. Manual mocks only — see the testing skill.
contracts/interfaces/ERC interfaces in their pristine spec form.
test/Hardhat + Chai tests (.test.js), shared behaviors (.behavior.js), and Foundry tests (.t.sol).
contracts-exposed/Auto-generated $ContractName wrappers from hardhat-exposed. Gitignored. Do not edit.
fv/Certora specs (fv/specs/*.{conf,spec}), harnesses, and make-applied patches.
scripts/generate/Procedurally generated .sol files (Arrays variants, Checkpoints, EnumerableSet, …). Source of truth is the template, not the generated file.
scripts/checks/CI checks: inheritance-ordering.js, pragma-validity.js, generation diff, storage layout.
docs/AsciiDoc sources used by the OZ documentation site. Per-module README.adoc files in contracts/**/ are also rendered.
.changeset/Per-PR changelog entries consumed by the release workflow.
audits/Historical third-party audit reports, one per release. Reference only.
.claude/skills/Skills specific to working in this repository, loaded by AI assistants per task. See CONTRIBUTING.md.

Commands

TaskCommand
Compilenpm run compile
Tests (JS + Solidity)npm test
Foundry tests only (forge defaults)forge test -vvv
Halmos symbolic testshalmos --match-test '^symbolic|^testSymbolic' -vv
Lint (JS + Sol)npm run lint / npm run lint:fix
Coveragenpm run coverage
Inheritance order checknpm run test:inheritance
Pragma validity checknpm run test:pragma
Generated-file freshness checknpm run test:generation
Regenerate procedural contractsnpm run generate
Add a changelog entrynpx changeset add
Run a single Certora specnode fv/run.js <SpecName> (apply harnesses first: make -C fv apply)

What linting via solhint already enforces (don't re-state in code review)

solhint-plugin-openzeppelin + scripts/solhint-custom/index.js enforce, on contracts/**/*.sol (mocks and tests are exempt):

  • State variables are private (constant/immutable are the only exceptions).
  • Underscore prefix matches visibility: private/internal state vars and functions get _; public/external do not. Library internal functions do NOT get _.
  • No external virtual (except fallback). The public default makes this redundant; flagged by no-external-virtual.
  • Libraries expose only internal/private.
  • Interfaces start with I, contracts use CapWords, events use CapWords, modifiers/params mixedCase.

If a lint rule already catches it, don't waste tokens explaining it — fix and move on.

Always-on conventions

These apply to every change and are not lint-enforced:

  • File header version line: don't add or edit the // OpenZeppelin Contracts (last updated vX.Y.Z) (path) line — release tooling (scripts/release/update-comment.js) maintains it automatically based on git diff between the previous tag and HEAD. The SPDX line is your only responsibility.
  • Pragma: don't pick the floor by hand. Run npm run pragma and let scripts/minimize-pragma.js walk the dependency graph, compile against every candidate solc, and write back the lowest version that works for each file (>= prefix for interfaces, ^ for implementations and libraries). Bumping the floor casually can introduce opcodes (mcopy in 0.8.24, etc.) not supported on all target chains — the script's output is the safe answer.
  • Imports: 100% named, curly-brace, relative paths within contracts/. No wildcards.
  • Inheritance order is globally consistent: if you change an is A, B, C list, run npm run compile && npm run test:inheritance before pushing.
  • Changesets: every PR that changes contract behavior needs one. Skip for NatSpec-only, internal refactors with no user-visible effect, or pure repo plumbing.
  • Procedurally generated files: never hand-edit a file whose header says "procedurally generated from <template>". Edit the template under scripts/generate/templates/ and run npm run generate. CI runs test:generation to enforce.
  • Backward compatibility: released contracts are inherited downstream and transpiled into the -upgradeable package. Don't change existing public/external signatures, event or error shapes, or the storage layout of existing contracts. Changes are additive; deprecate rather than delete. Breaking changes are a maintainer decision tied to a major release.
  • Dependencies: this library has no third-party dependencies that translate to the user, and nothing that could change behavior out from under it. Don't add an npm or Solidity dependency or a new external import without maintainer sign-off; reuse existing contracts/utils/ helpers first. Code that needs third-party dependencies belongs in openzeppelin-community-contracts, not here.

When to load which skill

Claude Code surfaces these from .claude/skills/ based on the task. You can also reference them directly:

  • library-api-design — when adding or modifying any contract in contracts/ (visibility, virtual, memory vs calldata, _update pattern, internal/external split, no-ops over reverts, hooks).
  • solidity-style — when writing or editing Solidity (errors, events, NatSpec, ERC-7201, assembly, unchecked, casting, immutables).
  • testing — when writing tests or mocks (hardhat-exposed $ wrappers, when manual mocks are warranted, .behavior.js reuse, multi-target test loops, Foundry fuzz, Halmos symbolic, Certora).
  • add-changeset — at PR close, or when the user asks for one.

Things to always verify manually

AI suggestions in these areas are often plausible-but-wrong. Read the surrounding code before accepting:

  • Cryptography — anything in contracts/utils/cryptography/, hashing, ECDSA, EIP-712 domains, BLS, signatures.
  • ERC-7201 slot derivations — recompute with SlotDerivation.erc7201Slot() and compare to the constant. The formula in the inline comment is mandatory.
  • Storage layout for transpiler-processed contracts — adding/removing/reordering fields breaks proxied deployments. CI runs storage-layout diff but read it.
  • delegatecall, inline assembly, memory safety — verify the memory-safe annotation is honest and stack/scratch usage is bounded.
  • unchecked invariants — re-derive the overflow-impossible claim for every code path. The inline comment is the contract.
  • _authorizeUpgrade access control — the base is empty by design; every override must restrict.
  • _disableInitializers() in implementation constructors for UUPS/Transparent proxy targets.
  • Pragma bumps — check that any new opcode the compiler will emit is supported on all target chains.

Out of scope for AI

  • Adding/renaming public API or deciding whether a feature belongs in the library — open an issue first.
  • Security assessments or audit opinions.
  • New ERC interfaces or standards without explicit direction.
  • Restructuring tests without a corresponding contract change.
  • Fabricated bug bounties and security rewards. Never claim or imply a reward, amount, or eligibility. The only existing program is Immunefi (See SECURITY.md).

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.