sf-apex-best-practices
CommunityWrite production-ready Apex with confidence
Software Engineering#best-practices#null-safety#error-handling#salesforce#apex#bulkification#code-style
Authorjiten-singh-shahi
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Inconsistent Apex structure, weak error handling, null-safety gaps, and inefficient collection usage cause brittle, hard-to-maintain Salesforce code and production incidents; this Skill provides clear, actionable conventions to make Apex classes robust and maintainable.
Core Features & Use Cases
- Class organization: Prescribed ordering for constants, statics, fields, constructors, public methods, private methods, and inner classes to improve readability and discoverability.
- Error handling and exceptions: Patterns for domain-specific exceptions, precise catch scopes, and meaningful messages including SaveResult inspection for partial DML failures.
- Null safety and collections: Guidance on null-safe navigation, map/list/set selection, and governor-limit-aware collection patterns and query-to-map idioms.
- Use Cases: Use when writing or reviewing Apex service classes, bulk processing logic, integration callouts, or refactoring legacy Apex for production readiness.
Quick Start
Analyze this Apex class and recommend reorganization, domain-specific exception usage, SaveResult checks, null-safety fixes, and collection optimizations for production readiness.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: sf-apex-best-practices Download link: https://github.com/jiten-singh-shahi/salesforce-claude-code/archive/main.zip#sf-apex-best-practices Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.