Agent skill

function Object() { [native code] } Patterns

by ccashwell in ccashwell/evm-cortex

Constructor and initializer patterns for deploying Solidity contracts.

MITAuto-check passedBackend & APIs

Install function Object() { [native code] } Patterns

skills CLI
$ npx skills add ccashwell/evm-cortex --skill constructor-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ccashwell/evm-cortex constructor-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/constructor-patterns .claude/skills/constructor-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
constructor-patterns
GitHub stars
131
Token cost
~1.7k tokens
SKILL.md length
212 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Constructor and initializer patterns for deploying Solidity contracts.

  • Designing deployment flows
  • SKILL.md covers Constructor for…, Initializer for Upgradeable…, Immutables + Initializers and Factory Patterns, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Upgradeable proxies

What it does

function Object() { [native code] } Patterns is an agent skill from ccashwell/evm-cortex. Constructor and initializer patterns for deploying Solidity contracts. Use when designing deployment flows, upgradeable proxies, factory patterns, or CREATE2 deployments. Covers constructor validation, initializer safety, and factory patterns.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Deployment and Smart contracts. It works with Solidity. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Designing deployment flows
  • Upgradeable proxies
  • Factory patterns
  • CREATE2 deployments

Example prompts

  • “/constructor-patterns”

What it can do on your machine

Read from SKILL.md and the folder at commit f8f3301. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are solidity).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

function Object() { [native code] } Patterns loads about 1.7k tokens when it runs. Until then it costs about 66 tokens; SKILL.md has 212 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~66
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ccashwell/evm-cortex at commit f8f3301, republished under its MIT licence (© ccashwell). 212 words, ~1,730 tokens.

Download SKILL.mdSave it as .claude/skills/constructor-patterns/SKILL.md (or your agent's skills folder).
name
constructor-patterns
description
Constructor and initializer patterns for deploying Solidity contracts. Use when designing deployment flows, upgradeable proxies, factory patterns, or CREATE2 deployments. Covers constructor validation, initializer safety, and factory patterns.

Constructor & Initializer Patterns

Constructor for Non-Upgradeable Contracts

Constructors run once at deployment. Validate all parameters and set immutables.

solidity
contract Vault {
    error ZeroAddress();
    error InvalidFee(uint256 fee);

    address public immutable TOKEN;
    address public immutable ORACLE;
    uint256 public immutable FEE_BPS;
    uint256 public immutable DEPLOYMENT_BLOCK;

    constructor(address token, address oracle, uint256 feeBps) {
        if (token == address(0)) revert ZeroAddress();
        if (oracle == address(0)) revert ZeroAddress();
        if (feeBps > 10_000) revert InvalidFee(feeBps);

        TOKEN = token;
        ORACLE = oracle;
        FEE_BPS = feeBps;
        DEPLOYMENT_BLOCK = block.number;
    }
}

Initializer for Upgradeable Contracts

Proxies never call the implementation's constructor. Use initializer from OpenZeppelin.

solidity
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";

contract VaultV1 is Initializable, OwnableUpgradeable, PausableUpgradeable {
    uint256 public depositCap;
    address public feeRecipient;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize(
        address admin,
        address _feeRecipient,
        uint256 _depositCap
    ) external initializer {
        if (admin == address(0)) revert ZeroAddress();
        if (_feeRecipient == address(0)) revert ZeroAddress();

        __Ownable_init(admin);
        __Pausable_init();

        feeRecipient = _feeRecipient;
        depositCap = _depositCap;
    }
}
Critical: Disable Initializers in Implementation

Without _disableInitializers(), an attacker can call initialize() on the implementation contract directly and potentially selfdestruct it (pre-Dencun) or manipulate its state.

solidity
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
    _disableInitializers();
}
Reinitializer for Upgrades

When adding new state in V2, use reinitializer(2) instead of initializer.

solidity
contract VaultV2 is VaultV1 {
    uint256 public withdrawalDelay;

    function initializeV2(uint256 _withdrawalDelay) external reinitializer(2) {
        withdrawalDelay = _withdrawalDelay;
    }
}

Immutables + Initializers

Immutables can coexist with initializers. They're set in the implementation's constructor.

solidity
contract VaultImplementation is Initializable, OwnableUpgradeable {
    address public immutable WETH;
    address public immutable FACTORY;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address weth, address factory) {
        if (weth == address(0)) revert ZeroAddress();
        if (factory == address(0)) revert ZeroAddress();

        WETH = weth;
        FACTORY = factory;
        _disableInitializers();
    }

    function initialize(address admin) external initializer {
        __Ownable_init(admin);
    }
}

Factory Patterns

Minimal Clone Factory (EIP-1167)

Cheapest deployment for contracts with identical logic but different state.

solidity
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

contract VaultFactory {
    using Clones for address;

    address public immutable IMPLEMENTATION;

    event VaultCreated(address indexed vault, address indexed admin);

    constructor(address implementation) {
        IMPLEMENTATION = implementation;
    }

    function createVault(address admin, bytes32 salt) external returns (address vault) {
        vault = IMPLEMENTATION.cloneDeterministic(salt);
        IVault(vault).initialize(admin);
        emit VaultCreated(vault, admin);
    }

    function predictVaultAddress(bytes32 salt) external view returns (address) {
        return IMPLEMENTATION.predictDeterministicAddress(salt);
    }
}
CREATE2 Factory

Deterministic addresses — compute the address before deployment.

solidity
contract Create2Factory {
    event Deployed(address indexed addr, bytes32 indexed salt);

    function deploy(bytes memory bytecode, bytes32 salt) external returns (address addr) {
        assembly {
            addr := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
            if iszero(addr) { revert(0, 0) }
        }
        emit Deployed(addr, salt);
    }

    function computeAddress(bytes memory bytecode, bytes32 salt) external view returns (address) {
        return address(uint160(uint256(keccak256(abi.encodePacked(
            bytes1(0xff),
            address(this),
            salt,
            keccak256(bytecode)
        )))));
    }
}
CREATE2 + Constructor Args
solidity
function deployWithArgs(bytes32 salt, address token, uint256 fee)
    external
    returns (address vault)
{
    bytes memory bytecode = abi.encodePacked(
        type(Vault).creationCode,
        abi.encode(token, fee)
    );

    assembly {
        vault := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
        if iszero(vault) { revert(0, 0) }
    }
}

Constructor vs Initializer Decision Tree

Is the contract upgradeable?
├── No  → Use constructor + immutables
└── Yes → Use initializer + _disableInitializers()
          │
          Are there deploy-time constants (WETH, factory)?
          ├── Yes → Set as immutables in constructor
          └── No  → Everything in initializer

Anti-Patterns

  • Missing _disableInitializers() — allows initialization of implementation
  • Constructor logic in upgradeable contract — runs on implementation, not proxy
  • Initializer without reentrancy protection — OpenZeppelin's initializer handles this
  • Forgetting reinitializer(n) for V2+ upgrades — reusing initializer fails silently
  • Setting storage in constructor of upgradeable — sets implementation storage, not proxy

Checklist

  • Non-upgradeable: constructor sets immutables, validates all parameters
  • Upgradeable: _disableInitializers() in constructor
  • Upgradeable: initializer modifier on initialize()
  • Upgradeable V2+: reinitializer(n) for upgrade initialization
  • All address parameters checked against address(0)
  • Numeric parameters validated against bounds
  • Factory: deterministic deployment uses salt from meaningful context
  • CREATE2: address pre-computation tested before mainnet deployment

© ccashwell, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/constructor-patterns of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

function Object() { [native code] } Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

function Object() { [native code] } Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
function Object() { [native code] } Patterns this skillccashwell/evm-cortex131—~1.7kAutomated safety check: PassMIT
Foundry Deploy Fixturesaviggiano/security144—~634Automated safety check: PassMIT
New Configlidofinance/diffyscan142—~1kAutomated safety check: PassMIT
Validate Configlidofinance/diffyscan142—~1.1kAutomated safety check: PassMIT
Foundry Differential Testsaviggiano/security144—~613Automated safety check: PassMIT
Add Explorerlidofinance/diffyscan142—~1kAutomated safety check: PassMIT

Similar skills

  • Foundry Deploy Fixtures

    aviggiano/security

    Create or refactor Foundry deployment fixtures for Solidity tests.

    144 GitHub stars~634 tokensUpdated 22 days ago
    Backend & APIsAuto-check passed
  • New Config

    lidofinance/diffyscan

    Creates or extends a Diffyscan verification config for a deployed contract or deployment.

    142 GitHub stars~1k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Validate Config

    lidofinance/diffyscan

    Reviews an existing Diffyscan YAML or JSON config for load errors, runtime prerequisites, pinned sources, address mappings and broad exceptions.

    142 GitHub stars~1.1k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Foundry Differential Tests

    aviggiano/security

    Create Foundry differential tests comparing production Solidity contracts against an independent reference model.

    144 GitHub stars~613 tokensUpdated 22 days ago
    Backend & APIsAuto-check passed
  • Add Explorer

    lidofinance/diffyscan

    Adds or repairs Diffyscan explorer API routing and response adapters for a new host, chain or payload format.

    142 GitHub stars~1k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • PayRam Agent Onboarding

    PayRam/payram-mcp

    Installs and runs the PayRam crypto payment gateway from the command line for agents, CI pipelines and serverless setups, with no web dashboard.

    158 GitHub stars~3.6k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed

More from ccashwell/evm-cortex

All 89 skills in this repo
  • Xray Pre Audit

    ccashwell/evm-cortex

    A skill your agent uses when preparing for a security audit, performing reconnaissance on a new codebase, or creating a protocol overview.

    131 GitHub stars~25k tokensUpdated 7 days ago
    Auto-check passed
  • Aave Integration

    ccashwell/evm-cortex

    A skill your agent uses when integrating with Aave V3 for lending, borrowing, flash loans, or building on top of Aave markets.

    131 GitHub stars~1.3k tokensUpdated 7 days ago
    Auto-check passed
  • Access Control Patterns

    ccashwell/evm-cortex

    Access control design patterns for Solidity protocols. An agent skill from ccashwell/evm-cortex.

    131 GitHub stars~1.8k tokensUpdated 7 days ago
    Auto-check passed
  • Anvil Patterns

    ccashwell/evm-cortex

    A skill your agent uses when running a local Ethereum node with Anvil.

    131 GitHub stars~1.3k tokensUpdated 7 days ago
    Auto-check passed
  • Audit Breadth Scan

    ccashwell/evm-cortex

    A skill your agent uses when performing systematic breadth-first review of all contracts during a security audit.

    131 GitHub stars~1.4k tokensUpdated 7 days ago
    Auto-check passed
  • Audit Depth Analysis

    ccashwell/evm-cortex

    A skill your agent uses when performing deep analysis of specific findings or high-risk areas during a security audit.

    131 GitHub stars~1.6k tokensUpdated 7 days ago
    Auto-check passed

Works with

Questions about function Object() { [native code] } Patterns

What does function Object() { [native code] } Patterns do?

Constructor and initializer patterns for deploying Solidity contracts. function Object() { [native code] } Patterns is an agent skill from ccashwell/evm-cortex. Constructor and initializer patterns for deploying Solidity contracts.

When should I use function Object() { [native code] } Patterns?

function Object() { [native code] } Patterns fits situations like: designing deployment flows; upgradeable proxies; factory patterns; CREATE2 deployments.

How do I install function Object() { [native code] } Patterns in Claude Code?

Run `npx skills add ccashwell/evm-cortex --skill constructor-patterns -a claude-code`. Or copy the skill folder (skills/constructor-patterns in ccashwell/evm-cortex) into .claude/skills/constructor-patterns in your project. Claude Code loads it when a task matches its description.

How do I install function Object() { [native code] } Patterns in Codex?

Run `npx skills add ccashwell/evm-cortex --skill constructor-patterns -a codex`. Or copy the skill folder (skills/constructor-patterns in ccashwell/evm-cortex) into .agents/skills/constructor-patterns in your project. Codex loads it when a task matches its description.

Can I use function Object() { [native code] } Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ccashwell/evm-cortex --skill constructor-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/constructor-patterns, .gemini/skills/constructor-patterns, .github/skills/constructor-patterns and .opencode/skills/constructor-patterns in your project.

What does function Object() { [native code] } Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: function Object() { [native code] } Patterns is instructions for the agent only.

Does function Object() { [native code] } Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is function Object() { [native code] } Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does function Object() { [native code] } Patterns use?

function Object() { [native code] } Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does function Object() { [native code] } Patterns use?

About 1.7k tokens (SKILL.md is roughly 6.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to function Object() { [native code] } Patterns?

Skills that share tags, products or a category with function Object() { [native code] } Patterns: Foundry Deploy Fixtures (aviggiano/security, 144 stars), New Config (lidofinance/diffyscan, 142 stars), Validate Config (lidofinance/diffyscan, 142 stars) and Foundry Differential Tests (aviggiano/security, 144 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains function Object() { [native code] } Patterns?

ccashwell (a GitHub user) maintains it in ccashwell/evm-cortex, which has 131 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on September 30, 2026.

Source: ccashwell/evm-cortex on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.