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.
Files changed (271) hide show
  1. package/.claude-plugin/plugin.json +44 -0
  2. package/.cursor/agents/deep-researcher.md +142 -0
  3. package/.cursor/agents/doc-updater.md +219 -0
  4. package/.cursor/agents/eval-runner.md +335 -0
  5. package/.cursor/agents/learning-engine.md +210 -0
  6. package/.cursor/agents/loop-operator.md +245 -0
  7. package/.cursor/agents/refactor-cleaner.md +119 -0
  8. package/.cursor/agents/sf-admin-agent.md +127 -0
  9. package/.cursor/agents/sf-agentforce-agent.md +126 -0
  10. package/.cursor/agents/sf-apex-agent.md +117 -0
  11. package/.cursor/agents/sf-architect.md +426 -0
  12. package/.cursor/agents/sf-aura-reviewer.md +369 -0
  13. package/.cursor/agents/sf-bugfix-agent.md +101 -0
  14. package/.cursor/agents/sf-flow-agent.md +155 -0
  15. package/.cursor/agents/sf-integration-agent.md +141 -0
  16. package/.cursor/agents/sf-lwc-agent.md +123 -0
  17. package/.cursor/agents/sf-review-agent.md +357 -0
  18. package/.cursor/agents/sf-visualforce-reviewer.md +465 -0
  19. package/.cursor/hooks/adapter.js +81 -0
  20. package/.cursor/hooks/after-file-edit.js +26 -0
  21. package/.cursor/hooks/after-mcp-execution.js +12 -0
  22. package/.cursor/hooks/after-shell-execution.js +30 -0
  23. package/.cursor/hooks/after-tab-file-edit.js +12 -0
  24. package/.cursor/hooks/before-mcp-execution.js +11 -0
  25. package/.cursor/hooks/before-read-file.js +13 -0
  26. package/.cursor/hooks/before-shell-execution.js +29 -0
  27. package/.cursor/hooks/before-submit-prompt.js +23 -0
  28. package/.cursor/hooks/pre-compact.js +7 -0
  29. package/.cursor/hooks/session-end.js +10 -0
  30. package/.cursor/hooks/session-start.js +10 -0
  31. package/.cursor/hooks/stop.js +18 -0
  32. package/.cursor/hooks/subagent-start.js +10 -0
  33. package/.cursor/hooks/subagent-stop.js +10 -0
  34. package/.cursor/hooks.json +107 -0
  35. package/.cursor/skills/aside/SKILL.md +115 -0
  36. package/.cursor/skills/checkpoint/SKILL.md +50 -0
  37. package/.cursor/skills/configure-scc/SKILL.md +160 -0
  38. package/.cursor/skills/continuous-agent-loop/SKILL.md +260 -0
  39. package/.cursor/skills/mcp-server-patterns/SKILL.md +142 -0
  40. package/.cursor/skills/model-route/SKILL.md +81 -0
  41. package/.cursor/skills/prompt-optimizer/SKILL.md +366 -0
  42. package/.cursor/skills/refactor-clean/SKILL.md +133 -0
  43. package/.cursor/skills/resume-session/SKILL.md +111 -0
  44. package/.cursor/skills/save-session/SKILL.md +183 -0
  45. package/.cursor/skills/search-first/SKILL.md +140 -0
  46. package/.cursor/skills/security-scan/SKILL.md +142 -0
  47. package/.cursor/skills/sessions/SKILL.md +124 -0
  48. package/.cursor/skills/sf-agentforce-development/SKILL.md +449 -0
  49. package/.cursor/skills/sf-apex-async-patterns/SKILL.md +324 -0
  50. package/.cursor/skills/sf-apex-best-practices/SKILL.md +421 -0
  51. package/.cursor/skills/sf-apex-constraints/SKILL.md +79 -0
  52. package/.cursor/skills/sf-apex-cursor/SKILL.md +336 -0
  53. package/.cursor/skills/sf-apex-enterprise-patterns/SKILL.md +344 -0
  54. package/.cursor/skills/sf-apex-testing/SKILL.md +407 -0
  55. package/.cursor/skills/sf-api-design/SKILL.md +237 -0
  56. package/.cursor/skills/sf-approval-processes/SKILL.md +312 -0
  57. package/.cursor/skills/sf-aura-development/SKILL.md +260 -0
  58. package/.cursor/skills/sf-build-fix/SKILL.md +120 -0
  59. package/.cursor/skills/sf-data-modeling/SKILL.md +274 -0
  60. package/.cursor/skills/sf-debugging/SKILL.md +362 -0
  61. package/.cursor/skills/sf-deployment/SKILL.md +291 -0
  62. package/.cursor/skills/sf-deployment-constraints/SKILL.md +153 -0
  63. package/.cursor/skills/sf-devops-ci-cd/SKILL.md +322 -0
  64. package/.cursor/skills/sf-docs-lookup/SKILL.md +100 -0
  65. package/.cursor/skills/sf-e2e-testing/SKILL.md +321 -0
  66. package/.cursor/skills/sf-experience-cloud/SKILL.md +248 -0
  67. package/.cursor/skills/sf-flow-development/SKILL.md +376 -0
  68. package/.cursor/skills/sf-governor-limits/SKILL.md +319 -0
  69. package/.cursor/skills/sf-harness-audit/SKILL.md +139 -0
  70. package/.cursor/skills/sf-help/SKILL.md +156 -0
  71. package/.cursor/skills/sf-integration/SKILL.md +479 -0
  72. package/.cursor/skills/sf-lwc-constraints/SKILL.md +128 -0
  73. package/.cursor/skills/sf-lwc-development/SKILL.md +302 -0
  74. package/.cursor/skills/sf-lwc-testing/SKILL.md +387 -0
  75. package/.cursor/skills/sf-metadata-management/SKILL.md +285 -0
  76. package/.cursor/skills/sf-platform-events-cdc/SKILL.md +372 -0
  77. package/.cursor/skills/sf-quickstart/SKILL.md +170 -0
  78. package/.cursor/skills/sf-security/SKILL.md +330 -0
  79. package/.cursor/skills/sf-security-constraints/SKILL.md +125 -0
  80. package/.cursor/skills/sf-soql-constraints/SKILL.md +129 -0
  81. package/.cursor/skills/sf-soql-optimization/SKILL.md +353 -0
  82. package/.cursor/skills/sf-tdd-workflow/SKILL.md +332 -0
  83. package/.cursor/skills/sf-testing-constraints/SKILL.md +198 -0
  84. package/.cursor/skills/sf-trigger-constraints/SKILL.md +88 -0
  85. package/.cursor/skills/sf-trigger-frameworks/SKILL.md +343 -0
  86. package/.cursor/skills/sf-visualforce-development/SKILL.md +259 -0
  87. package/.cursor/skills/strategic-compact/SKILL.md +205 -0
  88. package/.cursor/skills/update-docs/SKILL.md +162 -0
  89. package/.cursor/skills/update-platform-docs/SKILL.md +86 -0
  90. package/.cursor-plugin/plugin.json +26 -0
  91. package/LICENSE +21 -0
  92. package/README.md +522 -0
  93. package/agents/deep-researcher.md +145 -0
  94. package/agents/doc-updater.md +222 -0
  95. package/agents/eval-runner.md +340 -0
  96. package/agents/learning-engine.md +211 -0
  97. package/agents/loop-operator.md +247 -0
  98. package/agents/refactor-cleaner.md +122 -0
  99. package/agents/sf-admin-agent.md +131 -0
  100. package/agents/sf-agentforce-agent.md +132 -0
  101. package/agents/sf-apex-agent.md +124 -0
  102. package/agents/sf-architect.md +435 -0
  103. package/agents/sf-aura-reviewer.md +372 -0
  104. package/agents/sf-bugfix-agent.md +105 -0
  105. package/agents/sf-flow-agent.md +159 -0
  106. package/agents/sf-integration-agent.md +146 -0
  107. package/agents/sf-lwc-agent.md +127 -0
  108. package/agents/sf-review-agent.md +366 -0
  109. package/agents/sf-visualforce-reviewer.md +468 -0
  110. package/assets/logo.svg +18 -0
  111. package/docs/ARCHITECTURE.md +133 -0
  112. package/docs/authoring-guide.md +373 -0
  113. package/docs/hook-development.md +578 -0
  114. package/docs/token-optimization.md +139 -0
  115. package/docs/workflow-examples.md +645 -0
  116. package/examples/agentforce-action/README.md +227 -0
  117. package/examples/apex-trigger-handler/README.md +114 -0
  118. package/examples/devops-pipeline/README.md +325 -0
  119. package/examples/flow-automation/README.md +188 -0
  120. package/examples/integration-pattern/README.md +416 -0
  121. package/examples/lwc-component/README.md +180 -0
  122. package/examples/platform-events/README.md +492 -0
  123. package/examples/scratch-org-setup/README.md +138 -0
  124. package/examples/security-audit/README.md +244 -0
  125. package/examples/visualforce-migration/README.md +314 -0
  126. package/hooks/hooks.json +338 -0
  127. package/hooks/memory-persistence/README.md +73 -0
  128. package/manifests/install-modules.json +217 -0
  129. package/manifests/install-profiles.json +17 -0
  130. package/mcp-configs/mcp-servers.json +19 -0
  131. package/package.json +89 -0
  132. package/schemas/hooks.schema.json +123 -0
  133. package/schemas/install-modules.schema.json +76 -0
  134. package/schemas/install-profiles.schema.json +28 -0
  135. package/schemas/install-state.schema.json +73 -0
  136. package/schemas/package-manager.schema.json +18 -0
  137. package/schemas/plugin.schema.json +112 -0
  138. package/schemas/scc-install-config.schema.json +29 -0
  139. package/schemas/state-store.schema.json +111 -0
  140. package/scripts/cli/install-apply.js +170 -0
  141. package/scripts/cli/uninstall.js +193 -0
  142. package/scripts/hooks/check-console-log.js +101 -0
  143. package/scripts/hooks/check-hook-enabled.js +17 -0
  144. package/scripts/hooks/check-platform-docs-age.js +48 -0
  145. package/scripts/hooks/cost-tracker.js +78 -0
  146. package/scripts/hooks/doc-file-warning.js +63 -0
  147. package/scripts/hooks/evaluate-session.js +98 -0
  148. package/scripts/hooks/governor-check.js +220 -0
  149. package/scripts/hooks/learning-observe.sh +206 -0
  150. package/scripts/hooks/mcp-health-check.js +588 -0
  151. package/scripts/hooks/post-bash-build-complete.js +34 -0
  152. package/scripts/hooks/post-bash-pr-created.js +43 -0
  153. package/scripts/hooks/post-edit-console-warn.js +61 -0
  154. package/scripts/hooks/post-edit-format.js +79 -0
  155. package/scripts/hooks/post-edit-typecheck.js +98 -0
  156. package/scripts/hooks/post-write.js +168 -0
  157. package/scripts/hooks/pre-bash-git-push-reminder.js +35 -0
  158. package/scripts/hooks/pre-bash-tmux-reminder.js +47 -0
  159. package/scripts/hooks/pre-compact.js +51 -0
  160. package/scripts/hooks/pre-tool-use.js +163 -0
  161. package/scripts/hooks/pre-write-doc-warn.js +9 -0
  162. package/scripts/hooks/quality-gate.js +251 -0
  163. package/scripts/hooks/run-with-flags-shell.sh +32 -0
  164. package/scripts/hooks/run-with-flags.js +135 -0
  165. package/scripts/hooks/session-end-marker.js +29 -0
  166. package/scripts/hooks/session-end.js +311 -0
  167. package/scripts/hooks/session-start.js +202 -0
  168. package/scripts/hooks/sfdx-scanner-check.js +142 -0
  169. package/scripts/hooks/sfdx-validate.js +119 -0
  170. package/scripts/hooks/stop-hook.js +170 -0
  171. package/scripts/hooks/suggest-compact.js +67 -0
  172. package/scripts/lib/agent-adapter.js +82 -0
  173. package/scripts/lib/apex-analysis.js +194 -0
  174. package/scripts/lib/hook-flags.js +74 -0
  175. package/scripts/lib/install-config.js +73 -0
  176. package/scripts/lib/install-executor.js +363 -0
  177. package/scripts/lib/install-state.js +121 -0
  178. package/scripts/lib/orchestration-session.js +299 -0
  179. package/scripts/lib/package-manager.js +124 -0
  180. package/scripts/lib/project-detect.js +228 -0
  181. package/scripts/lib/schema-validator.js +190 -0
  182. package/scripts/lib/skill-adapter.js +100 -0
  183. package/scripts/lib/state-store.js +376 -0
  184. package/scripts/lib/tmux-worktree-orchestrator.js +598 -0
  185. package/scripts/lib/utils.js +313 -0
  186. package/scripts/scc.js +164 -0
  187. package/skills/_reference/AGENTFORCE_PATTERNS.md +112 -0
  188. package/skills/_reference/APEX_CURSOR.md +159 -0
  189. package/skills/_reference/API_VERSIONS.md +78 -0
  190. package/skills/_reference/APPROVAL_PROCESSES.md +105 -0
  191. package/skills/_reference/ASYNC_PATTERNS.md +163 -0
  192. package/skills/_reference/AURA_COMPONENTS.md +146 -0
  193. package/skills/_reference/DATA_MIGRATION_PATTERNS.md +151 -0
  194. package/skills/_reference/DATA_MODELING.md +124 -0
  195. package/skills/_reference/DEBUGGING_TOOLS.md +140 -0
  196. package/skills/_reference/DEPLOYMENT_CHECKLIST.md +87 -0
  197. package/skills/_reference/DEPRECATIONS.md +79 -0
  198. package/skills/_reference/DOCKER_CI_PATTERNS.md +138 -0
  199. package/skills/_reference/ENTERPRISE_PATTERNS.md +122 -0
  200. package/skills/_reference/EXPERIENCE_CLOUD.md +143 -0
  201. package/skills/_reference/FLOW_PATTERNS.md +113 -0
  202. package/skills/_reference/GOVERNOR_LIMITS.md +77 -0
  203. package/skills/_reference/INTEGRATION_PATTERNS.md +105 -0
  204. package/skills/_reference/LWC_PATTERNS.md +79 -0
  205. package/skills/_reference/METADATA_TYPES.md +115 -0
  206. package/skills/_reference/NAMING_CONVENTIONS.md +84 -0
  207. package/skills/_reference/PACKAGE_DEVELOPMENT.md +150 -0
  208. package/skills/_reference/PLATFORM_EVENTS.md +121 -0
  209. package/skills/_reference/REPORTING_API.md +143 -0
  210. package/skills/_reference/SCRATCH_ORG_PATTERNS.md +126 -0
  211. package/skills/_reference/SECURITY_PATTERNS.md +127 -0
  212. package/skills/_reference/SHARING_MODEL.md +120 -0
  213. package/skills/_reference/SOQL_PATTERNS.md +119 -0
  214. package/skills/_reference/TESTING_STANDARDS.md +96 -0
  215. package/skills/_reference/TRIGGER_PATTERNS.md +114 -0
  216. package/skills/_reference/VISUALFORCE_PATTERNS.md +121 -0
  217. package/skills/aside/SKILL.md +118 -0
  218. package/skills/checkpoint/SKILL.md +53 -0
  219. package/skills/configure-scc/SKILL.md +163 -0
  220. package/skills/continuous-agent-loop/SKILL.md +264 -0
  221. package/skills/mcp-server-patterns/SKILL.md +146 -0
  222. package/skills/model-route/SKILL.md +84 -0
  223. package/skills/prompt-optimizer/SKILL.md +369 -0
  224. package/skills/refactor-clean/SKILL.md +136 -0
  225. package/skills/resume-session/SKILL.md +114 -0
  226. package/skills/save-session/SKILL.md +186 -0
  227. package/skills/search-first/SKILL.md +144 -0
  228. package/skills/security-scan/SKILL.md +146 -0
  229. package/skills/sessions/SKILL.md +127 -0
  230. package/skills/sf-agentforce-development/SKILL.md +450 -0
  231. package/skills/sf-apex-async-patterns/SKILL.md +326 -0
  232. package/skills/sf-apex-best-practices/SKILL.md +425 -0
  233. package/skills/sf-apex-constraints/SKILL.md +81 -0
  234. package/skills/sf-apex-cursor/SKILL.md +338 -0
  235. package/skills/sf-apex-enterprise-patterns/SKILL.md +348 -0
  236. package/skills/sf-apex-testing/SKILL.md +409 -0
  237. package/skills/sf-api-design/SKILL.md +238 -0
  238. package/skills/sf-approval-processes/SKILL.md +315 -0
  239. package/skills/sf-aura-development/SKILL.md +263 -0
  240. package/skills/sf-build-fix/SKILL.md +121 -0
  241. package/skills/sf-data-modeling/SKILL.md +278 -0
  242. package/skills/sf-debugging/SKILL.md +363 -0
  243. package/skills/sf-deployment/SKILL.md +295 -0
  244. package/skills/sf-deployment-constraints/SKILL.md +155 -0
  245. package/skills/sf-devops-ci-cd/SKILL.md +325 -0
  246. package/skills/sf-docs-lookup/SKILL.md +103 -0
  247. package/skills/sf-e2e-testing/SKILL.md +324 -0
  248. package/skills/sf-experience-cloud/SKILL.md +249 -0
  249. package/skills/sf-flow-development/SKILL.md +377 -0
  250. package/skills/sf-governor-limits/SKILL.md +323 -0
  251. package/skills/sf-harness-audit/SKILL.md +142 -0
  252. package/skills/sf-help/SKILL.md +159 -0
  253. package/skills/sf-integration/SKILL.md +483 -0
  254. package/skills/sf-lwc-constraints/SKILL.md +130 -0
  255. package/skills/sf-lwc-development/SKILL.md +303 -0
  256. package/skills/sf-lwc-testing/SKILL.md +388 -0
  257. package/skills/sf-metadata-management/SKILL.md +288 -0
  258. package/skills/sf-platform-events-cdc/SKILL.md +375 -0
  259. package/skills/sf-quickstart/SKILL.md +173 -0
  260. package/skills/sf-security/SKILL.md +334 -0
  261. package/skills/sf-security-constraints/SKILL.md +127 -0
  262. package/skills/sf-soql-constraints/SKILL.md +131 -0
  263. package/skills/sf-soql-optimization/SKILL.md +354 -0
  264. package/skills/sf-tdd-workflow/SKILL.md +336 -0
  265. package/skills/sf-testing-constraints/SKILL.md +200 -0
  266. package/skills/sf-trigger-constraints/SKILL.md +90 -0
  267. package/skills/sf-trigger-frameworks/SKILL.md +347 -0
  268. package/skills/sf-visualforce-development/SKILL.md +260 -0
  269. package/skills/strategic-compact/SKILL.md +208 -0
  270. package/skills/update-docs/SKILL.md +165 -0
  271. package/skills/update-platform-docs/SKILL.md +90 -0
@@ -0,0 +1,366 @@
1
+ ---
2
+ name: prompt-optimizer
3
+ description: >-
4
+ Use when improving a Salesforce, Apex, or LWC prompt. Analyze intent and gaps, match SCC skills/agents, output a ready-to-paste optimized prompt. Advisory only.
5
+ ---
6
+
7
+ # Prompt Optimizer
8
+
9
+ Analyze a draft prompt, critique it, match it to SCC ecosystem components,
10
+ and output a complete optimized prompt the user can paste and run.
11
+
12
+ ## When to Use
13
+
14
+ - User says "optimize this prompt", "improve my prompt", "rewrite this prompt"
15
+ - User says "help me write a better prompt for..."
16
+ - User says "what's the best way to ask Claude Code to..."
17
+ - User pastes a draft prompt and asks for feedback or enhancement
18
+ - User says "I don't know how to prompt for this"
19
+ - User says "how should I use SCC for..."
20
+ - User explicitly invokes `/prompt-optimizer`
21
+
22
+ ### Do Not Use When
23
+
24
+ - User wants the task done directly (just execute it)
25
+ - User says "optimize this code", "optimize performance" — these are refactoring tasks, not prompt optimization
26
+ - User is asking about SCC configuration (use `configure-scc` instead)
27
+ - User wants a skill inventory (use `/sf-harness-audit` skill instead)
28
+ - User says "just do it"
29
+
30
+ ## How It Works
31
+
32
+ **Advisory only — do not execute the user's task.**
33
+
34
+ Do NOT write code, create files, run commands, or take any implementation
35
+ action. Your ONLY output is an analysis plus an optimized prompt.
36
+
37
+ If the user says "just do it" or "don't optimize, just execute",
38
+ do not switch into implementation mode inside this skill. Tell the user this
39
+ skill only produces optimized prompts, and instruct them to make a normal
40
+ task request if they want execution instead.
41
+
42
+ Run this 6-phase pipeline sequentially. Present results using the Output Format below.
43
+
44
+ ### Analysis Pipeline
45
+
46
+ ### Phase 0: Project Detection
47
+
48
+ Before analyzing the prompt, detect the current project context:
49
+
50
+ 1. Check if a `CLAUDE.md` exists in the working directory — read it for project conventions
51
+ 2. Detect tech stack from project files:
52
+ - `sfdx-project.json` → Salesforce (Apex / LWC / SOQL / Flow / Agentforce)
53
+ - `package.json` → Node.js / LWC tooling / Jest tests
54
+ 3. Note detected tech stack for use in Phase 3 and Phase 4
55
+
56
+ If no project files are found (e.g., the prompt is abstract or for a new project),
57
+ skip detection and flag "tech stack unknown" in Phase 4.
58
+
59
+ ### Phase 1: Intent Detection
60
+
61
+ Classify the user's task into one or more categories:
62
+
63
+ | Category | Signal Words | Example |
64
+ |----------|-------------|---------|
65
+ | New Feature | build, create, add, implement | "Build a lead scoring trigger" |
66
+ | Bug Fix | fix, broken, not working, error | "Fix the trigger recursion" |
67
+ | Refactor | refactor, clean up, restructure | "Refactor to trigger framework" |
68
+ | Research | how to, what is, explore, investigate | "How to add Platform Events" |
69
+ | Testing | test, coverage, verify | "Add tests for AccountService" |
70
+ | Review | review, audit, check | "Review my Apex trigger" |
71
+ | Documentation | document, update docs | "Update the API docs" |
72
+ | Infrastructure | deploy, CI, scratch org, DevOps | "Set up CI/CD with scratch orgs" |
73
+ | Design | design, architecture, plan | "Design the data model" |
74
+
75
+ ### Phase 2: Scope Assessment
76
+
77
+ If Phase 0 detected a project, use codebase size as a signal. Otherwise, estimate
78
+ from the prompt description alone and mark the estimate as uncertain.
79
+
80
+ | Scope | Heuristic | Orchestration |
81
+ |-------|-----------|---------------|
82
+ | TRIVIAL | Single file, < 50 lines | Direct execution |
83
+ | LOW | Single component or module | Single command or skill |
84
+ | MEDIUM | Multiple components, same domain | Command chain + sf-review-agent agent |
85
+ | HIGH | Cross-domain, 5+ files | Use sf-architect agent first, then phased execution |
86
+ | EPIC | Multi-session, multi-PR, architectural shift | Use sf-architect agent for multi-session plan |
87
+
88
+ ### Phase 3: SCC Component Matching
89
+
90
+ Map intent + scope + tech stack (from Phase 0) to specific SCC components.
91
+
92
+ #### By Intent Type
93
+
94
+ | Intent | Invocable Skills | Skills | Agents |
95
+ |--------|----------|--------|--------|
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
+ | Documentation | /update-docs | — | doc-updater, deep-researcher |
102
+ | Infrastructure | /sf-deployment | sf-devops-ci-cd, sf-deployment | sf-architect |
103
+ | Design (EPIC) | — | — | sf-architect, sf-architect |
104
+
105
+ #### By Tech Stack
106
+
107
+ | Tech Stack | Skills to Add | Agent |
108
+ |------------|--------------|-------|
109
+ | Apex | sf-apex-best-practices, sf-apex-testing, sf-security | sf-review-agent |
110
+ | LWC | sf-lwc-development, sf-lwc-testing | sf-lwc-agent |
111
+ | SOQL | sf-soql-optimization | sf-apex-agent |
112
+ | Flow | sf-flow-development | sf-flow-agent |
113
+ | Agentforce | sf-agentforce-development | sf-agentforce-agent |
114
+ | DevOps | sf-devops-ci-cd, sf-deployment | sf-architect |
115
+ | Security | sf-security | sf-review-agent |
116
+ | EPIC | — | sf-architect, sf-architect |
117
+
118
+ ### Phase 4: Missing Context Detection
119
+
120
+ Scan the prompt for missing critical information. Check each item and mark
121
+ whether Phase 0 auto-detected it or the user must supply it:
122
+
123
+ - [ ] **Tech stack** — Detected in Phase 0, or must user specify?
124
+ - [ ] **Target scope** — Files, directories, or modules mentioned?
125
+ - [ ] **Acceptance criteria** — How to know the task is done?
126
+ - [ ] **Error handling** — Edge cases and failure modes addressed?
127
+ - [ ] **Security requirements** — Auth, input validation, secrets?
128
+ - [ ] **Testing expectations** — Unit, integration, E2E?
129
+ - [ ] **Performance constraints** — Governor limits, bulk patterns, SOQL selectivity?
130
+ - [ ] **UI/UX requirements** — Design specs, SLDS compliance, accessibility? (if LWC)
131
+ - [ ] **Database changes** — Schema, migrations, indexes? (if data layer)
132
+ - [ ] **Existing patterns** — Reference files or conventions to follow?
133
+ - [ ] **Scope boundaries** — What NOT to do?
134
+
135
+ **If 3+ critical items are missing**, ask the user up to 3 clarification
136
+ questions before generating the optimized prompt. Then incorporate the
137
+ answers into the optimized prompt.
138
+
139
+ ### Phase 5: Workflow & Model Recommendation
140
+
141
+ Determine where this prompt sits in the development lifecycle:
142
+
143
+ ```
144
+ Research → Plan → Implement (TDD) → Review → Verify → Commit
145
+ ```
146
+
147
+ For MEDIUM+ tasks, always start with the sf-architect agent. For EPIC tasks, use the sf-architect agent.
148
+
149
+ **Model recommendation** (include in output):
150
+
151
+ | Scope | Recommended Model | Rationale |
152
+ |-------|------------------|-----------|
153
+ | TRIVIAL-LOW | Sonnet | Fast, cost-efficient for simple tasks |
154
+ | MEDIUM | Sonnet | Best coding model for standard work |
155
+ | HIGH | Sonnet (main) + Opus (planning) | Opus for architecture, Sonnet for implementation |
156
+ | EPIC | Opus (sf-architect) + Sonnet (execution) | Deep reasoning for multi-session planning |
157
+
158
+ **Multi-prompt splitting** (for HIGH/EPIC scope):
159
+
160
+ For tasks that exceed a single session, split into sequential prompts:
161
+
162
+ - Prompt 1: Research + Plan (use search-first skill, then sf-architect agent)
163
+ - Prompt 2-N: Implement one phase per prompt (each ends with sf-review-agent agent)
164
+ - Final Prompt: Integration test + /sf-apex-best-practices across all phases
165
+ - Use /save-session and /resume-session to preserve context between sessions
166
+
167
+ ---
168
+
169
+ ## Output Format
170
+
171
+ Present your analysis in this exact structure. Respond in the same language
172
+ as the user's input.
173
+
174
+ ### Section 1: Prompt Diagnosis
175
+
176
+ **Strengths:** List what the original prompt does well.
177
+
178
+ **Issues:**
179
+
180
+ | Issue | Impact | Suggested Fix |
181
+ |-------|--------|---------------|
182
+ | (problem) | (consequence) | (how to fix) |
183
+
184
+ **Needs Clarification:** Numbered list of questions the user should answer.
185
+ If Phase 0 auto-detected the answer, state it instead of asking.
186
+
187
+ ### Section 2: Recommended SCC Components
188
+
189
+ | Type | Component | Purpose |
190
+ |------|-----------|---------|
191
+ | Command | /sf-tdd-workflow | TDD workflow for Apex |
192
+ | Skill | sf-apex-best-practices | Apex coding standards |
193
+ | Agent | sf-review-agent | Post-implementation review |
194
+ | Model | Sonnet | Recommended for this scope |
195
+
196
+ ### Section 3: Optimized Prompt — Full Version
197
+
198
+ Present the complete optimized prompt inside a single fenced code block.
199
+ The prompt must be self-contained and ready to copy-paste. Include:
200
+
201
+ - Clear task description with context
202
+ - Tech stack (detected or specified)
203
+ - /command invocations at the right workflow stages
204
+ - Acceptance criteria
205
+ - Verification steps
206
+ - Scope boundaries (what NOT to do)
207
+
208
+ For items that reference blueprint, write: "Use the sf-architect agent to..."
209
+ (not `/blueprint`, since sf-architect is an agent, not a command).
210
+
211
+ ### Section 4: Optimized Prompt — Quick Version
212
+
213
+ A compact version for experienced SCC users. Vary by intent type:
214
+
215
+ | Intent | Quick Pattern |
216
+ |--------|--------------|
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
+ | Research | `Use search-first skill for [topic]. Use sf-architect agent based on findings.` |
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
+ | Docs | `/update-docs. Use deep-researcher agent.` |
224
+ | EPIC | `Use sf-architect agent for "[objective]". Execute phases with sf-review-agent agent gates.` |
225
+
226
+ ### Section 5: Enhancement Rationale
227
+
228
+ | Enhancement | Reason |
229
+ |-------------|--------|
230
+ | (what was added) | (why it matters) |
231
+
232
+ ### Footer
233
+
234
+ > Not what you need? Tell me what to adjust, or make a normal task request
235
+ > if you want execution instead of prompt optimization.
236
+
237
+ ---
238
+
239
+ ## Examples
240
+
241
+ ### Trigger Examples
242
+
243
+ - "Optimize this prompt for SCC"
244
+ - "Rewrite this prompt so Claude Code uses the right commands"
245
+ - "How should I prompt SCC for this task?"
246
+
247
+ ### Example 1: Vague Salesforce Prompt (Project Detected)
248
+
249
+ **User input:**
250
+
251
+ ```
252
+ Help me write an Account trigger
253
+ ```
254
+
255
+ **Phase 0 detects:** `sfdx-project.json` → Salesforce project; `package.json` with Jest
256
+
257
+ **Optimized Prompt (Full):**
258
+
259
+ ```
260
+ Implement an Account trigger using the project's existing Trigger Framework pattern.
261
+
262
+ Technical requirements:
263
+ - Follow the project's existing trigger handler architecture (check for TriggerHandler base class or similar framework)
264
+ - Implement bulkification — all SOQL queries and DML operations must be outside loops
265
+ - Add appropriate error handling and custom exception classes
266
+ - Follow Salesforce governor limits best practices
267
+
268
+ Workflow:
269
+ 1. Use sf-architect agent to plan trigger handler structure and business logic
270
+ 2. /sf-tdd-workflow — write failing test class first (use @TestSetup and test data factory)
271
+ 3. Implement AccountTrigger and AccountTriggerHandler
272
+ 4. /sf-apex-best-practices to review implementation
273
+ 5. Use sf-review-agent agent to verify all tests pass and coverage reaches 75%+
274
+
275
+ Security requirements:
276
+ - Use WITH USER_MODE for SOQL queries
277
+ - Verify CRUD/FLS permissions
278
+
279
+ Acceptance criteria:
280
+ - Test coverage 85%+
281
+ - Zero governor limit violations
282
+ - Passes /sf-security review
283
+ ```
284
+
285
+ ### Example 2: Moderate English Prompt
286
+
287
+ **User input:**
288
+
289
+ ```
290
+ Add a REST API endpoint for account creation with validation
291
+ ```
292
+
293
+ **Phase 0 detects:** `sfdx-project.json` → Salesforce project
294
+
295
+ **Optimized Prompt (Full):**
296
+
297
+ ```
298
+ Add a REST API endpoint for account creation (POST /api/accounts).
299
+
300
+ Tech stack: Salesforce Apex REST (detected from sfdx-project.json)
301
+
302
+ Requirements:
303
+ - @RestResource(urlMapping='/api/accounts')
304
+ - Input validation: Name (required), Industry, BillingCountry
305
+ - Auth: Connected App OAuth — caller must have Account create permission
306
+ - Return 201 with created Account Id on success
307
+ - Return 400 with validation errors on invalid input
308
+ - Return 403 for insufficient permissions
309
+
310
+ Workflow:
311
+ 1. Use sf-architect agent for the endpoint structure, validation logic, and error response envelope
312
+ 2. /sf-tdd-workflow — write tests for success, validation failure, permission failure
313
+ 3. Implement AccountAPI class following existing REST patterns
314
+ 4. /sf-security — verify CRUD/FLS enforcement
315
+ 5. /sf-apex-best-practices
316
+ 6. Use sf-review-agent agent — run full test suite, confirm no regressions
317
+
318
+ Do not:
319
+ - Modify existing Account fields or validation rules
320
+ - Add new custom fields without a separate plan step
321
+ ```
322
+
323
+ ### Example 3: EPIC Project
324
+
325
+ **User input:**
326
+
327
+ ```
328
+ Migrate our legacy Apex triggers to a trigger framework
329
+ ```
330
+
331
+ **Optimized Prompt (Full):**
332
+
333
+ ```
334
+ Use the sf-architect agent to plan: "Migrate all legacy Apex triggers to trigger framework"
335
+
336
+ Before executing, answer these questions in the blueprint:
337
+ 1. Which trigger framework is preferred (custom TriggerHandler, Apex Commons, or other)?
338
+ 2. How many triggers exist and which objects are highest priority?
339
+ 3. Are there existing test classes that need to be preserved?
340
+ 4. What is the deployment strategy (all at once vs object-by-object)?
341
+
342
+ The blueprint should produce phases like:
343
+ - Phase 1: Audit all existing triggers and document business logic
344
+ - Phase 2: Implement TriggerHandler base class and factory
345
+ - Phase 3: Migrate highest-priority object triggers with /sf-tdd-workflow gates
346
+ - Phase 4: Migrate remaining triggers
347
+ - Phase N: Remove legacy trigger code, run full regression
348
+
349
+ Each phase = 1 deployment unit, with sf-review-agent agent gates between phases.
350
+ Use /save-session between phases. Use /resume-session to continue.
351
+
352
+ Recommended: Opus for blueprint planning, Sonnet for phase execution.
353
+ ```
354
+
355
+ ---
356
+
357
+ ## Related Components
358
+
359
+ | Component | When to Reference |
360
+ |-----------|------------------|
361
+ | `configure-scc` | User hasn't set up SCC yet |
362
+ | `/sf-harness-audit` (skill) | Audit which components are installed (use instead of hardcoded catalog) |
363
+ | `search-first` | Research phase in optimized prompts |
364
+ | `sf-architect` (agent) | EPIC-scope optimized prompts |
365
+ | `strategic-compact` | Long session context management |
366
+ | `strategic-compact` (token tips) | Token optimization recommendations |
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: refactor-clean
3
+ description: >-
4
+ Use when cleaning up Salesforce Apex or LWC code. Dead code removal and consolidation using PMD and Salesforce Code Analyzer for safe cleanup.
5
+ disable-model-invocation: true
6
+ ---
7
+
8
+ # Refactor Clean — Dead Code Removal and Consolidation
9
+
10
+ Remove dead code and consolidate duplicates safely. Uses Salesforce Code Analyzer (`sf code-analyzer run`) for detection when available, falls back to manual analysis.
11
+
12
+ ## When to Use
13
+
14
+ - When cleaning up unused Apex classes, methods, or LWC components
15
+ - When consolidating duplicate utility methods across multiple service classes
16
+ - When preparing a codebase for a security review or AppExchange submission
17
+ - When Salesforce Code Analyzer or PMD reports high-severity findings that need cleanup
18
+ - When reducing technical debt by removing commented-out code and unreferenced classes
19
+
20
+ ## Workflow
21
+
22
+ ### Step 1 — Detect Dead Code
23
+
24
+ **Option A: Salesforce Code Analyzer (preferred)**
25
+
26
+ ```bash
27
+ sf code-analyzer run --target force-app --format table
28
+ sf code-analyzer run --target force-app --format json | jq '.[] | select(.severity <= 2)'
29
+ ```
30
+
31
+ **Option B: Manual analysis**
32
+
33
+ ```bash
34
+ # Find Apex classes with no references.
35
+ # Uses sfdx-project.json packageDirectories to find all source paths,
36
+ # rather than hardcoding force-app/main/default.
37
+ # Note: This heuristic searches source files for class name strings. Results may
38
+ # be incomplete — classes can be referenced dynamically (Type.forName), from
39
+ # managed packages, external integrations, or metadata not in source control.
40
+ # Always verify before deleting.
41
+ SRC_DIRS=$(node -e "
42
+ const p = require('./sfdx-project.json');
43
+ console.log(p.packageDirectories.map(d => d.path).join(' '));
44
+ " 2>/dev/null || echo "force-app")
45
+ for dir in $SRC_DIRS; do
46
+ find "$dir" -name "*.cls" -not -name "*Test*" | while read cls; do
47
+ name=$(basename "$cls" .cls)
48
+ # Note: Use word-boundary matching for precise results to avoid partial name matches
49
+ refs=$(grep -rlw "$name" $SRC_DIRS --include="*.cls" --include="*.trigger" --include="*.js" --include="*.xml" 2>/dev/null | grep -v "$cls" | wc -l)
50
+ if [ "$refs" -eq 0 ]; then echo "UNREFERENCED: $name"; fi
51
+ done
52
+ done
53
+
54
+ # Find unused methods within a class (private methods not called internally)
55
+ grep -n "private.*void\|private.*String\|private.*List\|private.*Map" <file>.cls
56
+ ```
57
+
58
+ ### Step 2 — Classify Safety
59
+
60
+ Categorize each finding before removing anything:
61
+
62
+ | Safety Level | Criteria | Action |
63
+ |-------------|----------|--------|
64
+ | **SAFE** | Private methods with no internal callers, unreferenced private classes, commented-out code blocks | Remove immediately |
65
+ | **CAUTION** | Public methods not referenced in code (may be called by Flows, Process Builders, or external systems) | Check metadata references first |
66
+ | **DANGER** | `global` methods, `@AuraEnabled`, `@InvocableMethod`, `@InvocableVariable`, `@RemoteAction`, `@HttpGet/Post`, managed package components | Do NOT remove without explicit verification |
67
+
68
+ ### Step 3 — Check Metadata References
69
+
70
+ Before removing any CAUTION or DANGER items:
71
+
72
+ ```bash
73
+ # Check if a method is referenced in Flows
74
+ grep -rl "ClassName.MethodName" force-app/main/default/flows/
75
+
76
+ # Check if a class is used in Process Builders
77
+ grep -rl "ClassName" force-app/main/default/workflows/
78
+
79
+ # Check if a class is referenced in Custom Metadata
80
+ grep -rl "ClassName" force-app/main/default/customMetadata/
81
+
82
+ # Check if an LWC component is used in FlexiPages
83
+ grep -rl "c-component-name" force-app/main/default/flexipages/
84
+
85
+ # Check if a class is referenced in page layouts
86
+ grep -rl "ClassName" force-app/main/default/layouts/
87
+ ```
88
+
89
+ ### Step 4 — Managed Package Considerations
90
+
91
+ Never remove without checking:
92
+
93
+ - `@AuraEnabled` methods — may be called by LWC/Aura components not in your source
94
+ - `@InvocableMethod` — may be called by Flows you can't see in source control
95
+ - `global` methods — may be called by subscriber orgs or external packages
96
+ - `webService` methods — may be called by external integrations
97
+ - Methods referenced in Permission Sets or Custom Permissions
98
+
99
+ ### Step 5 — Remove One at a Time
100
+
101
+ For each SAFE item:
102
+
103
+ 1. Delete the dead code
104
+ 2. Run tests: `sf apex run test --test-level RunLocalTests --wait 15`
105
+ 3. Verify deployment: `sf project deploy start --dry-run --wait 10`
106
+ 4. If tests fail, revert the deletion immediately
107
+
108
+ ### Step 6 — Consolidate Duplicates
109
+
110
+ After dead code removal, look for consolidation opportunities:
111
+
112
+ 1. Identify similar methods across classes (same logic, different names)
113
+ 2. Extract shared logic into a utility/service class
114
+ 3. Update all callers to use the shared implementation
115
+ 4. Run full test suite after each consolidation
116
+
117
+ ## Safety Rules
118
+
119
+ - Always create a checkpoint before starting: `/checkpoint refactor-start`
120
+ - Remove one item at a time — never batch deletions
121
+ - Run tests after each removal
122
+ - Never remove `@AuraEnabled`, `@InvocableMethod`, or `global` without verifying all callers
123
+ - Check metadata references (Flows, Process Builders, FlexiPages) before deleting any public method
124
+ - Keep a log of what was removed and why
125
+
126
+ ## Examples
127
+
128
+ ```
129
+ refactor-clean Remove unused Apex classes and dead methods from force-app/
130
+ refactor-clean Consolidate duplicate utility methods across AccountService and ContactService
131
+ refactor-clean Find and remove unreferenced LWC components
132
+ refactor-clean Run Salesforce Code Analyzer and clean up all HIGH severity PMD findings
133
+ ```
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: resume-session
3
+ description: >-
4
+ Use when resuming a previous Salesforce development session. Load saved org context and Apex work-in-progress to continue where the last session ended.
5
+ ---
6
+
7
+ # Resume Session — Restore and Orient from a Saved Session
8
+
9
+ Load the last saved session state and orient fully before doing any work.
10
+ This skill is the counterpart to the save-session skill.
11
+
12
+ ## When to Use
13
+
14
+ - Starting a new session to continue work from a previous day
15
+ - After starting a fresh session due to context limits
16
+ - When handing off a session file from another source (just provide the file path)
17
+ - Any time you have a session file and want Claude to fully absorb it before proceeding
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ /resume-session # loads most recent file in ~/.claude/sessions/
23
+ /resume-session 2026-03-18 # loads most recent session for that date
24
+ /resume-session ~/.claude/sessions/2026-03-18-apex-trig-session.md # loads a specific file
25
+ ```
26
+
27
+ ## Process
28
+
29
+ ### Step 1: Find the session file
30
+
31
+ If no argument provided:
32
+
33
+ 1. Check `~/.claude/sessions/`
34
+ 2. Pick the most recently modified `*-session.md` file
35
+ 3. If the folder does not exist or has no matching files, tell the user:
36
+
37
+ ```
38
+ No session files found in ~/.claude/sessions/
39
+ Run /save-session at the end of a session to create one.
40
+ ```
41
+
42
+ Then stop.
43
+
44
+ If an argument is provided:
45
+
46
+ - If it looks like a date (`YYYY-MM-DD`), search `~/.claude/sessions/` for matching files
47
+ and load the most recently modified variant for that date
48
+ - If it looks like a file path, read that file directly
49
+ - If not found, report clearly and stop
50
+
51
+ ### Step 2: Read the entire session file
52
+
53
+ Read the complete file. Do not summarize yet.
54
+
55
+ ### Step 3: Confirm understanding
56
+
57
+ Respond with a structured briefing in this exact format:
58
+
59
+ ```
60
+ SESSION LOADED: [actual resolved path to the file]
61
+
62
+ PROJECT: [project name / topic from file]
63
+
64
+ WHAT WE'RE BUILDING:
65
+ [2-3 sentence summary in your own words]
66
+
67
+ CURRENT STATE:
68
+ Working: [count] items confirmed
69
+ In Progress: [list files that are in progress]
70
+ Not Started: [list planned but untouched]
71
+
72
+ WHAT NOT TO RETRY:
73
+ [list every failed approach with its reason — this is critical]
74
+
75
+ OPEN QUESTIONS / BLOCKERS:
76
+ [list any blockers or unanswered questions]
77
+
78
+ NEXT STEP:
79
+ [exact next step if defined in the file]
80
+
81
+ Ready to continue. What would you like to do?
82
+ ```
83
+
84
+ ### Step 4: Wait for the user
85
+
86
+ Do NOT start working automatically. Do NOT touch any files. Wait for the user to say what to do next.
87
+
88
+ ---
89
+
90
+ ## Edge Cases
91
+
92
+ **Multiple sessions for the same date:**
93
+ Load the most recently modified matching file for that date.
94
+
95
+ **Session file references files that no longer exist:**
96
+ Note this during the briefing — "WARNING: `path/to/file.cls` referenced in session but not found on disk."
97
+
98
+ **Session file is from more than 7 days ago:**
99
+ Note the gap — "WARNING: This session is from N days ago. Things may have changed." — then proceed normally.
100
+
101
+ **Session file is empty or malformed:**
102
+ Report: "Session file found but appears empty or unreadable. You may need to create a new one with /save-session."
103
+
104
+ ---
105
+
106
+ ## Notes
107
+
108
+ - Never modify the session file when loading it — it's a read-only historical record
109
+ - The briefing format is fixed — do not skip sections even if they are empty
110
+ - "What Not To Retry" must always be shown, even if it just says "None"
111
+ - After resuming, the user may want to run `/save-session` again at the end of the new session