tejas0111/pharos/solidity-authoring
Claude Code and agent skill by tejas0111/pharos
- community
Checking that the SKILL.md file is still in the repository.
Write or refactor Pharos Solidity contracts with clear structure, custom errors, events, modifiers, and testable patterns. Use when implementing, writing, or refactoring Solidity smart contracts for Pharos, including ERC-20/721/1155 tokens, staking, vault, AMM, lending, or DeFi/RealFi protocols. Keywords: Solidity, write contract, implement, refactor, smart contract, ERC-20, ERC-721, ERC-1155, staking, vault, AMM, lending, DeFi, RealFi, Pharos, PHRS, custom errors, events, modifiers, Foundry, f…
Install
npx vskill@latest install tejas0111/pharos/solidity-authoringSKILL.md
The same SKILL.md was published earlier as tejas0111/pharos/solidity-authoring.
Solidity Authoring
Write or refactor Solidity contracts with clear structure, custom errors, events, modifiers, and testable patterns for Pharos mainnet (chain ID 1672) using PHRS as native currency (18 decimals).
When to Use
write Solidity, implement contract, refactor contract, contract code, Solidity, write a contract, implement the staking contract, write smart contract
When NOT to Use
designing architecture (use contract-architecture), reviewing code (use contract-review), or writing tests (use test-generation)
Prerequisites
- Security:
- .env Usage: Environment variables MUST be stored in a
.envfile in the project root. NEVER useexport VAR=...for sensitive data. - Mandatory Check: The Agent MUST verify
.envexists and variables are set usinggrep -q(NEVERcat,head,tail— those expose secrets) before any deployment or on-chain action. - Git: Ensure
.envis listed in.gitignoreto prevent accidental commits.
- Foundry:
forge buildmust succeed. Runforge --versionto verify installation. - RPC endpoint: Set
PHAROS_TESTNET_RPC=$PHAROS_TESTNET_RPC_URLorPHAROS_MAINNET_RPC=$PHAROS_MAINNET_RPC_URLin your environment or.env. - PharosScan API key: Set
PHAROSSCAN_API_KEYfor contract verification (https://www.pharosscan.xyz). - Network reachability: Run
cast chain-id --rpc-url $RPC_URLto confirm the target network is reachable. - Foundry config:
foundry.tomlshould have[rpc_endpoints]section withpharos_testnetandpharos_mainnetentries.
Pharos-Specific Contract Patterns
Chain ID Validation
Always verify the target chain in constructors and critical functions:
Native Currency Handling (PROS/PHRS)
The native currency (PROS on mainnet, PHRS on testnet, 18 decimals) forwards all remaining gas in .call{value:} — there is no 2300 gas stipend. Always specify a gas limit or use a pull-over-push pattern:
PHRS Receive Pattern for Staking/Vault
Workflow
- Strict .env Check: Confirm
.envexists withtest -f .envand check variables viagrep -q(without printing values). NEVER print.envcontents. Do NOT proceed if missing or if the user suggestsexport.
- Requirement Gathering: Analyze the user's request to identify the specific task, target environment (Atlantic 688689 or Pacific 1672), and any missing context. Zero-assumption delivery.
- Mandatory Plan (`PLAN.md`): Create or update
PLAN.mdin the project root with the proposed strategy. Wait for explicit 'Approve' or 'Proceed' from the user before taking any action. - Capture the contract goal, inputs, outputs, and invariants.
- Check prerequisites: verify Foundry is installed, RPC endpoints are reachable, and required env vars are set. Ask the user for any missing values before proceeding.
- Draft the contract shape, custom errors, events, and modifiers.
- Include Pharos chain ID validation and PHRS gas stipend warnings.
- Present the implementation plan and ask for confirmation.
- Write the contract in a way that is easy to test and review.
Output
- contract draft
- event and error plan
- implementation notes
- test hooks
- invariants
Examples
- "Write a Pharos staking contract with PHRS stake/unstake and chain ID 1672 validation"
- "Refactor this PHRS token contract to use custom errors and events"
- "Implement a PHRS staking contract with deposit, withdraw, and reward distribution using pull-over-push"
- "Add chain ID validation and gas-stipend-safe .call to this Pharos vault contract"
Verification
forge build or npx hardhat compile. Then forge test for unit tests. Verify chain ID in deployment script (see foundry-hardhat-contract-workflow).
Related
contract-architecture (design), interface-abi-design (ABI), test-generation (tests)
Gate
High risk — two-phase execution required:
Phase 1 — Plan (present freely):
- Draft the
PLAN.mdwith the full implementation strategy, environment-aware safeguards, and verification steps. - Wait for explicit 'Approve' or 'Proceed' from the user.
Phase 2 — Execute (wait for approval):
- Execute the approved plan from
PLAN.md. - Do NOT Write contract files to disk, modify existing files, or compile/deploy
- Perform a final "Ready to Broadcast?" check for any high-risk on-chain actions.
- Wait for explicit user confirmation ("I approve", "proceed", "looks good") before taking any of the Phase 2 actions.
Pharos Solidity Patterns (with Real Examples)
Immutable Chain ID Pattern
Every contract stores the chain ID as an immutable:
Pull-Over-Push Withdrawal
Instead of sending tokens directly, let users pull:
Custom Error Pattern
Reentrancy Guard
SafeERC20 Pattern
Contract Quick Reference
| Pattern | Where Applied | |
|---|---|---|
| Immutable owner + chain ID | All contracts | |
| Custom errors | All contracts | |
| ReentrancyGuard | SimpleLender, DEXPool, StakingPool | |
| SafeERC20 | SimpleLender, StakingPool | |
| Pull-over-push | StakingPool, PharosSPNPaymaster | |
| Event emission per state change | All contracts | |
| NatSpec documentation | All contracts |
References
contracts/— All contract implementationscontracts/interfaces/— ReentrancyGuard, SafeERC20, IERC20- OpenZeppelin patterns adapted for Pharos
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskill/subskills/solidity-authoring/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tejas0111/pharos/solidity-authoring)