ワンクリックで
solidity-conventions
Apply Solidity conventions — Foundry only, forge fmt, solhint:all, fuzz tests.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Apply Solidity conventions — Foundry only, forge fmt, solhint:all, fuzz tests.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Generate one "Implement Block X" GitHub issue per Spec Kit tasks.md PR-stack block, with a minimal body pointing at tasks.md as the source of truth.
Implement one Spec Kit `tasks.md` PR-stack block end-to-end — TDD + review + PR + CI fix loop.
Apply KISS, YAGNI, DRY, SOLID, fail-fast, be-brief on every code decision.
Five-pass review of a diff: code, security, architecture, acceptance, AI-native.
Commit via feature branch + PR + git hooks; never push main, never merge.
Drive strict red-green-refactor TDD discipline on any code change, any language.
| name | solidity-conventions |
| description | Apply Solidity conventions — Foundry only, forge fmt, solhint:all, fuzz tests. |
| allowed-tools | Read, Edit, Write, Grep, Glob, Bash(forge *), Bash(cast *), Bash(anvil *), Bash(chisel *), Bash(solhint *), Bash(yarn lint:*), Bash(npm run lint:*) |
| globs | **/*.sol |
| paths | **/*.sol |
If the repo doesn't define its own tooling, use:
forge, cast, anvil, chisel)sort_imports = true, contract_new_lines = true, bracket_spacing = true)^6.0.0 — linting, run with --max-warnings=0 --noPosterbuild_and_test and linter jobspre-commit hook runs npm run lint:checkDefault to audited, widely-used libraries over hand-rolling your own:
AccessControl, ReentrancyGuard, UUPS/transparent proxies).When neither covers the need, search these curated lists before writing from scratch:
forge test -vvv. No Hardhat/Truffle unless the repo already uses them.test/**/*.t.sol, one contract under test per file, named <ContractOrFeature>.t.sol.function testFoo(uint256 x) public) and let forge generate random inputs. Add vm.assume(...) for invariants, bound inputs with bound(x, min, max) rather than if-guards.forge-std/StdInvariant.sol with handler contracts.forge snapshot for regression tracking when gas matters.forge coverage --report lcov in CI.Default is the strictest available. Extend solhint:all (every rule enabled) and run with --max-warnings=0 so warnings block CI.
Logic (.solhint.json):
{
"extends": "solhint:all",
"rules": {
"compiler-version": ["error", "^0.8.22"]
}
}
Tests (test/.solhint.json) — minimum opt-outs for practical Foundry patterns:
{
"extends": "solhint:all",
"rules": {
"compiler-version": ["error", "^0.8.22"],
"one-contract-per-file": "off",
"no-console": "off",
"func-name-mixedcase": "off",
"reason-string": "off"
}
}
Relax individual rules in-project only when you hit a real conflict — never pre-emptively.
Events are the on-chain logging primitive; they are public and permanent. Treat them as part of the contract's external API.
Transferred, RegistryUpdated, EpochAnchored), not present tense (Transfer, UpdateRegistry).indexed slot. The cap is three indexed slots per event.emit second. Reversed ordering invites reentrancy / race confusion and breaks downstream consumers that expect the event payload to reflect post-mutation state.console2.log is test-only. It must not appear in production contracts; it inflates bytecode and is dead code in prod. Keep it gated to test/ files; lint or grep for it in src/.@inheritdoc on impl with a matching interface entry. When a public state variable, function, or modifier in the implementation matches an interface signature, use /// @inheritdoc IThing rather than restating the @notice / @dev prose inline. The interface is the single source of truth; duplicating the prose in the impl invites drift (one side gets updated, the other does not) and reviewers flag it as "documentation inconsistency". This is the convention in OpenZeppelin, Aave, Compound, and Uniswap.@notice directly when there is no interface counterpart: constants, internal helpers, modifiers without an interface, custom errors. @inheritdoc cannot resolve, so write the prose inline.@param / @return once: in the interface for public-surface functions; in the impl for internal helpers.@author on every file. Once at the project / module level if at all; per-file noise.Add to package.json:
"lint:check": "yarn lint:version && yarn lint:sol-logic && yarn lint:sol-tests && forge fmt --check",
"lint:fix": "forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix",
"lint:sol-logic": "solhint -c .solhint.json 'src/**/*.sol' --max-warnings=0 --noPoster",
"lint:sol-tests": "solhint -c test/.solhint.json 'test/**/*.sol' --max-warnings=0 --noPoster",
"lint:version": "solhint --version"
(Swap src/ ↔ contracts/ to match the repo's foundry.toml src =.)
NEVER use inline Solidity via forge script --via-stdin or heredocs.
For ad-hoc exploration:
chisel) — REPL for one-off expressions and cheatcode checks.script/Scratch.s.sol — throwaway forge script in repo root's script/, run with forge script script/Scratch.s.sol. Comment out previous blocks to keep history. Gitignored — never commit; move to a real script if the code should persist.