commit
免费Handle git commits with auto-staging, targeted pre-commit formatting, and Conventional Commit messages. Use when the user says commit it, commit this, commit changes, save my changes, or similar git commit requests.
中文简介正在准备中。当前显示原文说明。
Reorganize Foundry test files (*.t.sol) for readability and consistency without changing semantics. Use when the user asks to organize, reorder, clean up, tidy, or reformat a test file's structure.
中文简介正在准备中。当前显示原文说明。
实测评分 未实测
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Reorganize an existing Foundry test file (*.t.sol) so that imports, state variables, and functions follow the repository's established conventions. This skill makes purely structural changes — it never alters logic, assertions, values, names, or execution order.
These rules are absolute. If any rule would be violated by a proposed change, skip that change entirely.
*.t.sol inside contracts/tests/. NEVER touch production contracts or deploy scripts.public/internal/private), mutability (constant/immutable), types, or inheritance lists.Before making any edit, complete every item:
*.t.sol under contracts/tests/.Shared.t.sol), Concrete (concrete test), Fuzz (fuzz test), or Base (Base.t.sol, BaseFork.t.sol, BaseSmoke.t.sol).Organize imports into groups separated by a single blank line. Within each group, sort alphabetically by the imported symbol name (the name inside {}).
Each import group gets a named section header comment. Use the format // --- <Group Name> to label each group.
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
// --- Test base
import {Base} from "tests/Base.t.sol";
import {Fork_SomeStrategy_Shared_Test} from "../shared/Shared.t.sol";
// --- Test utilities
import {Mainnet} from "tests/utils/Addresses.sol";
// --- External libraries
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {MockERC20} from "@solmate/test/utils/mocks/MockERC20.sol";
// --- Project imports
import {IOToken} from "contracts/interfaces/IOToken.sol";
import {IVault} from "contracts/interfaces/IVault.sol";
import {MockStrategy} from "contracts/mocks/MockStrategy.sol";
import {InitializableAbstractStrategy} from "contracts/utils/InitializableAbstractStrategy.sol";
| Section | Contents |
|---|---|
Test base | Parent shared contract, Base.t.sol |
Test utilities | Address registries (tests/utils/Addresses.sol), test helpers |
External libraries | forge-std, OpenZeppelin, Solmate, etc. |
Project imports | Interfaces, contracts, and mocks from contracts/ |
If Group 4 is large and mixes interfaces with mocks/implementations, split it into two named sections: Project interfaces and Project contracts.
State variables must be organized into sections using the repo's standard section divider (see Section 5). Each section groups variables by semantic role.
constant variables, then immutable variables.IVault, IOToken, IAMOStrategy, etc.), then mock contracts.address variables for test actors (only if the file declares actors beyond what Base.t.sol provides).IERC20 references for external tokens (only if the file declares tokens beyond what Base.t.sol provides).uint256 fork ID variables (only in Base-level files).constant before immutable before mutable.abstract contract Fork_SomeStrategy_Shared_Test is BaseFork {
//////////////////////////////////////////////////////
/// --- CONSTANTS
//////////////////////////////////////////////////////
uint256 internal constant DEFAULT_AMOUNT = 1_000e18;
address internal constant DEAD_ADDRESS = address(0xdead);
//////////////////////////////////////////////////////
/// --- CONTRACTS
//////////////////////////////////////////////////////
IAMOStrategy internal amoStrategy;
IOToken internal otoken;
IVault internal vault;
MockERC20 internal mockToken;
//////////////////////////////////////////////////////
/// --- SETUP
//////////////////////////////////////////////////////
function setUp() public virtual override {
// ...
}
}
Function ordering depends on the file type.
Shared.t.sol, base test contracts)Every function group gets its own section divider (54-slash format from Section 5):
//////////////////////////////////////////////////////
/// --- SETUP
//////////////////////////////////////////////////////
function setUp() public virtual override { ... }
function _deployContracts() internal { ... }
function _configureContracts() internal { ... }
//////////////////////////////////////////////////////
/// --- HELPERS
//////////////////////////////////////////////////////
function _depositAsVault(uint256 amount) internal { ... }
function _verifyEndConditions() internal view { ... }
//////////////////////////////////////////////////////
/// --- ASSERTION HELPERS
//////////////////////////////////////////////////////
function _assertBalances(uint256 expected) internal view { ... }
//////////////////////////////////////////////////////
/// --- CALLBACKS
//////////////////////////////////////////////////////
function onERC721Received(...) external returns (bytes4) { ... }
//////////////////////////////////////////////////////
/// --- LABELS
//////////////////////////////////////////////////////
function _labelContracts() internal { ... }
Ordering within SETUP: setUp() first, then deployment/fetch helpers in the order they are called by setUp (_deployContracts, _deployMockContracts, _configureContracts, _fetchContracts, _resolveActors, _fundInitialUsers).
Omit a section divider if the section would be empty. Merge ASSERTION HELPERS into HELPERS if there are only 1-2 assertion helpers.
Every test group gets its own section divider:
//////////////////////////////////////////////////////
/// --- PASSING TESTS
//////////////////////////////////////////////////////
function test_deposit() public { ... }
function test_deposit_checkBalanceReflectsDeposit() public { ... }
//////////////////////////////////////////////////////
/// --- REVERTING TESTS
//////////////////////////////////////////////////////
function test_deposit_RevertWhen_paused() public { ... }
function test_deposit_RevertWhen_zeroAmount() public { ... }
//////////////////////////////////////////////////////
/// --- EVENT TESTS
//////////////////////////////////////////////////////
function test_deposit_emitsDeposit() public { ... }
//////////////////////////////////////////////////////
/// --- HELPERS
//////////////////////////////////////////////////////
function _prepareDeposit(uint256 amount) internal { ... }
If the file tests multiple functions (common in ViewFunctions.t.sol or Admin.t.sol), use a section divider per function (e.g., /// --- MINT, /// --- REDEEM), each following the passing → reverting → event order internally.
Same section divider convention:
//////////////////////////////////////////////////////
/// --- FUZZ TESTS
//////////////////////////////////////////////////////
function testFuzz_deposit_correctBalance(uint256 amount) public { ... }
function testFuzz_deposit_neverExceedsMax(uint256 amount) public { ... }
//////////////////////////////////////////////////////
/// --- HELPERS
//////////////////////////////////////////////////////
function _boundAmount(uint256 amount) internal pure returns (uint256) { ... }
If the file has enough fuzz tests to warrant sub-groups, split into BASIC PROPERTIES and COMPOUND PROPERTIES.
The repo uses this exact format:
//////////////////////////////////////////////////////
/// --- SECTION_NAME
//////////////////////////////////////////////////////
/)./// --- followed by the section name in ALL_CAPS.| Section | Used in |
|---|---|
CONSTANTS | Shared, Base |
CONTRACTS | Shared |
CONTRACTS & MOCKS | Shared (unit tests with mocks) |
ACTORS | Base, Shared |
EXTERNAL TOKENS | Base |
FORK IDS | Base |
SETUP | Shared |
HELPERS | Shared, Concrete, Fuzz |
PASSING TESTS | Concrete |
REVERTING TESTS | Concrete |
LABELS | Shared (when _labelContracts is present) |
CONFIGURATION | Shared (when config variables exist) |
If the file uses a custom section name that is clear and descriptive, keep it. Only rename section headers when they are misleading.
Do not reorganize if any of these conditions hold:
*.t.sol file under contracts/tests/.contracts/ outside tests/), a deploy script, or a legacy JS/TS test.assembly { ... }) interleaved with state variable declarations — moving variables could change storage layout.After all edits are complete:
forge b from contracts/ to confirm compilation.forge fmt tests/ scripts/ from contracts/ to ensure formatting is consistent.Before reporting completion, verify every item:
*.t.sol under contracts/tests/forge b passesforge fmt tests/ scripts/ runs cleanly1. User provides a test file path (or asks to organize a test file)
2. READ the entire file
3. CLASSIFY the file type (Shared / Concrete / Fuzz / Base)
4. CHECK pre-edit checklist (Section 1)
5. PLAN all moves (imports → variables → functions)
6. EDIT the file — imports first, then state variables, then functions
7. VERIFY — forge b, forge fmt, review diff
8. REPORT what was changed (or that the file was already clean)
If at any point a move feels unsafe, skip it and note it in the report.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Handle git commits with auto-staging, targeted pre-commit formatting, and Conventional Commit messages. Use when the user says commit it, commit this, commit changes, save my changes, or similar git commit requests.
中文简介正在准备中。当前显示原文说明。
Generate Foundry fork tests for contracts that need real on-chain integration coverage. Use when the user asks for fork tests, mainnet or chain fork coverage, or integration tests against live protocol state.
中文简介正在准备中。当前显示原文说明。
Generate Foundry smoke tests that validate deployment health using DeployManager/Resolver against real on-chain state with pending governance applied. Use when the user asks for smoke tests, deployment verification tests, or post-deploy health checks.
中文简介正在准备中。当前显示原文说明。
Develop, modify, review, and maintain standalone Talos actions in contracts/tasks/actions, including chain guardrails, contract bindings, transaction safety, schedules, action catalogues, and Talos documentation. Use when adding an action, changing an action’s behavior or parameters, updating a Talos schedule, or maintaining action runtime support.
中文简介正在准备中。当前显示原文说明。
Generate Foundry unit tests for a contract using this repository's conventions, structure, and naming. Use when the user asks for unit tests, Foundry tests, concrete tests, or fuzz tests.
中文简介正在准备中。当前显示原文说明。
Verifies a POST-EXECUTION mainnet (or other network) smart-contract deployment PR for this repo: confirms every deployed contract is listed in the PR description, that the on-chain verified source (and its dependencies) matches the codebase via `sol2uml diff`, that constructor args and the initialize tx match the Foundry script, and that the on-chain governance proposal matches the script's actions. Use when asked to review, verify, audit, or sign off on an executed deployment PR. Invoke explicitly with /verify-deployment-pr <PR#>.
中文简介正在准备中。当前显示原文说明。