commerce-b2b-open-code…
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Write, run, and analyze structured test suites for Agentforce agents — functional AND security. TRIGGER when: user writes or modifies test spec YAML (AiEvaluationDefinition); runs sf agent test create, run, run-eval, or results commands; asks about test coverage strategy, metric
$ npx -y skills add forcedotcom/sf-skills --skill agentforce-test --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/agentforce-testContext preview
The summary Claude sees to decide when to auto-load this skill.
Write, run, and analyze structured test suites for Agentforce agents — functional AND security. TRIGGER when: user writes or modifies test spec YAML (AiEvaluationDefinition); runs sf agent test create, run, run-eval, or results commands; asks about test coverage strategy, metric
name: agentforce-test
description: "Write, run, and analyze structured test suites for Agentforce agents — functional AND security. TRIGGER when: user writes or modifies test spec YAML (AiEvaluationDefinition); runs sf agent test create, run, run-eval, or results commands; asks about test coverage strategy, metric selection, or custom evaluations; interprets test results or diagnoses test failures; asks about batch testing, regression suites, or CI/CD test integration; requests security testing, OWASP LLM Top 10, red-teaming, penetration testing, prompt-injection tests, a security grade, or a vulnerability assessment of an agent. DO NOT TRIGGER when: user creates, modifies, previews, or debugs .agent files (use agentforce-generate); deploys or publishes agents; writes Agent Script code; uses sf agent preview for development iteration; analyzes production session traces (use agentforce-observe); performs a static safety review of .agent file content (use agentforce-generate Section 15)."
allowed-tools: Bash Read Write Edit Glob Grep
metadata:
relatedSkills:
- "agentforce-generate"
- "agentforce-observe"
version: "0.8"
domains: ["Agentforce"]
cliTools:
- tool: ["curl"]
semver: ">=7.0.0"
- tool: ["jq"]
semver: ">=1.6.0"
- tool: ["python3"]
semver: ">=3.10.0"
- tool: ["sf"]
semver: ">=2.121.7"Automated testing for Agentforce agents with smoke tests, batch execution, and iterative fix loops.
This skill provides comprehensive testing capabilities for Agentforce agents, including automated utterance derivation from agent subagents, preview-based smoke testing, trace analysis, an iterative fix loop for identified issues, and **security testing** (OWASP LLM Top 10). It bridges the gap between initial development and production deployment.
**Security testing is part of the ADLC, not a separate skill.** Functional correctness (right topic, right action) and security posture (resists attacks) are two dimensions of the same test suite. Treat adversarial coverage as part of the test flow and the Agent Spec — when you plan tests for an agent, plan its security tests too. Security test-case generation is **gated on explicit user confirmation** (see Mode C).
This skill uses `sf agent preview` and `sf agent test` CLI commands directly. There is no standalone Python script.
**Quick smoke test (Mode A):**
# Start preview, send utterance, end session (--authoring-bundle generates local traces). # Run from inside the Salesforce project directory (the CLI requires sfdx-project.json). # With --authoring-bundle, `start` REQUIRES an action mode: --simulate-actions or # --use-live-actions. The mode flag belongs on `start` only — `send` and `end` reject it. sf agent preview start --json --authoring-bundle MyAgent --simulate-actions -o <org-alias> sf agent preview send --json --session-id <ID> --utterance "test" --authoring-bundle MyAgent -o <org-alias> sf agent preview end --json --session-id <ID> --authoring-bundle MyAgent -o <org-alias>
**Batch testing (Mode B):**
# Deploy and run test suite sf agent test create --json --spec test-spec.yaml --api-name MySuite -o <org-alias> sf agent test run --json --api-name MySuite --wait 10 --result-format json -o <org-alias>
**Security testing (Mode C — confirm with the user before generating):**
# You read the .agent file and write the security cases yourself — same as # Mode B, with security-specific guidance in references/security-test-design.md. # C1: deploy the security suite you authored (identical to Mode B) sf agent test create --json --spec /tmp/MyAgent-security-spec.yaml --api-name MyAgent_Security -o <org-alias> # C2: live adversarial probing (identical to Mode A, one fresh session per case). # --simulate-actions is the C2 default: probe the agent's reasoning without firing # real Apex/Flow writes. Only substitute --use-live-actions on explicit user opt-in. sf agent preview start --json --authoring-bundle MyAgent --simulate-actions -o <org-alias> sf agent preview send --json --session-id <ID> --utterance "<payload>" --authoring-bundle MyAgent -o <org-alias> sf agent preview end --json --session-id <ID> --authoring-bundle MyAgent -o <org-alias>
**Action execution:**
# Execute a Flow or Apex action directly via REST API
TOKEN=$(sf org display -o <org-alias> --json | jq -r '.result.accessToken')
INSTANCE_URL=$(sf org display -o <org-alias> --json | jq -r '.result.instanceUrl')
curl -s "$INSTANCE_URL/services/data/v63.0/actions/custom/flow/Get_Order_Status" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"inputs": [{"orderId": "00190000023XXXX"}]}'This skill supports three testing modes plus direct action execution:
This repository provides a curated collection of Salesforce agent skills for building applications.
Repo: forcedotcom/sf-skills
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Replace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code…
Use this skill to diagnose and resolve what blocks a DevOps Center promotion of a work item's feature branch: Git merge conflicts and deployment failures.…
Use this skill to manage the full lifecycle of a DevOps Center pipeline — list all pipelines, get a single pipeline's details, create a new pipeline linked to…
Analyzes DevOps Center test failures and Code Analyzer violations in plain language — failure category, offending file/class/method/line, rule violated, fix…
Configures DevOps Center pipeline testing infrastructure: enables a test provider so its suites become available, re-syncs a configured provider to pull in new…