What it does
Speed to lead is the sales metric everyone agrees on and almost nobody measures, because Salesforce does not store it. The number has to be rebuilt from two places: when the Lead record was created, and when the first Task or Event was logged against it.
This skill does that rebuild every Monday for last week's leads. The tile shows the median in hours, the table shows it per owner, and leads that still have no activity at all are listed by name, because those are exactly the ones a median hides.
How it works
1Get last week's leads and their first activity
SELECT Id, Name, Company, LeadSource, Owner.Name, Owner.Type, CreatedDate, (SELECT CreatedDate FROM Tasks ORDER BY CreatedDate ASC LIMIT 1), (SELECT CreatedDate FROM Events ORDER BY CreatedDate ASC LIMIT 1) FROM Lead WHERE CreatedDate = LAST_WEEK.- 2
2Measure the gap
First touch is the earlier of the two subquery dates; hours to first touch is that minus the lead's
CreatedDate. Leads still owned by a queue (Owner.Type = 'Queue') stay out of the per-owner table and are counted on their own. - 3
3Compute the medians
Median for the team and per owner over touched leads, plus the share of all leads touched within 1 hour and within 24 hours. Leads with no activity yet are listed as waiting, with their age so far.
- 4
4Post the median
Headline: team median in hours, against the week before. Add the per-owner table (leads, median, share within an hour) and the untouched leads, oldest first.
Post it to the board
With
BRIEFKIN_TOKENset, the agent sends the result as one card that updates in place every run. Without it, you get the report in the chat.
Install and run it
Pick your agent, where the data comes from and how to schedule it; the commands below follow.
Install the skill
One command. It puts the SKILL.md in ~/.claude/skills and in ~/.agents/skills, which Codex, Cursor, Gemini CLI, Copilot CLI and OpenCode read too.
shell
curl -fsSL https://briefkin.dev/skills/salesforce-lead-response-time/install | shRun it
Ask Claude Code:
prompt
Run the salesforce-lead-response-time skillOr paste the prompt instead of installing:
prompt
Using SOQL on Salesforce, take leads created last week and, for each one, find the earliest Task or Event logged on it (subqueries on Tasks and Events ordered by CreatedDate). Compute hours from the lead's CreatedDate to that first activity. Give me the team median, the share of leads touched within 1 hour and within 24 hours, and a table by owner (leads, median hours, share within 1 hour). Keep queue-owned leads out of the owner table and count them separately. List leads with no activity yet, oldest first, with company, owner and LeadSource.Put it on a schedule
Mondays at 9:00, from cron on any machine where Claude Code is signed in:
crontab
0 9 * * 1 claude -p "Run the salesforce-lead-response-time skill"Add it with
crontab -e. A laptop asleep at that time runs it when it wakes if you use launchd or Task Scheduler instead; GitHub Actions works for the API route.Send it to your board
Connect Briefkin once with
curl -fsSL https://briefkin.dev/install | shand every run lands on your board as a stat tile. How setup works
View the SKILL.mdRaw file
SKILL.md---
name: salesforce-lead-response-time
description: "Every Monday: median hours from lead created to first logged activity for last week's Salesforce leads, per owner, with the leads still waiting. Use when the user asks for this, or when it runs on a schedule."
---
# Salesforce lead response time
Every Monday: median hours from lead created to first logged activity for last week's Salesforce leads, per owner, with the leads still waiting.
Speed to lead is the sales metric everyone agrees on and almost nobody measures, because Salesforce does not store it. The number has to be rebuilt from two places: when the Lead record was created, and when the first Task or Event was logged against it.
This skill does that rebuild every Monday for last week's leads. The tile shows the median in hours, the table shows it per owner, and leads that still have no activity at all are listed by name, because those are exactly the ones a median hides.
## Two ways to get the data
Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.
## Route A: API or MCP server
### What you need
- Read access to Lead, Task and Event records for the team, with SOQL through the `sf` CLI, a connector, or the REST API and a token in `SF_ACCESS_TOKEN`.
If something is missing, say what and stop; do not invent numbers.
### Steps
1. **Get last week's leads and their first activity** (Salesforce): `SELECT Id, Name, Company, LeadSource, Owner.Name, Owner.Type, CreatedDate, (SELECT CreatedDate FROM Tasks ORDER BY CreatedDate ASC LIMIT 1), (SELECT CreatedDate FROM Events ORDER BY CreatedDate ASC LIMIT 1) FROM Lead WHERE CreatedDate = LAST_WEEK`.
2. **Measure the gap**: First touch is the earlier of the two subquery dates; hours to first touch is that minus the lead's `CreatedDate`. Leads still owned by a queue (`Owner.Type = 'Queue'`) stay out of the per-owner table and are counted on their own.
3. **Compute the medians**: Median for the team and per owner over touched leads, plus the share of all leads touched within 1 hour and within 24 hours. Leads with no activity yet are listed as waiting, with their age so far.
4. **Post the median**: Headline: team median in hours, against the week before. Add the per-owner table (leads, median, share within an hour) and the untouched leads, oldest first.
## Route B: the browser
### What you need
- Signed in to Salesforce with Run Reports and read access to the team's leads, tasks and events.
If something is missing, say what and stop; do not invent numbers.
### Steps
Start at https://login.salesforce.com/. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.
1. **Report activities on last week's leads**: From your My Domain open **Reports** > **New Report**, report type **Activities with Leads**. Filters: Show Me All activities, **Lead: Created Date** **Last Week**, Date range All Time. Group by Lead, columns Lead Created Date, activity **Date** or Created Date, Assigned, Company, Lead Owner, Lead Source. Sort activities oldest first inside each group.
2. **Measure the gap**: The first activity in each lead group is the first touch; hours to first touch is its created time minus Lead Created Date. **Export** the report as Details Only CSV when there are more than a few dozen leads and do the subtraction in a sheet. Leads owned by a queue stay out of the per-owner numbers.
3. **Find the untouched leads**: A second report of type **Leads** with Created Date Last Week and **Last Activity** equals blank lists the leads with no Task or Event at all, with owner and Lead Source; sort by Created Date oldest first.
4. **Post the median**: Team median hours, the share touched within 1 hour and within 24 hours, the per-owner table, and the untouched leads, compared with the week before from your saved numbers.
Note: Salesforce stores no first-response field, so this route is export and arithmetic; the API route does the same from subqueries. Automated sends logged as Tasks by marketing tools count as a touch unless you exclude them by subject or creator in the report filter.
## The report
- **Median hours to first touch** for last week's leads, and the week before.
- **Within 1 hour and within 24 hours**, as shares of all leads.
- **By owner**: leads, median and the share touched within an hour.
- **Untouched leads**, oldest first, with owner and lead source.
## Post it to Briefkin
When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.
```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
-H "authorization: Bearer $BRIEFKIN_TOKEN" \
-H "content-type: application/json" \
-d @- <<'JSON'
{
"v": 1,
"event_id": "salesforce-lead-response-time/<date of this run, e.g. 2026-10-16>",
"item_key": "salesforce-lead-response-time",
"project": "Acme",
"source": "Salesforce lead response time skill",
"kind": "metric",
"title": "Median lead response 3.4 h last week",
"metric": {
"label": "Median first response",
"value": 3.4,
"unit": "h",
"better": "lower",
"period_start": "<start of the period, ISO 8601>",
"period_end": "<end of the period, ISO 8601>"
},
"glance": {
"type": "Grid",
"props": {
"columns": 3
},
"children": [
{
"type": "Stat",
"props": {
"label": "Within 1 h",
"value": 35,
"unit": "%"
}
},
{
"type": "Stat",
"props": {
"label": "Within 24 h",
"value": 88,
"unit": "%"
}
},
{
"type": "Stat",
"props": {
"label": "Untouched",
"value": 6,
"tone": "warn"
}
}
]
},
"widget": [
{
"type": "Table",
"props": {
"columns": [
"Owner",
"Leads",
"Median",
"Within 1 h"
],
"align": [
"left",
"right",
"right",
"right"
],
"rows": [
[
"Dana",
22,
"1.2 h",
"55%"
],
[
"Sam",
19,
"2.8 h",
"37%"
],
[
"Priya",
17,
"4.1 h",
"24%"
],
[
"Theo",
14,
"9.6 h",
"14%"
]
]
}
},
{
"type": "Table",
"props": {
"columns": [
"Untouched lead",
"Company",
"Owner",
"Source",
"Waiting"
],
"align": [
"left",
"left",
"left",
"left",
"right"
],
"rows": [
[
"Rafael Costa",
"Wide World Importers",
"Theo",
"Web",
"6 days"
],
[
"Emma Lindqvist",
"Alpine Ski House",
"Theo",
"Phone Inquiry",
"5 days"
],
[
"Arjun Patel",
"Litware",
"Priya",
"Web",
"4 days"
],
[
"Grace Kim",
"Humongous Insurance",
"Theo",
"Partner Referral",
"3 days"
],
[
"Noah Fischer",
"Proseware",
"Sam",
"Web",
"3 days"
],
[
"Chloe Martin",
"Fourth Coffee",
"Priya",
"Purchased List",
"2 days"
]
]
}
},
{
"type": "Callout",
"props": {
"text": "Theo holds 3 of the 6 untouched leads, and his median is 9.6 h.",
"tone": "warn"
}
}
],
"size": "md"
}
JSON
```
Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.
Set `period_start` and `period_end` to the window the number covers: the tile names it from them ("Last 7 days", "Today", "This month"). For a count right now (open items, a balance), send `"period_label": ""` so no period shows; for another name, send it as `period_label` (at most 24 characters).
## Run it on a schedule
Suggested: Mondays at 9:00 (`0 9 * * 1`). From cron, with the agent signed in on that machine:
```bash
0 9 * * 1 claude -p "Run the salesforce-lead-response-time skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```
Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/salesforce-lead-response-time#schedule
Source: https://briefkin.dev/skills/salesforce-lead-response-time
What your agent needs
Read access to Lead, Task and Event records for the team, with SOQL through the
sfCLI, a connector, or the REST API and a token inSF_ACCESS_TOKEN.
Connecting Salesforce
- Salesforce Hosted MCP Servers. Salesforce runs MCP servers for your org; in Setup under MCP Servers, activate the read-only SObject Reads server and copy its URL. To use it from Claude, create an External Client App with OAuth (scopes
mcp_apiandrefresh_token, callbackhttps://claude.ai/api/mcp/auth_callback) and add the URL as a custom connector (server reference). - The
sfCLI. Log in once withsf org login web --alias prod, then runsf data query --query "SELECT Name, StageName, Amount, CloseDate FROM Opportunity WHERE IsClosed = false" --target-org prod --json. Salesforce's DX MCP server (npx @salesforce/mcp) reuses the same CLI login for local agents. - REST API with OAuth. An External Client App with the
apiandrefresh_tokenscopes; the skill readsSF_INSTANCE_URLandSF_ACCESS_TOKEN(or a refresh token) and calls the query endpoint.
SObject Reads and SOQL never write, but the user's permissions are the real limit: run reports as an integration user whose permission set grants Read on Opportunity, Account, Lead and Case and nothing else.
Questions
Does it count business hours only?
No, it measures wall-clock hours, so a lead created at 23:00 on a Friday carries the weekend. Give the skill your working hours and time zone and it will skip nights and weekends when it measures.
What counts as a first touch?
The earliest Task or Event on the lead: a logged call, an email logged from Outlook or Gmail, or a meeting. If your marketing automation logs its own sends as Tasks, exclude them by subject or CreatedById so an automated welcome email does not count as a response.
Do I need Briefkin to use the Salesforce lead response time skill?
No. The skill runs with your own agent and gives you the report in the chat. With a Briefkin token set, each run also posts it to your board as a stat tile, so you can glance at it instead of asking again.
Which agents can run it?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Windsurf and Amp all read SKILL.md files. The install command puts it in ~/.claude/skills and ~/.agents/skills, where they look. ChatGPT, the Claude app and Grok take the prompt instead. Pick your agent under "Install and run it" and the commands change to match.
Can it work without an API or MCP server, from my browser?
Yes. Switch the data source to "Your browser" and the steps change to the Salesforce pages themselves: the agent opens login.salesforce.com in a browser you are signed in to and reads the numbers off the page. Claude Code, Codex, Cursor, Claude app and ChatGPT can drive a browser out of the box; Gemini CLI, Copilot CLI and OpenCode need a Playwright or Chrome DevTools MCP server first. It is slower than the API and needs you signed in, so it suits a report you run by hand or from a scheduler on your own computer.