Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问clear审计通过

smart-contract-security智能合约安全

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

4,609

周安装

194

GitHub Stars

1

下载量

1,614
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:smart-contract-security(智能合约安全)
来源仓库:https://github.com/pluginagentmarketplace/custom-plugin-blockchain
仓库路径:skills/smart-contract-security
安装命令:
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-blockchain --skill smart-contract-security
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-blockchain --skill smart-contract-security

简介

smart-contract-security 用于辅助安全审计、权限检查和常见漏洞排查,帮助识别风险点。

  • 适用于梳理敏感配置、检查依赖风险和分析鉴权逻辑的场景。
  • 使用时不能将工具输出直接当作最终结论,需人工复核。
  • 涉及密钥、令牌或生产系统时,应先确认最小权限和操作边界。
  • 建议结合项目实际情况进行脱敏处理和权限控制。

SKILL.md

Smart Contract Security Skill

Master smart contract security with vulnerability detection, auditing methodology, and incident response procedures.

Quick Start

# Invoke this skill for security analysis
Skill("smart-contract-security", topic="vulnerabilities", severity="high")

Topics Covered

1. Common Vulnerabilities

Recognize and prevent:

  • Reentrancy: CEI pattern violation
  • Access Control: Missing modifiers
  • Oracle Manipulation: Flash loan attacks
  • Integer Issues: Precision loss

2. Auditing Methodology

Systematic review process:

  • Manual Review: Line-by-line analysis
  • Static Analysis: Automated tools
  • Fuzzing: Property-based testing
  • Formal Verification: Mathematical proofs

3. Security Tools

Essential tooling:

  • Slither: Fast static analysis
  • Mythril: Symbolic execution
  • Foundry: Fuzzing, invariants
  • Certora: Formal verification

4. Incident Response

Handle security events:

  • Triage: Assess severity
  • Mitigation: Emergency actions
  • Post-mortem: Root cause analysis
  • Disclosure: Responsible reporting

Vulnerability Quick Reference

Critical: Reentrancy

// VULNERABLE
function withdraw(uint256 amount) external {
    (bool ok,) = msg.sender.call{value: amount}("");
    require(ok);
    balances[msg.sender] -= amount;  // After call!
}

// FIXED: CEI Pattern
function withdraw(uint256 amount) external {
    balances[msg.sender] -= amount;  // Before call
    (bool ok,) = msg.sender.call{value: amount}("");
    require(ok);
}

High: Missing Access Control

// VULNERABLE
function setAdmin(address newAdmin) external {
    admin = newAdmin;  // Anyone can call!
}

// FIXED
function setAdmin(address newAdmin) external onlyOwner {
    admin = newAdmin;
}

High: Unchecked Return Value

// VULNERABLE
IERC20(token).transfer(to, amount);  // Ignored!

// FIXED: Use SafeERC20
using SafeERC20 for IERC20;
IERC20(token).safeTransfer(to, amount);

Medium: Precision Loss

// VULNERABLE: Division before multiplication
uint256 fee = (amount / 1000) * rate;

// FIXED: Multiply first
uint256 fee = (amount * rate) / 1000;

Audit Checklist

Pre-Audit

  • Code compiles without warnings
  • Tests pass with good coverage
  • Documentation reviewed

Core Security

  • CEI pattern followed
  • Reentrancy guards present
  • Access control on admin functions
  • Input validation complete

DeFi Specific

  • Oracle staleness checks
  • Slippage protection
  • Flash loan resistance
  • Sandwich prevention

Security Tools

Static Analysis

# Slither - Fast vulnerability detection
slither . --exclude-dependencies

# Mythril - Symbolic execution
myth analyze src/Contract.sol

# Semgrep - Custom rules
semgrep --config "p/smart-contracts" .

Fuzzing

// Foundry fuzz test
function testFuzz_Withdraw(uint256 amount) public {
    amount = bound(amount, 1, type(uint128).max);

    vm.deal(address(vault), amount);
    vault.deposit{value: amount}();

    uint256 before = address(this).balance;
    vault.withdraw(amount);

    assertEq(address(this).balance, before + amount);
}

Invariant Testing

function invariant_BalancesMatchTotalSupply() public {
    uint256 sum = 0;
    for (uint i = 0; i < actors.length; i++) {
        sum += token.balanceOf(actors[i]);
    }
    assertEq(token.totalSupply(), sum);
}

Severity Classification

SeverityImpactExamples
CriticalDirect fund lossReentrancy, unprotected init
HighSignificant damageAccess control, oracle manipulation
MediumConditional impactPrecision loss, timing issues
LowMinor issuesMissing events, naming

Incident Response

1. Detection

# Monitor for suspicious activity
cast logs --address $CONTRACT --from-block latest

2. Mitigation

// Emergency pause
function pause() external onlyOwner {
    _pause();
}

3. Recovery

  • Assess damage scope
  • Coordinate disclosure
  • Deploy fixes with audit

Common Pitfalls

PitfallRiskPrevention
Only testing happy pathMissing edge casesFuzz test boundaries
Ignoring integrationsExternal call risksReview all dependencies
Trusting block.timestampMiner manipulationUse for long timeframes only

Cross-References

  • Bonded Agent: 06-smart-contract-security
  • Related Skills: solidity-development, defi-protocols

Resources

  • SWC Registry: Common weakness enumeration
  • Rekt News: Hack post-mortems
  • Immunefi: Bug bounties

Version History

VersionDateChanges
2.0.02025-01Production-grade with tools, methodology
1.0.02024-12Initial release

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.88%
按下载量换算466

OpenCode

22.74%
按下载量换算367

Antigravity

17.77%
按下载量换算287

Gemini CLI

13.27%
按下载量换算214

Codex

8.21%
按下载量换算133

Cursor

3.21%
按下载量换算52

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills