interface-lint
Automates file structure maintenance by enforcing error code generation and adding docstrings to interfaces.
Install
mkdir -p .claude/skills/interface-lint && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7881" && unzip -o skill.zip -d .claude/skills/interface-lint && rm skill.zipInstalls to .claude/skills/interface-lint
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Format and lint Solidity interface files following EigenLayer conventions. Use when the user asks to format an interface, add documentation to an interface, or create a new interface. Ensures proper organization with Errors/Events/Types sub-interfaces.Key capabilities
- →Format Solidity interfaces into Errors, Types, and Events
- →Generate 4-byte error codes using cast sig
- →Add documentation for errors, structs, and functions
- →Validate interface structure against EigenLayer conventions
How it works
The skill enforces a specific four-part contract structure and requires standardized docstrings for all interface components.
Inputs & outputs
When to use interface-lint
- →Formatting new interfaces
- →Adding documentation to existing interfaces
- →Validating interface structures
About this skill
Interface Lint
Format Solidity interface files following EigenLayer's established conventions for organization, documentation, and error code generation.
Interface Structure
Every interface file should contain four interface contracts in this order:
I{ContractName}Errors- All custom errorsI{ContractName}Types- All structs and enumsI{ContractName}Events- All events (inherits Types for struct access)I{ContractName}- Main interface (inherits Errors and Events)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
// Imports
interface I{ContractName}Errors {
// All errors with error codes
}
interface I{ContractName}Types {
// All structs and enums
}
interface I{ContractName}Events is I{ContractName}Types {
// All events
}
interface I{ContractName} is I{ContractName}Errors, I{ContractName}Events {
// All function declarations
}
Error Documentation
Each error MUST include:
@noticedescribing when the error is thrown@dev Error code: 0x...with the 4-byte selector fromcast sig
Generating Error Codes
Use cast sig to generate the error code:
cast sig "InvalidOperatorSet()"
# Output: 0x7ec5c154
Error Format
interface IContractNameErrors {
/// @notice Thrown when the operator set is not valid
/// @dev Error code: 0x7ec5c154
error InvalidOperatorSet();
/// @notice Thrown when the chainId is invalid
/// @dev Error code: 0x7a47c9a2
error InvalidChainId();
/// @notice Thrown when the key type is not set for the operatorSet
/// @dev Error code: 0xe57cacbd
/// @dev Additional context about why this is required
error KeyTypeNotSet();
}
Types Documentation
Each struct/enum MUST include:
@noticewith a brief description@paramfor each field in structs
interface IContractNameTypes {
/// @notice A per-operatorSet configuration struct
/// @param owner the permissioned owner of the OperatorSet
/// @param maxStalenessPeriod the maximum staleness period in seconds
struct OperatorSetConfig {
address owner;
uint32 maxStalenessPeriod;
}
/// @notice Represents the status of an operator's registration
/// @param registered Whether the operator is currently registered
/// @param slashableUntil Block until which the operator remains slashable
struct RegistrationStatus {
bool registered;
uint32 slashableUntil;
}
}
Event Documentation
Each event MUST include a singular @notice describing when the event is emitted:
interface IContractNameEvents is IContractNameTypes {
/// @notice Emitted when a generation reservation is created
event GenerationReservationCreated(OperatorSet operatorSet);
/// @notice Emitted when an operator set config is set
event OperatorSetConfigSet(OperatorSet operatorSet, OperatorSetConfig config);
/// @notice Emitted when a chainID is added to the whitelist
event ChainIDAddedToWhitelist(uint256 chainID, address operatorTableUpdater);
}
Function Documentation
Each function in the main interface MUST include:
@notice- What the function does@param- Description for each parameter@return- Description for each return value (for view functions)@dev- Additional context (optional, but include caller requirements)@dev Reverts for:- List ALL revert conditions@dev Emits the following events:- List ALL events emitted
Function Documentation Format
interface IContractName is IContractNameErrors, IContractNameEvents {
/// @notice Creates a generation reservation for cross-chain transport
/// @param operatorSet the operatorSet to make a reservation for
/// @param operatorTableCalculator the calculator contract address
/// @param config the config containing owner and staleness period
/// @dev msg.sender must be an authorized caller for operatorSet.avs
/// @dev Reverts for:
/// - CurrentlyPaused: Generation reservations are paused
/// - InvalidPermissions: Caller is not authorized
/// - InvalidOperatorSet: The operatorSet does not exist
/// - GenerationReservationAlreadyExists: Reservation already exists
/// - InvalidStalenessPeriod: The maxStalenessPeriod is invalid
/// @dev Emits the following events:
/// - GenerationReservationCreated: When the reservation is created
/// - OperatorTableCalculatorSet: When the calculator is set
/// - OperatorSetConfigSet: When the config is set
function createGenerationReservation(
OperatorSet calldata operatorSet,
IOperatorTableCalculator operatorTableCalculator,
OperatorSetConfig calldata config
) external;
/// @notice Gets the operator set config
/// @param operatorSet the operatorSet to query
/// @return The OperatorSetConfig for the given operatorSet
/// @dev You should check if an operatorSet has an active reservation first
function getOperatorSetConfig(
OperatorSet memory operatorSet
) external view returns (OperatorSetConfig memory);
}
Revert Conditions Format
List each revert condition with the error name and when it occurs:
/// @dev Reverts for:
/// - CurrentlyPaused: Generation reservations are paused
/// - InvalidPermissions: Caller is not an authorized caller for operatorSet.avs
/// - InvalidOperatorSet: The operatorSet does not exist in the AllocationManager
/// - GenerationReservationAlreadyExists: A generation reservation already exists
For Ownable errors, use the string format:
/// @dev Reverts for:
/// - "Ownable: caller is not the owner": Caller is not the owner
Events Emitted Format
List each event with a brief description of when it's emitted:
/// @dev Emits the following events:
/// - GenerationReservationCreated: When the reservation is successfully created
/// - OperatorTableCalculatorSet: When the calculator is set for the operatorSet
/// - OperatorSetConfigSet: When the config is set for the operatorSet
View Functions
View functions typically don't revert (except for input validation) and don't emit events. Document them simpler:
/// @notice Gets the active generation reservations
/// @return An array of operatorSets with active generationReservations
function getActiveGenerationReservations() external view returns (OperatorSet[] memory);
/// @notice Gets reservations by range for pagination
/// @param startIndex the start index of the range, inclusive
/// @param endIndex the end index of the range, exclusive
/// @return An array of operatorSets in the specified range
/// @dev Reverts for:
/// - InvalidRange: startIndex is greater than endIndex
/// - InvalidEndIndex: endIndex exceeds array length
function getActiveGenerationReservationsByRange(
uint256 startIndex,
uint256 endIndex
) external view returns (OperatorSet[] memory);
Complete Example
Reference: src/contracts/interfaces/ICrossChainRegistry.sol
This file demonstrates the full pattern with:
- Errors interface with
cast sigerror codes - Types interface with documented structs
- Events interface inheriting Types
- Main interface with full function documentation
Checklist for Linting an Interface
- ☐ Split into Errors, Types, Events, and main interface contracts
- ☐ Errors have
@noticeand@dev Error code: 0x...(usecast sig) - ☐ Types have
@noticeand@paramfor each field - ☐ Events have singular
@noticedescribing when emitted - ☐ Events interface inherits Types interface
- ☐ Main interface inherits Errors and Events interfaces
- ☐ Functions have
@notice,@param, and@return(for views) - ☐ Functions list ALL revert conditions under
@dev Reverts for: - ☐ Functions list ALL events under
@dev Emits the following events: - ☐ View functions document reverts only when they can revert
Generating All Error Codes
To generate error codes for an entire interface:
# For each error in the interface, run:
cast sig "ErrorName()"
cast sig "ErrorName(uint256)" # Include params if error has them
# Example output:
# 0x7ec5c154 # InvalidOperatorSet()
# 0x7a47c9a2 # InvalidChainId()
Common Error Patterns
| Error | Typical Code | Usage |
|---|---|---|
InvalidOperatorSet() | 0x7ec5c154 | OperatorSet doesn't exist |
InvalidPermissions() | varies | Caller not authorized |
InvalidCaller() | varies | Wrong msg.sender |
ArrayLengthMismatch() | 0xa24a13a6 | Input arrays have different lengths |
When not to use it
- →Non-Solidity interface files
- →Projects not following EigenLayer conventions
Prerequisites
Limitations
- →Requires specific contract order: Errors, Types, Events, Main
- →Requires cast sig for error code generation
How it compares
It automates the adherence to strict organizational conventions and error code generation compared to manual formatting.
Compared to similar skills
interface-lint side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| interface-lint (this skill) | 1 | 7mo | Review | Intermediate |
| code-review | 0 | 6mo | No flags | Intermediate |
| dbt-transformation-patterns | 6 | 2mo | No flags | Intermediate |
| salesforce-development | 14 | 6mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by Layr-Labs
View all by Layr-Labs →You might also like
code-review
jonatron55
Instructions for reviewing changes and ensuring quality before completion. Use when asking for a review or before committing changes.
dbt-transformation-patterns
wshobson
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
salesforce-development
davila7
Expert patterns for Salesforce platform development including Lightning Web Components (LWC), Apex triggers and classes, REST/Bulk APIs, Connected Apps, and Salesforce DX with scratch orgs and 2nd generation packages (2GP). Use when: salesforce, sfdc, apex, lwc, lightning web components.
woocommerce-backend-dev
woocommerce
Add or modify WooCommerce backend PHP code following project conventions. Use when creating new classes, methods, hooks, or modifying existing backend code. **MUST be invoked before writing any PHP unit tests.**
convex-best-practices
waynesutton
Guidelines for building production-ready Convex apps covering function organization, query patterns, validation, TypeScript usage, error handling, and the Zen of Convex design philosophy
database-documentation-gen
jeremylongshore
Process use when you need to work with database documentation. This skill provides automated documentation generation with comprehensive guidance and automation. Trigger with phrases like "generate docs", "document schema", or "create database documentation".