sf-experience-cloud
Skill15 starsChanged 7 months agoMITView on GitHub
Salesforce Experience Cloud — site setup, guest users, external sharing, LWC in communities, CMS, auth. Use when building portals or partner communities. Do NOT use for internal Lightning apps.
In this repository58 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- asideSkill
- checkpointSkill
- configure-sccSkill
- continuous-agent-loopSkill
- mcp-server-patternsSkill
- model-routeSkill
- prompt-optimizerSkill
- refactor-cleanSkill
- resume-sessionSkill
- save-sessionSkill
- search-firstSkill
- security-scanSkill
- sessionsSkill
- sf-2gp-security-reviewSkill
- sf-agentforce-developmentSkill
- sf-agentforce-mcp-actionsSkill
- sf-apex-async-patternsSkill
- sf-apex-best-practicesSkill
- sf-apex-constraintsSkill
- sf-apex-cursorSkill
- sf-apex-enterprise-patternsSkill
- sf-apex-testingSkill
- sf-api-designSkill
- sf-approval-processesSkill
- sf-aura-developmentSkill
- sf-build-fixSkill
- sf-cli-referenceSkill
- sf-data-modelingSkill
- sf-debuggingSkill
- sf-deployment-constraintsSkill
- sf-deploymentSkill
- sf-devops-ci-cdSkill
- sf-docs-lookupSkill
- sf-e2e-testingSkill
- sf-flow-developmentSkill
- sf-governor-limitsSkill
- sf-harness-auditSkill
- sf-helpSkill
- sf-integrationSkill
- sf-lwc-constraintsSkill
- sf-lwc-developmentSkill
- sf-lwc-testingSkill
- sf-metadata-managementSkill
- sf-platform-events-cdcSkill
- sf-quickstartSkill
- sf-security-constraintsSkill
- sf-securitySkill
- sf-soql-constraintsSkill
- sf-soql-optimizationSkill
- sf-tdd-workflowSkill
- sf-testing-constraintsSkill
- sf-trigger-constraintsSkill
- sf-trigger-frameworksSkill
- sf-visualforce-developmentSkill
- strategic-compactSkill
- update-docsSkill
- update-platform-docsSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
When building customer self-service portals, partner communities, or public-facing sites
- Distinctive: line 12
When configuring guest user access and reviewing external user security
- Distinctive: line 13
When developing LWC components for Experience Cloud sites
- Distinctive: line 14
When managing Experience Cloud deployment (Network, ExperienceBundle metadata)
- Distinctive: line 15
When designing sharing models for community/external users
- Distinctive: line 225
Verify guest user profile permissions
- Distinctive: line 226
Test with community user login
- Very specific: line 233
Use semantic URLs (/orders/12345 not /s/detail/a01xx000003ABC)
- Very specific: line 235
Use @AuraEnabled(cacheable=true) for read-only data
- Distinctive: line 236
Use Custom Labels for multi-language support
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Salesforce Experience Cloud
When to Use
- When building customer self-service portals, partner communities, or public-facing sites
- When configuring guest user access and reviewing external user security
- When developing LWC components for Experience Cloud sites
- When managing Experience Cloud deployment (Network, ExperienceBundle metadata)
- When designing sharing models for community/external users
@../_reference/EXPERIENCE_CLOUD.md
Site Setup Procedure
Step 1 — Choose Site Type
| Site Type | Use Case |
| Customer Service | Self-service portal (Knowledge, Cases) |
| Partner Central | Channel partner management (Leads, Opps) |
| Build Your Own (LWR) | Custom branded site, full customization |
| Help Center | Public knowledge base, no login required |
For new sites, use LWR (Lightning Web Runtime) for better performance, SEO, and LWC-only components.
Step 2 — Configure User Licensing
| User Type | License | Access |
| Customer Community | Community | Read/create own records |
| Customer Community Plus | Community Plus | Read/create + sharing rules |
| Partner Community | Partner Community | Leads, Opps, deal registration |
| Guest User | None | Public read access only |
Step 3 — Set Up Sharing Model
External users see records based on their Account association:
External User -> Contact -> Account -> Records shared with that AccountConfigure Sharing Sets in Setup for account-based access. Each community has automatic share groups: All Customer Portal Users, All Partner Users.
Guest User Configuration
Guest users access your site without logging in. This is the highest-risk area for data exposure.
Profile Permissions
- Grant Read only on objects explicitly needed for public display
- Review: Setup > Digital Experiences > [Site] > Guest User Profile
Guest User Sharing Rules
Configure in Setup > Sharing Settings > Guest User Sharing Rules:
Object: Knowledge__kav
Criteria: IsPublished__c = TRUE AND Channel__c includes 'Public'
Access: Read Only
Shared With: Guest User (site-specific)Securing Apex Controllers for Guest Access
// Use "with sharing" to enforce sharing rules
// Use WITH USER_MODE for CRUD/FLS enforcement
public with sharing class PublicKnowledgeController {
@AuraEnabled(cacheable=true)
public static List<Knowledge__kav> getPublicArticles() {
return [
SELECT Title, Summary FROM Knowledge__kav
WHERE PublishStatus = 'Online' AND IsVisibleInPkb = true
WITH USER_MODE
];
}
}with sharing is necessary but not sufficient for guest users. You must also configure Guest User Sharing Rules. Without them, the query returns zero results.
LWC in Experience Cloud
Component Meta XML
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>66.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightningCommunity__Page</target>
<target>lightningCommunity__Default</target>
</targets>
<targetConfigs>
<targetConfig targets="lightningCommunity__Default">
<property name="title" type="String" label="Card Title" default="Welcome"/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>Accessing Community Context
import communityId from '@salesforce/community/Id';
import communityBasePath from '@salesforce/community/basePath';
import isGuest from '@salesforce/user/isGuest';Light DOM for Theming
LWR sites support Light DOM, allowing site-level CSS to style component internals:
export default class ThemedComponent extends LightningElement {
static renderMode = 'light';
}Navigation
import { NavigationMixin } from 'lightning/navigation';
// Navigate to a community named page
this[NavigationMixin.Navigate]({
type: 'comm__namedPage',
attributes: { name: 'Home' }
});CMS Content
Manage content via CMS Workspaces, publish to site channels.
import { getContent } from 'experience/cmsDeliveryApi';
@wire(getContent, { channelId: '$channelId', contentKeyOrId: '$contentId' })
content;
get title() { return this.content?.data?.title?.value; }Custom Authentication
Self-Registration Handler
global class CustomRegistrationHandler implements Auth.RegistrationHandler {
global User createUser(Id portalId, Auth.UserData data) {
Account portalAccount = [SELECT Id FROM Account WHERE Name = 'Community Users' LIMIT 1];
Contact c = new Contact(
AccountId = portalAccount.Id, FirstName = data.firstName,
LastName = data.lastName, Email = data.email
);
insert c;
Profile p = [SELECT Id FROM Profile WHERE Name = 'Customer Community User'];
return new User(
ContactId = c.Id, ProfileId = p.Id,
Username = data.email + '.community',
FirstName = data.firstName, LastName = data.lastName,
Email = data.email, Alias = data.firstName != null ? data.firstName.left(8) : 'guest',
EmailEncodingKey = 'UTF-8', LanguageLocaleKey = 'en_US',
LocaleSidKey = 'en_US', TimeZoneSidKey = 'America/Los_Angeles'
);
}
global void updateUser(Id userId, Id portalId, Auth.UserData data) {
update new User(Id = userId, FirstName = data.firstName,
LastName = data.lastName, Email = data.email);
}
}Social login: configure in Settings > Login & Registration > Social Sign-On (Google, Facebook, Apple, LinkedIn, or custom OAuth providers).
Deployment Steps
Metadata Components
| Metadata Type | Directory |
| Network | networks/ |
| ExperienceBundle | experiences/ |
| CustomSite | sites/ |
| NavigationMenu | navigationMenus/ |
Deploy Procedure
sf project deploy start --source-dir force-app/main/default/experiences
sf project deploy start --source-dir force-app/main/default/networksPublish via Experience Builder UI or Apex: ConnectApi.Communities.publishCommunity(null, communityId);
Deployment Checklist
- Deploy Network metadata (site configuration)
- Deploy ExperienceBundle (pages, themes, routes)
- Deploy NavigationMenu and dependent components (LWC, Apex, objects)
- Publish the site
- Verify guest user profile permissions
- Test with community user login
SEO and Performance
- Configure sitemap in Settings > SEO (LWR sites only)
- Use semantic URLs (
/orders/12345not/s/detail/a01xx000003ABC) - Enable CDN caching for static assets (default for LWR)
- Use
@AuraEnabled(cacheable=true)for read-only data - Use Custom Labels for multi-language support
Related
Guardrails
- sf-security-constraints — Enforced rules for guest user permissions, sharing, and CRUD/FLS
Agents
- sf-lwc-agent — For LWC components used in Experience Cloud sites
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

