Mandatory verification protocol after code changes for Solidity projects. Use after any code modification to ensure quality.
Mandatory verification protocol for Solidity projects after any code modification. Triggers automatically after creating, modifying, or refactoring contracts to ensure quality through formatting, linting, compilation, and testing.
/plugin marketplace add IvanTorresEdge/molcajete.ai/plugin install sol@Molcajete.aiThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill defines the mandatory verification steps that Solidity agents must perform after modifying code files.
Use this skill ALWAYS when:
Do NOT use when:
Before running commands, detect the project's framework:
| Indicator | Framework | Tools |
|---|---|---|
foundry.toml | Foundry | forge fmt, forge build, forge test |
hardhat.config.js/ts | Hardhat | npx prettier, npx hardhat compile, npx hardhat test |
| Both files exist | Hybrid | Use Foundry for contracts, Hardhat for deployment |
Detection Order: Check for foundry.toml first, then hardhat.config.*.
After completing code changes, agents MUST execute these steps IN ORDER:
Foundry:
forge fmt
Hardhat:
npx prettier --write "contracts/**/*.sol"
Purpose: Ensure consistent code formatting across contracts.
solhint "src/**/*.sol"
# or for Hardhat projects
solhint "contracts/**/*.sol"
Purpose: Detect code quality issues, potential vulnerabilities, and style violations.
Foundry:
forge build
Hardhat:
npx hardhat compile
Purpose: Verify contracts compile without errors. Catches type errors and syntax issues.
Foundry:
forge test --match-path "test/ModifiedContract.t.sol"
# or run all tests
forge test
Hardhat:
npx hardhat test test/ModifiedContract.test.ts
# or run all tests
npx hardhat test
Purpose: Verify code changes do not break existing functionality.
TARGET: All steps must complete with ZERO errors and ZERO warnings.
If any step reports errors or warnings, proceed to Exception Handling.
When verification finds issues, follow this decision tree:
Issue Found During Verification
|
v
Was this issue caused
by current changes?
|
+------+------+
| |
YES NO
| |
v v
Fix it Is it in a file
now you modified?
|
+------+------+
| |
YES NO
| |
v v
Is it a Document and
small fix? report only
(< 10 lines) |
| |
+------+------+ v
| | DONE
YES NO (proceed with
| | task)
v v
Fix it Document,
now report,
recommend
separate task
Scenario 1: You add a new function and the linter reports a visibility issue in your new code.
Scenario 2: You modify a contract and discover a pre-existing lint warning (3 lines to fix) in a function you touched.
Scenario 3: You modify a contract and discover 50+ lines of lint warnings throughout the file.
Scenario 4: Lint reports warnings in a contract you did not modify.
Report verification results using this consistent format:
=== POST-CHANGE VERIFICATION ===
Format: [PASSED | FAILED | SKIPPED (reason)]
Lint: [PASSED | FAILED] ([X] errors, [Y] warnings)
Compile: [PASSED | FAILED] ([X] errors)
Tests: [PASSED | FAILED] ([X]/[Y] passed)
Pre-existing issues: [NONE | count listed below]
[If issues exist, list them here]
=== [TASK COMPLETE | VERIFICATION FAILED] ===
=== POST-CHANGE VERIFICATION ===
Format: PASSED
Lint: PASSED (0 errors, 0 warnings)
Compile: PASSED (0 errors)
Tests: PASSED (15/15)
Pre-existing issues: NONE
=== TASK COMPLETE ===
=== POST-CHANGE VERIFICATION ===
Format: PASSED
Lint: FAILED (0 errors caused by this change)
Compile: PASSED (0 errors)
Tests: PASSED (15/15)
Pre-existing issues (not caused by this change):
- src/legacy/OldToken.sol: Line 45 - func-visibility: Consider adding visibility specifier
- src/utils/Helper.sol: Lines 78-92 - reason-string: Missing error message
These issues require structural changes beyond the scope of this task.
Recommend creating a separate cleanup task.
=== TASK COMPLETE ===
=== POST-CHANGE VERIFICATION ===
Format: PASSED
Lint: FAILED (2 errors, 1 warning)
Compile: FAILED (1 error)
Tests: FAILED (13/15)
Issues to fix:
- src/Token.sol: Line 23 - ParserError: Expected ';' but got '{'
- src/Token.sol: Line 45 - not-rely-on-time: Avoid using block.timestamp
- src/Token.sol: Line 67 - Missing NatSpec documentation
=== VERIFICATION FAILED - FIX ISSUES BEFORE COMPLETING ===
Handle missing or failing commands gracefully:
| Situation | Status | Action |
|---|---|---|
| Command not found | SKIPPED (command not found) | Note and proceed to next step |
| Command timeout (> 5 min) | SKIPPED (timeout) | Note and proceed to next step |
| Execution error | SKIPPED (execution error: [reason]) | Note and proceed to next step |
=== POST-CHANGE VERIFICATION ===
Format: PASSED
Lint: SKIPPED (command not found - solhint not installed)
Compile: PASSED (0 errors)
Tests: PASSED (15/15)
Pre-existing issues: NONE
Note: Consider installing solhint for full quality verification.
=== TASK COMPLETE ===
Foundry projects SHOULD use Makefile for build operations. Ensure these targets exist:
.PHONY: fmt lint build test verify
fmt:
forge fmt
lint:
solhint "src/**/*.sol"
build:
forge build
test:
forge test
# Combined verification target
verify: fmt lint build test
If Makefile targets are missing, fall back to direct commands but note in output.
Before completing any code-modifying task:
forge fmt or npx prettier)This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.