sf-dev

Provides Salesforce DX reference guidance for metadata, Apex, LWC, and CLI deployments.

13|17|Updated Jan 30, 2025
One-click install
npx skills add https://github.com/CodeWithSally/CodeWithSally-Apex-English --skill sf-dev-codewithsally
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sf-dev
Source: https://github.com/CodeWithSally/CodeWithSally-Apex-English/tree/main/Sessions/ClaudeCode/Session003/.claude/skills/sf-dev
Command: npx skills add https://github.com/CodeWithSally/CodeWithSally-Apex-English --skill sf-dev-codewithsally

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Salesforce DX projects fail deploys for obscure reasons: invalid metadata tags, permission set quirks, and Apex patterns that only surface at runtime. This Skill consolidates hard-won lessons into short reference files so you avoid deploy failures and write correct Apex and LWC code the first time. ## Core Features & Use Cases - Metadata Gotchas: Documents constraints for Html fields, CustomObject sharingModel (OWD), and API 66.0+ permission set rules like the removed userLicense tag and required-field FLS restrictions. - Apex & Testing Patterns: Covers @AuraEnabled annotations, custom permission checks with FeatureManagement, Comparable sorting, sharing keywords, and granting custom permissions in tests via SetupEntityAccess. - LWC & CLI Reference: Shows record context wiring, refreshApex after DML, js-meta.xml object targeting, and sf CLI commands for deploys, test runs, and permission set assignment. - Use Case: A deploy fails with "You cannot deploy to a required field" — load the metadata reference to find the exact permission set fix, then redeploy with the documented sf CLI command. ## Quick Start Ask the AI to load the sf-dev skill before writing Salesforce metadata, Apex controllers, or LWC components, or when troubleshooting a failed sf project deploy.

Frequently Asked Questions about sf-dev

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a failed Salesforce metadata deploy?

Run sf project deploy report --job-id <deployId> to see the full error, then check the metadata reference for known gotchas. Common causes include the removed userLicense tag in API 66.0+ permission sets and FLS entries on required fields.

How do I check a custom permission in Apex?

Use FeatureManagement.checkPermission('PermissionDeveloperName'), which returns true if the running user has the permission. Combine it with an ownership check and throw an AuraHandledException when authorization fails.

Why does my permission set deploy fail on a required field?

Salesforce rejects fieldPermissions entries for fields marked required, returning "You cannot deploy to a required field." Remove that field from fieldPermissions; required fields are always readable and editable implicitly.

How do I grant a custom permission in an Apex test?

Create a PermissionSet, insert a SetupEntityAccess linking it to the CustomPermission, assign it to a test user via PermissionSetAssignment, then run the test logic inside System.runAs(testUser).

How do I refresh wired Apex data in LWC after a save?

Store the wired result from your @wire function in a property, then call refreshApex with that stored result after the DML operation completes. This forces the wire to re-fetch updated data from the server.

What are the constraints for Html rich text fields in Salesforce metadata?

Html type fields cannot include a required tag and must specify visibleLines, such as 10. Including required causes a deploy failure, while omitting visibleLines also fails validation.