organize-test

Reorganize Foundry test files into standardized import, variable, and function sections without changing semantics.

152|115|Updated Aug 3, 2020
One-click install
npx skills add https://github.com/OriginProtocol/origin-dollar --skill organize-test-originprotocol
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: organize-test
Source: https://github.com/OriginProtocol/origin-dollar/tree/main/.codex/skills/organize-test
Command: npx skills add https://github.com/OriginProtocol/origin-dollar --skill organize-test-originprotocol

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Foundry test files (*.t.sol) often grow organically with inconsistent import ordering, scattered state variables, and mixed function groups, making them hard to read and review. This Skill reorganizes test files to match the repository's established structural conventions while guaranteeing zero semantic changes. ## Core Features & Use Cases - Import Grouping: Sorts imports into named sections (Test base, Test utilities, External libraries, Project imports) ordered alphabetically by symbol. - State Variable Sections: Organizes variables into CONSTANTS, CONTRACTS, ACTORS, EXTERNAL TOKENS, and CONFIGURATION sections using the repo's 54-slash divider format. - Function Ordering by File Type: Applies distinct ordering rules for Shared, Concrete, Fuzz, and Base test files (e.g., passing tests before reverting tests before event tests). - Safety Guardrails: Never renames, adds, removes, or modifies logic; skips risky moves and verifies with forge build and forge fmt. - Use Case: After writing a new fork test for a strategy, ask the AI to organize the file so imports, variables, and test functions follow the team's conventions before opening a pull request. ## Quick Start Ask the AI to organize the test file at contracts/tests/strategies/MyStrategy.t.sol following the repository conventions.

Frequently Asked Questions about organize-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize a Foundry test file without breaking it?

Reorganize only the structure: group imports by category, place state variables into labeled sections, and order functions by test type. Never modify function bodies, assertions, names, or values, then verify with forge build and forge fmt.

How to order imports in Solidity test files?

Group imports into named sections: Test base first, then Test utilities, External libraries, and Project imports. Within each group, sort alphabetically by the imported symbol name and separate groups with a single blank line.

What is the standard section divider format for Solidity tests?

The convention uses a top and bottom line of exactly 54 forward slashes, with a middle line of '/// --- SECTION_NAME' in all caps. Leave one blank line after the closing divider before the first item.

When should I not reorganize a Solidity test file?

Skip reorganization for production contracts, deploy scripts, files with inline assembly interleaved with state variables, auto-generated files, or when the diff would exceed 60% of lines. Also skip files that already follow all conventions.

Does reordering Solidity test functions change test behavior?

Function order in Solidity does not affect compilation or isolated test execution, but stateful test contracts with sequential dependencies could be affected. Preserve existing order when tests share state or dependencies are unclear.