scc-universal 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +44 -0
- package/.cursor/agents/deep-researcher.md +142 -0
- package/.cursor/agents/doc-updater.md +219 -0
- package/.cursor/agents/eval-runner.md +335 -0
- package/.cursor/agents/learning-engine.md +210 -0
- package/.cursor/agents/loop-operator.md +245 -0
- package/.cursor/agents/refactor-cleaner.md +119 -0
- package/.cursor/agents/sf-admin-agent.md +127 -0
- package/.cursor/agents/sf-agentforce-agent.md +126 -0
- package/.cursor/agents/sf-apex-agent.md +117 -0
- package/.cursor/agents/sf-architect.md +426 -0
- package/.cursor/agents/sf-aura-reviewer.md +369 -0
- package/.cursor/agents/sf-bugfix-agent.md +101 -0
- package/.cursor/agents/sf-flow-agent.md +155 -0
- package/.cursor/agents/sf-integration-agent.md +141 -0
- package/.cursor/agents/sf-lwc-agent.md +123 -0
- package/.cursor/agents/sf-review-agent.md +357 -0
- package/.cursor/agents/sf-visualforce-reviewer.md +465 -0
- package/.cursor/hooks/adapter.js +81 -0
- package/.cursor/hooks/after-file-edit.js +26 -0
- package/.cursor/hooks/after-mcp-execution.js +12 -0
- package/.cursor/hooks/after-shell-execution.js +30 -0
- package/.cursor/hooks/after-tab-file-edit.js +12 -0
- package/.cursor/hooks/before-mcp-execution.js +11 -0
- package/.cursor/hooks/before-read-file.js +13 -0
- package/.cursor/hooks/before-shell-execution.js +29 -0
- package/.cursor/hooks/before-submit-prompt.js +23 -0
- package/.cursor/hooks/pre-compact.js +7 -0
- package/.cursor/hooks/session-end.js +10 -0
- package/.cursor/hooks/session-start.js +10 -0
- package/.cursor/hooks/stop.js +18 -0
- package/.cursor/hooks/subagent-start.js +10 -0
- package/.cursor/hooks/subagent-stop.js +10 -0
- package/.cursor/hooks.json +107 -0
- package/.cursor/skills/aside/SKILL.md +115 -0
- package/.cursor/skills/checkpoint/SKILL.md +50 -0
- package/.cursor/skills/configure-scc/SKILL.md +160 -0
- package/.cursor/skills/continuous-agent-loop/SKILL.md +260 -0
- package/.cursor/skills/mcp-server-patterns/SKILL.md +142 -0
- package/.cursor/skills/model-route/SKILL.md +81 -0
- package/.cursor/skills/prompt-optimizer/SKILL.md +366 -0
- package/.cursor/skills/refactor-clean/SKILL.md +133 -0
- package/.cursor/skills/resume-session/SKILL.md +111 -0
- package/.cursor/skills/save-session/SKILL.md +183 -0
- package/.cursor/skills/search-first/SKILL.md +140 -0
- package/.cursor/skills/security-scan/SKILL.md +142 -0
- package/.cursor/skills/sessions/SKILL.md +124 -0
- package/.cursor/skills/sf-agentforce-development/SKILL.md +449 -0
- package/.cursor/skills/sf-apex-async-patterns/SKILL.md +324 -0
- package/.cursor/skills/sf-apex-best-practices/SKILL.md +421 -0
- package/.cursor/skills/sf-apex-constraints/SKILL.md +79 -0
- package/.cursor/skills/sf-apex-cursor/SKILL.md +336 -0
- package/.cursor/skills/sf-apex-enterprise-patterns/SKILL.md +344 -0
- package/.cursor/skills/sf-apex-testing/SKILL.md +407 -0
- package/.cursor/skills/sf-api-design/SKILL.md +237 -0
- package/.cursor/skills/sf-approval-processes/SKILL.md +312 -0
- package/.cursor/skills/sf-aura-development/SKILL.md +260 -0
- package/.cursor/skills/sf-build-fix/SKILL.md +120 -0
- package/.cursor/skills/sf-data-modeling/SKILL.md +274 -0
- package/.cursor/skills/sf-debugging/SKILL.md +362 -0
- package/.cursor/skills/sf-deployment/SKILL.md +291 -0
- package/.cursor/skills/sf-deployment-constraints/SKILL.md +153 -0
- package/.cursor/skills/sf-devops-ci-cd/SKILL.md +322 -0
- package/.cursor/skills/sf-docs-lookup/SKILL.md +100 -0
- package/.cursor/skills/sf-e2e-testing/SKILL.md +321 -0
- package/.cursor/skills/sf-experience-cloud/SKILL.md +248 -0
- package/.cursor/skills/sf-flow-development/SKILL.md +376 -0
- package/.cursor/skills/sf-governor-limits/SKILL.md +319 -0
- package/.cursor/skills/sf-harness-audit/SKILL.md +139 -0
- package/.cursor/skills/sf-help/SKILL.md +156 -0
- package/.cursor/skills/sf-integration/SKILL.md +479 -0
- package/.cursor/skills/sf-lwc-constraints/SKILL.md +128 -0
- package/.cursor/skills/sf-lwc-development/SKILL.md +302 -0
- package/.cursor/skills/sf-lwc-testing/SKILL.md +387 -0
- package/.cursor/skills/sf-metadata-management/SKILL.md +285 -0
- package/.cursor/skills/sf-platform-events-cdc/SKILL.md +372 -0
- package/.cursor/skills/sf-quickstart/SKILL.md +170 -0
- package/.cursor/skills/sf-security/SKILL.md +330 -0
- package/.cursor/skills/sf-security-constraints/SKILL.md +125 -0
- package/.cursor/skills/sf-soql-constraints/SKILL.md +129 -0
- package/.cursor/skills/sf-soql-optimization/SKILL.md +353 -0
- package/.cursor/skills/sf-tdd-workflow/SKILL.md +332 -0
- package/.cursor/skills/sf-testing-constraints/SKILL.md +198 -0
- package/.cursor/skills/sf-trigger-constraints/SKILL.md +88 -0
- package/.cursor/skills/sf-trigger-frameworks/SKILL.md +343 -0
- package/.cursor/skills/sf-visualforce-development/SKILL.md +259 -0
- package/.cursor/skills/strategic-compact/SKILL.md +205 -0
- package/.cursor/skills/update-docs/SKILL.md +162 -0
- package/.cursor/skills/update-platform-docs/SKILL.md +86 -0
- package/.cursor-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +522 -0
- package/agents/deep-researcher.md +145 -0
- package/agents/doc-updater.md +222 -0
- package/agents/eval-runner.md +340 -0
- package/agents/learning-engine.md +211 -0
- package/agents/loop-operator.md +247 -0
- package/agents/refactor-cleaner.md +122 -0
- package/agents/sf-admin-agent.md +131 -0
- package/agents/sf-agentforce-agent.md +132 -0
- package/agents/sf-apex-agent.md +124 -0
- package/agents/sf-architect.md +435 -0
- package/agents/sf-aura-reviewer.md +372 -0
- package/agents/sf-bugfix-agent.md +105 -0
- package/agents/sf-flow-agent.md +159 -0
- package/agents/sf-integration-agent.md +146 -0
- package/agents/sf-lwc-agent.md +127 -0
- package/agents/sf-review-agent.md +366 -0
- package/agents/sf-visualforce-reviewer.md +468 -0
- package/assets/logo.svg +18 -0
- package/docs/ARCHITECTURE.md +133 -0
- package/docs/authoring-guide.md +373 -0
- package/docs/hook-development.md +578 -0
- package/docs/token-optimization.md +139 -0
- package/docs/workflow-examples.md +645 -0
- package/examples/agentforce-action/README.md +227 -0
- package/examples/apex-trigger-handler/README.md +114 -0
- package/examples/devops-pipeline/README.md +325 -0
- package/examples/flow-automation/README.md +188 -0
- package/examples/integration-pattern/README.md +416 -0
- package/examples/lwc-component/README.md +180 -0
- package/examples/platform-events/README.md +492 -0
- package/examples/scratch-org-setup/README.md +138 -0
- package/examples/security-audit/README.md +244 -0
- package/examples/visualforce-migration/README.md +314 -0
- package/hooks/hooks.json +338 -0
- package/hooks/memory-persistence/README.md +73 -0
- package/manifests/install-modules.json +217 -0
- package/manifests/install-profiles.json +17 -0
- package/mcp-configs/mcp-servers.json +19 -0
- package/package.json +89 -0
- package/schemas/hooks.schema.json +123 -0
- package/schemas/install-modules.schema.json +76 -0
- package/schemas/install-profiles.schema.json +28 -0
- package/schemas/install-state.schema.json +73 -0
- package/schemas/package-manager.schema.json +18 -0
- package/schemas/plugin.schema.json +112 -0
- package/schemas/scc-install-config.schema.json +29 -0
- package/schemas/state-store.schema.json +111 -0
- package/scripts/cli/install-apply.js +170 -0
- package/scripts/cli/uninstall.js +193 -0
- package/scripts/hooks/check-console-log.js +101 -0
- package/scripts/hooks/check-hook-enabled.js +17 -0
- package/scripts/hooks/check-platform-docs-age.js +48 -0
- package/scripts/hooks/cost-tracker.js +78 -0
- package/scripts/hooks/doc-file-warning.js +63 -0
- package/scripts/hooks/evaluate-session.js +98 -0
- package/scripts/hooks/governor-check.js +220 -0
- package/scripts/hooks/learning-observe.sh +206 -0
- package/scripts/hooks/mcp-health-check.js +588 -0
- package/scripts/hooks/post-bash-build-complete.js +34 -0
- package/scripts/hooks/post-bash-pr-created.js +43 -0
- package/scripts/hooks/post-edit-console-warn.js +61 -0
- package/scripts/hooks/post-edit-format.js +79 -0
- package/scripts/hooks/post-edit-typecheck.js +98 -0
- package/scripts/hooks/post-write.js +168 -0
- package/scripts/hooks/pre-bash-git-push-reminder.js +35 -0
- package/scripts/hooks/pre-bash-tmux-reminder.js +47 -0
- package/scripts/hooks/pre-compact.js +51 -0
- package/scripts/hooks/pre-tool-use.js +163 -0
- package/scripts/hooks/pre-write-doc-warn.js +9 -0
- package/scripts/hooks/quality-gate.js +251 -0
- package/scripts/hooks/run-with-flags-shell.sh +32 -0
- package/scripts/hooks/run-with-flags.js +135 -0
- package/scripts/hooks/session-end-marker.js +29 -0
- package/scripts/hooks/session-end.js +311 -0
- package/scripts/hooks/session-start.js +202 -0
- package/scripts/hooks/sfdx-scanner-check.js +142 -0
- package/scripts/hooks/sfdx-validate.js +119 -0
- package/scripts/hooks/stop-hook.js +170 -0
- package/scripts/hooks/suggest-compact.js +67 -0
- package/scripts/lib/agent-adapter.js +82 -0
- package/scripts/lib/apex-analysis.js +194 -0
- package/scripts/lib/hook-flags.js +74 -0
- package/scripts/lib/install-config.js +73 -0
- package/scripts/lib/install-executor.js +363 -0
- package/scripts/lib/install-state.js +121 -0
- package/scripts/lib/orchestration-session.js +299 -0
- package/scripts/lib/package-manager.js +124 -0
- package/scripts/lib/project-detect.js +228 -0
- package/scripts/lib/schema-validator.js +190 -0
- package/scripts/lib/skill-adapter.js +100 -0
- package/scripts/lib/state-store.js +376 -0
- package/scripts/lib/tmux-worktree-orchestrator.js +598 -0
- package/scripts/lib/utils.js +313 -0
- package/scripts/scc.js +164 -0
- package/skills/_reference/AGENTFORCE_PATTERNS.md +112 -0
- package/skills/_reference/APEX_CURSOR.md +159 -0
- package/skills/_reference/API_VERSIONS.md +78 -0
- package/skills/_reference/APPROVAL_PROCESSES.md +105 -0
- package/skills/_reference/ASYNC_PATTERNS.md +163 -0
- package/skills/_reference/AURA_COMPONENTS.md +146 -0
- package/skills/_reference/DATA_MIGRATION_PATTERNS.md +151 -0
- package/skills/_reference/DATA_MODELING.md +124 -0
- package/skills/_reference/DEBUGGING_TOOLS.md +140 -0
- package/skills/_reference/DEPLOYMENT_CHECKLIST.md +87 -0
- package/skills/_reference/DEPRECATIONS.md +79 -0
- package/skills/_reference/DOCKER_CI_PATTERNS.md +138 -0
- package/skills/_reference/ENTERPRISE_PATTERNS.md +122 -0
- package/skills/_reference/EXPERIENCE_CLOUD.md +143 -0
- package/skills/_reference/FLOW_PATTERNS.md +113 -0
- package/skills/_reference/GOVERNOR_LIMITS.md +77 -0
- package/skills/_reference/INTEGRATION_PATTERNS.md +105 -0
- package/skills/_reference/LWC_PATTERNS.md +79 -0
- package/skills/_reference/METADATA_TYPES.md +115 -0
- package/skills/_reference/NAMING_CONVENTIONS.md +84 -0
- package/skills/_reference/PACKAGE_DEVELOPMENT.md +150 -0
- package/skills/_reference/PLATFORM_EVENTS.md +121 -0
- package/skills/_reference/REPORTING_API.md +143 -0
- package/skills/_reference/SCRATCH_ORG_PATTERNS.md +126 -0
- package/skills/_reference/SECURITY_PATTERNS.md +127 -0
- package/skills/_reference/SHARING_MODEL.md +120 -0
- package/skills/_reference/SOQL_PATTERNS.md +119 -0
- package/skills/_reference/TESTING_STANDARDS.md +96 -0
- package/skills/_reference/TRIGGER_PATTERNS.md +114 -0
- package/skills/_reference/VISUALFORCE_PATTERNS.md +121 -0
- package/skills/aside/SKILL.md +118 -0
- package/skills/checkpoint/SKILL.md +53 -0
- package/skills/configure-scc/SKILL.md +163 -0
- package/skills/continuous-agent-loop/SKILL.md +264 -0
- package/skills/mcp-server-patterns/SKILL.md +146 -0
- package/skills/model-route/SKILL.md +84 -0
- package/skills/prompt-optimizer/SKILL.md +369 -0
- package/skills/refactor-clean/SKILL.md +136 -0
- package/skills/resume-session/SKILL.md +114 -0
- package/skills/save-session/SKILL.md +186 -0
- package/skills/search-first/SKILL.md +144 -0
- package/skills/security-scan/SKILL.md +146 -0
- package/skills/sessions/SKILL.md +127 -0
- package/skills/sf-agentforce-development/SKILL.md +450 -0
- package/skills/sf-apex-async-patterns/SKILL.md +326 -0
- package/skills/sf-apex-best-practices/SKILL.md +425 -0
- package/skills/sf-apex-constraints/SKILL.md +81 -0
- package/skills/sf-apex-cursor/SKILL.md +338 -0
- package/skills/sf-apex-enterprise-patterns/SKILL.md +348 -0
- package/skills/sf-apex-testing/SKILL.md +409 -0
- package/skills/sf-api-design/SKILL.md +238 -0
- package/skills/sf-approval-processes/SKILL.md +315 -0
- package/skills/sf-aura-development/SKILL.md +263 -0
- package/skills/sf-build-fix/SKILL.md +121 -0
- package/skills/sf-data-modeling/SKILL.md +278 -0
- package/skills/sf-debugging/SKILL.md +363 -0
- package/skills/sf-deployment/SKILL.md +295 -0
- package/skills/sf-deployment-constraints/SKILL.md +155 -0
- package/skills/sf-devops-ci-cd/SKILL.md +325 -0
- package/skills/sf-docs-lookup/SKILL.md +103 -0
- package/skills/sf-e2e-testing/SKILL.md +324 -0
- package/skills/sf-experience-cloud/SKILL.md +249 -0
- package/skills/sf-flow-development/SKILL.md +377 -0
- package/skills/sf-governor-limits/SKILL.md +323 -0
- package/skills/sf-harness-audit/SKILL.md +142 -0
- package/skills/sf-help/SKILL.md +159 -0
- package/skills/sf-integration/SKILL.md +483 -0
- package/skills/sf-lwc-constraints/SKILL.md +130 -0
- package/skills/sf-lwc-development/SKILL.md +303 -0
- package/skills/sf-lwc-testing/SKILL.md +388 -0
- package/skills/sf-metadata-management/SKILL.md +288 -0
- package/skills/sf-platform-events-cdc/SKILL.md +375 -0
- package/skills/sf-quickstart/SKILL.md +173 -0
- package/skills/sf-security/SKILL.md +334 -0
- package/skills/sf-security-constraints/SKILL.md +127 -0
- package/skills/sf-soql-constraints/SKILL.md +131 -0
- package/skills/sf-soql-optimization/SKILL.md +354 -0
- package/skills/sf-tdd-workflow/SKILL.md +336 -0
- package/skills/sf-testing-constraints/SKILL.md +200 -0
- package/skills/sf-trigger-constraints/SKILL.md +90 -0
- package/skills/sf-trigger-frameworks/SKILL.md +347 -0
- package/skills/sf-visualforce-development/SKILL.md +260 -0
- package/skills/strategic-compact/SKILL.md +208 -0
- package/skills/update-docs/SKILL.md +165 -0
- package/skills/update-platform-docs/SKILL.md +90 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: continuous-agent-loop
|
|
3
|
+
description: >-
|
|
4
|
+
Use when building autonomous Claude Code loops for Salesforce Apex and LWC projects. Patterns from sequential pipelines to RFC-driven multi-agent DAG systems with quality gates. Do NOT use for single-shot Apex tasks.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Continuous Agent Loop
|
|
8
|
+
|
|
9
|
+
Patterns, architectures, and reference implementations for running Claude Code autonomously in loops on Salesforce projects. Covers sequential `claude -p` pipelines through RFC-driven multi-agent DAG orchestration with Apex test gates.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Setting up autonomous Salesforce development workflows (Apex TDD cycles, LWC iteration)
|
|
14
|
+
- Choosing the right loop architecture for your problem (simple deploy vs complex feature)
|
|
15
|
+
- Building CI/CD-style continuous development pipelines with SF CLI gates
|
|
16
|
+
- Running parallel agents for multi-layer Salesforce work (Apex + LWC + Integration)
|
|
17
|
+
- Adding quality gates (governor limits, coverage thresholds) to autonomous workflows
|
|
18
|
+
|
|
19
|
+
## Loop Selection Flow
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
Start
|
|
23
|
+
|
|
|
24
|
+
+-- Need strict CI/PR control? -- yes --> continuous-pr
|
|
25
|
+
|
|
|
26
|
+
+-- Need RFC decomposition? -- yes --> rfc-dag
|
|
27
|
+
|
|
|
28
|
+
+-- Need exploratory parallel generation? -- yes --> infinite
|
|
29
|
+
|
|
|
30
|
+
+-- default --> sequential
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Loop Pattern Spectrum
|
|
34
|
+
|
|
35
|
+
| Pattern | Complexity | Best For |
|
|
36
|
+
|---------|-----------|----------|
|
|
37
|
+
| [Sequential Pipeline](#1-sequential-pipeline) | Low | Daily Apex dev steps, scripted SFDX workflows |
|
|
38
|
+
| [Infinite Agentic Loop](#2-infinite-agentic-loop) | Medium | Parallel Apex/LWC generation from a spec |
|
|
39
|
+
| [Continuous Claude PR Loop](#3-continuous-claude-pr-loop) | Medium | Multi-day Apex TDD iterations with CI gates |
|
|
40
|
+
| [De-Sloppify Pattern](#4-the-de-sloppify-pattern) | Add-on | Quality cleanup after any Implementer step |
|
|
41
|
+
| [Ralphinho / RFC-Driven DAG](#5-ralphinho--rfc-driven-dag) | High | Large Salesforce features with parallel units and merge queue |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 1. Sequential Pipeline
|
|
46
|
+
|
|
47
|
+
**The simplest loop.** Chain `claude -p` calls — each is a focused step with a clear prompt.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
#!/bin/bash
|
|
51
|
+
set -e
|
|
52
|
+
|
|
53
|
+
# Step 1: Implement with TDD
|
|
54
|
+
claude -p "Read docs/order-service-spec.md. Implement OrderService.cls with TDD.
|
|
55
|
+
Target 85% coverage. No SOQL or DML inside for loops."
|
|
56
|
+
|
|
57
|
+
# Step 2: De-sloppify
|
|
58
|
+
claude -p "Review changes. Remove: unnecessary null checks, tests verifying platform
|
|
59
|
+
behavior, System.debug statements, commented-out code.
|
|
60
|
+
Run 'sf apex run test --class-names OrderServiceTest' after cleanup."
|
|
61
|
+
|
|
62
|
+
# Step 3: Verify
|
|
63
|
+
claude -p "Run 'sf project deploy start --dry-run --source-dir force-app/main/default/classes'.
|
|
64
|
+
Fix any failures. Do not add new features."
|
|
65
|
+
|
|
66
|
+
# Step 4: Commit
|
|
67
|
+
claude -p "Commit with message: feat: add order service with test coverage"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Variations:** Use `--model opus` for architecture analysis, `--model haiku` for simple fixes. Use `--allowedTools "Read,Grep,Glob"` for read-only analysis passes.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 2. Infinite Agentic Loop
|
|
75
|
+
|
|
76
|
+
**Two-prompt system** for parallel sub-agents. Useful for generating multiple Apex test class variants or LWC component iterations from a spec.
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
PROMPT 1 (Orchestrator) PROMPT 2 (Sub-Agents)
|
|
80
|
+
┌─────────────────────┐ ┌──────────────────────┐
|
|
81
|
+
│ Parse spec file │ │ Receive full context │
|
|
82
|
+
│ Scan output dir │ deploys │ Read assigned number │
|
|
83
|
+
│ Plan iteration │────────────│ Follow spec exactly │
|
|
84
|
+
│ Assign creative dirs │ N agents │ Generate unique output │
|
|
85
|
+
└─────────────────────┘ └──────────────────────┘
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Key Insight: Uniqueness via Assignment
|
|
89
|
+
|
|
90
|
+
Don't rely on agents to self-differentiate. The orchestrator **assigns** each agent a specific test scenario and iteration number. Batching: 1-5 simultaneously, 6-20 in batches of 5, infinite in waves of 3-5.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 3. Continuous Claude PR Loop
|
|
95
|
+
|
|
96
|
+
**Production-grade shell script** that runs Claude Code in a continuous loop, creating PRs, waiting for CI (including Apex test runs), and merging automatically.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
┌─────────────────────────────────────────────────────┐
|
|
100
|
+
│ 1. Create branch (continuous-claude/iteration-N) │
|
|
101
|
+
│ 2. Run claude -p with Apex TDD prompt │
|
|
102
|
+
│ 3. (Optional) Reviewer pass │
|
|
103
|
+
│ 4. Commit + Push + Create PR │
|
|
104
|
+
│ 5. Wait for CI (sf apex run test --code-coverage) │
|
|
105
|
+
│ 6. CI failure? → Auto-fix pass (claude -p) │
|
|
106
|
+
│ 7. Merge PR (squash) → Return to main → repeat │
|
|
107
|
+
│ Limit by: --max-runs N | --max-cost $X │
|
|
108
|
+
└─────────────────────────────────────────────────────┘
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Cross-Iteration Context: SHARED_TASK_NOTES.md
|
|
112
|
+
|
|
113
|
+
The critical innovation — a file that persists across iterations:
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
## Progress
|
|
117
|
+
- [x] OrderService.cls — 82% coverage (iteration 1)
|
|
118
|
+
- [ ] OrderController.cls — 45% coverage, needs work
|
|
119
|
+
|
|
120
|
+
## Next Steps
|
|
121
|
+
- Focus on OrderController.cls
|
|
122
|
+
- Named credential for external API is set up
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Claude reads this at iteration start, updates at iteration end.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 4. The De-Sloppify Pattern
|
|
130
|
+
|
|
131
|
+
**Add-on for any loop.** When you ask an LLM to implement Apex with TDD, it over-tests:
|
|
132
|
+
|
|
133
|
+
- Tests verifying Salesforce platform behavior
|
|
134
|
+
- Defensive null checks for schema-guaranteed fields
|
|
135
|
+
- Excessive try/catch blocks
|
|
136
|
+
|
|
137
|
+
**Solution:** Don't constrain the Implementer — let it be thorough. Then add a focused cleanup pass:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Implement (thorough)
|
|
141
|
+
claude -p "Implement OrderService.cls with full TDD."
|
|
142
|
+
|
|
143
|
+
# De-sloppify (separate context)
|
|
144
|
+
claude -p "Review changes. Remove tests for platform behavior, redundant null checks,
|
|
145
|
+
System.debug statements, commented-out code. Run 'sf apex run test' after cleanup."
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> Two focused agents outperform one constrained agent.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 5. Ralphinho / RFC-Driven DAG
|
|
153
|
+
|
|
154
|
+
**Most sophisticated.** RFC-driven pipeline that decomposes a Salesforce feature into a dependency DAG, runs each unit through quality stages, and lands via merge queue.
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Salesforce RFC/PRD
|
|
158
|
+
│
|
|
159
|
+
DECOMPOSITION (sf-architect)
|
|
160
|
+
Break into: Apex → LWC → Integration → Metadata layers
|
|
161
|
+
│
|
|
162
|
+
┌──────────────────────────────────────────────────┐
|
|
163
|
+
│ For each DAG layer (sequential, by dependency): │
|
|
164
|
+
│ │
|
|
165
|
+
│ Quality Pipelines (parallel per unit): │
|
|
166
|
+
│ Research → Plan → Implement → Test → Review │
|
|
167
|
+
│ Apex: governor check + ≥75% coverage gate │
|
|
168
|
+
│ LWC: Jest tests + accessibility check │
|
|
169
|
+
│ │
|
|
170
|
+
│ Merge Queue: │
|
|
171
|
+
│ Rebase → sf deploy validate → Apex tests → │
|
|
172
|
+
│ Pass → Land | Fail → Evict + re-enter │
|
|
173
|
+
└──────────────────────────────────────────────────┘
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Complexity Tiers
|
|
177
|
+
|
|
178
|
+
| Tier | Pipeline Stages |
|
|
179
|
+
|------|----------------|
|
|
180
|
+
| **trivial** | implement → sf deploy validate |
|
|
181
|
+
| **small** | implement → apex test → code-review |
|
|
182
|
+
| **medium** | research → plan → implement → apex test → governor-check → review-fix |
|
|
183
|
+
| **large** | + sf-architect final review |
|
|
184
|
+
|
|
185
|
+
### When to Use Ralphinho vs SCC-Native
|
|
186
|
+
|
|
187
|
+
| Signal | Ralphinho | SCC-Native |
|
|
188
|
+
|--------|----------|------------|
|
|
189
|
+
| 10+ interdependent work units | Yes | No |
|
|
190
|
+
| Need worktree isolation | Yes | No |
|
|
191
|
+
| Single feature with 3 layers | No | Yes |
|
|
192
|
+
| Quick Apex + LWC iteration | No | Yes |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Salesforce Loop Patterns
|
|
197
|
+
|
|
198
|
+
| Pattern | Loop Type | Stop Condition |
|
|
199
|
+
|---------|-----------|---------------|
|
|
200
|
+
| **Governor Fix** | sequential | No more governor violations |
|
|
201
|
+
| **Coverage Ramp** | sequential | All classes at 75%+ (85% target) |
|
|
202
|
+
| **PB→Flow Migration** | continuous-pr | All Process Builders converted |
|
|
203
|
+
| **Trigger Framework Migration** | sequential | All triggers use handler pattern |
|
|
204
|
+
| **Deployment Monitor** | infinite (30s) | Deploy succeeds/fails/cancelled |
|
|
205
|
+
|
|
206
|
+
### SF-Specific Checkpoint Format
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
── SF Checkpoint #N ────────────────────────
|
|
210
|
+
Apex Tests: 142/145 passing (+3)
|
|
211
|
+
Coverage: 78% → 82% (target: 85%)
|
|
212
|
+
Governor: 2 violations remaining (was 8)
|
|
213
|
+
Deploy: Validates against scratch org
|
|
214
|
+
Iteration: N/max
|
|
215
|
+
────────────────────────────────────────────
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Choosing the Right Pattern
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Is the task a single focused Salesforce change?
|
|
224
|
+
├─ Yes → Sequential Pipeline
|
|
225
|
+
└─ No → Is there a written RFC/spec?
|
|
226
|
+
├─ Yes → Need parallel layers?
|
|
227
|
+
│ ├─ Yes → RFC-Driven DAG
|
|
228
|
+
│ └─ No → Continuous Claude PR Loop
|
|
229
|
+
└─ No → Need many variants from a spec?
|
|
230
|
+
├─ Yes → Infinite Agentic Loop
|
|
231
|
+
└─ No → Sequential + De-Sloppify
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Combining Patterns
|
|
235
|
+
|
|
236
|
+
1. **Sequential + De-Sloppify** — Most common. Every Apex implement step gets a cleanup pass.
|
|
237
|
+
2. **Continuous Claude + De-Sloppify** — Add `--review-prompt` with de-sloppify directive.
|
|
238
|
+
3. **Any loop + Quality Gates** — Use the `sf-review-agent` agent as a gate before commits.
|
|
239
|
+
4. **Model routing** — `--model haiku` for simple fixes, `--model opus` for architecture.
|
|
240
|
+
|
|
241
|
+
## Anti-Patterns
|
|
242
|
+
|
|
243
|
+
1. **Infinite loops without exit conditions** — Always have max-runs, max-cost, or completion signal.
|
|
244
|
+
2. **No context bridge** — Use `SHARED_TASK_NOTES.md` to bridge `claude -p` invocations.
|
|
245
|
+
3. **Retrying same failure** — Capture failure output and feed to next attempt.
|
|
246
|
+
4. **Negative instructions instead of cleanup** — Don't say "don't add System.debug." Add a separate de-sloppify pass.
|
|
247
|
+
5. **All agents in one context** — Separate concerns into different agent processes.
|
|
248
|
+
6. **Ignoring deploy dependency order** — Apex before LWC before metadata.
|
|
249
|
+
|
|
250
|
+
## References
|
|
251
|
+
|
|
252
|
+
| Project | Author | SCC Context |
|
|
253
|
+
|---------|--------|-------------|
|
|
254
|
+
| Ralphinho | enitrat | Adapted for Salesforce layers |
|
|
255
|
+
| Infinite Agentic Loop | disler | Useful for Apex test generation |
|
|
256
|
+
| Continuous Claude | AnandChowdhary | Use with sf apex run test as CI gate |
|
|
257
|
+
|
|
258
|
+
## Related
|
|
259
|
+
|
|
260
|
+
- **Agent**: `loop-operator` — For monitoring and managing autonomous agent loops
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp-server-patterns
|
|
3
|
+
description: >-
|
|
4
|
+
Use when building MCP servers for Salesforce Apex or org integration. Node/TypeScript SDK patterns — tools, resources, prompts, Zod validation, stdio vs Streamable HTTP. Do NOT use for Apex class writing or deployment.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MCP Server Patterns
|
|
8
|
+
|
|
9
|
+
The Model Context Protocol (MCP) lets AI assistants call tools, read resources, and use prompts from your server. Use this skill when building or maintaining MCP servers, or integrating with the official Salesforce MCP server. The SDK API evolves; check Context7 (query-docs for "MCP") or the official MCP documentation for current method names and signatures.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
Use when: implementing a new MCP server, adding tools or resources, choosing stdio vs HTTP, integrating with `@salesforce/mcp`, upgrading the SDK, or debugging MCP registration and transport issues.
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
### Core Concepts
|
|
18
|
+
|
|
19
|
+
- **Tools**: Actions the model can invoke (e.g. search, run a command). Register with `registerTool()` or `tool()` depending on SDK version.
|
|
20
|
+
- **Resources**: Read-only data the model can fetch (e.g. file contents, API responses). Register with `registerResource()` or `resource()`. Handlers typically receive a `uri` argument.
|
|
21
|
+
- **Prompts**: Reusable, parameterised prompt templates the client can surface (e.g. in Claude Desktop). Register with `registerPrompt()` or equivalent.
|
|
22
|
+
- **Transport**: stdio for local clients (e.g. Claude Desktop); Streamable HTTP is preferred for remote (Cursor, cloud). Legacy HTTP/SSE is for backward compatibility.
|
|
23
|
+
|
|
24
|
+
The Node/TypeScript SDK may expose `tool()` / `resource()` or `registerTool()` / `registerResource()`; the official SDK has changed over time. Always verify against the current [MCP docs](https://modelcontextprotocol.io) or Context7.
|
|
25
|
+
|
|
26
|
+
### Transport Decision Guide
|
|
27
|
+
|
|
28
|
+
| Transport | Use When | Examples |
|
|
29
|
+
|-----------|----------|---------|
|
|
30
|
+
| **stdio** | Local client, same machine, Claude Desktop/Code | Development, local testing |
|
|
31
|
+
| **Streamable HTTP** | Remote clients, cloud deployment, multi-user | Cursor, production APIs |
|
|
32
|
+
| **Legacy HTTP/SSE** | Backward compatibility only | Older clients |
|
|
33
|
+
|
|
34
|
+
Keep server logic (tools + resources) independent of transport so you can plug in stdio or HTTP in the entrypoint.
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Install and Server Setup
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install @modelcontextprotocol/sdk zod
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
46
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
47
|
+
import { z } from "zod";
|
|
48
|
+
|
|
49
|
+
const server = new McpServer({ name: "my-server", version: "1.0.0" });
|
|
50
|
+
|
|
51
|
+
// Register a tool
|
|
52
|
+
server.tool(
|
|
53
|
+
"search-records",
|
|
54
|
+
"Search Salesforce records by keyword",
|
|
55
|
+
{ query: z.string(), objectType: z.string().default("Account") },
|
|
56
|
+
async ({ query, objectType }) => {
|
|
57
|
+
// Your implementation here
|
|
58
|
+
return { content: [{ type: "text", text: JSON.stringify(results) }] };
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Connect via stdio
|
|
63
|
+
const transport = new StdioServerTransport();
|
|
64
|
+
await server.connect(transport);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
> **Note:** Registration API varies by SDK version — some versions use positional args `server.tool(name, description, schema, handler)`, others use object syntax. Check the official MCP docs or Context7 for current `@modelcontextprotocol/sdk` signatures.
|
|
68
|
+
|
|
69
|
+
Use **Zod** (or the SDK's preferred schema format) for input validation.
|
|
70
|
+
|
|
71
|
+
## Salesforce MCP Integration
|
|
72
|
+
|
|
73
|
+
### Official @salesforce/mcp Server
|
|
74
|
+
|
|
75
|
+
MCP config is auto-installed by `npx scc install` (`.mcp.json` for Claude Code, `.cursor/mcp.json` for Cursor). The official `@salesforce/mcp` server provides these toolsets:
|
|
76
|
+
|
|
77
|
+
| Toolset | What It Does |
|
|
78
|
+
|---------|-------------|
|
|
79
|
+
| `orgs` | Org management, auth, user info |
|
|
80
|
+
| `metadata` | Deploy, retrieve, list metadata types |
|
|
81
|
+
| `data` | SOQL queries, record CRUD, bulk operations |
|
|
82
|
+
| `users` | User management, permission sets |
|
|
83
|
+
| `testing` | Run Apex tests, get coverage results |
|
|
84
|
+
| `code-analysis` | PMD/scanner, code quality checks |
|
|
85
|
+
| `lwc-experts` | LWC development guidance |
|
|
86
|
+
| `devops` | Source tracking, scratch org operations |
|
|
87
|
+
|
|
88
|
+
### Using @salesforce/mcp in Claude Code
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"salesforce": {
|
|
94
|
+
"command": "npx",
|
|
95
|
+
"args": ["-y", "@salesforce/mcp@latest"],
|
|
96
|
+
"env": {
|
|
97
|
+
"SF_ORG_ALIAS": "my-org"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Building Custom Salesforce MCP Tools
|
|
105
|
+
|
|
106
|
+
When `@salesforce/mcp` doesn't cover your use case (org-specific business logic, custom validation rules, internal APIs), build a custom MCP server:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { execFileSync } from "child_process";
|
|
110
|
+
|
|
111
|
+
server.tool(
|
|
112
|
+
"validate-account-hierarchy",
|
|
113
|
+
"Check account hierarchy depth and circular references",
|
|
114
|
+
{ accountId: z.string().regex(/^[a-zA-Z0-9]{15,18}$/, "Must be a valid 15- or 18-char Salesforce ID") },
|
|
115
|
+
async ({ accountId }) => {
|
|
116
|
+
const result = execFileSync("sf", [
|
|
117
|
+
"data", "query",
|
|
118
|
+
"--sobject", "Account",
|
|
119
|
+
"--where", `Id='${accountId}'`,
|
|
120
|
+
"--fields", "Id,ParentId",
|
|
121
|
+
"--json"
|
|
122
|
+
], { timeout: 30000, encoding: "utf-8" });
|
|
123
|
+
return { content: [{ type: "text", text: result }] };
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Best Practices
|
|
129
|
+
|
|
130
|
+
- **Schema first**: Define input schemas with Zod for every tool; document parameters and return shape.
|
|
131
|
+
- **Input validation**: Validate and sanitize all inputs before passing to SF CLI or SOQL. Never interpolate raw user input into shell commands or queries.
|
|
132
|
+
- **Errors**: Return structured errors or messages the model can interpret; avoid raw stack traces.
|
|
133
|
+
- **Idempotency**: Prefer idempotent tools where possible so retries are safe.
|
|
134
|
+
- **Timeouts**: Set explicit timeouts on `execSync`/`exec` calls (e.g., `{ timeout: 30000 }`) and on HTTP requests.
|
|
135
|
+
- **Security**: Never pass raw user input to SOQL queries — use bind variables or parameterized queries. Use Named Credentials for external callouts. Validate Salesforce IDs with Zod regex (`/^[a-zA-Z0-9]{15,18}$/`) before passing to SF CLI.
|
|
136
|
+
|
|
137
|
+
## Official SDKs and Docs
|
|
138
|
+
|
|
139
|
+
- **JavaScript/TypeScript**: `@modelcontextprotocol/sdk` (npm). Use Context7 with library name "MCP" for current registration and transport patterns.
|
|
140
|
+
- **Go**: Official Go SDK on GitHub (`modelcontextprotocol/go-sdk`).
|
|
141
|
+
- **C#**: Official C# SDK for .NET.
|
|
142
|
+
- **Salesforce MCP**: `@salesforce/mcp` (npm) — official Salesforce MCP server.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: model-route
|
|
3
|
+
description: >-
|
|
4
|
+
Use when selecting Claude model tier for Salesforce development tasks. Recommend haiku, sonnet, or opus based on Apex complexity, deploy risk, and budget.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Model Route — Task-to-Model Tier Recommendation
|
|
8
|
+
|
|
9
|
+
Recommend the best model tier for the current task by complexity and budget.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Before starting a task where model choice significantly affects quality or cost
|
|
14
|
+
- When deciding between haiku, sonnet, and opus for a Salesforce development task
|
|
15
|
+
- When the user wants cost-conscious model selection guidance
|
|
16
|
+
- When routing sub-agent work to the appropriate model tier
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
`/model-route [task-description] [--budget low|med|high]`
|
|
21
|
+
|
|
22
|
+
## Routing Heuristic
|
|
23
|
+
|
|
24
|
+
- `haiku`: deterministic, low-risk mechanical changes
|
|
25
|
+
- `sonnet`: default for implementation and refactors
|
|
26
|
+
- `opus`: architecture, deep review, ambiguous requirements
|
|
27
|
+
|
|
28
|
+
> Model names (haiku, sonnet, opus) refer to the current Claude model mapped to that tier in your Claude Code configuration.
|
|
29
|
+
|
|
30
|
+
## Output Format
|
|
31
|
+
|
|
32
|
+
- recommended model
|
|
33
|
+
- confidence level
|
|
34
|
+
- why this model fits
|
|
35
|
+
- fallback model if first attempt fails
|
|
36
|
+
|
|
37
|
+
## Salesforce Routing Examples
|
|
38
|
+
|
|
39
|
+
### Opus — Complex Reasoning Tasks
|
|
40
|
+
|
|
41
|
+
Use `opus` when the task requires deep understanding of Salesforce architecture, security implications, or governor limit analysis across multiple execution paths.
|
|
42
|
+
|
|
43
|
+
| Task | Why Opus |
|
|
44
|
+
|------|----------|
|
|
45
|
+
| Governor limit audit across trigger/flow/batch chains | Must trace cumulative DML/SOQL across async boundaries, understand order of execution, and reason about worst-case heap/CPU scenarios |
|
|
46
|
+
| Security review of `@RestResource` or `with sharing`/`without sharing` decisions | Requires nuanced reasoning about record access, CRUD/FLS enforcement, SOQL injection vectors, and org-wide defaults |
|
|
47
|
+
| Architecture review for large-scale data model changes | Must evaluate cascade effects on triggers, flows, validation rules, sharing rules, and downstream integrations |
|
|
48
|
+
|
|
49
|
+
### Haiku — Mechanical / Low-Risk Tasks
|
|
50
|
+
|
|
51
|
+
Use `haiku` when the task is deterministic, well-scoped, and unlikely to have subtle correctness issues.
|
|
52
|
+
|
|
53
|
+
| Task | Why Haiku |
|
|
54
|
+
|------|-----------|
|
|
55
|
+
| Formatting LWC components (fix indentation, add missing `@api` decorators) | Purely mechanical — no logic changes, just style compliance |
|
|
56
|
+
| Simple Apex fixes (rename a variable, fix a typo in a label, add a missing null check) | Single-line or few-line changes with obvious correctness |
|
|
57
|
+
| Adding `<meta.xml>` boilerplate or updating `apiVersion` across components | Repetitive, pattern-based edits with no ambiguity |
|
|
58
|
+
|
|
59
|
+
### Sonnet — Balanced Implementation Tasks
|
|
60
|
+
|
|
61
|
+
Use `sonnet` (default) for standard development work that requires understanding but follows well-known patterns.
|
|
62
|
+
|
|
63
|
+
| Task | Why Sonnet |
|
|
64
|
+
|------|------------|
|
|
65
|
+
| Code review of an Apex trigger handler or service class | Needs to understand patterns and spot issues, but follows standard review criteria |
|
|
66
|
+
| Generating Apex test classes with `@TestSetup`, mocking, and assertions | Requires understanding the class under test, but test generation follows repeatable patterns |
|
|
67
|
+
| Implementing a new LWC component with wire adapters and error handling | Standard implementation work — needs context awareness but not deep architectural reasoning |
|
|
68
|
+
|
|
69
|
+
## Arguments
|
|
70
|
+
|
|
71
|
+
- `[task-description]` optional free-text
|
|
72
|
+
- `--budget low|med|high` optional
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
/model-route Review the sharing model for the new Patient__c object hierarchy
|
|
78
|
+
/model-route Fix the CSS alignment on the accountDashboard LWC --budget low
|
|
79
|
+
/model-route Generate test coverage for OpportunityTriggerHandler
|
|
80
|
+
/model-route Audit all SOQL queries in force-app for governor limit risks --budget high
|
|
81
|
+
```
|