token-antiflash

token-antiflash is a skill for Claude Code, Codex from 0xlayerghost/solidity-agent-kit. It costs 91 tokens per session (5,435 once invoked), scanned A, original, MIT.

A design guide for protecting an ERC-20 token contract from certain flash-loan attacks. Flash loans are temporary, uncollateralized loans that must be repaid within one transaction.

In plain words
What is it for?
Use it to assess realistic token threats, compare protection strategies, explain their trade-offs, and choose an approach before implementation.
Why use it?
It prevents jumping straight into security code before considering the token's threat model, costs, user experience, and implementation complexity.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/0xlayerghost/solidity-agent-kit/token-antiflash
Any agent
npx skills add 0xlayerghost/solidity-agent-kit --skill token-antiflash
Clone the repo
git clone --depth 1 https://github.com/0xlayerghost/solidity-agent-kit

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for token-antiflash

README.md
[![agentmods](https://agentmods.dev/badge/skills/0xlayerghost/solidity-agent-kit/token-antiflash.svg)](https://agentmods.dev/skills/0xlayerghost/solidity-agent-kit/token-antiflash)
Your own site
<a href="https://agentmods.dev/skills/0xlayerghost/solidity-agent-kit/token-antiflash"><img src="https://agentmods.dev/badge/skills/0xlayerghost/solidity-agent-kit/token-antiflash.svg" alt="Measured on agentmods" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,435 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00091 $0.05435
Opus 5 $0.00046 $0.02717
Sonnet 5 $0.00018 $0.01087
Haiku 4.5 $0.00009 $0.00543

Measured 5d ago against content hash ccb295fd7c23, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

token-antiflash scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/token-antiflash/SKILL.md · 456 lines

How it starts

The opening of the file, as written. The whole thing — 456 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Token-Level Flash Loan Prevention Design Patterns

Language Rule

  • Always respond in the same language the user is using. If the user asks in Chinese, respond in Chinese. If in English, respond in English.

Scope: Applicable to ERC20 token contracts that need protection against flash loan attacks at the token contract level. Complements the defi-security skill (protocol-level) with token-internal defense mechanisms. All parameters mentioned below are design references — actual values should be determined based on project requirements, tokenomics, and market conditions.

Workflow Rule

When this skill is triggered, DO NOT directly implement all strategies. Follow this workflow:

  1. Assess: Identify the project's threat model — what type of token (meme, community, DeFi ecosystem), what value at stake, what attack vectors are realistic
  2. Present: Show the developer the Strategy Decision Matrix and Combination Guide. Clearly explain the trade-offs of each strategy (gas cost, UX friction, implementation complexity)
  3. Let the developer choose: Ask the developer which protection level (Basic / Standard / Advanced / Maximum) or which specific strategies they want. Do NOT assume a protection level
  4. Confirm parameters: For each chosen strategy, confirm key design parameters with the developer (e.g., tax tiers, volume limit percentages, cooldown granularity) before writing code
  5. Implement: Only after developer confirmation, implement the selected strategies with the agreed parameters

Exception: If the developer explicitly says "implement all" or "maximum protection", skip steps 2-4 and implement the Maximum combination. If the developer specifies exact strategies by number, skip to step 4 for those strategies.

Version Compatibility

OpenZeppelin Version Hook to Override Notes
OZ 5.x (Solidity ≥0.8.20) _update(address from, address to, uint256 amount) State already updated when hook runs
OZ 4.x (Solidity <0.8.20) _beforeTokenTransfer(address from, address to, uint256 amount) State NOT yet updated; reads are pre-transfer

Read the full file on GitHub · 456 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 456 lines · 91 tokens per session scan A ccb295fd7c23

Subscribe to this mod's changes

token-antiflash is a skill published in the GitHub repository 0xlayerghost/solidity-agent-kit (4 stars, last pushed 25d ago), licensed MIT. It adds 91 tokens to every session and 5,435 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

web3-bug-classes

Complete reference for all 10 DeFi smart contract bug classes. Use this when hunting for specific vulnerability types, need attack patterns for accounting desync, access control, incomplete path, off-by-one, oracle manipulation, ERC4626 vaults, reentrancy, flash loans, signature replay, or proxy/upgrade bugs.

Awarexone/web3-bug-bounty-hunting-ai-skills · 72 tokens

web3-methodology-research

External research synthesis from Trail of Bits, SlowMist, ConsenSys, Immunefi, and Cyfrin. Use this for advanced audit methodology, Echidna/Medusa fuzzing setup, Slither custom detector writing, attack pattern deep dives, or the 4-phase learning roadmap.

Awarexone/web3-bug-bounty-hunting-ai-skills · 66 tokens

web3-poc-foundry

Complete Foundry PoC writing guide + all cheatcodes + DeFiHackLabs reproduction patterns. Use this when building a proof of concept exploit, setting up a fork test, using Foundry cheatcodes, or reproducing a known DeFi hack for learning.

Awarexone/web3-bug-bounty-hunting-ai-skills · 59 tokens

web3-triage-report

Bug triage validation system, Immunefi report format, and 20 real paid bounty examples dissected. Use this when validating a finding before submitting, writing an Immunefi report, checking if a bug is actually valid, or studying real examples of paid vulnerabilities.

Awarexone/web3-bug-bounty-hunting-ai-skills · 59 tokens

web3-case-study-role-misconfig

Case study - role misconfiguration bug class applied to a yield aggregator protocol. Use as a template for applying all 10 bug classes to a single target.

Awarexone/web3-bug-bounty-hunting-ai-skills · 40 tokens

web3-grep-arsenal

Master grep command arsenal for Web3 smart contract auditing. Use when starting a new protocol scan, before deep code review, or when hunting specific vulnerability classes.

Awarexone/web3-bug-bounty-hunting-ai-skills · 39 tokens