skills/vulnerability-patterns/unused-variables/SKILL.md
- Contract declares state variables, local variables, function parameters, or imports that are never referenced
npx skillsauth add apegurus/solidity-argus unused-variablesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
contract Vault {
uint256 public totalDeposits;
uint256 public unusedCounter; // Declared but never read or written
function deposit(uint256 amount, bytes memory data) external {
// `data` parameter never used — possible missing validation
totalDeposits += amount;
}
function process() external {
// Return value from transfer silently discarded
// This may indicate missing success check
IERC20(token).transfer(recipient, amount);
uint256 result = _calculate();
// `result` computed but never used — missing logic?
}
}
_ to explicitly mark as unused (e.g., function hook(uint256 /* _amount */))// Remove dead state variables
// uint256 public unusedCounter; — DELETE
// Unnamed parameters for interface compliance
function onERC721Received(
address, // operator — unused
address, // from — unused
uint256, // tokenId — unused
bytes memory // data — unused
) external pure returns (bytes4) {
return this.onERC721Received.selector;
}
// Check return values — use SafeERC20 for non-compliant tokens
bool success = IERC20(token).transfer(recipient, amount);
require(success);
testing
Specialist profile for mechanically applying the attack-vector deck and classifying vectors as skip, drop, or investigate.
tools
Specialist profile for libraries, helpers, base contracts, adapters, encoders, wrappers, and integration glue.
testing
Specialist profile for rounding, scale, decimal, downcast, and arithmetic accounting edge cases.
testing
Specialist profile for extracting conservation laws and state couplings, then searching for violating paths.