/agentforce-test
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.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/agentforce-test
Context 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
SKILL.md
agentforce-test.SKILL.mdname: 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"
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"ADLC Test
Automated testing for Agentforce agents with smoke tests, batch execution, and iterative fix loops.
Overview
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).
Platform Notes
- Shell examples below use bash syntax. On Windows, use PowerShell equivalents or Git Bash.
- Replace `python3` with `python` on Windows.
- Replace `/tmp/` with `$env:TEMP\` (PowerShell) or `%TEMP%\` (cmd).
- Replace `jq` with `python -c "import json,sys; ..."` if jq is not installed.
- `find ... | head -1` -> `Get-ChildItem -Recurse ... | Select-Object -First 1` in PowerShell.
Usage
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"}]}'Testing Workflow
This skill supports three testing modes plus direct action execution:
- **Mode A: Ad-Hoc Preview Testing** -- Quick smoke tests during development using `sf agent preview`. No test suite deployment needed (org authentication still required). Best for iterative development and fix validation.
- **Mode B: Testing Center Batch Testing** -- Persistent test suites deployed to the org via `sf agent test`. Best for regression suites, CI/CD, and cross-skill integration with /agentforce-observe.
- **Mode C: Security Testing (OWASP LLM Top 10)** -- Adversarial testing across 7 OWASP categories. You write the cases yourself by reading the agent's own `.agent` script and business domain, using the neutral technique catalog in `assets/payloads/` as a coverage checklist. Two sub-modes over the same authored case set: **C1** deploys them as a Testing Center s
Read more
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"
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"ADLC Test
Automated testing for Agentforce agents with smoke tests, batch execution, and iterative fix loops.
Overview
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).
Platform Notes
- Shell examples below use bash syntax. On Windows, use PowerShell equivalents or Git Bash.
- Replace `python3` with `python` on Windows.
- Replace `/tmp/` with `$env:TEMP\` (PowerShell) or `%TEMP%\` (cmd).
- Replace `jq` with `python -c "import json,sys; ..."` if jq is not installed.
- `find ... | head -1` -> `Get-ChildItem -Recurse ... | Select-Object -First 1` in PowerShell.
Usage
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"}]}'Testing Workflow
This skill supports three testing modes plus direct action execution:
- **Mode A: Ad-Hoc Preview Testing** -- Quick smoke tests during development using `sf agent preview`. No test suite deployment needed (org authentication still required). Best for iterative development and fix validation.
- **Mode B: Testing Center Batch Testing** -- Persistent test suites deployed to the org via `sf agent test`. Best for regression suites, CI/CD, and cross-skill integration with /agentforce-observe.
- **Mode C: Security Testing (OWASP LLM Top 10)** -- Adversarial testing across 7 OWASP categories. You write the cases yourself by reading the agent's own `.agent` script and business domain, using the neutral technique catalog in `assets/payloads/` as a coverage checklist. Two sub-modes over the same authored case set: **C1** deploys them as a Testing Center s
This repository provides a curated collection of Salesforce agent skills for building applications.
Repo: forcedotcom/sf-skills
Other skills on sf-skills.
- /agentforce-generate
Build, modify, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, optimizes, or asks about .agent files or aiAuthoringBundle metadata; changes agent behavior, responses, or conversation logic; designs agent actions, tools,
Open skill - /agentforce-observe
Analyze production Agentforce agent behavior using session traces and Data Cloud. TRIGGER when: user queries STDM session data or Data Cloud trace records; investigates production agent failures, regressions, or performance issues; asks about session traces, conversation logs,
Open skill - /automation-flow-generate
Generate Salesforce Flows using the MCP tool execute_metadata_action. Use when the user asks to create, build, or generate a flow — including Screen, Autolaunched, Record-Triggered (before/after-save), Scheduled. Also trigger for flow-like requests such as \"when a record is
Open skill - /dx-code-analyzer-configure
Set up, configure, and troubleshoot Salesforce Code Analyzer for any project. Handles installation, prerequisite checks, diagnosing broken setups, creating and editing code-analyzer.yml overrides, engine-specific settings, ignore patterns, severity overrides, and CI/CD pipeline
Open skill - /dx-code-analyzer-custom-rule-create
Create custom Code Analyzer rules for Regex (pattern matching), PMD (XPath/AST for Apex and metadata XML), and ESLint (LWC/JavaScript/TypeScript). Use when users want to enforce coding standards, ban patterns, detect hardcoded values, govern metadata, or add rules not in the
Open skill - /dx-code-analyzer-run
Run Salesforce Code Analyzer to scan code for security, performance, best practice, and code style violations. Supports all engines (PMD, ESLint, CPD, RetireJS, Flow, SFGE, ApexGuru), targets (files, folders, git diff), categories, and severities. Also handles post-scan
Open skill

