solidity-security
यह क्या करती है
यह टूल स्मार्ट कॉन्ट्रैक्ट कोड (ब्लॉकचेन के प्रोग्राम) को ज़्यादा सुरक्षित लिखने में मदद करता है। यह आम गलतियों और हमलों से बचने के सबसे अच्छे तरीके सिखाता है, ताकि आपके प्रोग्राम सही और बिना खामियों के चलें।
कब इस्तेमाल करें
- ✓नया स्मार्ट कॉन्ट्रैक्ट बनाते समय।
- ✓मौजूदा कॉन्ट्रैक्ट में कमियाँ ढूँढने के लिए उसकी समीक्षा करते समय।
- ✓ब्लॉकचेन ऐप्स में सुरक्षा के उपाय लागू करते समय।
Skill का लिंक
https://github.com/wshobson/agents/blob/main/plugins/blockchain-web3/skills/solidity-security/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मैं अपने स्मार्ट कॉन्ट्रैक्ट को reentrancy अटैक से कैसे सुरक्षित रखूँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह आपके कोड का विश्लेषण करता है और सुरक्षित प्रोग्रामिंग पैटर्न सुझाता है। साथ ही यह दिखाता है कि आम हमले कैसे काम करते हैं और उन्हें टेस्ट और साफ़ डॉक्यूमेंटेशन की मदद से कैसे रोका जा सकता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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");
}
}
अक्सर पूछे जाने वाले सवाल
स्मार्ट कॉन्ट्रैक्ट में 'वल्नरेबिलिटी' क्या होती है?
यह कोड में मौजूद वह खामी है जिसका फ़ायदा हैकर पैसे चुराने या दूसरी समस्या पैदा करने के लिए उठा सकते हैं।
'reentrancy' क्या है?
यह एक तरह का हमला है, जिसमें एक खतरनाक कॉन्ट्रैक्ट पहली कॉल पूरी होने से पहले बार-बार एक ही फ़ंक्शन को बुलाता है, और इससे वॉलेट का पैसा खाली हो सकता है।
'कॉन्ट्रैक्ट ऑडिटिंग' क्या है?
यह स्मार्ट कॉन्ट्रैक्ट के कोड की जाँच करने की प्रक्रिया है, ताकि उसे डिप्लॉय करने से पहले सुरक्षा की खामियाँ ढूँढकर ठीक की जा सकें।
जानकारी
लेखक का मूल विवरण
Master smart contract security best practices to prevent common vulnerabilities and implement secure Solidity patterns. Use when writing smart contracts, auditing existing contracts, or implementing security measures for blockchain applications.
repo: wshobson/agents
लोकप्रियता
- GitHub स्टार
- 41k
- रैंकिंग में स्थान
- #6648
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
screen-reader-testing
41kआपके एजेंट को screen readers का इस्तेमाल करके वेबसाइटों की जांच करने देता है, ताकि यह पक्का हो सके कि वे accessible हैं।
wcag-audit-patterns
41kआपके एजेंट को वेबसाइटों का accessibility audit करने और WCAG guidelines के हिसाब से समस्याएं ठीक करने में मदद करता है।
multi-reviewer-patterns
41kआपके एजेंट को कई code reviews को एक साथ चलाने देता है। यह एक जैसे findings हटाता है और सारी रिपोर्ट को एक जगह जोड़ता है।
parallel-debugging
41kआपके एजेंट को parallel जांच के साथ जटिल समस्याओं को debug करने और root cause analysis में मदद करता है।
मिलती-जुलती skills
reverse-engineer-anything
422kयह आपके एजेंट को REA टूल से शिप हुई ऐप्स और पैकेज को अंदर से समझने, वर्ज़न की तुलना करने या दोबारा बनाने में मदद करती है।
1password
394kयह आपके एजेंट को 1Password CLI सेट करने, साइन इन करने और सीक्रेट्स की वैल्यू चैट में छापे बिना उन्हें पढ़ने या इस्तेमाल करने में मदद करती है।
healthcheck
394kयह आपके एजेंट को उस कंप्यूटर या सर्वर का सुरक्षा ऑडिट करने देती है जिस पर OpenClaw चलता है, जिसमें SSH, firewall, अपडेट और बैकअप शामिल हैं, और फिर सुरक्षित सुधार सुझाती है।