闲社服务运行正常AI智能体自动化平台
s

Solidity语言服务器

技能标识:solidity-lsp

Solidity language server providing smart contract development support including compilation, linting, security analysis, and code intelligence for .sol files. Use when working with Ethereum smart contracts, Substrate pallets, or any Solidity code that needs compilation, security checks, gas optimization, or code navigation. Essential for ClawChain pallet development.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

Solidity语言服务器

Solidity LSP

通过solc(Solidity编译器)和solhint(代码检查工具)提供全面智能合约开发支持的Solidity语言服务器集成。

功能特性

  • - 编译:使用solc编译Solidity智能合约
  • 代码检查:通过solhint进行静态分析,遵循最佳实践和安全规范
  • 安全检测:识别常见漏洞(重入攻击、整数溢出等)
  • Gas优化:定位高消耗操作
  • 代码智能:语法高亮、错误检测
  • 支持扩展名:.sol

安装指南

安装Solidity编译器和代码检查工具:

bash

Solidity编译器


npm install -g solc

Solidity代码检查工具

npm install -g solhint

验证安装:
bash
solcjs --version
solhint --version

使用方法

编译Solidity合约

bash
solcjs --bin --abi contract.sol

带优化编译:
bash
solcjs --optimize --bin --abi contract.sol

代码检查

对单个文件运行solhint:
bash
solhint contracts/MyContract.sol

对整个项目运行:
bash
solhint contracts//*.sol

安全分析

solhint默认包含安全规则。如需高级安全分析,可考虑:

bash

安装Slither(需要Python环境)


pip3 install slither-analyzer

运行安全分析

slither contracts/

配置说明

solhint配置

在项目根目录创建.solhint.json:

json
{
extends: solhint:recommended,
rules: {
compiler-version: [error, ^0.8.0],
func-visibility: [warn, {ignoreConstructors: true}],
max-line-length: [warn, 120],
not-rely-on-time: warn,
avoid-low-level-calls: warn,
no-inline-assembly: warn
}
}

Hardhat/Foundry集成

完整开发环境配置请参考references/frameworks.md。

集成流程

开发智能合约时:

  1. 1. 编写:编辑Solidity代码
  2. 检查:运行solhint提前发现问题
  3. 编译:使用solcjs验证编译
  4. 分析:部署前运行安全工具
  5. 测试:编写全面的单元测试

常见问题

  • - 编译器版本不匹配:在合约中指定pragma版本
  • Gas优化:尽可能使用view/pure修饰符
  • 安全性:切勿使用tx.origin进行身份验证
  • 最佳实践:遵循检查-效果-交互模式

更多信息

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 solidity-lsp-1776336132 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 solidity-lsp-1776336132 技能

通过命令行安装

skillhub install solidity-lsp-1776336132

下载

⬇ 下载 solidity-lsp v1.0.0(免费)

文件大小: 3.04 KB | 发布时间: 2026-4-17 15:46

v1.0.0 最新 2026-4-17 15:46
Initial release: Solidity language server for smart contract development, compilation, security analysis.
返回顶部