home / skills / oimiragieo / agent-studio / starknet-react-rules

This skill helps you enforce Starknet React project rules by centralizing connection management, error handling, and UI feedback for blockchain interactions.

npx playbooks add skill oimiragieo/agent-studio --skill starknet-react-rules

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.6 KB
---
name: starknet-react-rules
description: Specific rules for Starknet React projects, focusing on blockchain integration.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit]
globs: starknet/**/*.tsx
best_practices:
  - Follow the guidelines consistently
  - Apply rules during code review
  - Use as reference when writing new code
error_handling: graceful
streaming: supported
---

# Starknet React Rules Skill

<identity>
You are a coding standards expert specializing in starknet react rules.
You help developers write better code by applying established guidelines and best practices.
</identity>

<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>

<instructions>
When reviewing or writing code, apply these guidelines:

- Centralize blockchain connection management
- Implement automatic reconnection and error handling
- Use React hooks for transaction status management
- Provide clear UI feedback for blockchain interactions
- Implement comprehensive error handling for blockchain operations
  </instructions>

<examples>
Example usage:
```
User: "Review this code for starknet react rules compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>

## Memory Protocol (MANDATORY)

**Before starting:**

```bash
cat .claude/context/memory/learnings.md
```

**After completing:** Record any new patterns or exceptions discovered.

> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

Overview

This skill codifies specific rules for building Starknet + React applications, focusing on reliable blockchain integration and developer ergonomics. I provide targeted guidance to centralize connection logic, manage transactions with hooks, and surface clear UI feedback for on-chain activity. The goal is safer, more maintainable React apps that interact with Starknet.

How this skill works

I inspect code and project structure for a few core patterns: a single connection manager (provider/wallet handling), hook-based transaction state, and consistent error/reconnect logic. I flag deviations, suggest refactors, and propose concrete code-level fixes to align with best practices. I also recommend UI patterns for progress, confirmations, and error messaging tied to blockchain events.

When to use it

  • When starting a new Starknet + React project and defining connection architecture
  • During code reviews to validate blockchain integration patterns and robustness
  • When refactoring fragmented wallet/connection handling into a centralized layer
  • Before shipping features that submit transactions or depend on chain state
  • When adding UX for transactions, confirmations, or error recovery

Best practices

  • Centralize wallet/provider management in one context or service to avoid duplication and race conditions
  • Implement automatic reconnection with exponential backoff and clear user feedback for network changes
  • Use custom React hooks to encapsulate transaction lifecycle: submit, pending, confirmed, failed
  • Provide deterministic UI states for every blockchain interaction: loading, success, error, retry
  • Surface and log comprehensive errors (user, RPC, and contract-level) to aid debugging and retries

Example use cases

  • Convert scattered wallet code into a single ConnectionProvider that exports hooks like useAccount and useProvider
  • Add a useTransaction hook that returns status, receipt, and helper methods to resubmit or cancel
  • Improve UX by showing transaction estimations, pending state, and explorer links for on-chain receipts
  • Automate reconnection and session recovery when the wallet disconnects or the user changes networks
  • Audit an existing codebase to identify missing error handling and add consistent retry logic

FAQ

How do I handle wallet reconnection without confusing users?

Use a single connection manager that emits well-defined events. Attempt automatic reconnects with backoff and show a concise banner or modal explaining the status and any required user action.

How should I present transaction states in the UI?

Expose a transaction state model from hooks (idle, submitting, pending, confirmed, failed). Show immediate feedback on submit, a persistent pending indicator with explorer link, and clear success or actionable error messages.