scc-universal 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +44 -0
- package/.cursor/agents/deep-researcher.md +142 -0
- package/.cursor/agents/doc-updater.md +219 -0
- package/.cursor/agents/eval-runner.md +335 -0
- package/.cursor/agents/learning-engine.md +210 -0
- package/.cursor/agents/loop-operator.md +245 -0
- package/.cursor/agents/refactor-cleaner.md +119 -0
- package/.cursor/agents/sf-admin-agent.md +127 -0
- package/.cursor/agents/sf-agentforce-agent.md +126 -0
- package/.cursor/agents/sf-apex-agent.md +117 -0
- package/.cursor/agents/sf-architect.md +426 -0
- package/.cursor/agents/sf-aura-reviewer.md +369 -0
- package/.cursor/agents/sf-bugfix-agent.md +101 -0
- package/.cursor/agents/sf-flow-agent.md +155 -0
- package/.cursor/agents/sf-integration-agent.md +141 -0
- package/.cursor/agents/sf-lwc-agent.md +123 -0
- package/.cursor/agents/sf-review-agent.md +357 -0
- package/.cursor/agents/sf-visualforce-reviewer.md +465 -0
- package/.cursor/hooks/adapter.js +81 -0
- package/.cursor/hooks/after-file-edit.js +26 -0
- package/.cursor/hooks/after-mcp-execution.js +12 -0
- package/.cursor/hooks/after-shell-execution.js +30 -0
- package/.cursor/hooks/after-tab-file-edit.js +12 -0
- package/.cursor/hooks/before-mcp-execution.js +11 -0
- package/.cursor/hooks/before-read-file.js +13 -0
- package/.cursor/hooks/before-shell-execution.js +29 -0
- package/.cursor/hooks/before-submit-prompt.js +23 -0
- package/.cursor/hooks/pre-compact.js +7 -0
- package/.cursor/hooks/session-end.js +10 -0
- package/.cursor/hooks/session-start.js +10 -0
- package/.cursor/hooks/stop.js +18 -0
- package/.cursor/hooks/subagent-start.js +10 -0
- package/.cursor/hooks/subagent-stop.js +10 -0
- package/.cursor/hooks.json +107 -0
- package/.cursor/skills/aside/SKILL.md +115 -0
- package/.cursor/skills/checkpoint/SKILL.md +50 -0
- package/.cursor/skills/configure-scc/SKILL.md +160 -0
- package/.cursor/skills/continuous-agent-loop/SKILL.md +260 -0
- package/.cursor/skills/mcp-server-patterns/SKILL.md +142 -0
- package/.cursor/skills/model-route/SKILL.md +81 -0
- package/.cursor/skills/prompt-optimizer/SKILL.md +366 -0
- package/.cursor/skills/refactor-clean/SKILL.md +133 -0
- package/.cursor/skills/resume-session/SKILL.md +111 -0
- package/.cursor/skills/save-session/SKILL.md +183 -0
- package/.cursor/skills/search-first/SKILL.md +140 -0
- package/.cursor/skills/security-scan/SKILL.md +142 -0
- package/.cursor/skills/sessions/SKILL.md +124 -0
- package/.cursor/skills/sf-agentforce-development/SKILL.md +449 -0
- package/.cursor/skills/sf-apex-async-patterns/SKILL.md +324 -0
- package/.cursor/skills/sf-apex-best-practices/SKILL.md +421 -0
- package/.cursor/skills/sf-apex-constraints/SKILL.md +79 -0
- package/.cursor/skills/sf-apex-cursor/SKILL.md +336 -0
- package/.cursor/skills/sf-apex-enterprise-patterns/SKILL.md +344 -0
- package/.cursor/skills/sf-apex-testing/SKILL.md +407 -0
- package/.cursor/skills/sf-api-design/SKILL.md +237 -0
- package/.cursor/skills/sf-approval-processes/SKILL.md +312 -0
- package/.cursor/skills/sf-aura-development/SKILL.md +260 -0
- package/.cursor/skills/sf-build-fix/SKILL.md +120 -0
- package/.cursor/skills/sf-data-modeling/SKILL.md +274 -0
- package/.cursor/skills/sf-debugging/SKILL.md +362 -0
- package/.cursor/skills/sf-deployment/SKILL.md +291 -0
- package/.cursor/skills/sf-deployment-constraints/SKILL.md +153 -0
- package/.cursor/skills/sf-devops-ci-cd/SKILL.md +322 -0
- package/.cursor/skills/sf-docs-lookup/SKILL.md +100 -0
- package/.cursor/skills/sf-e2e-testing/SKILL.md +321 -0
- package/.cursor/skills/sf-experience-cloud/SKILL.md +248 -0
- package/.cursor/skills/sf-flow-development/SKILL.md +376 -0
- package/.cursor/skills/sf-governor-limits/SKILL.md +319 -0
- package/.cursor/skills/sf-harness-audit/SKILL.md +139 -0
- package/.cursor/skills/sf-help/SKILL.md +156 -0
- package/.cursor/skills/sf-integration/SKILL.md +479 -0
- package/.cursor/skills/sf-lwc-constraints/SKILL.md +128 -0
- package/.cursor/skills/sf-lwc-development/SKILL.md +302 -0
- package/.cursor/skills/sf-lwc-testing/SKILL.md +387 -0
- package/.cursor/skills/sf-metadata-management/SKILL.md +285 -0
- package/.cursor/skills/sf-platform-events-cdc/SKILL.md +372 -0
- package/.cursor/skills/sf-quickstart/SKILL.md +170 -0
- package/.cursor/skills/sf-security/SKILL.md +330 -0
- package/.cursor/skills/sf-security-constraints/SKILL.md +125 -0
- package/.cursor/skills/sf-soql-constraints/SKILL.md +129 -0
- package/.cursor/skills/sf-soql-optimization/SKILL.md +353 -0
- package/.cursor/skills/sf-tdd-workflow/SKILL.md +332 -0
- package/.cursor/skills/sf-testing-constraints/SKILL.md +198 -0
- package/.cursor/skills/sf-trigger-constraints/SKILL.md +88 -0
- package/.cursor/skills/sf-trigger-frameworks/SKILL.md +343 -0
- package/.cursor/skills/sf-visualforce-development/SKILL.md +259 -0
- package/.cursor/skills/strategic-compact/SKILL.md +205 -0
- package/.cursor/skills/update-docs/SKILL.md +162 -0
- package/.cursor/skills/update-platform-docs/SKILL.md +86 -0
- package/.cursor-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +522 -0
- package/agents/deep-researcher.md +145 -0
- package/agents/doc-updater.md +222 -0
- package/agents/eval-runner.md +340 -0
- package/agents/learning-engine.md +211 -0
- package/agents/loop-operator.md +247 -0
- package/agents/refactor-cleaner.md +122 -0
- package/agents/sf-admin-agent.md +131 -0
- package/agents/sf-agentforce-agent.md +132 -0
- package/agents/sf-apex-agent.md +124 -0
- package/agents/sf-architect.md +435 -0
- package/agents/sf-aura-reviewer.md +372 -0
- package/agents/sf-bugfix-agent.md +105 -0
- package/agents/sf-flow-agent.md +159 -0
- package/agents/sf-integration-agent.md +146 -0
- package/agents/sf-lwc-agent.md +127 -0
- package/agents/sf-review-agent.md +366 -0
- package/agents/sf-visualforce-reviewer.md +468 -0
- package/assets/logo.svg +18 -0
- package/docs/ARCHITECTURE.md +133 -0
- package/docs/authoring-guide.md +373 -0
- package/docs/hook-development.md +578 -0
- package/docs/token-optimization.md +139 -0
- package/docs/workflow-examples.md +645 -0
- package/examples/agentforce-action/README.md +227 -0
- package/examples/apex-trigger-handler/README.md +114 -0
- package/examples/devops-pipeline/README.md +325 -0
- package/examples/flow-automation/README.md +188 -0
- package/examples/integration-pattern/README.md +416 -0
- package/examples/lwc-component/README.md +180 -0
- package/examples/platform-events/README.md +492 -0
- package/examples/scratch-org-setup/README.md +138 -0
- package/examples/security-audit/README.md +244 -0
- package/examples/visualforce-migration/README.md +314 -0
- package/hooks/hooks.json +338 -0
- package/hooks/memory-persistence/README.md +73 -0
- package/manifests/install-modules.json +217 -0
- package/manifests/install-profiles.json +17 -0
- package/mcp-configs/mcp-servers.json +19 -0
- package/package.json +89 -0
- package/schemas/hooks.schema.json +123 -0
- package/schemas/install-modules.schema.json +76 -0
- package/schemas/install-profiles.schema.json +28 -0
- package/schemas/install-state.schema.json +73 -0
- package/schemas/package-manager.schema.json +18 -0
- package/schemas/plugin.schema.json +112 -0
- package/schemas/scc-install-config.schema.json +29 -0
- package/schemas/state-store.schema.json +111 -0
- package/scripts/cli/install-apply.js +170 -0
- package/scripts/cli/uninstall.js +193 -0
- package/scripts/hooks/check-console-log.js +101 -0
- package/scripts/hooks/check-hook-enabled.js +17 -0
- package/scripts/hooks/check-platform-docs-age.js +48 -0
- package/scripts/hooks/cost-tracker.js +78 -0
- package/scripts/hooks/doc-file-warning.js +63 -0
- package/scripts/hooks/evaluate-session.js +98 -0
- package/scripts/hooks/governor-check.js +220 -0
- package/scripts/hooks/learning-observe.sh +206 -0
- package/scripts/hooks/mcp-health-check.js +588 -0
- package/scripts/hooks/post-bash-build-complete.js +34 -0
- package/scripts/hooks/post-bash-pr-created.js +43 -0
- package/scripts/hooks/post-edit-console-warn.js +61 -0
- package/scripts/hooks/post-edit-format.js +79 -0
- package/scripts/hooks/post-edit-typecheck.js +98 -0
- package/scripts/hooks/post-write.js +168 -0
- package/scripts/hooks/pre-bash-git-push-reminder.js +35 -0
- package/scripts/hooks/pre-bash-tmux-reminder.js +47 -0
- package/scripts/hooks/pre-compact.js +51 -0
- package/scripts/hooks/pre-tool-use.js +163 -0
- package/scripts/hooks/pre-write-doc-warn.js +9 -0
- package/scripts/hooks/quality-gate.js +251 -0
- package/scripts/hooks/run-with-flags-shell.sh +32 -0
- package/scripts/hooks/run-with-flags.js +135 -0
- package/scripts/hooks/session-end-marker.js +29 -0
- package/scripts/hooks/session-end.js +311 -0
- package/scripts/hooks/session-start.js +202 -0
- package/scripts/hooks/sfdx-scanner-check.js +142 -0
- package/scripts/hooks/sfdx-validate.js +119 -0
- package/scripts/hooks/stop-hook.js +170 -0
- package/scripts/hooks/suggest-compact.js +67 -0
- package/scripts/lib/agent-adapter.js +82 -0
- package/scripts/lib/apex-analysis.js +194 -0
- package/scripts/lib/hook-flags.js +74 -0
- package/scripts/lib/install-config.js +73 -0
- package/scripts/lib/install-executor.js +363 -0
- package/scripts/lib/install-state.js +121 -0
- package/scripts/lib/orchestration-session.js +299 -0
- package/scripts/lib/package-manager.js +124 -0
- package/scripts/lib/project-detect.js +228 -0
- package/scripts/lib/schema-validator.js +190 -0
- package/scripts/lib/skill-adapter.js +100 -0
- package/scripts/lib/state-store.js +376 -0
- package/scripts/lib/tmux-worktree-orchestrator.js +598 -0
- package/scripts/lib/utils.js +313 -0
- package/scripts/scc.js +164 -0
- package/skills/_reference/AGENTFORCE_PATTERNS.md +112 -0
- package/skills/_reference/APEX_CURSOR.md +159 -0
- package/skills/_reference/API_VERSIONS.md +78 -0
- package/skills/_reference/APPROVAL_PROCESSES.md +105 -0
- package/skills/_reference/ASYNC_PATTERNS.md +163 -0
- package/skills/_reference/AURA_COMPONENTS.md +146 -0
- package/skills/_reference/DATA_MIGRATION_PATTERNS.md +151 -0
- package/skills/_reference/DATA_MODELING.md +124 -0
- package/skills/_reference/DEBUGGING_TOOLS.md +140 -0
- package/skills/_reference/DEPLOYMENT_CHECKLIST.md +87 -0
- package/skills/_reference/DEPRECATIONS.md +79 -0
- package/skills/_reference/DOCKER_CI_PATTERNS.md +138 -0
- package/skills/_reference/ENTERPRISE_PATTERNS.md +122 -0
- package/skills/_reference/EXPERIENCE_CLOUD.md +143 -0
- package/skills/_reference/FLOW_PATTERNS.md +113 -0
- package/skills/_reference/GOVERNOR_LIMITS.md +77 -0
- package/skills/_reference/INTEGRATION_PATTERNS.md +105 -0
- package/skills/_reference/LWC_PATTERNS.md +79 -0
- package/skills/_reference/METADATA_TYPES.md +115 -0
- package/skills/_reference/NAMING_CONVENTIONS.md +84 -0
- package/skills/_reference/PACKAGE_DEVELOPMENT.md +150 -0
- package/skills/_reference/PLATFORM_EVENTS.md +121 -0
- package/skills/_reference/REPORTING_API.md +143 -0
- package/skills/_reference/SCRATCH_ORG_PATTERNS.md +126 -0
- package/skills/_reference/SECURITY_PATTERNS.md +127 -0
- package/skills/_reference/SHARING_MODEL.md +120 -0
- package/skills/_reference/SOQL_PATTERNS.md +119 -0
- package/skills/_reference/TESTING_STANDARDS.md +96 -0
- package/skills/_reference/TRIGGER_PATTERNS.md +114 -0
- package/skills/_reference/VISUALFORCE_PATTERNS.md +121 -0
- package/skills/aside/SKILL.md +118 -0
- package/skills/checkpoint/SKILL.md +53 -0
- package/skills/configure-scc/SKILL.md +163 -0
- package/skills/continuous-agent-loop/SKILL.md +264 -0
- package/skills/mcp-server-patterns/SKILL.md +146 -0
- package/skills/model-route/SKILL.md +84 -0
- package/skills/prompt-optimizer/SKILL.md +369 -0
- package/skills/refactor-clean/SKILL.md +136 -0
- package/skills/resume-session/SKILL.md +114 -0
- package/skills/save-session/SKILL.md +186 -0
- package/skills/search-first/SKILL.md +144 -0
- package/skills/security-scan/SKILL.md +146 -0
- package/skills/sessions/SKILL.md +127 -0
- package/skills/sf-agentforce-development/SKILL.md +450 -0
- package/skills/sf-apex-async-patterns/SKILL.md +326 -0
- package/skills/sf-apex-best-practices/SKILL.md +425 -0
- package/skills/sf-apex-constraints/SKILL.md +81 -0
- package/skills/sf-apex-cursor/SKILL.md +338 -0
- package/skills/sf-apex-enterprise-patterns/SKILL.md +348 -0
- package/skills/sf-apex-testing/SKILL.md +409 -0
- package/skills/sf-api-design/SKILL.md +238 -0
- package/skills/sf-approval-processes/SKILL.md +315 -0
- package/skills/sf-aura-development/SKILL.md +263 -0
- package/skills/sf-build-fix/SKILL.md +121 -0
- package/skills/sf-data-modeling/SKILL.md +278 -0
- package/skills/sf-debugging/SKILL.md +363 -0
- package/skills/sf-deployment/SKILL.md +295 -0
- package/skills/sf-deployment-constraints/SKILL.md +155 -0
- package/skills/sf-devops-ci-cd/SKILL.md +325 -0
- package/skills/sf-docs-lookup/SKILL.md +103 -0
- package/skills/sf-e2e-testing/SKILL.md +324 -0
- package/skills/sf-experience-cloud/SKILL.md +249 -0
- package/skills/sf-flow-development/SKILL.md +377 -0
- package/skills/sf-governor-limits/SKILL.md +323 -0
- package/skills/sf-harness-audit/SKILL.md +142 -0
- package/skills/sf-help/SKILL.md +159 -0
- package/skills/sf-integration/SKILL.md +483 -0
- package/skills/sf-lwc-constraints/SKILL.md +130 -0
- package/skills/sf-lwc-development/SKILL.md +303 -0
- package/skills/sf-lwc-testing/SKILL.md +388 -0
- package/skills/sf-metadata-management/SKILL.md +288 -0
- package/skills/sf-platform-events-cdc/SKILL.md +375 -0
- package/skills/sf-quickstart/SKILL.md +173 -0
- package/skills/sf-security/SKILL.md +334 -0
- package/skills/sf-security-constraints/SKILL.md +127 -0
- package/skills/sf-soql-constraints/SKILL.md +131 -0
- package/skills/sf-soql-optimization/SKILL.md +354 -0
- package/skills/sf-tdd-workflow/SKILL.md +336 -0
- package/skills/sf-testing-constraints/SKILL.md +200 -0
- package/skills/sf-trigger-constraints/SKILL.md +90 -0
- package/skills/sf-trigger-frameworks/SKILL.md +347 -0
- package/skills/sf-visualforce-development/SKILL.md +260 -0
- package/skills/strategic-compact/SKILL.md +208 -0
- package/skills/update-docs/SKILL.md +165 -0
- package/skills/update-platform-docs/SKILL.md +90 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Testing Standards — Salesforce Reference
|
|
2
|
+
|
|
3
|
+
> Last verified: API v66.0 (Spring '26)
|
|
4
|
+
> Source: <https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing.htm>
|
|
5
|
+
|
|
6
|
+
## Coverage Requirements
|
|
7
|
+
|
|
8
|
+
| Context | Minimum Coverage | Recommended Target |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| Production deployment | 75% org-wide | 85%+ per class |
|
|
11
|
+
| Managed package (AppExchange) | 75% org-wide | 90%+ per class |
|
|
12
|
+
| Per-class (not enforced but tracked) | 0% | 80%+ |
|
|
13
|
+
|
|
14
|
+
Coverage measures **lines executed**, not branches tested. 100% line coverage can still miss branches in `if/else` statements.
|
|
15
|
+
|
|
16
|
+
## Core Annotations
|
|
17
|
+
|
|
18
|
+
| Annotation | Scope | Purpose |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `@IsTest` / `@isTest` | Class or method | Marks code as test-only (not counted toward coverage) |
|
|
21
|
+
| `@TestSetup` | Method | Runs once per class; each test method gets its own rollback |
|
|
22
|
+
| `@TestVisible` | Field or method | Makes private members accessible in tests without changing access modifiers |
|
|
23
|
+
| `@testFor(ClassName)` | Class (v66.0+) | Explicitly maps test class to production class for `RunRelevantTests` |
|
|
24
|
+
|
|
25
|
+
## Test Class Rules
|
|
26
|
+
|
|
27
|
+
| Rule | Detail |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Test classes deploy to production | They DO count toward the 6 MB Apex code size limit |
|
|
30
|
+
| Test classes are excluded from coverage | They are not included in coverage calculations |
|
|
31
|
+
| `@TestSetup` data is isolated per method | Each test method gets a fresh transaction with setup data |
|
|
32
|
+
| No `SeeAllData=true` | Exception: Pricebook-dependent tests only |
|
|
33
|
+
| No hardcoded Record IDs | IDs differ between orgs and sandboxes |
|
|
34
|
+
|
|
35
|
+
## Test.startTest() / Test.stopTest()
|
|
36
|
+
|
|
37
|
+
| Behavior | Detail |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `Test.startTest()` | Resets all governor limit counters — fresh budget for code under test |
|
|
40
|
+
| `Test.stopTest()` | Async work (@future, Queueable, Batch) enqueued inside the block runs synchronously here |
|
|
41
|
+
| Scope | Only one `startTest/stopTest` pair per test method |
|
|
42
|
+
|
|
43
|
+
## TestDataFactory Pattern
|
|
44
|
+
|
|
45
|
+
A central `@IsTest` factory class that creates test records consistently across the test suite. Benefits:
|
|
46
|
+
|
|
47
|
+
- Prevents duplicated record-creation logic across test classes
|
|
48
|
+
- Ensures valid test data with all required fields populated
|
|
49
|
+
- Supports override maps for scenario-specific field values
|
|
50
|
+
- Centralizes maintenance when field requirements change
|
|
51
|
+
|
|
52
|
+
## Test Method Naming
|
|
53
|
+
|
|
54
|
+
Format: `test{MethodName}_{scenario}_{expectedResult}`
|
|
55
|
+
|
|
56
|
+
Examples:
|
|
57
|
+
|
|
58
|
+
- `testCalculateDiscount_premiumTier_returns20Percent()`
|
|
59
|
+
- `testCreateAccount_duplicateName_throwsException()`
|
|
60
|
+
- `testProcessOrders_emptyList_noExceptionThrown()`
|
|
61
|
+
|
|
62
|
+
## Assertion API
|
|
63
|
+
|
|
64
|
+
| API | Minimum Version | Notes |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `Assert.areEqual()`, `Assert.isTrue()`, `Assert.fail()` | v56.0+ | Preferred — clearer method names |
|
|
67
|
+
| `System.assertEquals()`, `System.assert()` | All versions | Legacy — still valid |
|
|
68
|
+
|
|
69
|
+
Every test method must have at least one meaningful assertion. Asserting only that a record was inserted is insufficient — assert specific field values and business logic outcomes.
|
|
70
|
+
|
|
71
|
+
## Bulk Testing
|
|
72
|
+
|
|
73
|
+
Always test with **200 records** (the standard trigger batch size). A method that works with 1 record may fail at governor limits with 200.
|
|
74
|
+
|
|
75
|
+
## Mock Patterns
|
|
76
|
+
|
|
77
|
+
| Pattern | Use Case |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `HttpCalloutMock` | Mock HTTP callouts in test context |
|
|
80
|
+
| `System.StubProvider` | Mock arbitrary interfaces without HTTP |
|
|
81
|
+
| `Test.setMock()` | Register the mock before the code under test runs |
|
|
82
|
+
|
|
83
|
+
## RunRelevantTests (Spring '26, API v66.0+)
|
|
84
|
+
|
|
85
|
+
Smart test-selection mode that runs only tests statistically linked to changed Apex classes. Pair with `@testFor` for explicit mapping. Falls back to `RunLocalTests` if `sourceApiVersion` < 66.0.
|
|
86
|
+
|
|
87
|
+
## Anti-Patterns
|
|
88
|
+
|
|
89
|
+
| Anti-Pattern | Problem | Fix |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| No assertions | Test always passes | Every test needs meaningful assertions |
|
|
92
|
+
| `SeeAllData=true` | Brittle, fails on sandbox refresh | Create data in test |
|
|
93
|
+
| One method testing 10 scenarios | Masks which scenario fails | One scenario per test method |
|
|
94
|
+
| Hardcoded IDs | Fails in other orgs | Query or create records |
|
|
95
|
+
| Missing `@testFor` | RunRelevantTests may skip test | Add `@testFor(ClassName)` |
|
|
96
|
+
| No bulk test (200 records) | Governor limit violations hidden | Test with 200 records |
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Trigger Patterns -- Reference
|
|
2
|
+
|
|
3
|
+
> Source: <https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm>
|
|
4
|
+
> Source: <https://github.com/kevinohara80/sfdc-trigger-framework>
|
|
5
|
+
> Source: <https://github.com/apex-enterprise-patterns/fflib-apex-common>
|
|
6
|
+
> Last verified: API v66.0, Spring '26 (2026-03-28)
|
|
7
|
+
|
|
8
|
+
## Order of Execution (Record Save)
|
|
9
|
+
|
|
10
|
+
| Step | Phase |
|
|
11
|
+
|------|-------|
|
|
12
|
+
| 1 | Load original record from DB (or init new) |
|
|
13
|
+
| 2 | Overwrite field values from request |
|
|
14
|
+
| 3 | System validation (layout rules, field types, max length) |
|
|
15
|
+
| 4 | Before-save record-triggered flows |
|
|
16
|
+
| 5 | **Before triggers** execute |
|
|
17
|
+
| 6 | Custom validation rules |
|
|
18
|
+
| 7 | Duplicate rules |
|
|
19
|
+
| 8 | Record saved to DB (not committed) |
|
|
20
|
+
| 9 | **After triggers** execute |
|
|
21
|
+
| 10 | Assignment rules |
|
|
22
|
+
| 11 | Auto-response rules |
|
|
23
|
+
| 12 | Workflow rules evaluate; field updates execute |
|
|
24
|
+
| 13 | If workflow field update fired: re-runs before/after update triggers **once more** (custom validation skipped) |
|
|
25
|
+
| 14 | Escalation rules |
|
|
26
|
+
| 15 | After-save record-triggered flows |
|
|
27
|
+
| 16 | Entitlement rules |
|
|
28
|
+
| 17 | Roll-up summary fields on parent; parent goes through own save cycle |
|
|
29
|
+
| 18 | Criteria-based sharing recalculated |
|
|
30
|
+
| 19 | DML committed; post-commit logic (async jobs, emails, platform events) |
|
|
31
|
+
|
|
32
|
+
Multiple triggers on the same object + event have **no guaranteed execution order**.
|
|
33
|
+
|
|
34
|
+
## Trigger Context Variables
|
|
35
|
+
|
|
36
|
+
| Variable | Type | Available |
|
|
37
|
+
|----------|------|-----------|
|
|
38
|
+
| `Trigger.isExecuting` | `Boolean` | All contexts |
|
|
39
|
+
| `Trigger.isBefore` | `Boolean` | All contexts |
|
|
40
|
+
| `Trigger.isAfter` | `Boolean` | All contexts |
|
|
41
|
+
| `Trigger.isInsert` | `Boolean` | All contexts |
|
|
42
|
+
| `Trigger.isUpdate` | `Boolean` | All contexts |
|
|
43
|
+
| `Trigger.isDelete` | `Boolean` | All contexts |
|
|
44
|
+
| `Trigger.isUndelete` | `Boolean` | All contexts |
|
|
45
|
+
| `Trigger.new` | `List<sObject>` | insert, update, undelete |
|
|
46
|
+
| `Trigger.old` | `List<sObject>` | update, delete |
|
|
47
|
+
| `Trigger.newMap` | `Map<Id, sObject>` | after insert, before/after update, after undelete |
|
|
48
|
+
| `Trigger.oldMap` | `Map<Id, sObject>` | update, delete |
|
|
49
|
+
| `Trigger.operationType` | `System.TriggerOperation` | All contexts |
|
|
50
|
+
| `Trigger.size` | `Integer` | All contexts |
|
|
51
|
+
|
|
52
|
+
`Trigger.new` is mutable only in **before** triggers. `Trigger.old` is always read-only.
|
|
53
|
+
|
|
54
|
+
## Framework Comparison
|
|
55
|
+
|
|
56
|
+
| Aspect | Kevin O'Hara TriggerHandler | FFLIB Domain Layer (fflib_SObjectDomain) |
|
|
57
|
+
|--------|----------------------------|------------------------------------------|
|
|
58
|
+
| **Complexity** | Low -- single base class | High -- domain + selector + UoW |
|
|
59
|
+
| **Trigger body** | `new Handler().run();` | `fflib_SObjectDomain.triggerHandler(Domain.class);` |
|
|
60
|
+
| **Handler methods** | `beforeInsert()`, `afterInsert()`, `beforeUpdate()`, `afterUpdate()`, `beforeDelete()`, `afterDelete()`, `afterUndelete()` | `onBeforeInsert()`, `onAfterInsert()`, `onBeforeUpdate()`, `onAfterUpdate()`, `onBeforeDelete()`, `onAfterDelete()`, `onAfterUndelete()`, plus `onApplyDefaults()`, `onValidate()` |
|
|
61
|
+
| **Bypass** | `TriggerHandler.bypass('HandlerName')` / `.clearBypass()` / `.clearAllBypasses()` | `fflib_SObjectDomain.getTriggerEvent(Type).disableAll()` |
|
|
62
|
+
| **Recursion guard** | `setMaxLoopCount(n)` -- throws exception on exceed | Manual via static flags or `fflib_SObjectDomain` configuration |
|
|
63
|
+
| **Testability** | Standard Apex DML | Supports DI/mocking via Application factory |
|
|
64
|
+
| **Best for** | Small-to-medium orgs, straightforward logic | Enterprise orgs, complex multi-object transactions |
|
|
65
|
+
|
|
66
|
+
## One-Trigger-Per-Object Pattern
|
|
67
|
+
|
|
68
|
+
Every sObject gets exactly **one** trigger that delegates to a handler class.
|
|
69
|
+
|
|
70
|
+
```apex
|
|
71
|
+
trigger AccountTrigger on Account (
|
|
72
|
+
before insert, before update, before delete,
|
|
73
|
+
after insert, after update, after delete, after undelete
|
|
74
|
+
) {
|
|
75
|
+
new AccountTriggerHandler().run();
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Recursion Prevention Patterns
|
|
80
|
+
|
|
81
|
+
| Pattern | Mechanism | Trade-off |
|
|
82
|
+
|---------|-----------|-----------|
|
|
83
|
+
| Static `Boolean` flag | `if (hasRun) return; hasRun = true;` | Blocks all re-entry including legitimate workflow re-fire |
|
|
84
|
+
| Static `Set<Id>` processed | Skip IDs already in set | Allows first pass per record; handles partial batches correctly |
|
|
85
|
+
| `setMaxLoopCount(n)` | TriggerHandler throws exception after n invocations | Configurable; exception must be handled or allowed to surface |
|
|
86
|
+
| Static counter | Increment on entry, check threshold | Flexible but manual |
|
|
87
|
+
|
|
88
|
+
Recommended: **`Set<Id>`-based** for most cases -- prevents true recursion while allowing workflow-triggered re-entry for records not yet processed.
|
|
89
|
+
|
|
90
|
+
## Bypass Mechanisms
|
|
91
|
+
|
|
92
|
+
```apex
|
|
93
|
+
// Kevin O'Hara pattern
|
|
94
|
+
TriggerHandler.bypass('AccountTriggerHandler');
|
|
95
|
+
update accounts; // handler skipped
|
|
96
|
+
TriggerHandler.clearBypass('AccountTriggerHandler');
|
|
97
|
+
|
|
98
|
+
// Custom Metadata bypass (org-configurable, no deploy)
|
|
99
|
+
Trigger_Setting__mdt setting = Trigger_Setting__mdt.getInstance('Account');
|
|
100
|
+
if (setting != null && setting.Is_Active__c == false) return;
|
|
101
|
+
|
|
102
|
+
// Hierarchy Custom Setting bypass (per-user/profile)
|
|
103
|
+
Trigger_Config__c config = Trigger_Config__c.getInstance();
|
|
104
|
+
if (config != null && config.Disable_Account_Trigger__c) return;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Key Rules
|
|
108
|
+
|
|
109
|
+
- Triggers fire on DML, not on formula/roll-up recalculation.
|
|
110
|
+
- Bulk triggers receive up to **200 records per batch** (`Trigger.size` max per chunk in Data Loader = 200).
|
|
111
|
+
- `addError()` on `Trigger.new` records prevents save (before triggers) or rolls back (after triggers).
|
|
112
|
+
- Callouts in triggers require `@future(callout=true)` or `Queueable` -- direct callouts are blocked.
|
|
113
|
+
- `before delete` and `after delete` do not fire on `merge` for the losing records (they get delete triggers).
|
|
114
|
+
- Undelete triggers: only `after undelete` exists; there is no `before undelete`.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<!-- Source: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_intro.htm -->
|
|
2
|
+
<!-- Last verified: API v66.0 — 2026-03-29 -->
|
|
3
|
+
<!-- WARNING: Web fetch of canonical URL failed (LWR client-side rendering). Facts below extracted from sf-visualforce-development skill. -->
|
|
4
|
+
|
|
5
|
+
# Visualforce Patterns — Reference
|
|
6
|
+
|
|
7
|
+
## Page Structure
|
|
8
|
+
|
|
9
|
+
| Attribute | Purpose | Notes |
|
|
10
|
+
|-----------|---------|-------|
|
|
11
|
+
| `standardController` | Binds to standard SObject controller | Mutually exclusive with `controller` |
|
|
12
|
+
| `controller` | Custom Apex controller class | Mutually exclusive with `standardController` |
|
|
13
|
+
| `extensions` | Comma-separated controller extensions | Works with either controller type |
|
|
14
|
+
| `renderAs` | Output format (`"pdf"` for PDF generation) | LWC cannot do this natively |
|
|
15
|
+
| `lightningStylesheets` | Apply SLDS styling | Use for Lightning-compatible look |
|
|
16
|
+
| `docType` | HTML doctype | Use `"html-5.0"` for modern pages |
|
|
17
|
+
| `sidebar` | Show/hide Classic sidebar | Boolean |
|
|
18
|
+
| `showHeader` | Show/hide Classic header | Boolean |
|
|
19
|
+
| `applyBodyTag` | Generate `<body>` tag | Set `false` for full HTML control |
|
|
20
|
+
|
|
21
|
+
## Controller Types
|
|
22
|
+
|
|
23
|
+
| Type | Class Pattern | Constructor Signature | Use Case |
|
|
24
|
+
|------|--------------|----------------------|----------|
|
|
25
|
+
| Standard Controller | Built-in (no Apex) | N/A | Single-record CRUD without custom logic |
|
|
26
|
+
| Standard List Controller | Built-in (`recordSetVar`) | N/A | List views with pagination (`hasNext`, `hasPrevious`) |
|
|
27
|
+
| Custom Controller | `public with sharing class Ctrl` | No-arg: `public Ctrl()` | Full control over logic, data, navigation |
|
|
28
|
+
| Controller Extension | `public with sharing class Ext` | `public Ext(ApexPages.StandardController sc)` | Add functionality to standard/custom controllers |
|
|
29
|
+
|
|
30
|
+
## ViewState
|
|
31
|
+
|
|
32
|
+
| Fact | Value |
|
|
33
|
+
|------|-------|
|
|
34
|
+
| Maximum ViewState size | **170 KB** (runtime error if exceeded) |
|
|
35
|
+
| Storage mechanism | Hidden, encrypted form field |
|
|
36
|
+
| Survives across | Postbacks (form submissions) |
|
|
37
|
+
|
|
38
|
+
### What Counts Toward ViewState
|
|
39
|
+
|
|
40
|
+
- All non-transient controller/extension instance variables
|
|
41
|
+
- Component tree state
|
|
42
|
+
- Expressions evaluated in the page
|
|
43
|
+
|
|
44
|
+
### ViewState Reduction Strategies
|
|
45
|
+
|
|
46
|
+
| Strategy | Impact |
|
|
47
|
+
|----------|--------|
|
|
48
|
+
| `transient` keyword on large/recomputable variables | High |
|
|
49
|
+
| `apex:outputPanel` + `reRender` (partial refresh) | Medium |
|
|
50
|
+
| Paginate large data sets (store only current page) | High |
|
|
51
|
+
| JavaScript Remoting instead of action methods (stateless) | High |
|
|
52
|
+
| Move read-only data to `<apex:repeat>` outside `<apex:form>` | Medium |
|
|
53
|
+
| Store IDs only, re-query on postback | Medium |
|
|
54
|
+
|
|
55
|
+
## Encoding Functions (XSS Prevention)
|
|
56
|
+
|
|
57
|
+
| Function | Context | Example |
|
|
58
|
+
|----------|---------|---------|
|
|
59
|
+
| `HTMLENCODE()` | HTML attributes, raw HTML | `<div title="{!HTMLENCODE(val)}">` |
|
|
60
|
+
| `JSENCODE()` | JavaScript strings in `<script>` blocks | `var x = '{!JSENCODE(val)}';` |
|
|
61
|
+
| `URLENCODE()` | URL parameters | `?q={!URLENCODE(val)}` |
|
|
62
|
+
| `JSINHTMLENCODE()` | JS inside HTML event handlers only | `onclick="fn('{!JSINHTMLENCODE(val)}')"` |
|
|
63
|
+
|
|
64
|
+
## Security Patterns
|
|
65
|
+
|
|
66
|
+
| Threat | Prevention |
|
|
67
|
+
|--------|-----------|
|
|
68
|
+
| XSS | Auto-escaped by `apex:outputText`, `apex:outputField`; never use `escape="false"` with user data |
|
|
69
|
+
| CSRF | Use `<apex:form>` (auto-includes CSRF token); never raw `<form>` tags |
|
|
70
|
+
| SOQL Injection | Use bind variables (`:term`) or `String.escapeSingleQuotes()`; prefer `Database.queryWithBinds()` |
|
|
71
|
+
| CRUD/FLS bypass | Controllers run in system mode; use `WITH USER_MODE` in SOQL, `AccessLevel.USER_MODE` in DML |
|
|
72
|
+
| Rich text XSS | Use `apex:outputField` for rich text fields; `String.stripHtmlTags()` to strip all HTML |
|
|
73
|
+
|
|
74
|
+
## Key Components
|
|
75
|
+
|
|
76
|
+
| Component | Purpose |
|
|
77
|
+
|-----------|---------|
|
|
78
|
+
| `apex:page` | Page container (defines controller, attributes) |
|
|
79
|
+
| `apex:form` | Form with CSRF token |
|
|
80
|
+
| `apex:pageBlock` / `apex:pageBlockSection` | Structured layout blocks |
|
|
81
|
+
| `apex:pageBlockTable` | Data table bound to collection |
|
|
82
|
+
| `apex:commandButton` / `apex:commandLink` | Server-side action triggers |
|
|
83
|
+
| `apex:inputField` / `apex:outputField` | CRUD/FLS-aware field input/output |
|
|
84
|
+
| `apex:actionFunction` | Call controller from JavaScript |
|
|
85
|
+
| `apex:actionSupport` | Fire action on DOM event |
|
|
86
|
+
| `apex:actionPoller` | Periodic server poll (interval in seconds) |
|
|
87
|
+
| `apex:actionStatus` | Loading indicator |
|
|
88
|
+
| `apex:outputPanel` | Rerenderable container |
|
|
89
|
+
| `apex:repeat` | Non-table iteration |
|
|
90
|
+
| `apex:includeLightning` | Enables Lightning Out (embed LWC in VF) |
|
|
91
|
+
| `apex:pageMessages` | Display ApexPages.addMessage feedback |
|
|
92
|
+
| `apex:slds` | Include SLDS stylesheets |
|
|
93
|
+
|
|
94
|
+
## JavaScript Remoting
|
|
95
|
+
|
|
96
|
+
| Fact | Value |
|
|
97
|
+
|------|-------|
|
|
98
|
+
| Annotation | `@RemoteAction` (must be `public static`) |
|
|
99
|
+
| Invocation | `Visualforce.remoting.Manager.invokeAction()` |
|
|
100
|
+
| Reference syntax | `{!$RemoteAction.ClassName.methodName}` (namespace-safe) |
|
|
101
|
+
| ViewState impact | None (fully stateless) |
|
|
102
|
+
| `escape: true` | Auto-escapes HTML in response (prevents XSS) |
|
|
103
|
+
| `timeout` | Configurable in ms (e.g., `30000` for 30s) |
|
|
104
|
+
|
|
105
|
+
## Migration Decision: Keep VF vs Migrate to LWC
|
|
106
|
+
|
|
107
|
+
| Keep Visualforce | Migrate to LWC |
|
|
108
|
+
|-----------------|----------------|
|
|
109
|
+
| PDF generation (`renderAs="pdf"`) | High-traffic pages needing performance |
|
|
110
|
+
| Email templates (VF/HTML) | Standard controller overrides |
|
|
111
|
+
| Complex server-state wizards | New feature development (always LWC) |
|
|
112
|
+
| | Pages using Apex controller only (easy migration) |
|
|
113
|
+
|
|
114
|
+
## Lightning Out (Embed LWC in VF)
|
|
115
|
+
|
|
116
|
+
| Step | Detail |
|
|
117
|
+
|------|--------|
|
|
118
|
+
| 1 | Add `<apex:includeLightning />` to VF page |
|
|
119
|
+
| 2 | Create Aura app extending `ltng:outApp` with `<aura:dependency>` |
|
|
120
|
+
| 3 | Call `$Lightning.use("c:appName", callback)` |
|
|
121
|
+
| 4 | Call `$Lightning.createComponent("c:lwcName", attrs, containerId)` |
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aside
|
|
3
|
+
description: >-
|
|
4
|
+
Use when you need a quick Salesforce answer mid-task. Answer a side question about Apex, org config,
|
|
5
|
+
or metadata without losing context, then resume work automatically.
|
|
6
|
+
origin: SCC
|
|
7
|
+
user-invocable: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Aside — Quick Side Question Without Losing Context
|
|
11
|
+
|
|
12
|
+
Ask a question mid-task and get an immediate, focused answer — then continue right where you left off. The current task, files, and context are never modified.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- You're curious about something while Claude is working and don't want to lose momentum
|
|
17
|
+
- You need a quick explanation of code Claude is currently editing
|
|
18
|
+
- You want a second opinion or clarification on a decision without derailing the task
|
|
19
|
+
- You need to understand an error, concept, or pattern before Claude proceeds
|
|
20
|
+
- You want to ask something unrelated to the current task without starting a new session
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
/aside <your question>
|
|
26
|
+
/aside what does this function actually return?
|
|
27
|
+
/aside is this pattern thread-safe?
|
|
28
|
+
/aside why are we using X instead of Y here?
|
|
29
|
+
/aside what's the difference between foo() and bar()?
|
|
30
|
+
/aside should we be worried about the SOQL in a loop we just added?
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Process
|
|
34
|
+
|
|
35
|
+
### Step 1: Freeze the current task state
|
|
36
|
+
|
|
37
|
+
Before answering anything, mentally note:
|
|
38
|
+
|
|
39
|
+
- What is the active task? (what file, feature, or problem was being worked on)
|
|
40
|
+
- What step was in progress at the moment the aside was invoked?
|
|
41
|
+
- What was about to happen next?
|
|
42
|
+
|
|
43
|
+
Do NOT touch, edit, create, or delete any files during the aside.
|
|
44
|
+
|
|
45
|
+
### Step 2: Answer the question directly
|
|
46
|
+
|
|
47
|
+
Answer the question in the most concise form that is still complete and useful.
|
|
48
|
+
|
|
49
|
+
- Lead with the answer, not the reasoning
|
|
50
|
+
- Keep it short — if a full explanation is needed, offer to go deeper after the task
|
|
51
|
+
- If the question is about the current file or code being worked on, reference it precisely (file path and line number if relevant)
|
|
52
|
+
- If answering requires reading a file, read it — but read only, never write
|
|
53
|
+
|
|
54
|
+
Format the response as:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
ASIDE: [restate the question briefly]
|
|
58
|
+
|
|
59
|
+
[Your answer here]
|
|
60
|
+
|
|
61
|
+
— Back to task: [one-line description of what was being done]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Step 3: Resume the main task
|
|
65
|
+
|
|
66
|
+
After delivering the answer, immediately continue the active task from the exact point it was paused. Do not ask for permission to resume unless the aside answer revealed a blocker or a reason to reconsider the current approach.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Edge Cases
|
|
71
|
+
|
|
72
|
+
**No question provided (aside invoked with nothing after it):**
|
|
73
|
+
Respond:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
ASIDE: no question provided
|
|
77
|
+
|
|
78
|
+
What would you like to know? (ask your question and I'll answer without losing the current task context)
|
|
79
|
+
|
|
80
|
+
— Back to task: [one-line description of what was being done]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Question reveals a potential problem with the current task:**
|
|
84
|
+
Flag it clearly before resuming:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
ASIDE: [answer]
|
|
88
|
+
|
|
89
|
+
Warning: This answer suggests [issue] with the current approach. Want to address this before continuing, or proceed as planned?
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Wait for the user's decision before resuming.
|
|
93
|
+
|
|
94
|
+
**Question is actually a task redirect (not a side question):**
|
|
95
|
+
If the question implies changing what is being built, clarify:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
ASIDE: That sounds like a direction change, not just a side question.
|
|
99
|
+
Do you want to:
|
|
100
|
+
(a) Answer this as information only and keep the current plan
|
|
101
|
+
(b) Pause the current task and change approach
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Wait for the user's answer.
|
|
105
|
+
|
|
106
|
+
**No active task (nothing in progress when aside is invoked):**
|
|
107
|
+
Still use the standard wrapper:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
ASIDE: [restate the question briefly]
|
|
111
|
+
|
|
112
|
+
[Your answer here]
|
|
113
|
+
|
|
114
|
+
— Back to task: no active task to resume
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Multiple aside questions in a row:**
|
|
118
|
+
Answer each one in sequence. After the last answer, resume the main task.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: checkpoint
|
|
3
|
+
description: >-
|
|
4
|
+
Use when saving Salesforce development progress. Create a named checkpoint via git stash before risky
|
|
5
|
+
Apex deploys or org changes for easy recovery.
|
|
6
|
+
origin: SCC
|
|
7
|
+
user-invocable: true
|
|
8
|
+
disable-model-invocation: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Checkpoint — Named Progress Snapshots
|
|
12
|
+
|
|
13
|
+
Save current progress as a named checkpoint for easy recovery.
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
- When you want to save work-in-progress before attempting a risky change
|
|
18
|
+
- When starting a refactoring pass and need a safe rollback point
|
|
19
|
+
- When switching between tasks and want to preserve current state
|
|
20
|
+
- When you need to snapshot progress at key milestones during a long session
|
|
21
|
+
- When collaborating and want to share a recoverable state with another agent or session
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
checkpoint [name]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Workflow
|
|
30
|
+
|
|
31
|
+
1. **Create checkpoint** — `git stash push --include-untracked -m "checkpoint: <name> [<timestamp>]"`
|
|
32
|
+
2. **Log metadata** — Append to `.claude/checkpoints.log`:
|
|
33
|
+
- Timestamp
|
|
34
|
+
- Checkpoint name
|
|
35
|
+
- Files changed (count)
|
|
36
|
+
- Current branch
|
|
37
|
+
3. **Verify** — Confirm working tree is clean after stash
|
|
38
|
+
|
|
39
|
+
## Operations
|
|
40
|
+
|
|
41
|
+
- `checkpoint save <name>` — Create new checkpoint
|
|
42
|
+
- `checkpoint list` — Show all checkpoints from log
|
|
43
|
+
- `checkpoint restore <name>` — Apply the named stash (`git stash apply`; keeps the stash entry safe). Find the stash reference via `git stash list | grep "<name>"`, then `git stash apply stash@{N}`. After verifying the restore, drop with `git stash drop stash@{N}`.
|
|
44
|
+
- `checkpoint verify` — Verify current state matches last checkpoint
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
checkpoint save before-trigger-refactor
|
|
50
|
+
checkpoint list
|
|
51
|
+
checkpoint restore before-trigger-refactor
|
|
52
|
+
checkpoint verify
|
|
53
|
+
```
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configure-scc
|
|
3
|
+
description: >-
|
|
4
|
+
Use when setting up SCC for Salesforce Apex and LWC development. Interactive wizard to install
|
|
5
|
+
profiles, modules, and customize the harness for your org.
|
|
6
|
+
origin: SCC
|
|
7
|
+
user-invocable: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Configure SCC
|
|
11
|
+
|
|
12
|
+
Interactive guide for installing and configuring Salesforce Claude Code.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- When installing SCC for the first time on a Salesforce project
|
|
17
|
+
- When adding new modules or profiles to an existing SCC installation
|
|
18
|
+
- When customizing hook behavior or profiles for your team's workflow
|
|
19
|
+
- When troubleshooting SCC configuration or missing components
|
|
20
|
+
- When setting up SCC for different team members or CI/CD environments
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
### Quick Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Install globally
|
|
28
|
+
npm install -g scc-universal
|
|
29
|
+
|
|
30
|
+
# Install with a profile
|
|
31
|
+
npx scc install all # Everything (all agents, skills, rules)
|
|
32
|
+
npx scc install apex # Apex-focused development
|
|
33
|
+
npx scc install lwc # LWC-focused development
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Profile Details
|
|
37
|
+
|
|
38
|
+
| Profile | Includes |
|
|
39
|
+
|---------|----------|
|
|
40
|
+
| `apex` | Common rules + Apex rules, agents, skills |
|
|
41
|
+
| `lwc` | Common rules + LWC rules, agents, skills |
|
|
42
|
+
| `full` | All agents, skills, rules |
|
|
43
|
+
|
|
44
|
+
### Diagnostics
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx scc doctor # Check for missing/drifted files
|
|
48
|
+
npx scc status # View installed components
|
|
49
|
+
npx scc repair # Restore drifted files
|
|
50
|
+
npx scc uninstall # Remove SCC-managed files
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Hook Configuration
|
|
54
|
+
|
|
55
|
+
### Profiles
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Set hook profile (controls which hooks run)
|
|
59
|
+
export SCC_HOOK_PROFILE=minimal # Session start + stop only
|
|
60
|
+
export SCC_HOOK_PROFILE=standard # Default — includes quality checks
|
|
61
|
+
export SCC_HOOK_PROFILE=strict # All hooks including auto-format
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Disable Specific Hooks
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
export SCC_DISABLED_HOOKS=governor-check,cost-tracker
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Package Manager
|
|
71
|
+
|
|
72
|
+
SCC auto-detects your package manager. Override with:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
export CLAUDE_PACKAGE_MANAGER=npm # or pnpm, yarn, bun
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Environment-Specific Configuration
|
|
79
|
+
|
|
80
|
+
### Sandbox / Scratch Org Development
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Set default target org for SF CLI commands
|
|
84
|
+
sf config set target-org=my-scratch-org
|
|
85
|
+
|
|
86
|
+
# Scratch org duration is set via --duration-days flag or scratch org definition file
|
|
87
|
+
# sf org create scratch -f config/project-scratch-def.json --duration-days 7
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### CI/CD Environments
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Minimal hooks for CI (fast, no interactive prompts)
|
|
94
|
+
export SCC_HOOK_PROFILE=minimal
|
|
95
|
+
|
|
96
|
+
# Disable all cost/session tracking in CI
|
|
97
|
+
export SCC_DISABLED_HOOKS=cost-tracker,session-start,session-end,evaluate-session
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Team Setup
|
|
101
|
+
|
|
102
|
+
Share SCC configuration across your team by adding to your project's `.env.example`:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# .env.example — copy to .env and customize
|
|
106
|
+
SCC_HOOK_PROFILE=standard
|
|
107
|
+
CLAUDE_PACKAGE_MANAGER=npm
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Troubleshooting
|
|
111
|
+
|
|
112
|
+
### Common Issues
|
|
113
|
+
|
|
114
|
+
| Problem | Cause | Fix |
|
|
115
|
+
|---------|-------|-----|
|
|
116
|
+
| `npx scc install` fails | Node.js < 20 | Upgrade: `nvm install 20` |
|
|
117
|
+
| Hooks not firing | SCC not installed in project | Run `npx scc doctor` to check |
|
|
118
|
+
| `Permission denied` on hooks | Script not executable | Run `npx scc repair` |
|
|
119
|
+
| Skills not loading | Wrong install profile | Run `npx scc install all` |
|
|
120
|
+
| `sf` command not found | SF CLI not installed | Install: `npm install -g @salesforce/cli` |
|
|
121
|
+
| `sf` commands fail with errors | SF CLI version too old | Upgrade: `npm update -g @salesforce/cli` (SCC requires SF CLI v2.x / `sf` not `sfdx`) |
|
|
122
|
+
| Hooks slow down session | Too many hooks enabled | Switch to `SCC_HOOK_PROFILE=minimal` |
|
|
123
|
+
|
|
124
|
+
### Diagnostic Commands
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Full diagnostic report
|
|
128
|
+
npx scc doctor
|
|
129
|
+
|
|
130
|
+
# See exactly what's installed
|
|
131
|
+
npx scc list-installed
|
|
132
|
+
|
|
133
|
+
# Preview what WOULD be installed (dry run)
|
|
134
|
+
npx scc plan apex
|
|
135
|
+
|
|
136
|
+
# Check state store
|
|
137
|
+
npx scc status
|
|
138
|
+
|
|
139
|
+
# Reset everything and reinstall
|
|
140
|
+
npx scc uninstall && npx scc install all
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Upgrading SCC
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Update to latest version
|
|
147
|
+
npm install -g scc-universal@latest
|
|
148
|
+
|
|
149
|
+
# Repair any drifted files after upgrade
|
|
150
|
+
npx scc repair
|
|
151
|
+
|
|
152
|
+
# Verify upgrade
|
|
153
|
+
npx scc doctor
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Verification
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm test # Run all validators
|
|
160
|
+
npx scc doctor # Check installation health
|
|
161
|
+
sf --version # Verify SF CLI is installed
|
|
162
|
+
npx scc status # Confirm installed components
|
|
163
|
+
```
|