jpskill.com
🛠️ 開発・MCP コミュニティ

solidity

Ethereum上で動作するスマートコントラクトをSolidityで記述し、ERC-20トークンやNFTコントラクトの作成、DeFiプロトコルの開発など、ブロックチェーン関連の様々な要求に応じたプログラムを構築するSkill。

📜 元の英語説明(参考)

Write smart contracts with Solidity for Ethereum. Use when a user asks to create a smart contract, build an ERC-20 token, deploy to Ethereum, write NFT contracts, or develop DeFi protocols.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Ethereum上で動作するスマートコントラクトをSolidityで記述し、ERC-20トークンやNFTコントラクトの作成、DeFiプロトコルの開発など、ブロックチェーン関連の様々な要求に応じたプログラムを構築するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o solidity.zip https://jpskill.com/download/15399.zip && unzip -o solidity.zip && rm solidity.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15399.zip -OutFile "$d\solidity.zip"; Expand-Archive "$d\solidity.zip" -DestinationPath $d -Force; ri "$d\solidity.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して solidity.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → solidity フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Solidity

概要

Solidity は、Ethereum スマートコントラクトのための主要な言語です。Ethereum およびすべての EVM 互換チェーン上で実行される EVM バイトコードにコンパイルされます。このスキルでは、コントラクトの構造、一般的なパターン (ERC-20, ERC-721)、セキュリティ、および Hardhat/Foundry を使用したデプロイについて説明します。

手順

ステップ 1: 基本的なコントラクト

// contracts/SimpleStorage.sol — 基本的なスマートコントラクト
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract SimpleStorage {
    uint256 private value;
    address public owner;

    event ValueChanged(uint256 newValue, address changedBy);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    constructor(uint256 initialValue) {
        owner = msg.sender;
        value = initialValue;
    }

    function setValue(uint256 newValue) external onlyOwner {
        value = newValue;
        emit ValueChanged(newValue, msg.sender);
    }

    function getValue() external view returns (uint256) {
        return value;
    }
}

ステップ 2: ERC-20 トークン

// contracts/MyToken.sol — 標準的な ERC-20 トークン
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MyToken is ERC20, Ownable {
    constructor() ERC20("My Token", "MTK") Ownable(msg.sender) {
        _mint(msg.sender, 1_000_000 * 10 ** decimals());    // 1M tokens
    }

    function mint(address to, uint256 amount) external onlyOwner {
        _mint(to, amount);
    }
}

ステップ 3: Hardhat でデプロイ

npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
npx hardhat init
// scripts/deploy.ts — コントラクトのデプロイ
import { ethers } from 'hardhat'

async function main() {
  const Token = await ethers.getContractFactory('MyToken')
  const token = await Token.deploy()
  await token.waitForDeployment()
  console.log('Token deployed to:', await token.getAddress())
}
main()
npx hardhat compile
npx hardhat test
npx hardhat run scripts/deploy.ts --network sepolia

ステップ 4: Foundry (代替)

forge init my-project
forge build
forge test
forge script script/Deploy.s.sol --rpc-url sepolia --broadcast

ガイドライン

  • 常に標準規格 (ERC-20, ERC-721) には OpenZeppelin コントラクトを使用してください。実戦でテストされ、監査されています。
  • 一般的な脆弱性: 再入可能性、整数オーバーフロー (0.8 以降で修正済み)、フロントランニング、アクセス制御。
  • 徹底的にテストしてください。デプロイされたコントラクトは不変です。テストには Hardhat または Foundry を使用してください。
  • Foundry はコンパイル/テストが高速です (Rust ベース)。Hardhat はより大きなプラグインのエコシステムを持っています。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Solidity

Overview

Solidity is the primary language for Ethereum smart contracts. It compiles to EVM bytecode that runs on Ethereum and all EVM-compatible chains. This skill covers contract structure, common patterns (ERC-20, ERC-721), security, and deployment with Hardhat/Foundry.

Instructions

Step 1: Basic Contract

// contracts/SimpleStorage.sol — Basic smart contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract SimpleStorage {
    uint256 private value;
    address public owner;

    event ValueChanged(uint256 newValue, address changedBy);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    constructor(uint256 initialValue) {
        owner = msg.sender;
        value = initialValue;
    }

    function setValue(uint256 newValue) external onlyOwner {
        value = newValue;
        emit ValueChanged(newValue, msg.sender);
    }

    function getValue() external view returns (uint256) {
        return value;
    }
}

Step 2: ERC-20 Token

// contracts/MyToken.sol — Standard ERC-20 token
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MyToken is ERC20, Ownable {
    constructor() ERC20("My Token", "MTK") Ownable(msg.sender) {
        _mint(msg.sender, 1_000_000 * 10 ** decimals());    // 1M tokens
    }

    function mint(address to, uint256 amount) external onlyOwner {
        _mint(to, amount);
    }
}

Step 3: Deploy with Hardhat

npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
npx hardhat init
// scripts/deploy.ts — Deploy contract
import { ethers } from 'hardhat'

async function main() {
  const Token = await ethers.getContractFactory('MyToken')
  const token = await Token.deploy()
  await token.waitForDeployment()
  console.log('Token deployed to:', await token.getAddress())
}
main()
npx hardhat compile
npx hardhat test
npx hardhat run scripts/deploy.ts --network sepolia

Step 4: Foundry (Alternative)

forge init my-project
forge build
forge test
forge script script/Deploy.s.sol --rpc-url sepolia --broadcast

Guidelines

  • Always use OpenZeppelin contracts for standards (ERC-20, ERC-721) — battle-tested and audited.
  • Common vulnerabilities: reentrancy, integer overflow (fixed in 0.8+), front-running, access control.
  • Test thoroughly — deployed contracts are immutable. Use Hardhat or Foundry for testing.
  • Foundry is faster for compilation/testing (Rust-based). Hardhat has a larger plugin ecosystem.