forcedotcom/sf-skills / plugins/builder/service-omni/skills/service-omni-skills-based-routing-configure
service-omni-skills-based-routing-configure
VerifiedUse to make agents routable by Omni skills-based routing: ensure an Omni Skill exists, then assign it to each active agent through the classic Omni-Channel SkillUser junction. Idempotent — existing skills and user bindings are reused, and only missing bindings are created. Works on Service Cloud orgs without requiring Field Service. Triggers: set up skills-based routing agents, assign Omni skills to agents, make agents skill-routable, create an Omni skill and bind users, repair missing agent skill assignments. Do not use to author WorkSkillRouting rules, create agent users, or configure queues.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.1 KB |
| references/api-notes.md | markdown | 2.6 KB |
| scripts/configure-and-report.shexecutable | script | 12.3 KB |
| scripts/tests/_bootstrap.py | script | 5.5 KB |
| scripts/tests/test_sbr_contracts.pyexecutable | script | 5.6 KB |
scripts/tests/test_sbr_contracts.py
View on GitHub#!/usr/bin/env python3
"""Contract tests for service-omni-skills-based-routing-configure/scripts/configure-and-report.sh."""
from __future__ import annotations
import json
import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from _bootstrap import ( # noqa: E402
FakeSf,
_FAKE_SF_PROD,
_FAKE_SF_SANDBOX,
run,
)
def _last_json(out: str) -> dict:
dec = json.JSONDecoder()
obj, i, n = None, 0, len(out)
while i < n:
if out[i] in "{[":
try:
cand, end = dec.raw_decode(out, i)
if isinstance(cand, dict):
obj = cand
i = end
continue
except json.JSONDecodeError:
pass
i += 1
assert obj is not None, f"no JSON object found in output:\n{out}"
return obj
class InputContractTests(unittest.TestCase):
def test_missing_args_rejected(self):
rc, out = run(["myorg"], scrub_sf=True)
self.assertEqual(rc, 1, out)
self.assertIn("Usage", out)
def test_injection_shaped_skill_name_rejected(self):
rc, out = run(["myorg", "Bad Skill; DROP", "a@b.com"], scrub_sf=True)
self.assertEqual(rc, 1, out)
self.assertIn("Invalid skill_developer_name", out)
def test_missing_agents_rejected(self):
rc, out = run(["myorg", "Omni_Demo_Voice"], scrub_sf=True)
self.assertEqual(rc, 1, out)
self.assertIn("No agents supplied", out)
class ProductionGuardTests(unittest.TestCase):
def test_refuses_production_org(self):
with FakeSf(_FAKE_SF_PROD) as p:
rc, out = run(["prodorg", "Omni_Demo_Voice", "agent1@example.com"], path_prefix=p)
self.assertEqual(rc, 1, out)
v = _last_json(out)
self.assertEqual(v["status"], "blocked", out)
self.assertIn("production", v["blocking_issue"].lower())
class ConfigureTests(unittest.TestCase):
def test_full_create_deploys_skill_and_binds(self):
with FakeSf(_FAKE_SF_SANDBOX) as p:
rc, out = run(["sandbox", "Omni_Demo_Voice", "agent1@example.com,agent2@example.com"],
path_prefix=p, extra_env={"FAKE_SKILL_PRESENT": "0", "FAKE_BIND_PRESENT": "0"})
self.assertEqual(rc, 0, out)
v = _last_json(out)
self.assertEqual(v["status"], "configured", out)
self.assertEqual(v["skill_configured"]["state"], "created", out)
self.assertEqual(v["created_counts"]["skill_bindings"], 2, out)
self.assertNotIn("service_resources", v["created_counts"], out)
self.assertTrue(all("skill_binding_id" in agent for agent in v["agents"]), out)
def test_reused_when_all_present_no_writes(self):
with FakeSf(_FAKE_SF_SANDBOX) as p:
calllog = str(Path(p) / "calls.log")
rc, out = run(["sandbox", "Omni_Demo_Voice", "agent1@example.com,agent2@example.com"],
path_prefix=p, extra_env={"FAKE_SKILL_PRESENT": "1", "FAKE_BIND_PRESENT": "1",
"FAKE_SF_CALLLOG": calllog})
log = Path(calllog).read_text() if Path(calllog).exists() else ""
self.assertEqual(rc, 0, out)
v = _last_json(out)
self.assertEqual(v["status"], "reused", out)
self.assertNotIn("project deploy", log, "reused must not deploy the skill")
self.assertNotIn("--method POST", log, "reused must not create bindings")
def test_partial_when_one_binding_post_fails(self):
with FakeSf(_FAKE_SF_SANDBOX) as p:
rc, out = run(["sandbox", "Omni_Demo_Voice", "agent1@example.com,agent2@example.com"],
path_prefix=p, extra_env={"FAKE_SKILL_PRESENT": "1", "FAKE_BIND_PRESENT": "0",
"FAKE_BIND_POST_FAIL": "1"})
self.assertEqual(rc, 0, out)
v = _last_json(out)
self.assertEqual(v["status"], "partial", out)
self.assertIn("skill binding failed", v["blocking_issue"])
self.assertEqual(v["created_counts"]["skill_bindings"], 1, out)
def test_duplicate_value_is_treated_as_reused(self):
with FakeSf(_FAKE_SF_SANDBOX) as p:
rc, out = run(["sandbox", "Omni_Demo_Voice", "agent1@example.com,agent2@example.com"],
path_prefix=p, extra_env={"FAKE_SKILL_PRESENT": "1", "FAKE_BIND_PRESENT": "0",
"FAKE_BIND_DUPLICATE": "1"})
self.assertEqual(rc, 0, out)
v = _last_json(out)
self.assertIsNone(v["blocking_issue"], out)
self.assertNotEqual(v["status"], "partial", out)
self.assertEqual(v["created_counts"]["skill_bindings"], 0, out)
self.assertEqual(v["reused_counts"]["skill_bindings"], 2, out)
def test_plan_only_reports_without_writing(self):
with FakeSf(_FAKE_SF_SANDBOX) as p:
calllog = str(Path(p) / "calls.log")
rc, out = run(["sandbox", "Omni_Demo_Voice", "agent1@example.com"],
path_prefix=p, extra_env={"FAKE_SKILL_PRESENT": "0", "PLAN_ONLY": "1",
"FAKE_SF_CALLLOG": calllog})
log = Path(calllog).read_text() if Path(calllog).exists() else ""
self.assertEqual(rc, 0, out)
v = _last_json(out)
self.assertTrue(v.get("plan_mode"), out)
self.assertEqual(v["status"], "action_needed", out)
self.assertNotIn("project deploy", log, "plan mode must not deploy")
self.assertNotIn("--method POST", log, "plan mode must not POST")
if __name__ == "__main__":
unittest.main(verbosity=2)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Unverified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |