tejas0111/pharos/bug-finding-and-debugging
Claude Code and agent skill by tejas0111/pharos
- community
Checking that the SKILL.md file is still in the repository.
Trace failures in Pharos contract compile, runtime, test, or dapp UI behavior and propose focused fixes. Use when debugging failing builds, failing tests, runtime errors, transaction reverts, or broken UI behavior in Pharos Solidity dapps. Keywords: bug, debug, error, failing build, failing test, runtime issue, broken, not working, trace failure, root cause, Solidity, Pharos, Foundry, Hardhat, revert, gas, transaction, wagmi, viem, forge, anvil, cast.
Install
npx vskill@latest install tejas0111/pharos/bug-finding-and-debuggingSKILL.md
The same SKILL.md was published earlier as tejas0111/pharos/bug-finding-and-debugging.
Bug Finding and Debugging
Trace failures in compile, runtime, test, or UI behavior and propose focused fixes on Pharos mainnet (chain 1672) or testnet (688689).
Pharos Debugging Commands
Reproduce with Anvil Fork
Inspect a Failed Transaction
Decode Revert Reason
Event Logs via PharosScan API
Common Pharos Bug Patterns
| Bug | Symptom | Root Cause | Fix | |
|---|---|---|---|---|
| Silent PHRS transfer failure | unstake() returns success but user gets no PHRS | .call{value:} forwards all gas (no 2300 stipend) → reentrancy or OOG | Cap gas: .call{value: amount, gas: 10000}("") | |
| Wrong chain ID | forge script reverts at broadcast | Hardcoded 688689 (old Atlantic) instead of 1672 | Use block.chainid check in deploy script | |
| RPC rate limit | eth_getLogs returns partial data | Exceed 100 block range limit | Paginate: query 100 blocks at a time | |
| Trace filter timeout | trace_filter returns error | Exceed 500 block range limit | Narrow range to <500 blocks |
Anvil Fork Reproduction — PHRS Gas Stipend Bug
When NOT to Use
- Code review — For proactive security review without a known bug, use
contract-revieworsecurity-audit. - Performance investigation — For slowness/gas optimization without a bug, use
performance-optimizationorgas-optimization. - Build failures — For CI/build issues, use
ci-and-build-troubleshooting.
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.
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. - Reproduce or reason about the failure from the error output.
- 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.
- Isolate the root cause and the smallest safe fix.
- Show the fix plan and ask for approval before editing.
- Patch the issue and verify the failure is gone.
Output
- root cause
- fix plan
- patch notes
- verification result
Examples
- "Debug this failing Pharos staking test — unstake sends 0 PHRS silently"
- "Find why the frontend transaction state never updates after PharosScan confirms"
- "Investigate why forge script reverts with 'WrongChain' — hardcoded old Atlantic ID"
- "Trace why eth_getLogs returns only 100 events for a Pharos contract"
- "Reproduce a PHRS transfer failure locally with anvil --fork-url $PHAROS_MAINNET_RPC_URL"
Verification
The specific failing test/command passes. Re-run the original failing command.
Related
contract-review (review before fixing), ci-and-build-troubleshooting (pipeline failures)
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. - Present the root-cause analysis with debug trace, reproduction steps, and fix options — show the complete analysis
- Wait for explicit 'Approve' or 'Proceed' from the user.
Phase 2 — Execute (wait for approval):
- Execute the approved plan from
PLAN.md. - Do NOT Edit files, modify code, or apply fixes
- 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.
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/bug-finding-and-debugging/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/bug-finding-and-debugging)