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.
Files changed (47) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.cursor/agents/sf-agentforce-agent.md +88 -40
  3. package/.cursor/skills/prompt-optimizer/SKILL.md +21 -21
  4. package/.cursor/skills/sf-2gp-security-review/SKILL.md +167 -0
  5. package/.cursor/skills/sf-agentforce-development/SKILL.md +385 -348
  6. package/.cursor/skills/sf-cli-reference/SKILL.md +221 -0
  7. package/.cursor/skills/sf-harness-audit/SKILL.md +2 -2
  8. package/.cursor/skills/sf-quickstart/SKILL.md +1 -1
  9. package/.cursor-plugin/plugin.json +1 -1
  10. package/README.md +8 -38
  11. package/agents/sf-agentforce-agent.md +88 -40
  12. package/docs/ARCHITECTURE.md +4 -3
  13. package/docs/authoring-guide.md +1 -1
  14. package/docs/hook-development.md +1 -1
  15. package/examples/agentforce-action/README.md +4 -4
  16. package/examples/devops-pipeline/README.md +4 -4
  17. package/examples/integration-pattern/README.md +4 -4
  18. package/examples/platform-events/README.md +4 -4
  19. package/examples/security-audit/README.md +3 -3
  20. package/examples/visualforce-migration/README.md +4 -4
  21. package/manifests/install-modules.json +9 -3
  22. package/package.json +2 -2
  23. package/scripts/lib/install-executor.js +23 -12
  24. package/skills/_reference/AGENTFORCE_PATTERNS.md +433 -51
  25. package/skills/_reference/APPEXCHANGE_REVIEW.md +427 -0
  26. package/skills/_reference/SF_CLI_COMMANDS.md +812 -0
  27. package/skills/prompt-optimizer/SKILL.md +21 -21
  28. package/skills/sf-2gp-security-review/SKILL.md +168 -0
  29. package/skills/sf-agentforce-development/SKILL.md +385 -348
  30. package/skills/sf-cli-reference/SKILL.md +225 -0
  31. package/skills/sf-harness-audit/SKILL.md +2 -2
  32. package/skills/sf-quickstart/SKILL.md +1 -1
  33. package/.cursor/hooks/adapter.js +0 -81
  34. package/.cursor/hooks/after-file-edit.js +0 -26
  35. package/.cursor/hooks/after-mcp-execution.js +0 -12
  36. package/.cursor/hooks/after-shell-execution.js +0 -30
  37. package/.cursor/hooks/after-tab-file-edit.js +0 -12
  38. package/.cursor/hooks/before-mcp-execution.js +0 -11
  39. package/.cursor/hooks/before-read-file.js +0 -13
  40. package/.cursor/hooks/before-shell-execution.js +0 -29
  41. package/.cursor/hooks/before-submit-prompt.js +0 -23
  42. package/.cursor/hooks/pre-compact.js +0 -7
  43. package/.cursor/hooks/session-end.js +0 -10
  44. package/.cursor/hooks/session-start.js +0 -10
  45. package/.cursor/hooks/stop.js +0 -18
  46. package/.cursor/hooks/subagent-start.js +0 -10
  47. package/.cursor/hooks/subagent-stop.js +0 -10
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: sf-cli-reference
3
+ description: >-
4
+ Use when looking up Salesforce CLI sf commands — org login, project deploy, apex run test, data query, package install, scratch org creation. Do NOT use for web documentation lookup or Apex code patterns.
5
+ ---
6
+
7
+ # SF CLI Command Reference
8
+
9
+ Reference: @../_reference/SF_CLI_COMMANDS.md
10
+
11
+ ## When to Use
12
+
13
+ - When you need to find the right `sf` command for a Salesforce task
14
+ - When constructing CLI commands with correct flags and syntax
15
+ - When choosing between similar commands (e.g., deploy start vs deploy validate)
16
+ - When setting up org authentication (web, jwt, sfdx-url)
17
+ - When running Apex tests or querying data from the command line
18
+ - When managing scratch orgs, packages, or metadata via CLI
19
+
20
+ ---
21
+
22
+ ## Command Decision Tree
23
+
24
+ ### Authenticate to an Org
25
+
26
+ | Scenario | Command | Key Flags |
27
+ |---|---|---|
28
+ | Interactive browser login | `sf org login web` | `--alias`, `--set-default` |
29
+ | CI/CD non-interactive login | `sf org login jwt` | `--client-id`, `--jwt-key-file`, `--username` |
30
+ | Auth URL from file | `sf org login sfdx-url` | `--sfdx-url-file` |
31
+ | Log out of an org | `sf org logout` | `--target-org`, `--no-prompt` |
32
+ | List all connected orgs | `sf org list` | `--all` |
33
+ | Open org in browser | `sf org open` | `--target-org`, `--path` |
34
+ | Display org details | `sf org display` | `--target-org`, `--verbose` |
35
+
36
+ ### Deploy or Retrieve Source
37
+
38
+ | Scenario | Command | Key Flags |
39
+ |---|---|---|
40
+ | Deploy source directory | `sf project deploy start` | `--source-dir`, `--target-org` |
41
+ | Deploy with manifest | `sf project deploy start` | `--manifest`, `--target-org` |
42
+ | Deploy specific metadata | `sf project deploy start` | `--metadata "ApexClass:MyClass"` |
43
+ | Validate without deploying | `sf project deploy validate` | `--test-level`, `--target-org` |
44
+ | Quick deploy after validation | `sf project deploy quick` | `--job-id`, `--target-org` |
45
+ | Check deploy status | `sf project deploy report` | `--job-id` |
46
+ | Resume failed deploy | `sf project deploy resume` | `--job-id` |
47
+ | Cancel in-progress deploy | `sf project deploy cancel` | `--job-id` |
48
+ | Retrieve from org | `sf project retrieve start` | `--source-dir`, `--target-org` |
49
+ | Retrieve by manifest | `sf project retrieve start` | `--manifest` |
50
+ | Preview retrieval | `sf project retrieve preview` | `--target-org` |
51
+ | Generate manifest | `sf project generate manifest` | `--source-dir`, `--output-dir` |
52
+ | Convert source to mdapi | `sf project convert source` | `--root-dir`, `--output-dir` |
53
+ | Convert mdapi to source | `sf project convert mdapi` | `--root-dir`, `--output-dir` |
54
+ | Create new project | `sf project generate` | `--name`, `--template` |
55
+
56
+ ### Run Apex Code and Tests
57
+
58
+ | Scenario | Command | Key Flags |
59
+ |---|---|---|
60
+ | Execute anonymous Apex | `sf apex run` | `--file`, `--target-org` |
61
+ | Run all local tests | `sf apex run test` | `--test-level RunLocalTests` |
62
+ | Run specific test classes | `sf apex run test` | `--class-names "MyTest,OtherTest"` |
63
+ | Run specific test methods | `sf apex run test` | `--tests "MyTest.testMethod"` |
64
+ | Run tests with coverage | `sf apex run test` | `--code-coverage`, `--output-dir` |
65
+ | Run test suite | `sf apex run test` | `--suite-names "MySuite"` |
66
+ | Stream debug logs live | `sf apex tail log` | `--target-org`, `--debug-level` |
67
+ | Get a specific log | `sf apex get log` | `--log-id` |
68
+ | List recent logs | `sf apex list log` | `--target-org` |
69
+
70
+ ### Work with Data
71
+
72
+ | Scenario | Command | Key Flags |
73
+ |---|---|---|
74
+ | Run SOQL query | `sf data query` | `--query`, `--target-org` |
75
+ | Run SOQL from file | `sf data query` | `--file`, `--result-format` |
76
+ | Bulk SOQL query | `sf data query` | `--query`, `--bulk`, `--wait` |
77
+ | Run SOSL search | `sf data search` | `--query` |
78
+ | Create a record | `sf data create record` | `--sobject`, `--values` |
79
+ | Update a record | `sf data update record` | `--sobject`, `--record-id`, `--values` |
80
+ | Delete a record | `sf data delete record` | `--sobject`, `--record-id` |
81
+ | Bulk upsert from CSV | `sf data upsert bulk` | `--file`, `--sobject`, `--external-id` |
82
+ | Bulk delete from CSV | `sf data delete bulk` | `--file`, `--sobject` |
83
+ | Export data as tree | `sf data export tree` | `--query`, `--plan` |
84
+ | Import tree data | `sf data import tree` | `--plan`, `--target-org` |
85
+
86
+ ### Manage Scratch Orgs and Sandboxes
87
+
88
+ | Scenario | Command | Key Flags |
89
+ |---|---|---|
90
+ | Create scratch org | `sf org create scratch` | `--definition-file`, `--alias`, `--duration-days` |
91
+ | Delete scratch org | `sf org delete scratch` | `--target-org`, `--no-prompt` |
92
+ | Create sandbox | `sf org create sandbox` | `--name`, `--definition-file`, `--alias` |
93
+ | Clone sandbox | `sf org create sandbox` | `--clone`, `--name` |
94
+ | Delete sandbox | `sf org delete sandbox` | `--target-org`, `--no-prompt` |
95
+ | Resume sandbox creation | `sf org resume sandbox` | `--name`, `--target-org` |
96
+ | Assign permission set | `sf org assign permset` | `--name`, `--target-org` |
97
+ | Create user | `sf org create user` | `--definition-file`, `--target-org` |
98
+
99
+ ### Manage Packages
100
+
101
+ | Scenario | Command | Key Flags |
102
+ |---|---|---|
103
+ | Create package | `sf package create` | `--name`, `--package-type`, `--path` |
104
+ | Create version | `sf package version create` | `--package`, `--installation-key`, `--code-coverage` |
105
+ | Promote version | `sf package version promote` | `--package` |
106
+ | Install package | `sf package install` | `--package`, `--target-org` |
107
+ | Uninstall package | `sf package uninstall` | `--package`, `--target-org` |
108
+ | List versions | `sf package version list` | `--packages`, `--verbose` |
109
+ | List installed | `sf package installed list` | `--target-org` |
110
+
111
+ ### Work with Agentforce / AI Agents
112
+
113
+ | Scenario | Command | Key Flags |
114
+ |---|---|---|
115
+ | Create agent | `sf agent create` | `--target-org` |
116
+ | Generate agent spec | `sf agent generate spec` | `--output-dir` |
117
+ | Generate agent tests | `sf agent generate test` | `--spec-file`, `--output-dir` |
118
+ | Run agent tests | `sf agent test run` | `--name`, `--target-org` |
119
+ | Preview agent | `sf agent preview` | `--name`, `--target-org` |
120
+ | Activate agent | `sf agent activate` | `--target-org` |
121
+ | Deactivate agent | `sf agent deactivate` | `--target-org` |
122
+
123
+ > Note: `sf agent` commands are actively evolving. Run `sf agent <command> --help` for the latest flags.
124
+
125
+ ### Generate Code from Templates
126
+
127
+ | Scenario | Command | Key Flags |
128
+ |---|---|---|
129
+ | Generate Apex class | `sf apex generate class` | `--name`, `--output-dir`, `--template` |
130
+ | Generate Apex trigger | `sf apex generate trigger` | `--name`, `--sobject`, `--output-dir` |
131
+ | Generate LWC | `sf lightning generate component` | `--name`, `--type lwc` |
132
+ | Generate Aura component | `sf lightning generate component` | `--name`, `--type aura` |
133
+ | Generate Lightning event | `sf lightning generate event` | `--name`, `--output-dir` |
134
+ | Generate SObject | `sf schema generate sobject` | `--label`, `--output-dir` |
135
+ | Generate field | `sf schema generate field` | `--label`, `--object` |
136
+ | Generate platform event | `sf schema generate platformevent` | `--label`, `--output-dir` |
137
+ | Generate project | `sf project generate` | `--name`, `--template` |
138
+
139
+ ### Other Utilities
140
+
141
+ | Scenario | Command | Key Flags |
142
+ |---|---|---|
143
+ | Set default org | `sf config set` | `target-org=myOrg` |
144
+ | List config values | `sf config list` | |
145
+ | Set alias | `sf alias set` | `myAlias=user@org.com` |
146
+ | Describe SObject | `sf sobject describe` | `--sobject`, `--target-org` |
147
+ | List SObjects | `sf sobject list` | `--sobject-type`, `--target-org` |
148
+ | REST API request | `sf api request rest` | (URL path), `--method`, `--body` |
149
+ | GraphQL request | `sf api request graphql` | `--body` |
150
+ | Run Flow tests | `sf logic run test` | `--target-org` |
151
+ | Diagnose CLI issues | `sf doctor` | |
152
+ | Install plugin | `sf plugins install` | (plugin name) |
153
+ | Update CLI | `sf update` | |
154
+ | Show release notes | `sf info releasenotes display` | |
155
+
156
+ ---
157
+
158
+ ## Workflow Patterns
159
+
160
+ ### Authentication + Deploy
161
+
162
+ ```bash
163
+ # Login and deploy source
164
+ sf org login web --alias myOrg --set-default
165
+ sf project deploy start --source-dir force-app --target-org myOrg --wait 30
166
+ ```
167
+
168
+ ### CI/CD: Validate Then Quick Deploy
169
+
170
+ ```bash
171
+ # Authenticate in CI
172
+ sf org login jwt \
173
+ --client-id $SF_CLIENT_ID \
174
+ --jwt-key-file server.key \
175
+ --username $SF_USERNAME \
176
+ --alias prod
177
+
178
+ # Validate (runs tests without committing)
179
+ sf project deploy validate \
180
+ --source-dir force-app \
181
+ --test-level RunLocalTests \
182
+ --target-org prod \
183
+ --wait 60
184
+
185
+ # Quick deploy after successful validation (use job ID from validation output)
186
+ sf project deploy quick --job-id $JOB_ID --target-org prod
187
+ ```
188
+
189
+ ### Scratch Org Development Cycle
190
+
191
+ ```bash
192
+ # Create scratch org
193
+ sf org create scratch \
194
+ --definition-file config/project-scratch-def.json \
195
+ --alias dev \
196
+ --duration-days 7 \
197
+ --set-default
198
+
199
+ # Push source and assign permissions
200
+ sf project deploy start --source-dir force-app --target-org dev
201
+ sf org assign permset --name MyPermSet --target-org dev
202
+
203
+ # Import sample data
204
+ sf data import tree --plan data/sample-data-plan.json --target-org dev
205
+
206
+ # Run tests
207
+ sf apex run test --test-level RunLocalTests --target-org dev --code-coverage
208
+
209
+ # Clean up
210
+ sf org delete scratch --target-org dev --no-prompt
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Related
216
+
217
+ - **Skill**: `sf-deployment` -- detailed deployment strategies and error resolution
218
+ - **Skill**: `sf-devops-ci-cd` -- CI/CD pipeline setup with GitHub Actions
219
+ - **Skill**: `sf-debugging` -- debug log setup and analysis with CLI commands
220
+ - **Skill**: `sf-metadata-management` -- metadata types and source tracking
221
+ - **Skill**: `sf-docs-lookup` -- web search for official Salesforce documentation
@@ -24,7 +24,7 @@ Check what's installed in the current project:
24
24
 
25
25
  ```bash
26
26
  # Check for SCC installation markers
27
- ls -la .claude/hooks/ 2>/dev/null
27
+ ls -la .claude/hooks/scripts/ 2>/dev/null
28
28
  ls -la .claude/agents/ 2>/dev/null
29
29
  ls -la .claude/skills/ 2>/dev/null
30
30
  ```
@@ -44,7 +44,7 @@ Rate each category 0-10 using these rubrics:
44
44
  | 7-8 | All standard profile hooks active |
45
45
  | 9-10 | Strict profile enabled, all hooks active including Code Analyzer integration |
46
46
 
47
- Check: `cat .claude/hooks/hooks.json | grep -c '"command"'` to count active hooks.
47
+ Check: `npx scc-universal status` to see installed hooks and their profiles.
48
48
  Check: `echo $SCC_HOOK_PROFILE` to verify profile level.
49
49
 
50
50
  **Agent Coverage (0-10)**
@@ -102,7 +102,7 @@ Based on the project state, suggest 3-5 commands to start with:
102
102
  | Low test coverage | `sf-apex-testing` skill -- analyze gaps |
103
103
  | Deployment files present | `sf-deployment` skill -- pre-deployment check |
104
104
  | Security review needed | `sf-security` skill -- full security audit |
105
- | Build errors | `/sf-build-fix` -- fix build and deployment errors |
105
+ | Build errors | `sf-build-fix` -- fix build and deployment errors |
106
106
  | Any project | `/sf-help` -- browse all available commands and skills |
107
107
 
108
108
  ### Step 5 — Verify SCC Installation
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "salesforce-claude-code",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Production-ready expert subagents, domain skills, and quality gates for Salesforce development",
5
5
  "author": {
6
6
  "name": "Jiten Singh",
package/README.md CHANGED
@@ -106,7 +106,8 @@ npx scc-universal uninstall # Remove SCC-managed files
106
106
  |---|---|---|
107
107
  | Agents | `.claude/agents/*.md` | `.cursor/agents/*.md` |
108
108
  | Skills | `.claude/skills/*/SKILL.md` | `.cursor/skills/*/SKILL.md` |
109
- | Hooks | Merged into `.claude/settings.json` | `.cursor/hooks.json` |
109
+ | Hooks (config) | Merged into `.claude/settings.json` | `.cursor/hooks.json` |
110
+ | Hooks (scripts) | `.claude/hooks/scripts/`, `.claude/hooks/lib/` | `.cursor/hooks/scripts/`, `.cursor/hooks/lib/` |
110
111
  | MCP config | `.mcp.json` (project root) | `.cursor/mcp.json` |
111
112
 
112
113
  ### Install Profiles
@@ -420,52 +421,21 @@ Control which hooks run via the `SCC_HOOK_PROFILE` environment variable:
420
421
 
421
422
  ## Tips and Best Practices
422
423
 
423
- ### Salesforce-Specific Workflows
424
+ ### Typical Workflows
424
425
 
425
- **New Feature Development:**
426
+ **New Feature:** Describe what you want to build — sf-architect activates automatically, designs the solution, and delegates to domain agents (sf-apex-agent, sf-lwc-agent, sf-flow-agent) with TDD.
426
427
 
427
- 1. `/blueprint` - Plan the implementation (metadata types, governor limits)
428
- 2. `/sf-tdd-workflow` - Write tests first, then implement
429
- 3. `/sf-apex-best-practices` - Review your code
430
- 4. `/sf-deployment` - Deploy to target org
428
+ **Bug Fix:** Describe the error sf-bugfix-agent activates, diagnoses root cause, applies minimal fix.
431
429
 
432
- **Code Review:**
433
-
434
- 1. `/sf-apex-best-practices` - Full review of uncommitted changes
435
- 2. `/sf-security` - Security-focused audit
436
- 3. `/sf-governor-limits` - Check for governor limit issues
437
-
438
- **Performance Optimization:**
439
-
440
- 1. `/sf-soql-optimization` - Fix expensive queries
441
- 2. `/sf-governor-limits` - Find limit violations
442
- 3. Use the `sf-review-agent` for deep analysis
443
-
444
- ### Context Window Management
445
-
446
- - Keep MCP servers minimal (SF CLI MCP + 2-3 others)
447
- - Use specific prompts: "Review AccountTrigger.cls" not "review everything"
448
- - Use `/compact` when context gets large
449
-
450
- ### Parallel Workflows
451
-
452
- - Use `/fork` for non-overlapping tasks
453
- - Use git worktrees for parallel scratch org work:
454
-
455
- ```bash
456
- git worktree add ../feature-branch feature-branch
457
- cd ../feature-branch
458
- sf org create scratch --alias feature-scratch
459
- ```
430
+ **Code Review:** Ask to review before deploy — sf-review-agent runs a full quality gate (security, governor limits, test coverage, deploy readiness).
460
431
 
461
432
  ### Key Principles
462
433
 
463
434
  1. **Governor limits are king** — Every agent checks for limit violations
464
435
  2. **Test-first approach** — 75% is the SF minimum, aim for 85%+
465
- 3. **Use the right agent** — Specialized agents give better results than generic prompts
436
+ 3. **Be specific** — "Review AccountTrigger.cls" not "review everything"
466
437
  4. **Hook profiles matter** — Start with `standard`, move to `strict` for CI
467
- 5. **Context is precious** — Be specific in prompts, disable unused MCPs
468
- 6. **Security baked in** — CRUD/FLS and sharing model from the start
438
+ 5. **Security baked in** — CRUD/FLS and sharing model from the start
469
439
 
470
440
  ---
471
441
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sf-agentforce-agent
3
- description: "Build and test Agentforce AI agents — topics, instructions, Apex actions (@InvocableMethod), Flow actions, Prompt Templates. Use PROACTIVELY when building Agentforce. For new features, use sf-architect first. Do NOT use for standard Apex."
3
+ description: "Build and test Agentforce AI agents — Agent Script, topics, Apex actions, metadata deployment. Use PROACTIVELY when building Agentforce. Do NOT use for standard Apex."
4
4
  tools: ["Read", "Write", "Edit", "Bash", "Grep", "Glob"]
5
5
  model: sonnet
6
6
  origin: SCC
@@ -11,15 +11,18 @@ skills:
11
11
  - sf-agentforce-development
12
12
  ---
13
13
 
14
- 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.
14
+ 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.
15
15
 
16
16
  ## When to Use
17
17
 
18
- - Creating Agentforce agent topics and instructions
18
+ - Creating Agentforce agents with Agent Script (`.agent` files)
19
+ - Generating and publishing authoring bundles
19
20
  - Building custom Apex actions (`@InvocableMethod`) for agents
20
21
  - Building Flow actions for agent orchestration
21
22
  - Creating and testing Prompt Templates
22
- - Testing agent behavior with `sf agent test`
23
+ - Configuring MCP Server, Named Query, or AuraEnabled actions
24
+ - Testing agent behavior with `sf agent test` and YAML test specs
25
+ - Deploying agent metadata (GenAi types, AiAuthoringBundle)
23
26
  - Reviewing existing Agentforce configurations for context engineering quality
24
27
 
25
28
  Do NOT use for standard Apex classes, LWC, or Flows unrelated to Agentforce.
@@ -29,16 +32,22 @@ Do NOT use for standard Apex classes, LWC, or Flows unrelated to Agentforce.
29
32
  ### Phase 1 — Assess
30
33
 
31
34
  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.
32
- 2. Check existing Agentforce configuration in the org
35
+ 2. Check existing Agentforce configuration in the org:
36
+ - Look for `aiAuthoringBundles/` directory (Agent Script)
37
+ - Inventory existing `.agent` files and their topics
38
+ - Check for classic config: `genAiPlugins/`, `genAiPlanners/`, `genAiPlannerBundles/`
33
39
  3. Inventory existing `@InvocableMethod` classes and their labels/descriptions
34
40
  4. Review existing topics — count total (max 10 recommended)
35
41
  5. Review existing actions per topic — count total (max 12-15 per topic)
42
+ 6. Determine approach: **Agent Script** (API v65+, recommended) or **Classic Setup** (API < v65)
36
43
 
37
44
  ### Phase 2 — Design Topics
38
45
 
39
46
  Consult `sf-agentforce-development` skill for patterns.
40
47
 
41
- **Topic Design Rules:**
48
+ **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.
49
+
50
+ **Topic Design Rules (both approaches):**
42
51
 
43
52
  | Rule | Rationale |
44
53
  |---|---|
@@ -46,9 +55,16 @@ Consult `sf-agentforce-development` skill for patterns.
46
55
  | Max 12-15 actions per topic | Agent routing degrades with too many options |
47
56
  | Topic scope: explicit WILL/WILL NOT | Prevents agent from attempting out-of-scope tasks |
48
57
  | Topic instructions: positive framing | "Always do X" not "Don't do Y" — LLM responds better |
49
- | No business rules in topic instructions | Put deterministic logic in action code, not natural language |
58
+ | No business rules in topic instructions | Put deterministic logic in action code or Agent Script `->` |
50
59
  | Varied action verb names | "Locate", "Retrieve", "Calculate" — not "Get X", "Get Y", "Get Z" |
51
60
 
61
+ **Agent Script Design Considerations:**
62
+
63
+ - Plan block order: `config → variables → system → start_agent → topics`
64
+ - Identify which logic is deterministic (`->`) vs LLM-driven (`|`)
65
+ - Design variables for state that must persist across turns (mutable) or from session context (linked)
66
+ - Plan topic transitions: deterministic (`transition to`) for hard gates, LLM-selected for flexible routing
67
+
52
68
  **Grounding Strategy:**
53
69
 
54
70
  | Data Source | Use When |
@@ -56,72 +72,104 @@ Consult `sf-agentforce-development` skill for patterns.
56
72
  | Knowledge Articles | FAQ-style, content that changes frequently |
57
73
  | Custom Objects | Structured data queryable via SOQL in actions |
58
74
  | External data via actions | Real-time data from APIs |
75
+ | MCP Server | Third-party integrations without custom Apex |
76
+ | Named Query | Simple read-only SOQL without Flow or Apex |
59
77
  | Prompt Templates | Structured output formatting, consistent tone |
60
78
 
61
- **Context Engineering Principles:**
62
-
63
- 1. Use variables to store key facts — don't rely on conversation memory
64
- 2. Eliminate contradictions across topic instructions, action instructions, and scope
65
- 3. Validate grounding data is current and accurate
66
- 4. Use structured actions for critical business logic — reserve natural language for conversational tasks
67
-
68
79
  ### Phase 3 — Test First (TDD)
69
80
 
70
- Write Apex test for each `@InvocableMethod` BEFORE the production class. Test must fail (RED) before action class exists.
81
+ **Apex action tests** write before the production class (RED GREEN):
71
82
 
72
83
  1. Create test class: `[ActionClass]Test.cls`
73
84
  2. Test with `@TestSetup` using `TestDataFactory`
74
- 3. Test cases:
75
- - **Valid inputs**: correct parameters → expected output
76
- - **Invalid inputs**: null, empty, wrong type → graceful error (not unhandled exception)
77
- - **Bulk scenario**: List of inputs (Flow bulkification)
78
- - **Permission test**: `System.runAs()` with user who should/shouldn't have access
79
- 4. Run test to confirm RED:
85
+ 3. Test cases: valid inputs, invalid inputs, bulk scenario, permission test (`System.runAs()`)
86
+ 4. Run to confirm RED:
80
87
 
81
88
  ```bash
82
89
  sf apex run test --class-names "MyActionTest" --result-format human --wait 10
83
90
  ```
84
91
 
92
+ **Agent test spec** — generate YAML for end-to-end agent behavior:
93
+
94
+ ```bash
95
+ sf agent generate test-spec --output-file specs/testSpec.yaml
96
+ ```
97
+
98
+ Customize with test cases covering each topic, expected actions, and metrics.
99
+
85
100
  ### Phase 4 — Build Actions
86
101
 
87
102
  1. Write `@InvocableMethod` Apex class with proper `InvocableVariable` inputs/outputs
88
103
  2. Keep actions focused — one action per business operation
89
104
  3. Use `with sharing` and enforce CRUD/FLS (`WITH USER_MODE`, `AccessLevel.USER_MODE`)
90
105
  4. Clear, descriptive `label` and `description` — these are what the LLM reads to decide routing
91
- 5. `InvocableVariable` descriptions specify data type and format: "accountId — The 18-digit unique Account record ID"
106
+ 5. `InvocableVariable` descriptions specify data type and format
92
107
  6. Return structured output — the LLM needs to parse the response
108
+ 7. Use `Database` class (partial success) not DML verbs (all-or-nothing)
109
+ 8. For long-running work: enqueue Queueable, return requestId
110
+ 9. Consider alternatives: MCP Server (external APIs), Named Query (read-only SOQL), AuraEnabled (reuse LWC controllers)
111
+
112
+ ### Phase 5 — Build Agent
113
+
114
+ **Agent Script path (recommended):**
115
+
116
+ 1. Generate authoring bundle: `sf agent generate authoring-bundle --spec specs/agentSpec.yaml --name "My Agent" --api-name My_Agent`
117
+ 2. Edit `.agent` file — define config, variables, system, start_agent, topics
118
+ 3. Map actions to topics in `reasoning.actions` blocks
119
+ 4. Use `->` for deterministic logic, `|` for LLM prompts
120
+ 5. Create Prompt Templates with clear output structure
121
+ 6. Validate: `sf agent validate authoring-bundle`
122
+ 7. Publish: `sf agent publish authoring-bundle --target-org MySandbox`
93
123
 
94
- ### Phase 5 — Build Topics and Templates
124
+ **Classic path (fallback):**
95
125
 
96
- 1. Write topic metadata with WILL/WILL NOT scope boundaries
97
- 2. Write numbered instructions (positive framing)
98
- 3. Map actions to topics — verify no orphaned actions
99
- 4. Create Prompt Templates with clear output structure
100
- 5. Test with `sf agent test`:
126
+ 1. Configure topics in Agentforce Builder UI
127
+ 2. Write WILL/WILL NOT scope boundaries
128
+ 3. Write numbered instructions (positive framing)
129
+ 4. Map actions to topics verify no orphaned actions
130
+ 5. Create Prompt Templates
131
+
132
+ ### Phase 6 — Test & Preview
101
133
 
102
134
  ```bash
103
- sf agent test --name "MyAgent" --test-case "OrderLookup" --target-org DevOrg
135
+ # Preview interactive testing
136
+ sf agent preview --target-org MySandbox
137
+
138
+ # Create agent tests in org from YAML spec
139
+ sf agent test create --spec specs/testSpec.yaml --target-org MySandbox
140
+
141
+ # Run tests — sync with output for review
142
+ sf agent test run --api-name My_Agent_Tests --wait 10 \
143
+ --result-format junit --output-dir ./test-results \
144
+ --target-org MySandbox
104
145
  ```
105
146
 
106
- ### Phase 6 Self-Review
147
+ Review results for topic routing, action execution, outcome quality, and instruction adherence.
148
+
149
+ ### Phase 7 — Self-Review
107
150
 
108
- 1. All actions use `with sharing` and enforce CRUD/FLS
109
- 2. Each action has clear, descriptive `label` and `description` (LLM reads these)
110
- 3. `InvocableVariable` inputs are required where needed, with format descriptions
111
- 4. Topic count <= 10, actions per topic <= 15
112
- 5. No contradictions between topic scope, topic instructions, and action instructions
113
- 6. No deterministic business rules in topic instructions (those go in action code)
114
- 7. Action verb names are varied across topics (not all "Get")
115
- 8. Test coverage includes valid, invalid, bulk, and permission cases
116
- 9. Grounding data (Knowledge Articles, custom objects) is current
117
- 10. All acceptance criteria from the architect's task plan are met
151
+ 1. Agent Script validates without errors (`sf agent validate authoring-bundle`)
152
+ 2. Authoring bundle publishes successfully
153
+ 3. All actions use `with sharing` and enforce CRUD/FLS
154
+ 4. Each action has clear, descriptive `label` and `description` (LLM reads these)
155
+ 5. `InvocableVariable` inputs are required where needed, with format descriptions
156
+ 6. Topic count <= 10, actions per topic <= 15
157
+ 7. No contradictions between topic scope, topic instructions, and action instructions
158
+ 8. No deterministic business rules in topic instructions (those go in action code or `->` logic)
159
+ 9. Action verb names are varied across topics (not all "Get")
160
+ 10. YAML test spec covers all topics with appropriate metrics
161
+ 11. Test coverage includes valid, invalid, bulk, and permission cases for Apex actions
162
+ 12. Grounding data (Knowledge Articles, custom objects) is current
163
+ 13. All acceptance criteria from the architect's task plan are met
118
164
 
119
165
  ## Escalation
120
166
 
121
167
  Stop and ask before:
122
168
 
169
+ - Publishing an authoring bundle to production without preview testing
123
170
  - Modifying existing agent topics that are live in production
124
171
  - Changing action labels/descriptions (affects agent routing — LLM may behave differently)
172
+ - Changing Agent Script `->` logic that affects deterministic control flow
125
173
  - Adding more than 10 topics to a single agent
126
174
  - Adding more than 15 actions to a single topic
127
175
  - Deploying an agent without end-to-end testing via `sf agent test`
@@ -117,9 +117,10 @@ npx scc-universal install all
117
117
  ├── Resolve component list for profile
118
118
  ├── Generate install plan (scripts/dev/install-plan.js)
119
119
  ├── Execute plan (scripts/cli/install-apply.js)
120
- │ ├── Copy agents to target
121
- │ ├── Copy skills to target
122
- └── Register hooks
120
+ │ ├── Copy agents to target (.claude/agents/)
121
+ │ ├── Copy skills to target (.claude/skills/)
122
+ ├── Copy hook scripts + lib (.claude/hooks/scripts/, .claude/hooks/lib/)
123
+ │ └── Merge hook config into .claude/settings.json
123
124
  └── Update state store (scripts/lib/state-store.js)
124
125
  ```
125
126
 
@@ -360,7 +360,7 @@ Before submitting a pull request that adds new content, verify:
360
360
  - [ ] `async: true` is set unless the hook must block execution
361
361
  - [ ] `timeout` is set to a reasonable value
362
362
  - [ ] Test file is created in `tests/hooks/`
363
- - [ ] Cursor mirror is updated in `.cursor/hooks/` if applicable
363
+ - [ ] Cursor hooks are auto-generated by `npm run build` (no manual mirror needed)
364
364
  - [ ] `node scripts/ci/validate-hooks.js` passes
365
365
  - [ ] `node tests/hooks/my-hook.test.js` passes
366
366
 
@@ -385,7 +385,7 @@ if (failCount > 0) process.exit(1);
385
385
 
386
386
  ### Step 4 -- Update the Cursor Mirror
387
387
 
388
- For Cursor IDE parity, add a corresponding hook in `.cursor/hooks/`. Cursor hooks use different lifecycle names but the adapter layer (`adapter.js`) maps them.
388
+ For Cursor IDE parity, run `npm run build` to regenerate `.cursor/hooks.json`. The adapter layer maps Claude Code lifecycle events to Cursor equivalents automatically.
389
389
 
390
390
  | Claude Code Event | Cursor Equivalent |
391
391
  |---|---|
@@ -221,7 +221,7 @@ Flow: Case Creation from Chat
221
221
 
222
222
  ## SCC Skills
223
223
 
224
- - `/sf-agentforce-development` -- scaffold and review Agentforce actions
225
- - `/sf-apex-best-practices` -- review the action class for best practices
226
- - `/sf-tdd-workflow` -- write tests first, then implement the action
227
- - `/sf-governor-limits` -- check governor limit compliance in bulk scenarios
224
+ - `sf-agentforce-development` -- scaffold and review Agentforce actions
225
+ - `sf-apex-best-practices` -- review the action class for best practices
226
+ - `sf-tdd-workflow` -- write tests first, then implement the action
227
+ - `sf-governor-limits` -- check governor limit compliance in bulk scenarios
@@ -319,7 +319,7 @@ jobs:
319
319
 
320
320
  ## SCC Skills
321
321
 
322
- - `/sf-deployment` -- validate and deploy metadata to a target org
323
- - `/sf-devops-ci-cd` -- CI/CD pipeline patterns with scratch orgs
324
- - `/sf-build-fix` -- diagnose and fix deployment failures
325
- - `/sf-apex-testing` -- run Apex tests with coverage analysis
322
+ - `sf-deployment` -- validate and deploy metadata to a target org
323
+ - `sf-devops-ci-cd` -- CI/CD pipeline patterns with scratch orgs
324
+ - `sf-build-fix` -- diagnose and fix deployment failures
325
+ - `sf-apex-testing` -- run Apex tests with coverage analysis
@@ -410,7 +410,7 @@ private class PaymentGatewayService_Test {
410
410
 
411
411
  ## SCC Skills
412
412
 
413
- - `/sf-security` -- verify Named Credential usage and no hardcoded secrets
414
- - `/sf-apex-best-practices` -- review callout service code for best practices
415
- - `/sf-tdd-workflow` -- write tests first using mock classes
416
- - `/sf-governor-limits` -- check callout limits in async and batch contexts
413
+ - `sf-security` -- verify Named Credential usage and no hardcoded secrets
414
+ - `sf-apex-best-practices` -- review callout service code for best practices
415
+ - `sf-tdd-workflow` -- write tests first using mock classes
416
+ - `sf-governor-limits` -- check callout limits in async and batch contexts
@@ -486,7 +486,7 @@ private class OrderEventPublisher_Test {
486
486
 
487
487
  ## SCC Skills
488
488
 
489
- - `/sf-platform-events-cdc` -- review Platform Event and CDC implementations
490
- - `/sf-apex-best-practices` -- review publisher and subscriber Apex code
491
- - `/sf-lwc-development` -- review the empApi subscription component
492
- - `/sf-governor-limits` -- check event publish limits and bulk compliance
489
+ - `sf-platform-events-cdc` -- review Platform Event and CDC implementations
490
+ - `sf-apex-best-practices` -- review publisher and subscriber Apex code
491
+ - `sf-lwc-development` -- review the empApi subscription component
492
+ - `sf-governor-limits` -- check event publish limits and bulk compliance
@@ -239,6 +239,6 @@ sf scanner run --target "force-app/" \
239
239
 
240
240
  ## SCC Skills
241
241
 
242
- - `/sf-security` -- run a comprehensive security audit on your codebase
243
- - `/sf-apex-best-practices` -- review Apex code including security best practices
244
- - `/sf-governor-limits` -- check for governor limit issues (overlaps with security for SOQL)
242
+ - `sf-security` -- run a comprehensive security audit on your codebase
243
+ - `sf-apex-best-practices` -- review Apex code including security best practices
244
+ - `sf-governor-limits` -- check for governor limit issues (overlaps with security for SOQL)