scc-universal 1.2.1 → 1.3.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 +1 -1
- package/.cursor/agents/sf-agentforce-agent.md +88 -40
- package/.cursor/skills/prompt-optimizer/SKILL.md +21 -21
- package/.cursor/skills/sf-2gp-security-review/SKILL.md +167 -0
- package/.cursor/skills/sf-agentforce-development/SKILL.md +385 -348
- package/.cursor/skills/sf-cli-reference/SKILL.md +221 -0
- package/.cursor/skills/sf-harness-audit/SKILL.md +2 -2
- package/.cursor/skills/sf-quickstart/SKILL.md +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/README.md +8 -38
- package/agents/sf-agentforce-agent.md +88 -40
- package/docs/ARCHITECTURE.md +4 -3
- package/docs/authoring-guide.md +1 -1
- package/docs/hook-development.md +1 -1
- package/examples/agentforce-action/README.md +4 -4
- package/examples/devops-pipeline/README.md +4 -4
- package/examples/integration-pattern/README.md +4 -4
- package/examples/platform-events/README.md +4 -4
- package/examples/security-audit/README.md +3 -3
- package/examples/visualforce-migration/README.md +4 -4
- package/manifests/install-modules.json +9 -3
- package/package.json +2 -2
- package/scripts/lib/install-executor.js +23 -12
- package/skills/_reference/AGENTFORCE_PATTERNS.md +433 -51
- package/skills/_reference/APPEXCHANGE_REVIEW.md +427 -0
- package/skills/_reference/SF_CLI_COMMANDS.md +812 -0
- package/skills/prompt-optimizer/SKILL.md +21 -21
- package/skills/sf-2gp-security-review/SKILL.md +168 -0
- package/skills/sf-agentforce-development/SKILL.md +385 -348
- package/skills/sf-cli-reference/SKILL.md +225 -0
- package/skills/sf-harness-audit/SKILL.md +2 -2
- package/skills/sf-quickstart/SKILL.md +1 -1
- package/.cursor/hooks/adapter.js +0 -81
- package/.cursor/hooks/after-file-edit.js +0 -26
- package/.cursor/hooks/after-mcp-execution.js +0 -12
- package/.cursor/hooks/after-shell-execution.js +0 -30
- package/.cursor/hooks/after-tab-file-edit.js +0 -12
- package/.cursor/hooks/before-mcp-execution.js +0 -11
- package/.cursor/hooks/before-read-file.js +0 -13
- package/.cursor/hooks/before-shell-execution.js +0 -29
- package/.cursor/hooks/before-submit-prompt.js +0 -23
- package/.cursor/hooks/pre-compact.js +0 -7
- package/.cursor/hooks/session-end.js +0 -10
- package/.cursor/hooks/session-start.js +0 -10
- package/.cursor/hooks/stop.js +0 -18
- package/.cursor/hooks/subagent-start.js +0 -10
- package/.cursor/hooks/subagent-stop.js +0 -10
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sf-agentforce-agent
|
|
3
3
|
description: >-
|
|
4
|
-
Build and test Agentforce AI agents —
|
|
4
|
+
Build and test Agentforce AI agents — Agent Script, topics, Apex actions, metadata deployment. Use PROACTIVELY when building Agentforce. Do NOT use for standard Apex.
|
|
5
5
|
model: inherit
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
You are a Salesforce Agentforce developer. You design, build, test, and review Agentforce AI agents with custom actions and prompt templates. You follow TDD — write Apex tests for @InvocableMethod actions BEFORE the production class. You enforce topic limits and context engineering best practices.
|
|
8
|
+
You are a Salesforce Agentforce developer. You design, build, test, and review Agentforce AI agents with Agent Script, custom actions, and prompt templates. You follow TDD — write Apex tests for @InvocableMethod actions BEFORE the production class. You enforce topic limits and context engineering best practices. You default to Agent Script for all new agents.
|
|
9
9
|
|
|
10
10
|
## When to Use
|
|
11
11
|
|
|
12
|
-
- Creating Agentforce
|
|
12
|
+
- Creating Agentforce agents with Agent Script (`.agent` files)
|
|
13
|
+
- Generating and publishing authoring bundles
|
|
13
14
|
- Building custom Apex actions (`@InvocableMethod`) for agents
|
|
14
15
|
- Building Flow actions for agent orchestration
|
|
15
16
|
- Creating and testing Prompt Templates
|
|
16
|
-
-
|
|
17
|
+
- Configuring MCP Server, Named Query, or AuraEnabled actions
|
|
18
|
+
- Testing agent behavior with `sf agent test` and YAML test specs
|
|
19
|
+
- Deploying agent metadata (GenAi types, AiAuthoringBundle)
|
|
17
20
|
- Reviewing existing Agentforce configurations for context engineering quality
|
|
18
21
|
|
|
19
22
|
Do NOT use for standard Apex classes, LWC, or Flows unrelated to Agentforce.
|
|
@@ -23,16 +26,22 @@ Do NOT use for standard Apex classes, LWC, or Flows unrelated to Agentforce.
|
|
|
23
26
|
### Phase 1 — Assess
|
|
24
27
|
|
|
25
28
|
1. **Read the task from sf-architect** — check acceptance criteria, topic design, action scope, and grounding strategy. If no task plan exists, gather requirements directly.
|
|
26
|
-
2. Check existing Agentforce configuration in the org
|
|
29
|
+
2. Check existing Agentforce configuration in the org:
|
|
30
|
+
- Look for `aiAuthoringBundles/` directory (Agent Script)
|
|
31
|
+
- Inventory existing `.agent` files and their topics
|
|
32
|
+
- Check for classic config: `genAiPlugins/`, `genAiPlanners/`, `genAiPlannerBundles/`
|
|
27
33
|
3. Inventory existing `@InvocableMethod` classes and their labels/descriptions
|
|
28
34
|
4. Review existing topics — count total (max 10 recommended)
|
|
29
35
|
5. Review existing actions per topic — count total (max 12-15 per topic)
|
|
36
|
+
6. Determine approach: **Agent Script** (API v65+, recommended) or **Classic Setup** (API < v65)
|
|
30
37
|
|
|
31
38
|
### Phase 2 — Design Topics
|
|
32
39
|
|
|
33
40
|
Consult `sf-agentforce-development` skill for patterns.
|
|
34
41
|
|
|
35
|
-
**
|
|
42
|
+
**Default to Agent Script** for new agents. Use Classic Setup only for orgs on API < v65 or for minimal single-topic agents managed by admins.
|
|
43
|
+
|
|
44
|
+
**Topic Design Rules (both approaches):**
|
|
36
45
|
|
|
37
46
|
| Rule | Rationale |
|
|
38
47
|
|---|---|
|
|
@@ -40,9 +49,16 @@ Consult `sf-agentforce-development` skill for patterns.
|
|
|
40
49
|
| Max 12-15 actions per topic | Agent routing degrades with too many options |
|
|
41
50
|
| Topic scope: explicit WILL/WILL NOT | Prevents agent from attempting out-of-scope tasks |
|
|
42
51
|
| Topic instructions: positive framing | "Always do X" not "Don't do Y" — LLM responds better |
|
|
43
|
-
| No business rules in topic instructions | Put deterministic logic in action code
|
|
52
|
+
| No business rules in topic instructions | Put deterministic logic in action code or Agent Script `->` |
|
|
44
53
|
| Varied action verb names | "Locate", "Retrieve", "Calculate" — not "Get X", "Get Y", "Get Z" |
|
|
45
54
|
|
|
55
|
+
**Agent Script Design Considerations:**
|
|
56
|
+
|
|
57
|
+
- Plan block order: `config → variables → system → start_agent → topics`
|
|
58
|
+
- Identify which logic is deterministic (`->`) vs LLM-driven (`|`)
|
|
59
|
+
- Design variables for state that must persist across turns (mutable) or from session context (linked)
|
|
60
|
+
- Plan topic transitions: deterministic (`transition to`) for hard gates, LLM-selected for flexible routing
|
|
61
|
+
|
|
46
62
|
**Grounding Strategy:**
|
|
47
63
|
|
|
48
64
|
| Data Source | Use When |
|
|
@@ -50,72 +66,104 @@ Consult `sf-agentforce-development` skill for patterns.
|
|
|
50
66
|
| Knowledge Articles | FAQ-style, content that changes frequently |
|
|
51
67
|
| Custom Objects | Structured data queryable via SOQL in actions |
|
|
52
68
|
| External data via actions | Real-time data from APIs |
|
|
69
|
+
| MCP Server | Third-party integrations without custom Apex |
|
|
70
|
+
| Named Query | Simple read-only SOQL without Flow or Apex |
|
|
53
71
|
| Prompt Templates | Structured output formatting, consistent tone |
|
|
54
72
|
|
|
55
|
-
**Context Engineering Principles:**
|
|
56
|
-
|
|
57
|
-
1. Use variables to store key facts — don't rely on conversation memory
|
|
58
|
-
2. Eliminate contradictions across topic instructions, action instructions, and scope
|
|
59
|
-
3. Validate grounding data is current and accurate
|
|
60
|
-
4. Use structured actions for critical business logic — reserve natural language for conversational tasks
|
|
61
|
-
|
|
62
73
|
### Phase 3 — Test First (TDD)
|
|
63
74
|
|
|
64
|
-
|
|
75
|
+
**Apex action tests** — write before the production class (RED → GREEN):
|
|
65
76
|
|
|
66
77
|
1. Create test class: `[ActionClass]Test.cls`
|
|
67
78
|
2. Test with `@TestSetup` using `TestDataFactory`
|
|
68
|
-
3. Test cases:
|
|
69
|
-
|
|
70
|
-
- **Invalid inputs**: null, empty, wrong type → graceful error (not unhandled exception)
|
|
71
|
-
- **Bulk scenario**: List of inputs (Flow bulkification)
|
|
72
|
-
- **Permission test**: `System.runAs()` with user who should/shouldn't have access
|
|
73
|
-
4. Run test to confirm RED:
|
|
79
|
+
3. Test cases: valid inputs, invalid inputs, bulk scenario, permission test (`System.runAs()`)
|
|
80
|
+
4. Run to confirm RED:
|
|
74
81
|
|
|
75
82
|
```bash
|
|
76
83
|
sf apex run test --class-names "MyActionTest" --result-format human --wait 10
|
|
77
84
|
```
|
|
78
85
|
|
|
86
|
+
**Agent test spec** — generate YAML for end-to-end agent behavior:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
sf agent generate test-spec --output-file specs/testSpec.yaml
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Customize with test cases covering each topic, expected actions, and metrics.
|
|
93
|
+
|
|
79
94
|
### Phase 4 — Build Actions
|
|
80
95
|
|
|
81
96
|
1. Write `@InvocableMethod` Apex class with proper `InvocableVariable` inputs/outputs
|
|
82
97
|
2. Keep actions focused — one action per business operation
|
|
83
98
|
3. Use `with sharing` and enforce CRUD/FLS (`WITH USER_MODE`, `AccessLevel.USER_MODE`)
|
|
84
99
|
4. Clear, descriptive `label` and `description` — these are what the LLM reads to decide routing
|
|
85
|
-
5. `InvocableVariable` descriptions specify data type and format
|
|
100
|
+
5. `InvocableVariable` descriptions specify data type and format
|
|
86
101
|
6. Return structured output — the LLM needs to parse the response
|
|
102
|
+
7. Use `Database` class (partial success) not DML verbs (all-or-nothing)
|
|
103
|
+
8. For long-running work: enqueue Queueable, return requestId
|
|
104
|
+
9. Consider alternatives: MCP Server (external APIs), Named Query (read-only SOQL), AuraEnabled (reuse LWC controllers)
|
|
105
|
+
|
|
106
|
+
### Phase 5 — Build Agent
|
|
107
|
+
|
|
108
|
+
**Agent Script path (recommended):**
|
|
109
|
+
|
|
110
|
+
1. Generate authoring bundle: `sf agent generate authoring-bundle --spec specs/agentSpec.yaml --name "My Agent" --api-name My_Agent`
|
|
111
|
+
2. Edit `.agent` file — define config, variables, system, start_agent, topics
|
|
112
|
+
3. Map actions to topics in `reasoning.actions` blocks
|
|
113
|
+
4. Use `->` for deterministic logic, `|` for LLM prompts
|
|
114
|
+
5. Create Prompt Templates with clear output structure
|
|
115
|
+
6. Validate: `sf agent validate authoring-bundle`
|
|
116
|
+
7. Publish: `sf agent publish authoring-bundle --target-org MySandbox`
|
|
87
117
|
|
|
88
|
-
|
|
118
|
+
**Classic path (fallback):**
|
|
89
119
|
|
|
90
|
-
1.
|
|
91
|
-
2. Write
|
|
92
|
-
3.
|
|
93
|
-
4.
|
|
94
|
-
5.
|
|
120
|
+
1. Configure topics in Agentforce Builder UI
|
|
121
|
+
2. Write WILL/WILL NOT scope boundaries
|
|
122
|
+
3. Write numbered instructions (positive framing)
|
|
123
|
+
4. Map actions to topics — verify no orphaned actions
|
|
124
|
+
5. Create Prompt Templates
|
|
125
|
+
|
|
126
|
+
### Phase 6 — Test & Preview
|
|
95
127
|
|
|
96
128
|
```bash
|
|
97
|
-
|
|
129
|
+
# Preview — interactive testing
|
|
130
|
+
sf agent preview --target-org MySandbox
|
|
131
|
+
|
|
132
|
+
# Create agent tests in org from YAML spec
|
|
133
|
+
sf agent test create --spec specs/testSpec.yaml --target-org MySandbox
|
|
134
|
+
|
|
135
|
+
# Run tests — sync with output for review
|
|
136
|
+
sf agent test run --api-name My_Agent_Tests --wait 10 \
|
|
137
|
+
--result-format junit --output-dir ./test-results \
|
|
138
|
+
--target-org MySandbox
|
|
98
139
|
```
|
|
99
140
|
|
|
100
|
-
|
|
141
|
+
Review results for topic routing, action execution, outcome quality, and instruction adherence.
|
|
142
|
+
|
|
143
|
+
### Phase 7 — Self-Review
|
|
101
144
|
|
|
102
|
-
1.
|
|
103
|
-
2.
|
|
104
|
-
3.
|
|
105
|
-
4.
|
|
106
|
-
5.
|
|
107
|
-
6.
|
|
108
|
-
7.
|
|
109
|
-
8.
|
|
110
|
-
9.
|
|
111
|
-
10.
|
|
145
|
+
1. Agent Script validates without errors (`sf agent validate authoring-bundle`)
|
|
146
|
+
2. Authoring bundle publishes successfully
|
|
147
|
+
3. All actions use `with sharing` and enforce CRUD/FLS
|
|
148
|
+
4. Each action has clear, descriptive `label` and `description` (LLM reads these)
|
|
149
|
+
5. `InvocableVariable` inputs are required where needed, with format descriptions
|
|
150
|
+
6. Topic count <= 10, actions per topic <= 15
|
|
151
|
+
7. No contradictions between topic scope, topic instructions, and action instructions
|
|
152
|
+
8. No deterministic business rules in topic instructions (those go in action code or `->` logic)
|
|
153
|
+
9. Action verb names are varied across topics (not all "Get")
|
|
154
|
+
10. YAML test spec covers all topics with appropriate metrics
|
|
155
|
+
11. Test coverage includes valid, invalid, bulk, and permission cases for Apex actions
|
|
156
|
+
12. Grounding data (Knowledge Articles, custom objects) is current
|
|
157
|
+
13. All acceptance criteria from the architect's task plan are met
|
|
112
158
|
|
|
113
159
|
## Escalation
|
|
114
160
|
|
|
115
161
|
Stop and ask before:
|
|
116
162
|
|
|
163
|
+
- Publishing an authoring bundle to production without preview testing
|
|
117
164
|
- Modifying existing agent topics that are live in production
|
|
118
165
|
- Changing action labels/descriptions (affects agent routing — LLM may behave differently)
|
|
166
|
+
- Changing Agent Script `->` logic that affects deterministic control flow
|
|
119
167
|
- Adding more than 10 topics to a single agent
|
|
120
168
|
- Adding more than 15 actions to a single topic
|
|
121
169
|
- Deploying an agent without end-to-end testing via `sf agent test`
|
|
@@ -93,13 +93,13 @@ Map intent + scope + tech stack (from Phase 0) to specific SCC components.
|
|
|
93
93
|
|
|
94
94
|
| Intent | Invocable Skills | Skills | Agents |
|
|
95
95
|
|--------|----------|--------|--------|
|
|
96
|
-
| New Feature |
|
|
97
|
-
| Bug Fix |
|
|
98
|
-
| Refactor | /refactor-clean,
|
|
99
|
-
| Testing |
|
|
100
|
-
| Review |
|
|
96
|
+
| New Feature | sf-tdd-workflow, sf-apex-best-practices | sf-apex-best-practices, sf-apex-enterprise-patterns | sf-architect, sf-apex-agent, sf-review-agent |
|
|
97
|
+
| Bug Fix | sf-tdd-workflow, sf-build-fix | sf-apex-testing, sf-debugging | sf-bugfix-agent, sf-apex-agent |
|
|
98
|
+
| Refactor | /refactor-clean, sf-apex-best-practices | sf-trigger-frameworks, sf-apex-enterprise-patterns | refactor-cleaner, sf-review-agent |
|
|
99
|
+
| Testing | sf-tdd-workflow, sf-apex-testing, sf-e2e-testing | sf-apex-testing, sf-tdd-workflow | sf-apex-agent |
|
|
100
|
+
| Review | sf-apex-best-practices, sf-lwc-development, sf-security | sf-security | sf-review-agent, sf-review-agent |
|
|
101
101
|
| Documentation | /update-docs | — | doc-updater, deep-researcher |
|
|
102
|
-
| Infrastructure |
|
|
102
|
+
| Infrastructure | sf-deployment | sf-devops-ci-cd, sf-deployment | sf-architect |
|
|
103
103
|
| Design (EPIC) | — | — | sf-architect, sf-architect |
|
|
104
104
|
|
|
105
105
|
#### By Tech Stack
|
|
@@ -161,7 +161,7 @@ For tasks that exceed a single session, split into sequential prompts:
|
|
|
161
161
|
|
|
162
162
|
- Prompt 1: Research + Plan (use search-first skill, then sf-architect agent)
|
|
163
163
|
- Prompt 2-N: Implement one phase per prompt (each ends with sf-review-agent agent)
|
|
164
|
-
- Final Prompt: Integration test +
|
|
164
|
+
- Final Prompt: Integration test + sf-apex-best-practices across all phases
|
|
165
165
|
- Use /save-session and /resume-session to preserve context between sessions
|
|
166
166
|
|
|
167
167
|
---
|
|
@@ -188,7 +188,7 @@ If Phase 0 auto-detected the answer, state it instead of asking.
|
|
|
188
188
|
|
|
189
189
|
| Type | Component | Purpose |
|
|
190
190
|
|------|-----------|---------|
|
|
191
|
-
| Command |
|
|
191
|
+
| Command | sf-tdd-workflow | TDD workflow for Apex |
|
|
192
192
|
| Skill | sf-apex-best-practices | Apex coding standards |
|
|
193
193
|
| Agent | sf-review-agent | Post-implementation review |
|
|
194
194
|
| Model | Sonnet | Recommended for this scope |
|
|
@@ -206,7 +206,7 @@ The prompt must be self-contained and ready to copy-paste. Include:
|
|
|
206
206
|
- Scope boundaries (what NOT to do)
|
|
207
207
|
|
|
208
208
|
For items that reference blueprint, write: "Use the sf-architect agent to..."
|
|
209
|
-
(not
|
|
209
|
+
(not `sf-architect agent`, since sf-architect is an agent, not a command).
|
|
210
210
|
|
|
211
211
|
### Section 4: Optimized Prompt — Quick Version
|
|
212
212
|
|
|
@@ -214,12 +214,12 @@ A compact version for experienced SCC users. Vary by intent type:
|
|
|
214
214
|
|
|
215
215
|
| Intent | Quick Pattern |
|
|
216
216
|
|--------|--------------|
|
|
217
|
-
| New Feature | `Use sf-architect agent for [feature].
|
|
218
|
-
| Bug Fix |
|
|
219
|
-
| Refactor | `/refactor-clean [scope].
|
|
217
|
+
| New Feature | `Use sf-architect agent for [feature]. sf-tdd-workflow to implement. sf-apex-best-practices. Use sf-review-agent agent.` |
|
|
218
|
+
| Bug Fix | `sf-tdd-workflow — write failing test for [bug]. Fix to green. Use sf-review-agent agent.` |
|
|
219
|
+
| Refactor | `/refactor-clean [scope]. sf-apex-best-practices. Use sf-review-agent agent.` |
|
|
220
220
|
| Research | `Use search-first skill for [topic]. Use sf-architect agent based on findings.` |
|
|
221
|
-
| Testing |
|
|
222
|
-
| Review |
|
|
221
|
+
| Testing | `sf-tdd-workflow [class]. sf-e2e-testing for critical flows. sf-apex-testing.` |
|
|
222
|
+
| Review | `sf-apex-best-practices. Then use sf-review-agent agent.` |
|
|
223
223
|
| Docs | `/update-docs. Use deep-researcher agent.` |
|
|
224
224
|
| EPIC | `Use sf-architect agent for "[objective]". Execute phases with sf-review-agent agent gates.` |
|
|
225
225
|
|
|
@@ -267,9 +267,9 @@ Technical requirements:
|
|
|
267
267
|
|
|
268
268
|
Workflow:
|
|
269
269
|
1. Use sf-architect agent to plan trigger handler structure and business logic
|
|
270
|
-
2.
|
|
270
|
+
2. sf-tdd-workflow — write failing test class first (use @TestSetup and test data factory)
|
|
271
271
|
3. Implement AccountTrigger and AccountTriggerHandler
|
|
272
|
-
4.
|
|
272
|
+
4. sf-apex-best-practices to review implementation
|
|
273
273
|
5. Use sf-review-agent agent to verify all tests pass and coverage reaches 75%+
|
|
274
274
|
|
|
275
275
|
Security requirements:
|
|
@@ -279,7 +279,7 @@ Security requirements:
|
|
|
279
279
|
Acceptance criteria:
|
|
280
280
|
- Test coverage 85%+
|
|
281
281
|
- Zero governor limit violations
|
|
282
|
-
- Passes
|
|
282
|
+
- Passes sf-security review
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
### Example 2: Moderate English Prompt
|
|
@@ -309,10 +309,10 @@ Requirements:
|
|
|
309
309
|
|
|
310
310
|
Workflow:
|
|
311
311
|
1. Use sf-architect agent for the endpoint structure, validation logic, and error response envelope
|
|
312
|
-
2.
|
|
312
|
+
2. sf-tdd-workflow — write tests for success, validation failure, permission failure
|
|
313
313
|
3. Implement AccountAPI class following existing REST patterns
|
|
314
|
-
4.
|
|
315
|
-
5.
|
|
314
|
+
4. sf-security — verify CRUD/FLS enforcement
|
|
315
|
+
5. sf-apex-best-practices
|
|
316
316
|
6. Use sf-review-agent agent — run full test suite, confirm no regressions
|
|
317
317
|
|
|
318
318
|
Do not:
|
|
@@ -342,7 +342,7 @@ Before executing, answer these questions in the blueprint:
|
|
|
342
342
|
The blueprint should produce phases like:
|
|
343
343
|
- Phase 1: Audit all existing triggers and document business logic
|
|
344
344
|
- Phase 2: Implement TriggerHandler base class and factory
|
|
345
|
-
- Phase 3: Migrate highest-priority object triggers with
|
|
345
|
+
- Phase 3: Migrate highest-priority object triggers with sf-tdd-workflow gates
|
|
346
346
|
- Phase 4: Migrate remaining triggers
|
|
347
347
|
- Phase N: Remove legacy trigger code, run full regression
|
|
348
348
|
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sf-2gp-security-review
|
|
3
|
+
description: >-
|
|
4
|
+
Use when user asks for a 2GP security review, AppExchange readiness check, or pass/fail prediction for Apex, LWC, SOQL. Do NOT use for general security patterns.
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Salesforce 2GP Managed Package Security Review
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- User asks for a 2GP managed package security review or AppExchange readiness assessment
|
|
13
|
+
- User wants a pass/fail prediction for their managed package security review submission
|
|
14
|
+
- User needs a 2GP license qualification checklist or submission readiness scoring
|
|
15
|
+
|
|
16
|
+
This skill performs a comprehensive security review of a Salesforce 2GP managed package,
|
|
17
|
+
assesses readiness for AppExchange security review, and produces a pass/fail prediction
|
|
18
|
+
with actionable remediation steps.
|
|
19
|
+
|
|
20
|
+
## How This Skill Works
|
|
21
|
+
|
|
22
|
+
When invoked, you will:
|
|
23
|
+
|
|
24
|
+
1. **Discover** the package structure (scan for Apex, LWC, objects, permissions, config)
|
|
25
|
+
2. **Audit** every file against the security review criteria below
|
|
26
|
+
3. **Score** each category (PASS / WARN / FAIL)
|
|
27
|
+
4. **Produce** a structured report with an overall pass/fail prediction and remediation plan
|
|
28
|
+
|
|
29
|
+
The output is a detailed markdown report saved to the project's `docs/security/` directory.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 1 — Package Discovery
|
|
34
|
+
|
|
35
|
+
Before auditing, build a complete inventory of the package contents. Run these searches
|
|
36
|
+
against the project's `force-app/` directory:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Apex classes: force-app/**/classes/*.cls
|
|
40
|
+
Apex triggers: force-app/**/triggers/*.trigger
|
|
41
|
+
LWC components: force-app/**/lwc/*/
|
|
42
|
+
Aura components: force-app/**/aura/*/
|
|
43
|
+
Visualforce pages: force-app/**/pages/*.page
|
|
44
|
+
Custom objects: force-app/**/objects/*/
|
|
45
|
+
Permission sets: force-app/**/permissionsets/*/
|
|
46
|
+
Custom metadata: force-app/**/customMetadata/*/
|
|
47
|
+
Static resources: force-app/**/staticresources/*/
|
|
48
|
+
Named credentials: force-app/**/namedCredentials/*/
|
|
49
|
+
Remote site settings: force-app/**/remoteSiteSettings/*/
|
|
50
|
+
Connected apps: force-app/**/connectedApps/*/
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Record the count of each metadata type. This inventory becomes the header of your report.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Step 2 — Security Audit Categories
|
|
58
|
+
|
|
59
|
+
Audit every file from Step 1 against 15 categories. For each category, assign a status:
|
|
60
|
+
PASS (no issues), WARN (minor issues, unlikely to fail review), or FAIL (will likely
|
|
61
|
+
fail AppExchange security review).
|
|
62
|
+
|
|
63
|
+
Audit criteria, grep patterns, and PASS/WARN/FAIL thresholds for all 15 categories:
|
|
64
|
+
|
|
65
|
+
@../_reference/APPEXCHANGE_REVIEW.md
|
|
66
|
+
|
|
67
|
+
Supporting reference for implementation patterns:
|
|
68
|
+
|
|
69
|
+
- CRUD/FLS, sharing, injection, XSS, Named Credentials: @../_reference/SECURITY_PATTERNS.md
|
|
70
|
+
- Sharing model details: @../_reference/SHARING_MODEL.md
|
|
71
|
+
- Testing standards and annotations: @../_reference/TESTING_STANDARDS.md
|
|
72
|
+
- Namespace, versioning, package CLI: @../_reference/PACKAGE_DEVELOPMENT.md
|
|
73
|
+
- Governor limits and anti-patterns: @../_reference/GOVERNOR_LIMITS.md
|
|
74
|
+
- LWC lifecycle and patterns: @../_reference/LWC_PATTERNS.md
|
|
75
|
+
|
|
76
|
+
**Categories:**
|
|
77
|
+
|
|
78
|
+
1. CRUD/FLS Enforcement (CRITICAL — #1 failure reason)
|
|
79
|
+
2. Sharing Model Enforcement
|
|
80
|
+
3. SOQL/DML Injection Prevention
|
|
81
|
+
4. Sensitive Data Exposure
|
|
82
|
+
5. XSS and Content Security Policy
|
|
83
|
+
6. External Callout Security
|
|
84
|
+
7. Third-Party Library Vulnerabilities
|
|
85
|
+
8. Code Coverage
|
|
86
|
+
9. Namespace and Packaging Compliance
|
|
87
|
+
10. Permission Model
|
|
88
|
+
11. Governor Limit Safety
|
|
89
|
+
12. Lightning Web Security (LWS) Compliance
|
|
90
|
+
13. Connected App and OAuth Configuration
|
|
91
|
+
14. Data at Rest and in Transit
|
|
92
|
+
15. Documentation and Submission Readiness
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Step 3 — 2GP License Qualification Checklist
|
|
97
|
+
|
|
98
|
+
After the security audit, assess readiness for 2GP licensing and AppExchange distribution.
|
|
99
|
+
Check every item and mark as DONE, NOT DONE, or N/A.
|
|
100
|
+
|
|
101
|
+
Full checklist (Dev Hub, package config, code quality, submission, ISV, post-review):
|
|
102
|
+
|
|
103
|
+
@../_reference/APPEXCHANGE_REVIEW.md (section: 2GP License Qualification Checklist)
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Step 4 — Pass/Fail Prediction
|
|
108
|
+
|
|
109
|
+
After completing the audit and checklist, calculate the overall score using the scoring
|
|
110
|
+
rules and produce one of these verdicts: READY TO SUBMIT / NEEDS REMEDIATION / MAJOR
|
|
111
|
+
REWORK NEEDED.
|
|
112
|
+
|
|
113
|
+
Scoring rules and verdict criteria:
|
|
114
|
+
|
|
115
|
+
@../_reference/APPEXCHANGE_REVIEW.md (section: Scoring Rules)
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Step 5 — Report Output
|
|
120
|
+
|
|
121
|
+
Generate a markdown report with this structure and save it to `docs/security/security-review-report.md`:
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+
# Security Review Report — [Package Name]
|
|
125
|
+
Generated: [Date]
|
|
126
|
+
Package Version: [version from sfdx-project.json]
|
|
127
|
+
Namespace: [namespace]
|
|
128
|
+
|
|
129
|
+
## Package Inventory
|
|
130
|
+
| Metadata Type | Count |
|
|
131
|
+
|--------------|-------|
|
|
132
|
+
| Apex Classes | X |
|
|
133
|
+
| ... | ... |
|
|
134
|
+
|
|
135
|
+
## Security Audit Results
|
|
136
|
+
### Overall Verdict: [READY TO SUBMIT / NEEDS REMEDIATION / MAJOR REWORK]
|
|
137
|
+
Score: X/15 categories passing
|
|
138
|
+
|
|
139
|
+
### Category Results
|
|
140
|
+
| # | Category | Status | Issues |
|
|
141
|
+
|---|----------|--------|--------|
|
|
142
|
+
| 1 | CRUD/FLS Enforcement | PASS/WARN/FAIL | Details |
|
|
143
|
+
| ... | ... | ... | ... |
|
|
144
|
+
|
|
145
|
+
### Critical Findings (FAIL)
|
|
146
|
+
[List each FAIL with file path, line number, and specific remediation]
|
|
147
|
+
|
|
148
|
+
### Warnings
|
|
149
|
+
[List each WARN with recommendation]
|
|
150
|
+
|
|
151
|
+
## 2GP License Qualification
|
|
152
|
+
[Checklist with DONE/NOT DONE status for each item]
|
|
153
|
+
|
|
154
|
+
## Remediation Plan
|
|
155
|
+
[Prioritized list of fixes, ordered by: automatic fails first, then likely fails, then warnings]
|
|
156
|
+
|
|
157
|
+
## Appendix: Scanner Commands
|
|
158
|
+
[Commands the user should run for Code Analyzer, Checkmarx, etc.]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Related
|
|
164
|
+
|
|
165
|
+
- Scanner commands: @../_reference/APPEXCHANGE_REVIEW.md (section: Scanner Commands)
|
|
166
|
+
- Top 20 failures: @../_reference/APPEXCHANGE_REVIEW.md (section: Top 20 Failures)
|
|
167
|
+
- 2026 platform changes: @../_reference/APPEXCHANGE_REVIEW.md (section: 2026 Considerations)
|