Agent skill

External Precondition Audit

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy)

MITAuto-check passed

Install External Precondition Audit

skills CLI
$ npx skills add PlamenTSV/plamen --skill external-precondition-audit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PlamenTSV/plamen external-precondition-audit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/solana/external-precondition-audit .claude/skills/external-precondition-audit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
external-precondition-audit
GitHub stars
303
Token cost
~2k tokens
SKILL.md length
890 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy)

  • Works in 6 steps: CPI Target Inventory and Validation → Signer Privilege Propagation → Account Reload After CPI (Rule S5 --… → …
  • Pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy)
  • SKILL.md covers 1. CPI Target Inventory and…, 2. Signer Privilege Propagation, 3. Account Reload After CPI… and 4. Return Data Consumption, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

External Precondition Audit is an agent skill from PlamenTSV/plamen. Trigger Pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy)

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with Solana. The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy)

Example prompts

  • “/external-precondition-audit”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. CPI Target Inventory and Validation
  2. Signer Privilege Propagation
  3. Account Reload After CPI (Rule S5 -- CRITICAL)
  4. Return Data Consumption
  5. State Dependency Mapping
  6. Lamport Conservation Audit

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

External Precondition Audit loads about 2k tokens when it runs. Until then it costs about 38 tokens; SKILL.md has 890 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~38
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 890 words, ~2,018 tokens.

Download SKILL.mdSave it as .claude/skills/external-precondition-audit/SKILL.md (or your agent's skills folder).
name
external-precondition-audit
description
Trigger Pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy)

Skill: External Precondition Audit (Solana)

Trigger Pattern: Any CPI (Cross-Program Invocation) detected in program Inject Into: Breadth agents (merged via M5 hierarchy) Finding prefix: [EPA-N] Rules referenced: S1, S3, S5, S9, R1, R4 Constraint: IDL/interface-level inference only -- no production fetch required

invoke|invoke_signed|CpiContext|cpi::|anchor_spl|spl_token|system_program|
associated_token|token_2022|program::invoke

For every CPI target program the protocol invokes:

1. CPI Target Inventory and Validation

CPI TargetProgram ID SourceHardcoded?Validated Against Constant?Upgradeable?Risk if Substituted

Rule S3 check: For each CPI call, is the target program ID:

  • Hardcoded as a constant (spl_token::ID, known program address)? -> SAFE
  • Read from an account field without validation? -> CRITICAL: attacker substitutes malicious program
  • Passed as an AccountInfo and checked via constraint = program.key() == expected_id? -> SAFE if constraint present

Upgradeability assessment: Is the CPI target program upgradeable?

  • If YES: its behavior can change after audit. Apply Rule 4 (adversarial assumption).
  • If NO (immutable / upgrade authority revoked): behavior is fixed, trust boundary is clear.

2. Signer Privilege Propagation

For each invoke_signed / CPI call, trace signer propagation:

CPI CallSigners ForwardedPDA Seeds UsedShould This Signer Be Forwarded?Privilege Escalation Risk

Checks:

  • Does the CPI forward signer privileges that should NOT be forwarded? (e.g., forwarding user signer to an external program that can drain their accounts)
  • Are PDA signer seeds constructed correctly? (wrong seeds = wrong PDA = different authority)
  • Can an attacker control any of the PDA seed components to derive a different PDA?
  • Does invoke_signed pass accounts the CPI target can mutate that should not be mutated?

3. Account Reload After CPI (Rule S5 -- CRITICAL)

For each CPI call that modifies accounts used by subsequent logic:

CPI CallAccounts Modified by CPIReloaded After CPI?Subsequent Read LocationStale Data Risk

Rule S5: After a CPI call, any account that the CPI target may have modified MUST be reloaded before the calling program reads it again. Anchor's reload() method handles this. Without reload, the program reads cached (pre-CPI) data.

Attack pattern:

  1. Program reads account balance (cached)
  2. CPI transfers tokens out of account
  3. Program reads account balance again -- gets STALE pre-CPI value
  4. Program makes decisions based on stale balance

Check for each CPI:

  • All mutable accounts passed to CPI are reloaded after return
  • Lamport balances are re-read after CPI (lamports can change via CPI)
  • Token account balances are re-read after SPL Token CPI
  • If NOT reloaded: trace what stale data is used for and compute impact

4. Return Data Consumption

CPI CallReturn Data ExpectedHow Protocol Uses ReturnFailure Mode if Unexpected

For each return value:

  • What happens if CPI returns 0? (division by zero, incorrect accounting)
  • What happens if CPI returns MAX_U64? (overflow in subsequent arithmetic)
  • What happens if CPI does NOT set return data? (Solana's get_return_data() returns None)
  • What happens if the CPI reverts? Does the calling program handle the error or propagate it?

Solana-specific: sol_get_return_data returns the program ID that set the data. Verify the caller checks that the return data comes from the expected program, not a previously-invoked program's stale return data.

  • For each external data structure received (Vec, array, Map, list): (a) What ordering/uniqueness does the consuming code assume? (b) Does the external contract's spec guarantee that ordering? (c) What happens if the assumption is violated (unsorted, duplicates, gaps)?
Show full SKILL.md (357 more words)Show less

5. State Dependency Mapping

Protocol StateDepends on CPI Target StateExternal State Can Change Without Our Knowledge?

For each dependency: model what happens when the external state changes between our program's read and use.

Solana-specific concerns:

  • Another instruction in the SAME transaction can modify the CPI target's state between our instructions
  • An attacker can construct a transaction: [attacker_ix_1 (modify external state)] -> [our_ix (reads stale external state)]
  • Oracle accounts (Pyth, Switchboard) can be updated by their respective programs between instructions
5b. Oracle Data Quality Checks (IF Pyth/Switchboard/other oracle consumed)
Oracle AccountTypeConfidence Checked?Staleness Checked?First-Update Bypass?Account Owner Validated?

Checks:

  1. Is confidence_interval (Pyth) or deviation threshold (Switchboard) validated before price is used?
  2. Is staleness enforced? (publish_time vs Clock::get() compared against max age)
  3. Can the first price read bypass confidence/staleness checks? (no prior reference → no comparison baseline)
  4. Can the oracle account be substituted with a stale or attacker-controlled account? (check owner == pyth_program_id) Tag: [TRACE:oracle read → confidence={X} vs threshold={Y} → {accepted/rejected}]

6. Lamport Conservation Audit

After each CPI call, verify lamport conservation:

CPI CallAccounts Passed (Mutable)Lamports BeforeLamports AfterConservation Checked?

Attack: A malicious CPI target (if program ID is not validated per Section 1) can drain lamports from any mutable account passed to it. Even for trusted CPI targets, verify that lamport changes are expected and accounted for.

Check: For each mutable account passed to CPI:

  • Is it acceptable for this account's lamports to change?
  • If NOT: is there a post-CPI lamport check?
  • If the CPI target is upgradeable: lamport behavior could change in future versions

Finding Template

markdown
**ID**: [EPA-N]
**Verdict**: CONFIRMED / PARTIAL / REFUTED / CONTESTED
**Step Execution**: (see checklist below)
**Rules Applied**: [S1:___, S3:___, S5:___, S9:___, R1:___, R4:___]
**Severity**: Critical/High/Medium/Low/Info
**Location**: programs/{program}/src/instructions/{file}.rs:LineN
**Title**: {missing CPI validation / stale data after CPI / privilege escalation}
**Description**: {specific issue with code reference}
**Impact**: {what attacker can achieve via the CPI weakness}

Step Execution Checklist (MANDATORY)

SectionRequiredCompleted?Notes
1. CPI Target Inventory and ValidationYESRule S3 check for every CPI
2. Signer Privilege PropagationYESEvery invoke_signed traced
3. Account Reload After CPI (Rule S5)YESEvery mutable account checked
4. Return Data ConsumptionIF return data used
5. State Dependency MappingYES
5b. Oracle Data Quality ChecksIF oracle consumedPyth confidence, staleness, first-update bypass
6. Lamport Conservation AuditYESEvery mutable account passed to CPI

If any step skipped, document valid reason (N/A, no CPI, no return data, immutable target).

© PlamenTSV, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/solana/external-precondition-audit of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

External Precondition Audit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

External Precondition Audit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
External Precondition Audit this skillPlamenTSV/plamen303—~2kAutomated safety check: PassMIT
Solana Devsolana-foundation/solana-dev-skill574—~3.8kAutomated safety check: PassMIT
Meme Coin Security Auditawarexone/Agentic-Bug-Hunter5.3k1 repos~2.4kAutomated safety check: PassMIT
Swapper Depositswapperfinance/swapper-toolkit852—~1.8kAutomated safety check: PassMIT
PNP Prediction Markets on Solanainternet-court/internet-court-skill6.5k—~7.5kAutomated safety check: NotesMIT
Minara Crypto Trading and WalletMinara-AI/minara-skills362—~5.7kAutomated safety check: PassNone

Similar skills

  • Solana Dev

    solana-foundation/solana-dev-skill

    A skill your agent uses when user asks to "build a Solana dapp", "write an Anchor program", "create a token", "debug Solana errors", "set up wallet connection", "test my Solana program", "fuzz my…

    574 GitHub stars~3.8k tokensUpdated today
    Backend & APIsAuto-check passed
  • Meme Coin Security Audit

    awarexone/Agentic-Bug-Hunter

    Screens EVM and Solana meme coins for rug pull signs such as hidden mint, honeypot logic and fee tricks, starting with fast kill signals before any code review.

    5.3k GitHub starsUsed in 1 repo~2.4k tokens
    SecurityAuto-check passed
  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • PNP Prediction Markets on Solana

    internet-court/internet-court-skill

    Creates, trades and settles permissionless prediction markets on Solana with any SPL token as collateral, including social-media and custom-oracle markets.

    6.5k GitHub stars~7.5k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check: notes
  • Minara Crypto Trading and Wallet

    Minara-AI/minara-skills

    Drives the Minara CLI for crypto swaps, perps, limit orders, wallet transfers, deposits and withdrawals, plus AI market analysis.

    362 GitHub stars~5.7k tokensUpdated 22 days ago
    Business, Finance & HRAuto-check passed
  • Manifest

    Bonasa-Tech/manifest

    A skill your agent uses when building, debugging, or integrating with the Manifest DEX on Solana, especially for TypeScript SDK usage, transaction construction with ManifestClient, market state…

    158 GitHub stars~478 tokensUpdated today
    DevelopmentAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 13 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 13 days ago
    Auto-check passed

Works with

Questions about External Precondition Audit

What does External Precondition Audit do?

Trigger Pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy). External Precondition Audit is an agent skill from PlamenTSV/plamen.

When should I use External Precondition Audit?

External Precondition Audit fits situations like: pattern Any CPI (Cross-Program Invocation) detected in program - Inject Into Breadth agents (merged via M5 hierarchy).

How do I install External Precondition Audit in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill external-precondition-audit -a claude-code`. Or copy the skill folder (agents/skills/solana/external-precondition-audit in PlamenTSV/plamen) into .claude/skills/external-precondition-audit in your project. Claude Code loads it when a task matches its description.

How do I install External Precondition Audit in Codex?

Run `npx skills add PlamenTSV/plamen --skill external-precondition-audit -a codex`. Or copy the skill folder (agents/skills/solana/external-precondition-audit in PlamenTSV/plamen) into .agents/skills/external-precondition-audit in your project. Codex loads it when a task matches its description.

Can I use External Precondition Audit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PlamenTSV/plamen --skill external-precondition-audit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/external-precondition-audit, .gemini/skills/external-precondition-audit, .github/skills/external-precondition-audit and .opencode/skills/external-precondition-audit in your project.

What does External Precondition Audit need to run?

SKILL.md names no scripts, command-line tools or credentials: External Precondition Audit is instructions for the agent only.

Does External Precondition Audit access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is External Precondition Audit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does External Precondition Audit use?

External Precondition Audit is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does External Precondition Audit use?

About 2k tokens (SKILL.md is roughly 8.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to External Precondition Audit?

Skills that share tags, products or a category with External Precondition Audit: Solana Dev (solana-foundation/solana-dev-skill, 574 stars), Meme Coin Security Audit (awarexone/Agentic-Bug-Hunter, 5.3k stars), Swapper Deposit (swapperfinance/swapper-toolkit, 852 stars) and PNP Prediction Markets on Solana (internet-court/internet-court-skill, 6.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains External Precondition Audit?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: PlamenTSV/plamen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.