Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
wshobson avatar

Solidity Security

  • 12.9k installs
  • 38.3k repo stars
  • Updated July 22, 2026
  • wshobson/agents

Solidity Security is a skill that teaches smart contract security patterns and vulnerability prevention.

About

Solidity Security teaches smart contract security best practices and vulnerability prevention patterns. Developers use this skill when writing secure smart contracts, auditing existing contracts, or implementing DeFi protocols. The skill covers reentrancy, overflow, access control, and gas optimization while maintaining security.

  • Reentrancy attack prevention, integer overflow protection, and access control enforcement
  • Testing patterns for security vulnerabilities using Hardhat and ethers.js
  • Audit preparation with complete documentation and vulnerability identification

Solidity Security by the numbers

  • 12,883 all-time installs (skills.sh)
  • +188 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #1 of 483 Web3 & Blockchain skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/wshobson/agents --skill solidity-security

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs12.9k
repo stars38.3k
Security audit2 / 3 scanners passed
Last updatedJuly 22, 2026
Repositorywshobson/agents

How do you fix reentrancy vulnerabilities in Solidity?

Solidity Security teaches smart contract security best practices and vulnerability prevention patterns. Developers use this skill when writing secure smart contracts, auditing existing contracts, or

Who is it for?

Smart contract developers building production DeFi protocols and those preparing for professional audits

Skip if: Web2 backend development or non-blockchain applications

When should I use this skill?

A developer writes or reviews Solidity contracts with withdraw, transfer, or external call logic and needs vulnerability detection before deploy.

What you get

Remediated .sol contract code with checks-effects-interactions patterns replacing vulnerable external-call-before-state-update logic.

  • Secure contract patterns
  • Test suite for security
  • Audit-ready documentation

Files

SKILL.mdMarkdownGitHub ↗

Solidity Security

Master smart contract security best practices, vulnerability prevention, and secure Solidity development patterns.

When to Use This Skill

  • Writing secure smart contracts
  • Auditing existing contracts for vulnerabilities
  • Implementing secure DeFi protocols
  • Preventing reentrancy, overflow, and access control issues
  • Optimizing gas usage while maintaining security
  • Preparing contracts for professional audits
  • Understanding common attack vectors

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Testing for Security

// Hardhat test example
const { expect } = require("chai");
const { ethers } = require("hardhat");

describe("Security Tests", function () {
  it("Should prevent reentrancy attack", async function () {
    const [attacker] = await ethers.getSigners();

    const VictimBank = await ethers.getContractFactory("SecureBank");
    const bank = await VictimBank.deploy();

    const Attacker = await ethers.getContractFactory("ReentrancyAttacker");
    const attackerContract = await Attacker.deploy(bank.address);

    // Deposit funds
    await bank.deposit({ value: ethers.utils.parseEther("10") });

    // Attempt reentrancy attack
    await expect(
      attackerContract.attack({ value: ethers.utils.parseEther("1") }),
    ).to.be.revertedWith("ReentrancyGuard: reentrant call");
  });

  it("Should prevent integer overflow", async function () {
    const Token = await ethers.getContractFactory("SecureToken");
    const token = await Token.deploy();

    // Attempt overflow
    await expect(token.transfer(attacker.address, ethers.constants.MaxUint256))
      .to.be.reverted;
  });

  it("Should enforce access control", async function () {
    const [owner, attacker] = await ethers.getSigners();

    const Contract = await ethers.getContractFactory("SecureContract");
    const contract = await Contract.deploy();

    // Attempt unauthorized withdrawal
    await expect(contract.connect(attacker).withdraw(100)).to.be.revertedWith(
      "Ownable: caller is not the owner",
    );
  });
});

Audit Preparation

contract WellDocumentedContract {
    /**
     * @title Well Documented Contract
     * @dev Example of proper documentation for audits
     * @notice This contract handles user deposits and withdrawals
     */

    /// @notice Mapping of user balances
    mapping(address => uint256) public balances;

    /**
     * @dev Deposits ETH into the contract
     * @notice Anyone can deposit funds
     */
    function deposit() public payable {
        require(msg.value > 0, "Must send ETH");
        balances[msg.sender] += msg.value;
    }

    /**
     * @dev Withdraws user's balance
     * @notice Follows CEI pattern to prevent reentrancy
     * @param amount Amount to withdraw in wei
     */
    function withdraw(uint256 amount) public {
        // CHECKS
        require(amount <= balances[msg.sender], "Insufficient balance");

        // EFFECTS
        balances[msg.sender] -= amount;

        // INTERACTIONS
        (bool success, ) = msg.sender.call{value: amount}("");
        require(success, "Transfer failed");
    }
}

Related skills

How it compares

Pick solidity-security over general security skills when the codebase is Solidity smart contracts with reentrancy and external-call risk patterns.

FAQ

What vulnerabilities does solidity-security cover?

solidity-security covers critical Solidity vulnerabilities including reentrancy where external calls execute before state updates. The skill provides vulnerable code examples and secure checks-effects-interactions replacement patterns for fund-handling contracts.

When should developers use solidity-security?

Developers should use solidity-security during smart contract code review or pre-deploy hardening when contracts handle ETH transfers or external calls. The skill remediates .sol source patterns rather than managing deployment infrastructure.

Is Solidity Security safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.