Agent skill

External Precondition Audit

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern Any env.invokecontract() or env.tryinvokecontract() detected in contract - Inject Into Breadth agents

MITAuto-check passedSecurity

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/soroban/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
~2.2k tokens
SKILL.md length
999 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern Any env.invokecontract() or env.tryinvokecontract() detected in contract - Inject Into Breadth agents

  • Works in 5 steps: External Call Target Inventory and… → invoke_contract vs try_invoke_contract —… → Return Value Consumption → …
  • Pattern Any env.invokecontract()
  • SKILL.md covers 1. External Call Target…, 2. invoke_contract vs…, 3. Return Value Consumption and 4. State Dependency Mapping, plus 3 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 env.invokecontract() or env.tryinvokecontract() detected in contract - Inject Into Breadth agents

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

It sits in Security, covering Smart contract auditing. It works with Stellar. The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern Any env.invokecontract()
  • Env.tryinvokecontract() detected in contract - Inject Into Breadth agents

Example prompts

  • “/external-precondition-audit”

Workflow steps

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

  1. External Call Target Inventory and Validation
  2. invoke_contract vs try_invoke_contract — Error Handling
  3. Return Value Consumption
  4. State Dependency Mapping
  5. XLM Reserve and Storage TTL Considerations

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 2.2k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 999 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~2.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). 999 words, ~2,201 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 env.invoke_contract() or env.try_invoke_contract() detected in contract - Inject Into Breadth agents

Skill: External Precondition Audit (Soroban)

Trigger Pattern: Any env.invoke_contract() or env.try_invoke_contract() detected in contract Inject Into: Breadth agents Finding prefix: [EPA-N] Rules referenced: R1, R4, R8, R10, R16 Constraint: Interface-level inference only — no production fetch required

invoke_contract|try_invoke_contract|contractimport!|ContractClient|
external_contract|token::Client|token_contract|SorobanInterface

For every external contract the protocol invokes:

1. External Call Target Inventory and Validation

External ContractAddress SourceHardcoded?Validated Against Constant?Upgradeable?Risk if Substituted

Address validation check: For each invoke_contract call, is the target contract address:

  • Hardcoded as a constant or loaded from admin-controlled storage with access control? -> SAFE
  • Read from user-supplied input without validation? -> CRITICAL: attacker substitutes malicious contract
  • Loaded from contract storage but settable by an unauthorized caller? -> HIGH: arbitrary external call

Upgradeability assessment: Soroban contracts can be upgraded via update_current_contract_wasm() if the contract has an upgrade entry point. Is the external contract upgradeable?

  • If YES: its behavior can change after audit. Apply Rule 4 (adversarial assumption on future behavior).
  • If NO (no upgrade entry point or upgrade authority revoked): behavior is fixed, trust boundary is clear.

contractimport! macro risk: Contracts imported via contractimport! bind the caller to the interface of the external contract at compile time. If the external contract upgrades and changes its interface, calls will fail. More critically, if the imported interface definition does not match the deployed contract's actual interface, calls may succeed with incorrect semantics (wrong argument order, wrong return type interpretation).

2. invoke_contract vs try_invoke_contract — Error Handling

Soroban provides two call modes with fundamentally different error semantics:

Call SiteMode UsedError Handled?On Panic:Risk
{location}invoke_contract / try_invoke_contractYES/NOpropagates trap / returns Err{describe}

invoke_contract (trap mode): If the external call fails (panic, host error), the ENTIRE transaction reverts. This is safe against partial state corruption but means any external contract can DoS the protocol by reverting.

try_invoke_contract (Result mode): Returns Ok(val) or Err(...). The calling contract's state changes are NOT automatically reverted on error — the calling contract must handle the error explicitly and decide whether to revert or continue.

Critical check for try_invoke_contract:

  • Is the Err branch handled explicitly?
  • Does the calling contract revert (panic) on external error, or continue with partial state?
  • If it continues: what state was already written before the external call? Is that state now inconsistent?

Attack pattern (partial state corruption):

  1. Protocol calls try_invoke_contract to external token
  2. External call fails (returns Err)
  3. Protocol writes partial state without reverting (e.g., records a deposit but token transfer failed)
  4. User's accounting shows balance but tokens were never transferred

3. Return Value Consumption

Call SiteReturn TypeProtocol Uses Return Value?Failure Mode if Unexpected

For each return value:

  • What happens if the external call returns 0? (division by zero, incorrect accounting)
  • What happens if it returns an unexpected type? (Soroban SDK will trap on deserialization mismatch)
  • What happens if try_invoke_contract returns Err? Does the protocol handle this case explicitly?
  • Are return values deserialized with a type assertion that could trap on malformed data from an upgraded contract?
  • 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)?

4. State Dependency Mapping

Protocol StateDepends on External Contract StateExternal State Can Change Without Our Knowledge?

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

Soroban-specific concerns:

  • Soroban contracts within the SAME transaction can call the same external contract before and after our contract — state may differ between our calls
  • Storage TTL: if an external contract's data entry has expired (TTL exhausted), reading it returns the default value, not the last written value. This can silently return zero or empty data.
  • A contract call that reads external state, then performs computation, then re-reads external state may see inconsistent state if another contract in the same transaction modified the external state between reads.
Show full SKILL.md (348 more words)Show less
4b. Oracle Data Quality Checks (IF oracle consumed)
Oracle AddressTypeConfidence Checked?Staleness Checked?Address Validated?

Checks:

  1. Is the price/rate value validated for bounds before use (not zero, not negative, not impossibly large)? 1b. Price magnitude bounds: does the protocol enforce an upper bound or deviation check on price values? If no circuit breaker exists (e.g., reject price if >N× previous price or a configured ceiling), flag the absence — extreme-but-positive prices from oracle glitches or flash crashes pass the zero/negative check but can still cause mass liquidation or inflated borrowing.
  2. Is staleness enforced? (compare oracle's timestamp field against env.ledger().timestamp() with max age)
  3. Can the oracle address be substituted by an attacker (see Section 1)?
  4. What happens if the oracle contract's storage entry has expired (returns default value)?

Tag: [TRACE:oracle read → price={X} at timestamp={T} vs current={U} → {accepted/rejected}]

5. XLM Reserve and Storage TTL Considerations

After each external call that modifies storage:

External CallCreates/Extends Storage?Who Pays TTL Extension Fees?TTL Sufficient?

Soroban-specific: External contracts may create or extend storage entries on behalf of the calling contract. Storage entries have TTLs; if not extended, data expires and is wiped. If an external call creates state that the calling contract later depends on, but the TTL is not extended, that state may vanish.

XLM reserve for contract instances: Each deployed contract and each storage entry requires XLM held in reserve. If the protocol relies on an external contract maintaining state, verify that the external contract's reserve is adequate and not drainable by an attacker.

Finding Template

markdown
**ID**: [EPA-N]
**Verdict**: CONFIRMED / PARTIAL / REFUTED / CONTESTED
**Step Execution**: (see checklist below)
**Rules Applied**: [R1:___, R4:___, R8:___, R10:___]
**Severity**: Critical/High/Medium/Low/Info
**Location**: src/{file}.rs:LineN
**Title**: {missing call validation / partial state on try_invoke error / stale external state}
**Description**: {specific issue with code reference}
**Impact**: {what attacker can achieve via the external call weakness}

Step Execution Checklist (MANDATORY)

SectionRequiredCompleted?Notes
1. External Call Target Inventory and ValidationYESAddress source for every invoke_contract
2. invoke_contract vs try_invoke_contract Error HandlingYESEvery try_invoke_contract error branch checked
3. Return Value ConsumptionIF return value used
4. State Dependency MappingYES
4b. Oracle Data Quality ChecksIF oracle consumedPrice bounds, staleness, TTL expiry
5. XLM Reserve and Storage TTLYESStorage entries created by external calls

If any step skipped, document valid reason (N/A, no external calls, immutable target with no state dependency).

© 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/soroban/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—~2.2kAutomated safety check: PassMIT
Soroban Contract Auditsickn33/agentic-awesome-skills47k1 repos~1.4kAutomated safety check: PassMIT
Soroban Liquidity Poolsickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Soroban Storage Ttl Lifecyclesickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Soroban Token Mintersickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Stellar DevVelaPayments/vela-payments131—~1.8kAutomated safety check: PassMIT

Similar skills

  • Soroban Contract Audit

    sickn33/agentic-awesome-skills

    Soroban smart contract security audit register: authorization checks, panic pathways, integer overflows, and storage footprint verification for Stellar.

    47k GitHub starsUsed in 1 repo~1.4k tokens
    SecurityAuto-check passed
  • Soroban Liquidity Pool

    sickn33/agentic-awesome-skills

    Automated market maker liquidity pool register: constant-product invariant curves, swap fee tiers, and LP token shares for Soroban DeFi.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    SecurityAuto-check passed
  • Soroban Storage Ttl Lifecycle

    sickn33/agentic-awesome-skills

    Soroban ledger state rent and TTL extension register: live state tracking, bump thresholds, rent fee reserves, and archive boundaries.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    SecurityAuto-check passed
  • Soroban Token Minter

    sickn33/agentic-awesome-skills

    Soroban SEP-41 token contract architecture register: admin control, supply caps, metadata standard, and transfer event emissions on Stellar.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    SecurityAuto-check passed
  • Stellar Dev

    VelaPayments/vela-payments

    End-to-end Stellar development playbook. An agent skill from VelaPayments/vela-payments.

    131 GitHub stars~1.8k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Stellar iOS Mac SDK

    Soneso/stellar-ios-mac-sdk

    Guides Stellar blockchain development in Swift using stellar-ios-mac-sdk.

    132 GitHub stars~4.3k tokensUpdated yesterday
    Backend & APIsAuto-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 12 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 12 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 12 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 12 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 12 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 12 days ago
    Auto-check passed

Works with

Categories

Questions about External Precondition Audit

What does External Precondition Audit do?

Trigger Pattern Any env.invokecontract() or env.tryinvokecontract() detected in contract - Inject Into Breadth agents. 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 env.invokecontract(); env.tryinvokecontract() detected in contract - Inject Into Breadth agents.

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/soroban/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/soroban/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 2.2k tokens (SKILL.md is roughly 8.8k 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: Soroban Contract Audit (sickn33/agentic-awesome-skills, 47k stars), Soroban Liquidity Pool (sickn33/agentic-awesome-skills, 47k stars), Soroban Storage Ttl Lifecycle (sickn33/agentic-awesome-skills, 47k stars) and Soroban Token Minter (sickn33/agentic-awesome-skills, 47k 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.