building-secure-contracts — for Claude Code building-secure-contracts, agent-studio, community, for Claude Code, ide skills, onlyOwner, onlyRole, Building, Secure, Contracts

v1.1.0

关于此技能

适用场景: Ideal for AI agents that need building secure contracts skill. 本地化技能摘要: # Building Secure Contracts Skill <!-- Agent: skill-updater Task: #6 Session: 2026-03-01 -- <identity Smart contract and secure API contract security analysis skill. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

功能特性

Building Secure Contracts Skill
<!-- Agent: skill-updater Task: #6 Session: 2026-03-01 --
Checks-Effects-Interactions (CEI) pattern enforcement and verification
Reentrancy attack surface mapping (cross-function, cross-contract, read-only)
Access control audit: missing modifiers, privilege escalation, role confusion

# 核心主题

oimiragieo oimiragieo
[24]
[2]
更新于: 4/23/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 10/11

This page remains useful for teams, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution Quality floor passed for review
Review Score
10/11
Quality Score
77
Canonical Locale
en
Detected Body Locale
en

适用场景: Ideal for AI agents that need building secure contracts skill. 本地化技能摘要: # Building Secure Contracts Skill <!-- Agent: skill-updater Task: #6 Session: 2026-03-01 -- <identity Smart contract and secure API contract security analysis skill. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

核心价值

推荐说明: building-secure-contracts helps agents building secure contracts skill. Building Secure Contracts Skill <!-- Agent: skill-updater Task: #6 Session: 2026-03-01 -- <identity Smart contract and secure API contract

适用 Agent 类型

适用场景: Ideal for AI agents that need building secure contracts skill.

赋予的主要能力 · building-secure-contracts

适用任务: Applying Building Secure Contracts Skill
适用任务: Applying <!-- Agent: skill-updater Task: #6 Session: 2026-03-01 --
适用任务: Applying Checks-Effects-Interactions (CEI) pattern enforcement and verification

! 使用限制与门槛

  • 限制说明: Reentrancy attack surface mapping (cross-function, cross-contract, read-only)
  • 限制说明: Requires repository-specific context from the skill documentation
  • 限制说明: Works best when the underlying tools and dependencies are already configured

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

评审后的下一步

先决定动作,再继续看上游仓库材料

Killer-Skills 的主价值不应该停在“帮你打开仓库说明”,而是先帮你判断这项技能是否值得安装、是否应该回到可信集合复核,以及是否已经进入工作流落地阶段。

实验室 Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

常见问题与安装步骤

以下问题与步骤与页面结构化数据保持一致,便于搜索引擎理解页面内容。

? FAQ

building-secure-contracts 是什么?

适用场景: Ideal for AI agents that need building secure contracts skill. 本地化技能摘要: # Building Secure Contracts Skill <!-- Agent: skill-updater Task: #6 Session: 2026-03-01 -- <identity Smart contract and secure API contract security analysis skill. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

如何安装 building-secure-contracts?

运行命令:npx killer-skills add oimiragieo/agent-studio/building-secure-contracts。支持 Cursor、Windsurf、VS Code、Claude Code 等 19+ IDE/Agent。

building-secure-contracts 适用于哪些场景?

典型场景包括:适用任务: Applying Building Secure Contracts Skill、适用任务: Applying <!-- Agent: skill-updater Task: #6 Session: 2026-03-01 --、适用任务: Applying Checks-Effects-Interactions (CEI) pattern enforcement and verification。

building-secure-contracts 支持哪些 IDE 或 Agent?

该技能兼容 Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer。可使用 Killer-Skills CLI 一条命令通用安装。

building-secure-contracts 有哪些限制?

限制说明: Reentrancy attack surface mapping (cross-function, cross-contract, read-only);限制说明: Requires repository-specific context from the skill documentation;限制说明: Works best when the underlying tools and dependencies are already configured。

安装步骤

  1. 1. 打开终端

    在你的项目目录中打开终端或命令行。

  2. 2. 执行安装命令

    运行:npx killer-skills add oimiragieo/agent-studio/building-secure-contracts。CLI 会自动识别 IDE 或 AI Agent 并完成配置。

  3. 3. 开始使用技能

    building-secure-contracts 已启用,可立即在当前项目中调用。

! 参考页模式

此页面仍可作为安装与查阅参考,但 Killer-Skills 不再把它视为主要可索引落地页。请优先阅读上方评审结论,再决定是否继续查看上游仓库说明。

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

building-secure-contracts

安装 building-secure-contracts,这是一款面向AI agent workflows and automation的 AI Agent Skill。查看评审结论、使用场景与安装路径。

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

Building Secure Contracts Skill

<!-- Agent: skill-updater | Task: #6 | Session: 2026-03-01 --> <identity> Smart contract and secure API contract security analysis skill. Implements Trail of Bits and OpenSCV-aligned methodology for detecting reentrancy attacks, access control failures, integer overflows, and invariant violations in Solidity (EVM) and Rust (Solana) contracts. Addresses the $1.8B+ DeFi exploit landscape (Q3 2025) through systematic vulnerability analysis. </identity> <capabilities> - Checks-Effects-Interactions (CEI) pattern enforcement and verification - Reentrancy attack surface mapping (cross-function, cross-contract, read-only) - Access control audit: missing modifiers, privilege escalation, role confusion - Integer arithmetic analysis: overflow, underflow, precision loss, rounding direction - Contract invariant identification and formal verification setup - Storage collision and proxy upgrade security analysis - Oracle manipulation and price feed dependency analysis - Flash loan attack surface enumeration - EVM vs Solana security model comparison and platform-specific risk identification - OpenSCV vulnerability taxonomy classification for all findings </capabilities>

Overview

This skill applies systematic security analysis to smart contracts and secure API contracts. The core principle: every state mutation must be proven safe through invariant verification before an external call executes. It covers both EVM (Solidity) and Solana (Rust) ecosystems with platform-specific vulnerability patterns.

Vulnerability taxonomy: OpenSCV (94 classified security issues) Critical patterns: CEI, reentrancy guards, access modifiers, SafeMath equivalents Risk landscape: $1.8B+ in DeFi exploits Q3 2025 (access control: $953M, reentrancy: $420M)

When to Use

  • Before deploying any smart contract to mainnet
  • When auditing existing contracts for security vulnerabilities
  • When reviewing API contracts for invariant violations
  • When adding new entry points or external calls to existing contracts
  • When upgrading proxy contracts (storage slot collision risk)
  • When integrating oracles, flash loans, or third-party DeFi protocols

Iron Laws

  1. NEVER make external calls before updating state — Checks-Effects-Interactions (CEI) is non-negotiable; any external call before state update is a reentrancy vector regardless of perceived safety.
  2. NEVER assume access control is correct without reading every modifier — access control failures account for ~53% of 2024 DeFi losses; verify every onlyOwner, onlyRole, and custom guard.
  3. NEVER trust integer arithmetic without explicit bounds checking — Solidity 0.8+ has native overflow protection but custom assembly, unchecked blocks, and Rust/Solana code require explicit verification.
  4. ALWAYS enumerate all contract invariants before analysis — invariants are the ground truth for correctness; a violation is always a bug; document them in NatSpec before reviewing the implementation.
  5. ALWAYS test reentrancy across full call chains, not just single functions — cross-function reentrancy (withdraw + transfer sharing state) is as dangerous as direct reentrancy.

Phase 1: Contract Reconnaissance

Goal: Map the attack surface before deep analysis.

Steps

  1. Enumerate entry points: All external/public functions, fallback, receive
  2. Identify state-mutating functions: Functions that modify storage
  3. Map access control boundaries: Roles, modifiers, ownership checks
  4. Catalog external calls: call(), transfer(), ERC20 hooks, interface calls
  5. Identify trust boundaries: User input, oracle feeds, cross-contract calls

Output Format

markdown
1## Contract Reconnaissance 2 3### Entry Points 4 5- [ ] `withdraw(uint256 amount)` — external, state-mutating, calls msg.sender 6- [ ] `deposit()` — payable, updates balances mapping 7 8### Access Control Map 9 10- [ ] `onlyOwner`: [list of functions] 11- [ ] `onlyRole(ADMIN_ROLE)`: [list of functions] 12- [ ] No modifier (verify intent): [list of functions] 13 14### External Calls 15 16- [ ] `msg.sender.call{value: amount}("")` at withdraw():L45 17- [ ] `token.transferFrom(...)` at deposit():L23 18 19### Trust Boundaries 20 21- [ ] User-supplied amount at withdraw():L40 22- [ ] Oracle price feed at getPrice():L67 — manipulation risk

Phase 2: Reentrancy Analysis

Goal: Identify all reentrancy vectors (direct, cross-function, read-only).

Checks-Effects-Interactions Verification

For each function with external calls:

markdown
1### Function: withdraw(uint256 amount) 2 3#### CEI Order Analysis 4 5- L40: CHECK — require(balances[msg.sender] >= amount) ✓ 6- L45: EXTERNAL CALL — msg.sender.call{value: amount}("") ← VIOLATION 7- L48: EFFECT — balances[msg.sender] -= amount ← STATE AFTER CALL 8 9**FINDING**: Classic reentrancy — balance updated after external call. 10**Fix**: Move L48 before L45 (CEI pattern) 11**Severity**: Critical 12 13#### Fixed Pattern 14 15```solidity 16require(balances[msg.sender] >= amount); 17balances[msg.sender] -= amount; // Effect BEFORE external call 18(bool success, ) = msg.sender.call{value: amount}(""); 19require(success); 20```

Cross-Function Reentrancy Check

Identify shared state between functions that both make external calls:

markdown
1### Shared State: balances mapping 2 3- withdraw() reads + writes balances + makes external call 4- emergencyWithdraw() reads + writes balances + makes external call 5 **RISK**: Reentrancy from withdraw() into emergencyWithdraw() bypasses checks

Phase 3: Access Control Audit

Goal: Verify every state-mutating function has appropriate guards.

Access Control Checklist

For each function:

markdown
1### Function Audit: updateTreasury(address newTreasury) 2 3- [ ] Has access modifier? → NO ← FINDING: Missing onlyOwner 4- [ ] Modifier verified in contract? → N/A (not present) 5- [ ] Owner transferable safely? → N/A 6- [ ] Time lock for critical changes? → NO 7 8**Severity**: Critical — anyone can redirect protocol treasury 9**Fix**: Add `onlyOwner` modifier and time-lock for parameter changes

Role Confusion Patterns

markdown
1### Role Check: PAUSER_ROLE vs ADMIN_ROLE 2 3- pause() requires: PAUSER_ROLE 4- unpause() requires: PAUSER_ROLE (RISK: pauser can also unpause) 5- grantRole() requires: ADMIN_ROLE 6 7**Issue**: Pauser can unilaterally pause and unpause — should require separate roles 8**Severity**: Medium

Phase 4: Integer Arithmetic Analysis

Goal: Identify overflow, underflow, precision loss, and rounding direction bugs.

Arithmetic Boundary Analysis

markdown
1### Function: calculateReward(uint256 principal, uint256 rate) 2 3- L88: `uint256 reward = principal * rate / 1e18` 4 - Multiplication before division: OK (avoids precision loss) 5 - Overflow check: principal \* rate could overflow if both > sqrt(uint256.max) 6 - Rounding: truncates toward zero — check if favors protocol or user 7 - `unchecked` block? → NO → Solidity 0.8+ protects this 8 9### Unchecked Block Analysis 10 11- L102-108: `unchecked { ... }` 12 - Why unchecked? Check comment and verify mathematician's claim 13 - Is the claimed impossibility of overflow actually proven? 14 - [UNVERIFIED] claim: "amount < balance guarantees no underflow"

Phase 5: Invariant Verification

Goal: Identify and verify all contract-level invariants.

markdown
1### Contract Invariants: LiquidityPool 2 31. **Solvency**: sum(balances) == address(this).balance — [VERIFIED L90] 42. **Total supply**: totalSupply == sum(all user shares) — [UNVERIFIED] 53. **Fee bound**: fee <= MAX_FEE (1000 bps) — [VERIFIED by require at L45] 64. **Non-zero denominator**: totalSupply > 0 before share calculation — [VIOLATED at L67, division-by-zero risk on first deposit] 7 8### Invariant Violation Findings 9 10**FINDING**: Invariant 4 violated — first depositor can cause division by zero 11 12- Location: L67 `shares = amount * totalSupply / totalAssets` 13- When: totalSupply == 0 on first deposit 14- Impact: DoS attack on first deposit; protocol initialization blocked 15- Fix: Handle zero totalSupply case separately with initial share ratio

Output: Security Report

markdown
1# Security Report: [Contract Name] 2 3## Summary 4 5- Functions analyzed: N 6- Findings: N (Critical: X, High: Y, Medium: Z, Low: W) 7- Invariants verified: N of M 8- CEI violations: N 9 10## Critical Findings 11 12### [F-01] Reentrancy in withdraw() 13 14- Location: `src/Pool.sol:L45` 15- Pattern: External call before state update (CEI violation) 16- Impact: Complete fund drainage 17- Fix: Apply CEI pattern — update state before external call 18- 5 Whys: [root cause chain] 19 20## Invariant Status 21 22| Invariant | Status | Evidence | 23| -------------------------- | ---------- | ------------------- | 24| sum(balances) == balance | VERIFIED | L90 invariant check | 25| totalSupply == sum(shares) | UNVERIFIED | No test coverage | 26 27## Recommendations 28 291. [Critical] Fix reentrancy in withdraw() before deployment 302. [High] Add reentrancy guard as defense-in-depth 313. [Medium] Add formal invariant tests via Foundry invariant suite

Integration with Agent-Studio

  1. Invoke audit-context-building for initial code reconnaissance
  2. Invoke building-secure-contracts for contract-specific analysis
  3. Feed findings into security-architect for threat modeling
  4. Use static-analysis (Semgrep/CodeQL) for automated confirmation
  5. Use medusa-security for fuzzing-based invariant testing

Complementary Skills

SkillRelationship
audit-context-buildingBuilds initial mental model before contract analysis
security-architectConsumes findings for threat modeling and STRIDE
static-analysisAutomated SAST confirmation of manual findings
medusa-securityFuzzing and property-based testing for invariants
variant-analysisFinds similar vulnerability patterns across codebase
web3-expertSolidity/Ethereum ecosystem expertise

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Auditing only the happy pathReentrancy and access control bugs are invisible in happy pathExplicitly trace every error path and external call
Trusting function name for access controlonlyAdmin() might not check the actual admin roleRead the modifier implementation, not just its name
Assuming Solidity 0.8 prevents all integer bugsunchecked blocks, assembly, and casting bypass protectionAudit all unchecked blocks and type casts explicitly
Skipping cross-function reentrancyCross-function reentrancy bypasses single-function guardsMap shared state across ALL functions making external calls
Leaving invariants implicitUnwritten invariants are unverified risksDocument every invariant in NatSpec before analysis

Memory Protocol

Before starting: Check .claude/context/memory/learnings.md for prior contract audits of the same protocol or token standard.

During analysis: Write incremental findings to context report as discovered. Do not wait until the end.

After completion: Record key findings and patterns to .claude/context/memory/learnings.md. Record architecture decisions (CEI enforcement patterns, invariant frameworks) to decisions.md.

相关技能

寻找 building-secure-contracts 的替代方案 (Alternative) 或可搭配使用的同类 community Skill?探索以下相关开源技能。

查看全部

openclaw-release-maintainer

Logo of openclaw
openclaw

Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞

333.8k
0
AI

widget-generator

Logo of f
f

为prompts.chat的信息反馈系统生成可定制的插件小部件

149.6k
0
AI

flags

Logo of vercel
vercel

React 框架

138.4k
0
浏览器

pr-review

Logo of pytorch
pytorch

Python中具有强大GPU加速的张量和动态神经网络

98.6k
0
开发者工具