mcpField
P
pharos-skill-engine

pharos-skill-engine

github.com/pharosnetworkDevelopment046 installsUpdated 23w ago
Repository

About pharos-skill-engine

pharos-skill-engine is a developer skill for querying and operating on the Pharos blockchain with Foundry commands. It covers wallet and contract tasks, with network confirmation and private-key checks before write operations.

Key features

  1. 01Query balances, transactions, and contracts
  2. 02Send transfers and contract transactions
  3. 03Deploy and verify contracts
  4. 04Create batch airdrop scripts
  5. 05Check network and key before writes

Use cases

  1. 01Review a wallet’s assets or transaction status
  2. 02Call read-only contract methods
  3. 03Deploy or verify a contract
  4. 04Send token transfers or batch airdrops

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pharosnetwork/pharos-skill-engine --skill pharos-skill-engine

After installing, type/pharos-skill-enginein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/
networks.json
tokens.json
assets/airdrop/
NativeDistributor.sol
BatchAirdropERC20.s.sol
AirdropHelper.sol
BatchAirdrop.s.sol
ERC20Distributor.sol
assets/erc20/
StandardERC20.sol
assets/templates/
template_read.js.tpl
template_read.ts.tpl
template_read.py.tpl
template_write.py.tpl
template_write.js.tpl
template_write.ts.tpl
references/
contract.md
script-gen.md
transaction.md
query.md

Details

From the project README

Pharos Chain Skills

Developer toolkit for the Pharos blockchain. Perform on-chain queries, send transactions, deploy and verify contracts via Foundry (cast / forge) CLI commands.

Prerequisites

  1. Install Foundry (MANDATORY — MUST be done before ANY other action):
    • The Agent MUST first run which cast to check if Foundry is installed.
    • If cast is NOT found, the Agent MUST immediately run the following installation commands. Do NOT skip installation. Do NOT fall back to curl/JSON-RPC as a workaround. Do NOT proceed with any other task until Foundry is installed.
      curl -L https://foundry.paradigm.xyz | bash
      
      Then run:
      source ~/.zshenv && foundryup
      
      Then verify with:
      cast --version
      
    • If installation fails, inform the user and STOP. Do not attempt alternative approaches.
  2. Configure Private Key: Write operations (sending transactions, deploying contracts) require a private key, provided via one of the following:
    • Command argument: --private-key <your_private_key>
    • Environment variable: $PRIVATE_KEY

Network Configuration

Network information is stored in assets/networks.json, containing both the Atlantic testnet and mainnet chains.

  • Default Network: Atlantic testnet (atlantic-testnet). Used when the user does not specify a network.
  • Switching Networks: When the user specifies mainnet, read the corresponding entry's rpcUrl from assets/networks.json.
  • Usage: Read assets/networks.json and fill the target network's rpcUrl into each command's --rpc-url parameter. Contract verification also requires chainId and explorerApiUrl.
# Example: reading network configuration
RPC_URL=$(jq -r '.networks[] | select(.name=="atlantic-testnet") | .rpcUrl' assets/networks.json)

Capability Index

Load the corresponding reference file based on user needs to get full command templates.

User NeedCapabilityDetailed Instructions
View wallet portfolio / asset overviewcast balance + cast call (batch query all known tokens)→ references/query.md#address-portfolio-wallet-asset-overview
Query address balancecast balance / cast call→ references/query.md#balance-query
Query transaction statuscast tx / cast receipt→ references/query.md#transaction-query
Call contract read-only methodcast call→ references/query.md#contract-read-only-call
Send transaction (native transfer)cast send→ references/transaction.md#native-token-transfer
Call contract write methodcast send→ references/transaction.md#contract-write-call
Estimate Gascast estimate→ references/transaction.md#gas-estimation
Deploy contractforge script (auto-generate deploy script)→ references/contract.md#deploy-contract-forge-script
Verify contractforge verify-contract→ references/contract.md#verify-contract
One-click ERC20 deployforge script + built-in ERC20 template→ references/contract.md#erc20-one-click-deploy-built-in-template
Batch transfer / Airdropforge script (auto-generate airdrop script, supports 6000+ address batched airdrop, CSV file input, three-tier auto mode: ≤10 simple mode / 11-200 single batch / >200 multi-batch, hardened Distributor contract)→ references/transaction.md#batch-transfer--airdrop
Generate contract interaction scripts (read/write methods, JS/TS/Python)Script_Generator (Agent auto-generates)→ references/script-gen.md

General Error Handling

Before executing commands, the Agent should perform pre-checks; when commands fail, provide user-friendly error messages based on stderr output.

Error ScenarioCLI Error SignatureHandling
Invalid address formatinvalid addressPrompt to check address format (0x + 40 hex characters)
Transaction hash not foundtransaction not foundPrompt that transaction was not found, suggest checking the hash
No contract code at addressEmpty return valuePrompt that target address has no contract code
Call revertexecution revertedExtract and display revert reason
Private key not configuredCommand missing --private-keyPrompt user to configure private key (argument or environment variable)
Insufficient balanceinsufficient fundsPrompt insufficient balance, show current balance
Nonce conflictnonce too lowSuggest waiting or manually specifying nonce
Missing network configassets/networks.json unreadablePrompt that config file is missing or has invalid format
Unsupported networkNetwork name not in config listPrompt that only atlantic-testnet and mainnet are supported

See the corresponding reference files for detailed error handling tables for each operation.

Security Reminders

  • Private Key Protection: Never expose private keys in logs, chat history, or version control. Store the private key in the $PRIVATE_KEY environment variable and reference it explicitly in commands via --private-key $PRIVATE_KEY. Note: forge / cast do not automatically read environment variables; they must be explicitly passed as command arguments.
  • Network Confirmation: Before executing write operations, the Agent must clearly inform the user of the target network (testnet or mainnet). Mainnet operations require a prominent warning and user re-confirmation to prevent accidental operations.

Write Operation Pre-checks (Required for All Write Operations)

For all operations requiring a private key (transfers, contract calls, deployments, airdrops, etc.), the Agent must automatically complete the following checks before execution:

1. Private Key Check

Automatically detect whether the $PRIVATE_KEY environment variable is set:

# Check if environment variable exists (without outputting the private key)
[ -n "$PRIVATE_KEY" ] && echo "PRIVATE_KEY is set" || echo "PRIVATE_KEY is not set"
  • If not set: Prompt the user to configure via export PRIVATE_KEY=<your_private_key>, do not proceed
  • If set: Continue to next step
2. Derive Public Address and Confirm with User

Derive the corresponding public address from the private key via cast wallet address:

cast wallet address --private-key $PRIVATE_KEY
3. Network Confirmation (Must Clearly Inform User)

The Agent must clearly inform the user of the target network before executing any write operation. Read the target network info from assets/networks.json and display the network name and type to the user.

  • If the user did not specify a network, use the default network (atlantic-testnet) and clearly inform the user: Current operation targets the Atlantic testnet
  • If the user specified mainnet, prominently warn the user: Current operation targets mainnet, please confirm to proceed

Combine the information from steps 2 and 3 for user confirmation. Example format:

Detected private key address: 0x1234...abcd
Target network: Atlantic Testnet (atlantic-testnet)
Proceed with this account on this network?

Example format for mainnet operations:

Detected private key address: 0x1234...abcd
⚠️ Target network: Mainnet (mainnet) — please proceed with caution
Proceed with this account on mainnet?
  • After user confirmation, continue with subsequent operations (balance check, transaction sending, etc.)
  • If user declines, stop execution
4. Automatic Balance Check

After confirming the account and network, automatically query the balance (see the balance check steps in each operation's Agent guidelines).

Comments

Markdown supported