writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
submit-hookSubmit a deployed Uniswap v4 hook to the public univ4-hooks registry - format the listing, open a PR (issue fallback) so it lists on the hook marketplace.
Independent GitHub snapshot · Automated classification · Original documentation governs
${var} - a hook address (
0x...) to submit. Empty means the most recent live mainnet deploy inmemory/state/hook-deploys.json.
Today is ${today}. This skill takes a hook this instance already deployed and lists it on the public registry aeonfun/univ4-hooks (the source behind the aeon hook marketplace). It does the formatting the registry expects, then opens a PR. The flags and callbacks are decoded from the address by the registry, so this skill only supplies the address, the chain, and the human-readable listing.
The mechanics (clone, write the entry, regenerate the registry, open the PR, fall back to an issue when there is no push access) live in skills/submit-hook/submit-univ4.py, so all GitHub egress stays inside that helper.
SUBMIT_HOOK_SKIP.chains.json covers ethereum base robinhood monad bnb arbitrum unichain. A deploy on any other chain is skipped (SUBMIT_HOOK_UNSUPPORTED_CHAIN); note it and stop.Pick the deploy. Read memory/state/hook-deploys.json (a list of deploy records). If ${var} is a 0x... address, select the record whose hookAddress matches it; else select the most recent record with network: "mainnet". No matching record means notify and exit SUBMIT_HOOK_NONE.
Gate it. If the record's network is not mainnet, exit SUBMIT_HOOK_SKIP. If its chain is not one of ethereum base robinhood monad bnb arbitrum unichain, exit SUBMIT_HOOK_UNSUPPORTED_CHAIN (the registry cannot list it yet). Confirm int(hookAddress,16) & 0x3FFF == int(flags,16); if not, the record is inconsistent, so notify and exit SUBMIT_HOOK_BAD_RECORD.
Name it. Derive a PascalCase contract-style name from the record's brief/feature (a market-hours gate becomes MarketHoursGate). This is the marketplace title and the hooks/<slug>.json filename.
Classify it. From the brief and flagNames, choose:
category: one of Fees Rewards Access Games Orders Launch. A gate/allowlist is Access; a fee/volatility hook is Fees; a tribute/buyback/leaderboard is Rewards; a block/price/volume game is Games; limit/async/MEV ordering is Orders; launch/anti-bot/anti-rug is Launch.klass: VALUE if the hook returns a delta or moves tokens (a *ReturnDelta flag), FEE if it sets a dynamic LP fee, else GATE.template: map the record's template. dynamic stays dynamic, noop stays noop, anything else (freeform/skim) becomes freeform.Write the listing prose from the brief:
mechanic: one punchy line for the tile.plain: 2-4 plain-language sentences a non-dev follows, for the modal.rules: the exact rules the hook enforces, one per line (2-4).Submit. Run the helper (a live mainnet deploy that cleared this instance's deploy gates lists as an aeon, verified hook):
python3 skills/submit-hook/submit-univ4.py \
--address "$HOOK_ADDRESS" --chain "$CHAIN" \
--name "$NAME" --category "$CATEGORY" --klass "$KLASS" \
--template "$TEMPLATE" --stage deployed --source aeon --verified \
--date "$(echo "$TIMESTAMP" | cut -c1-10)" \
--mechanic "$MECHANIC" --plain "$PLAIN" \
--rule "$RULE1" --rule "$RULE2" [--rule "$RULE3"]
Add --dry-run first to print the entry and the intended action without touching the registry, then drop it to actually open the PR. The helper prints the PR URL (or the issue URL on a fallback, or already listed).
Notify + exit. Send a short note (hook name, chain, PR/issue URL). Exit SUBMIT_HOOK_OK (PR/issue opened or already listed).
SUBMIT_HOOK_NONE (notify, never fail hard).SUBMIT_HOOK_SKIP.SUBMIT_HOOK_UNSUPPORTED_CHAIN.flags != address & 0x3FFF in the record: SUBMIT_HOOK_BAD_RECORD.SUBMIT_HOOK_OK.hooklist.json is checked. The helper regenerates hooklist.json + HOOKS.md before pushing so that check passes.deploy-uni-hook calls this same helper on a successful live deploy, so a hook usually lists itself the moment it lands. Run this skill by hand to resubmit an older deploy or one that failed to auto-list.gh CLI, which reads GH_TOKEN from the environment.