Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /permit2:permit2-router-witness still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
---
name: permit2-router-witness
description: This skill should be used when the user asks about Permit2 witness signatures for Balancer V3 router swaps, typed-data construction, nonce/deadline handling, or needs the router’s canonical witness type string/typehash.
license: MIT
---
# Permit2 Router Witness (Balancer V3)
Use this skill for signed swap flows that call:
- `swapSingleTokenExactInWithPermit(...)`
- `swapSingleTokenExactOutWithPermit(...)`
Both routes use Permit2 `permitWitnessTransferFrom` and must use the router’s exact witness schema.
## Canonical Router Witness Values
Source of truth is the router itself (via `BalancerV3StandardExchangeRouterPermit2WitnessFacet`):
- `WITNESS_TYPE_STRING()`
- `WITNESS_TYPEHASH()`
Current canonical witness type string:
```text
Witness witness)TokenPermissions(address token,uint256 amount)Witness(address owner,address pool,address tokenIn,address tokenInVault,address tokenOut,address tokenOutVault,uint256 amountIn,uint256 limit,uint256 deadline,bool wethIsEth,bytes32 userData)
```
Current canonical witness struct hash preimage:
```text
Witness(address owner,address pool,address tokenIn,address tokenInVault,address tokenOut,address tokenOutVault,uint256 amountIn,uint256 limit,uint256 deadline,bool wethIsEth,bytes32 userData)
```
## Critical Rules
1. **Always read witness constants from router**
- Do not hardcode app-only strings when the router can return the canonical values.
2. **Typed data must use EIP-712 signing**
- Use `signTypedData`.
- Do **not** fall back to `personal_sign` / `signMessage` for Permit2 typed-data payloads.
3. **Nonce and deadline are single-use/strict**
- Build a fresh nonce from Permit2 nonce bitmap if stored permit is missing/expired.
- Re-sign on swap click when quote-time signature is absent or stale.
4. **Token -> Permit2 allowance still required**
- SignatureTransfer still pulls via Permit2 and requires ERC20 allowance to Permit2.
5. **Signed mode should not silently downgrade**
- If signed mode is selected, execute the `*WithPermit` method path.
- If permit prep fails, surface actionable error instead of unsigned fallback.
## Known Failure Patterns
- `InvalidSigner`:
- Usually typed-data mismatch (domain/witness fields/order/spender/chain).
- `AllowanceExpired(uint256)` from Permit2:
- Flow hit non-signature transfer path or used stale allowance deadline.
- Ensure signed mode invokes `*WithPermit` and regenerates signature if expired.
- Unknown selector custom errors from router:
- Inline ABI drift in frontend (tuple shape mismatch) causes wrong selector.
## Validation Checklist
- Confirm router has required function selector via `facetAddress(bytes4)`.
- Confirm router witness getters return expected constants.
- Confirm frontend ABI tuple shapes match deployed contract exactly.
- Confirm signed swap path includes fresh or valid stored permit.
- Confirm token balance and token->Permit2 allowance before submission.
## Useful Files
- `contracts/protocols/dexes/balancer/v3/routers/BalancerV3StandardExchangeRouterCommon.sol`
- `contracts/protocols/dexes/balancer/v3/routers/BalancerV3StandardExchangeRouterPermit2WitnessTarget.sol`
- `contracts/protocols/dexes/balancer/v3/routers/BalancerV3StandardExchangeRouterPermit2WitnessFacet.sol`
- `contracts/protocols/dexes/balancer/v3/routers/BalancerV3StandardExchangeRouterDFPkg.sol`
- `frontend/app/swap/page.tsx`
What SKILL.md sets; muted values are Claude Code's defaults
None: SKILL.md is the whole skill.
2 plugins ship this exact skill · first indexed Jul 20, 2026
10 skills in this plugin
/permit2-addressesCanonical Permit2 contract addresses by chain. Use when configuring multi-chain support./permit2-allowance-flowComplete approval flow with reset-to-zero pattern. Use when implementing full ERC20 and Permit2 approval workflow./permit2-allowance-transferUses AllowanceTransfer for persistent token approvals. Use when user grants recurring spend authority to the protocol.Other plugins' skills for the same job
/permit2-nonce-managementBitmap nonce patterns for Permit2 signature replay protection. Use when generating nonces for SignatureTransfer permits.permit2@cyotee is listed by cyotee/cyotee-claude-plugins — review the source before installing
npx claudepluginhub cyotee/cyotee-claude-plugins --plugin permit2