CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
96/100
Scores the file, not the repository.Length
1,530 words
57 headings · 7 code blocksRepository
15
— · pushed 76 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Project Overview67The SettleMint SDK is a comprehensive blockchain development toolkit and platform integration suite. It provides developers with tools to build, deploy, and manage blockchain applications using the SettleMint platform's infrastructure and services.89### Technology Stack1011**Core Technologies**12- Runtime: Bun (fast JavaScript runtime)13- Package Manager: Bun workspaces with Turbo14- Language: TypeScript (strict mode)15- Code Quality: Biome for linting and formatting16- Testing: Vitest for unit/integration tests17- Documentation: TypeDoc18- GraphQL: Apollo Client, GraphQL Code Generator19- Blockchain: Viem, Ethers, Foundry, Hardhat support2021**Monorepo Structure**22- sdk/ - All SDK packages (13 packages total)23- test/ - End-to-end tests24- docs/ - Documentation25- scripts/ - Build and utility scripts26- fixtures/ - Test fixtures2728**SDK Packages**29- @settlemint/sdk-cli - Command-line interface30- @settlemint/sdk-js - Core JavaScript SDK31- @settlemint/sdk-portal - Smart contract portal API32- @settlemint/sdk-viem - Ethereum interface (Viem)33- @settlemint/sdk-blockscout - Blockchain explorer34- @settlemint/sdk-eas - Ethereum Attestation Service35- @settlemint/sdk-hasura - GraphQL/PostgreSQL36- @settlemint/sdk-ipfs - Decentralized storage37- @settlemint/sdk-minio - S3-compatible storage38- @settlemint/sdk-thegraph - Blockchain indexing39- @settlemint/sdk-next - Next.js components40- @settlemint/sdk-mcp - Model Context Protocol41- @settlemint/sdk-utils - Shared utilities4243**Key Features**44- Multi-chain blockchain support45- Smart contract deployment and verification46- Platform service integration47- Developer tooling and scaffolding48- GraphQL API generation49- TypeScript type generation50- Comprehensive CLI tools51- Example applications5253## Essential Commands5455### Development Workflow56```bash57# Setup58bun install # Install dependencies (root)59bun install --frozen-lockfile # CI-safe install6061# Development62bun run dev # Start development (turbo)63bun run dev:cli # Develop CLI package64bun run dev:portal # Develop portal package6566# Building67bun run build # Build all packages68bun run build:cli # Build CLI package69bun run build:sdk # Build SDK packages7071# Testing72bun test # Run all tests73bun test:unit # Run unit tests74bun test:e2e # Run e2e tests75bun test:coverage # Generate coverage report7677# Code Quality78bun run lint # Run Biome linter79bun run lint:fix # Fix linting issues80bun run format # Format with Biome81bun run typecheck # Run TypeScript checks8283# Documentation84bun run docs # Generate TypeDoc docs85bun run docs:build # Build documentation8687# Publishing88bun run changeset # Create changeset89bun run version # Version packages90bun run release # Release packages91```9293### Package Development94```bash95# Work on specific packages96cd sdk/cli && bun run dev # CLI development97cd sdk/js && bun test # Test JS SDK98cd sdk/portal && bun build # Build portal99100# Run package scripts101turbo run build --filter=@settlemint/sdk-cli102turbo run test --filter=@settlemint/sdk-*103```104105## Architecture & Code Organization106107### Repository Structure108```109/110├── sdk/ # SDK packages (monorepo)111│ ├── cli/ # CLI tool (@settlemint/sdk-cli)112│ ├── js/ # Core SDK (@settlemint/sdk-js)113│ ├── portal/ # Portal API (@settlemint/sdk-portal)114│ ├── viem/ # Viem integration (@settlemint/sdk-viem)115│ ├── blockscout/ # Explorer integration116│ ├── eas/ # Attestation service117│ ├── hasura/ # GraphQL/PostgreSQL118│ ├── ipfs/ # IPFS integration119│ ├── minio/ # S3 storage120│ ├── thegraph/ # Subgraph integration121│ ├── next/ # Next.js components122│ ├── mcp/ # MCP interface123│ └── utils/ # Shared utilities124├── test/ # E2E tests125├── docs/ # Documentation126├── scripts/ # Build scripts127├── fixtures/ # Test fixtures128├── turbo.json # Turbo config129├── biome.json # Biome config130└── package.json # Root package131```132133### Key Architecture Patterns1341351. **Monorepo Structure**136 - Bun workspaces for package management137 - Turbo for build orchestration138 - Shared dependencies and tooling139 - Independent package versioning1401412. **TypeScript-First Development**142 - Strict TypeScript configuration143 - Type generation for GraphQL144 - Shared type definitions in utils145 - Runtime validation with Zod1461473. **SDK Design Principles**148 - Each package is independently usable149 - Minimal dependencies between packages150 - Consistent API design across packages151 - Comprehensive TypeScript types1521534. **Platform Integration**154 - GraphQL for API communication155 - RESTful endpoints where appropriate156 - WebSocket support for real-time data157 - Authentication and authorization built-in158159## Development Guidelines160161### TypeScript Conventions162- **NO default exports** (except when framework requires)163- Use `import type` for type imports164- Prefer interfaces over type aliases for objects165- **Never use `any`** - use `unknown` or proper types166- Use discriminated unions for error handling167- Naming conventions:168 - Files: kebab-case169 - Variables/functions: camelCase170 - Types/interfaces/classes: PascalCase171 - Constants: UPPER_SNAKE_CASE172173### Code Style Rules174- Prefer nullish coalescing (`??`) over logical OR (`||`)175- Use early returns to reduce nesting176- Extract complex logic into well-named functions177- Keep functions small and focused178- Use structured logging with proper context179180### API Design Principles181- RESTful conventions for HTTP endpoints182- GraphQL for complex queries and subscriptions183- Consistent error responses184- Proper HTTP status codes185- Comprehensive OpenAPI documentation186187### Blockchain Best Practices188- Always validate addresses before use189- Handle chain-specific differences properly190- Implement proper gas estimation191- Use type-safe contract interactions192- Never store private keys in code or logs193194### Git Workflow195- **Never push to main branch**196- Branch naming: `feat/`, `fix/`, `chore/`, etc.197- Commit format: `type(scope): description`198- Create PRs for all changes199- Ensure CI passes before merge200201## Claude Code Best Practices202203- Always read entire files before making changes204- Run tests after modifications205- Check existing patterns before implementing new features206- Use the project's established error handling patterns207- Validate all blockchain interactions208- Keep security in mind - never expose sensitive data209- Use queue jobs for long-running operations210- Implement proper retry logic for external calls211212## Package-Specific Guidelines213214### SDK CLI (@settlemint/sdk-cli)215- Main entry point for developers216- Provides project scaffolding217- Handles authentication flows218- Manages deployments and configurations219220### SDK JS (@settlemint/sdk-js)221- Core platform integration222- API client for SettleMint services223- Authentication and authorization224- Resource management (nodes, networks, etc.)225226### SDK Portal (@settlemint/sdk-portal)227- Smart contract portal integration228- Contract deployment and verification229- Transaction management230- Event monitoring231232### SDK Viem (@settlemint/sdk-viem)233- Viem-based blockchain interactions234- Multi-chain support235- Type-safe contract calls236- Transaction helpers237238## Testing Guidelines239240- Write unit tests using Vitest241- E2E tests for CLI commands242- Mock external API calls243- Test error scenarios244- Use test fixtures for consistency245- Follow AAA pattern (Arrange, Act, Assert)246247## Environment Configuration248249Key environment variables:250- `SETTLEMINT_API_URL` - Platform API endpoint251- `SETTLEMINT_AUTH_TOKEN` - Authentication token252- `NODE_ENV` - Environment (development/production)253254Package-specific configs:255- Each SDK package may have its own configuration256- Check individual package README files257- Use `.env` files for local development258259## Troubleshooting260261### Common Issues2621. **Build errors**: Run `bun install` and `bun run build`2632. **Type errors**: Check with `bun run typecheck`2643. **Linting issues**: Fix with `bun run lint:fix`2654. **Test failures**: Check test output and mocks266267### Development Tips268- Use Turbo's cache for faster builds269- Run specific package tests with filters270- Check individual package README files271- Use `--verbose` flag for detailed output272273## Before Creating a PR2742751. **Run tests**: `bun test`2762. **Type check**: `bun run typecheck`2773. **Lint code**: `bun run lint`2784. **Format code**: `bun run format`2795. **Update documentation** if needed2806. **Test locally** with different scenarios281282## Project-Specific Notes283284- This is a developer SDK, not an application285- Supports the SettleMint blockchain platform286- Each package can be used independently287- Follow semantic versioning for releases288- Documentation is essential for all public APIs289290## Command Reference291292Use these Claude Code commands when appropriate:293- `/pr` - Create pull requests294- `/qa` - Run quality checks295- `/explore` - Understand architecture296- `/stuck` - Debug systematically297- `/deps` - Update dependencies safely298- `/performance` - Analyze performance299300## MCP Server Usage301302### Linear (Project Management)303When working with Linear tickets, use the MCP Linear tools:304305```306# Search for issues307mcp__linear__list_issues(query="ENG-3236", limit=10)308309# Get issue details310mcp__linear__get_issue(id="ENG-3236")311312# Update issue with comment and/or status313mcp__linear__update_issue(314 id="ENG-3236",315 stateId="<state-id>", # Optional: update status316 description="Updated description" # Optional: update description317)318319# Create comment on issue320mcp__linear__create_comment(321 issueId="<issue-id>",322 body="PR created: https://github.com/..."323)324325# List issue statuses to find stateId326mcp__linear__list_issue_statuses(teamId="<team-id>")327```328329When you create a PR for a Linear ticket:3301. Add a comment with the PR link using `mcp__linear__create_comment`3312. Update the issue status if needed using `mcp__linear__update_issue`3323. Include the Linear issue ID in the PR description for automatic linking333334### Sentry (Error Tracking)335Use Sentry MCP tools for error investigation:336337```338# Find organizations you have access to339mcp__sentry__find_organizations()340341# Find issues in an organization342mcp__sentry__find_issues(343 organizationSlug="settlemint",344 query="is:unresolved",345 sortBy="last_seen"346)347348# Get detailed error information349mcp__sentry__get_issue_details(350 organizationSlug="settlemint",351 issueId="PROJECT-123"352)353354# Update issue status355mcp__sentry__update_issue(356 organizationSlug="settlemint",357 issueId="PROJECT-123",358 status="resolved"359)360```361362### Context7 (Documentation)363Use for checking latest documentation:364365```366# Search for library documentation367mcp__context7__resolve-library-id(libraryName="viem")368369# Get library docs370mcp__context7__get-library-docs(371 context7CompatibleLibraryID="/wagmi-dev/viem",372 topic="contract-interactions"373)374```375376### DeepWiki (GitHub Documentation)377Use for repository documentation:378379```380# Get repository documentation structure381mcp__deepwiki__read_wiki_structure(repoName="wagmi-dev/viem")382383# Read repository documentation384mcp__deepwiki__read_wiki_contents(repoName="wagmi-dev/viem")385386# Ask questions about a repository387mcp__deepwiki__ask_question(388 repoName="wagmi-dev/viem",389 question="How do I deploy a contract?"390)391```
Also in settlemint/sdk
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| settlemint/sdk.cursor/rules/commands.mdc · 15 | Cursor rules | setup | 31/100 | 3 days ago | |
| settlemint/sdk.cursor/rules/solidity.mdc · 15 | Cursor rules | teststylearchtypes+6 | 73/100 | 3 days ago | |
| settlemint/sdk.cursor/rules/bun.mdc · 15 | Cursor rules | setupbuildtest | 73/100 | 3 days ago | |
| settlemint/sdk.cursor/rules/commits.mdc · 15 | Cursor rules | lint-formattypesgitdependencies | 48/100 | 3 days ago | |
| settlemint/sdk.cursor/rules/git-workflow.mdc · 15 | Cursor rules | gitdo-notagent-behaviour | 65/100 | 3 days ago | |
| settlemint/sdk.cursor/rules/mcp.mdc · 15 | Cursor rules | no sections | 4/100 | 3 days ago | |
| settlemint/sdk.cursor/rules/shadcn.mdc · 15 | Cursor rules | ui | 55/100 | 3 days ago | |
| settlemint/sdk.cursor/rules/typescript.mdc · 15 | Cursor rules | setuplint-formatstylearch+3 | 66/100 | 3 days ago |
Diff against .cursor/rules/commands.mdc Diff against .cursor/rules/solidity.mdc Diff against .cursor/rules/bun.mdc Diff against .cursor/rules/commits.mdc Diff against .cursor/rules/git-workflow.mdc Diff against .cursor/rules/mcp.mdc Diff against .cursor/rules/shadcn.mdc Diff against .cursor/rules/typescript.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today | |
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago | |
| carrot-foundation/middle-earthCLAUDE.md · 0 | CLAUDE.md | setupbuildtestlint-format+6 | 97/100 | 3 days ago | |
| caliber-ai-org/ai-setupCLAUDE.md · 1.2k | CLAUDE.md | buildtestlint-formatstyle+1 | 97/100 | 3 days ago |
