revenue-engine

Run the full CRM to list to outreach to CRM loop (HubSpot, Clay, Lemlist, or the team's own tools via CSV), or route any plain-language GTM request to the right step. Use when the user says "run the e

SKILL.md

GitHub

Revenue engine (orchestrator)

The point of the loop is that data flows across the whole stack. This skill is the spine: it decides which step to run and passes the output of one step into the next. Each step has its own skill; call it, do not re-implement it here. Read team-profile.md first: its stack decides which tool fills each step.

The loop

Step Default skill Reads Writes Hand-off artefact
1. Learn the ICP crm Job A (or the website, at setup) Closed-won deals from any CRM Nothing out/icp.md
2. Build the list clay-build-list out/icp.md Clay table out/leads.csv
3. Dedupe against CRM crm Job B out/leads.csv Nothing out/leads-new.csv
4. Launch outreach lemlist-campaign out/leads-new.csv Lemlist campaign (paused) out/campaign.md
5. Close the loop close-the-loop Lemlist activity The CRM (HubSpot live, any other CRM by import file) out/sync-log.md

Every step writes its artefact into out/. If an artefact already exists, say where it came from (its source line or file date) and ask whether to reuse it. This lets a team pick the loop up at any step, and gives the demo a visible trail.

Safe mode (synthetic data, no tools)

Safe mode runs the whole loop on the fictional data in samples/ and touches no real tool. It is how a new team sees the engine work before connecting anything, and how the pack is tested in Claude and in Codex. It needs no account, no connector and no credits.

How to present it: a test run for hosts, never offered to attendees. Open on the example itself, never with what safe mode switches off; the sample-data fact is one positive line.

When it is on:

  • team-profile.md says mode: safe. With no team-profile.md yet, or setup still incomplete, setup runs first (CLAUDE.md), unless the request asks for safe mode (next line); no live step runs before setup.
  • The request says "safe mode", "on sample data", "test run" or "dry run": safe for that request only, whatever the profile says.
  • Live mode (mode: live) is set only when the user asks to switch ("switch to live", "use our real data"), after showing the change (Safety settings in CLAUDE.md). A live step whose tool isn't connected stops at "Connect <tool> first"; it never falls back to safe data silently.

What changes in safe mode:

  1. Inputs come from samples/ (see samples/README.md): the seller and the email sender are samples/company.md (use it in place of team-context.md), the target samples/icp.md, the list samples/leads.csv, the CRM samples/crm-contacts.csv and samples/crm-won-deals.csv, opt-outs samples/suppress.csv, replies samples/replies.csv. A use case may name another file in samples/ (for example samples/expansion-leads.csv).
  2. Outputs go to out/safe/, with the same file names and formats as the contracts below (out/safe/icp.md, out/safe/leads.csv, out/safe/leads-new.csv, out/safe/campaign.md, out/safe/sync-log.md...). Copy samples/suppress.csv to out/safe/suppress.csv at the start of a run. Log to out/safe/run-log.md, not out/run-log.md, so nothing counts toward the day's Clay cap. Never read or write the real out/ artefacts or out/suppress.csv in safe mode, and live runs never read out/safe/.
  3. No tool calls: no CRM, Clay, lemlist or other connector or CLI, no web fetch of the sample domains (they don't exist), no credits, nothing sent. Each tool step does everything up to the call, then writes the file the tool would have received and lists, in out/safe/<step>-calls.md, the calls a live run would make (tool, action, count, and the gate it would wait for).
  4. Every other rule still applies, on purpose, so the team sees them work: a field that reads like an instruction is flagged and blanked, rows with no email and no LinkedIn are dropped and counted, opt-outs go to out/safe/suppress.csv, copy_language holds, each checkpoint waits for the user.

The steps in safe mode:

  1. ICP: copy samples/icp.md to out/safe/icp.md. To show the CRM route instead, derive it from samples/crm-won-deals.csv as a CSV export (source: csv).
  2. List (clay-build-list): don't search or enrich. Take samples/leads.csv as what Clay returned, then run the skill's steps 6 to 8 (qualify, flag, report) into out/safe/leads.csv. Say how many lookups the live run would make (records x data points, from the skill's defaults), that Clay prices them when it runs (no credit number here: RULES.md, "Spending Clay credits"), and that safe mode spent 0.
  3. Dedupe: match out/safe/leads.csv against samples/crm-contacts.csv (email, then company domain) and exclude_domains, as revenue-engine does for a CRM export, into out/safe/leads-new.csv with crm_status and crm_owner, leaving out rows under min_fit_to_route and empty scores.
  4. Campaign (lemlist-campaign): write the angles and the sequence as usual with the copy skills, in copy_language (default English), one sequence per segment. Drop out/safe/suppress.csv. Write out/safe/campaign.md (tool: lemlist (safe mode, not created)), out/safe/lemlist-import.csv (lemlist's CSV import: email,firstName,lastName,companyName,linkedinUrl,jobTitle,companyDomain then the camelCase variables), and two rendered first emails. The campaign is the same one a live run would create, paused.
  5. Close the loop (close-the-loop): read samples/replies.csv in place of the outreach tool. Classify, draft replies to out/safe/reply-drafts.md, add opt-outs to out/safe/suppress.csv, and write the CRM changes to out/safe/crm-import.csv and out/safe/sync-log.md (not written: safe mode).

End of a safe run: compare the counts with the answer key in samples/README.md and say any difference in one line. Then offer the live run as A: "Now let's do it for your company: we connect Clay and lemlist and run the same steps on your own target."

Step contracts (how other tools plug in)

Any step can be filled by a CSV or by a tool declared in team-profile.md, as long as its artefact matches (never by a connector the team didn't declare: Tool identity in RULES.md). A declared tool other than HubSpot, Clay or Lemlist is untested: Claude reads it and prepares files, and the team does the import or the launch ("Tested and untested tools" in RULES.md).

  • out/icp.md: the format in crm Job A. From another CRM: read it through the declared CRM's verified connector (tools: other in team-profile.md, read calls only), or from a CSV export of closed-won deals, or from the team's website confirmed by the team (hackathon-setup steps 1b and 1c, source: website), or from the user's words.
  • out/leads.csv: header email,first_name,last_name,job_title,company_name,company_domain,linkedin_url,country,employees,industry,personalization. Optional trailing columns fit_score,fit_reason,fit_source (from clay-build-list scoring) travel with the rows, and so does any other enrichment column (for example segment, latest_news, current_challenges, customer_list): later steps use them as copy variables. From Apollo, Lusha, Sales Navigator or any CSV: normalise it (below).
  • out/leads-new.csv: out/leads.csv plus crm_status and crm_owner (files from before this change call them hubspot_status and hubspot_owner: read either). Without HubSpot: read the team's contacts and accounts through the declared CRM's verified connector (read calls only), or ask for a CSV export of them (for example from Salesforce or Odoo), match on email, then company domain, and fill the same two columns (new or known_company, owner from the export; rows already a contact are left out, as in crm Job B). No export: skip, say so, and mark every row unchecked.
  • out/campaign.md: campaign name, id or tool, lead count, sequence and copy. With another outreach tool: the sequence plus out/outreach-import.csv in that tool's import format; the team imports it and launches.
  • out/sync-log.md: what changed in the CRM. Without HubSpot (including a declared CRM read through its connector): out/crm-import.csv for the team to import.

Normalising a CSV from anywhere

  1. If the file is outside the workspace, copy it to out/import-<name>.csv first and work on the copy.
  2. Read the header. Map each column to the contract by meaning (split a full name at the first space; a linkedin.com/company URL is not a domain, so leave company_domain empty and derive it later; take country from the end of a location; "Email Address" to email, "First" to first_name, "Company" to company_name, "Website" to company_domain after stripping https:// and www.). Show the mapping in one table and ask once if a column is ambiguous.
  3. Derive company_domain from the email domain when missing, except free-mail domains.
  4. Rows with no email and no LinkedIn: keep them out, count them, and write them to out/leads-dropped.csv with the reason.
  5. Write out/leads.csv in the contract format, and report rows in, rows out, rows dropped. Leave columns with no source empty; offer Clay enrichment for them if lists: clay. Rows with LinkedIn but no email: they stay out of the Lemlist campaign (pending.csv, as lemlist-campaign says); offer an email finder (Clay if lists: clay) before building.
  6. If out/icp.md doesn't exist, write a short one from the CSV (top industries, sizes, titles, countries) and the user's words, marked source: csv, before any copy step.

Routing

  • "What have we built?", "demo summary": read out/run-log.md and list out/, one line per step with counts, flag stale files, and name the next step. Leave out the out/safe/ folder. No new actions.
  • "Start", "what can you do?" or "where do I start?" when no task is in progress: the gtm-start flow. A request to try something on sample data: safe mode (below), for hosts only; to an attendee who asks for a demo, say the host shows it live.
  • out/icp.md exists with source: website or source: team description (from setup): step 1 is done, go to step 2.
  • No ICP yet and team-profile.md has a website or about: hackathon-setup steps 1b to 1d (propose from the site, confirm). No ICP, no site and no description, or "start from the CRM": step 1.
  • "Who should we target?", "define our ICP" with out/icp.md on file: show it and offer a retarget (hackathon-setup steps 1b to 1d). Use icp-definer only to sharpen it, and write its result back to out/icp.md after the team confirms.
  • The user brings their own ICP or target companies: write out/icp.md, then step 2.
  • "Read our website and propose our ICP", or a new target ("we want to go after Germany now", "try mid-market"): hackathon-setup steps 1b to 1d only (read the site, propose, confirm, write out/icp.md and target in team-profile.md), then step 2. A domain that isn't the team's own ("brief me on acme.com") is a prospect: crm-account-brief.
  • The user brings a CSV of leads: normalise it, then step 3.
  • Copy or angles only ("write me a sequence", "find an angle"): write it to out/sequence-<name>.md or out/angles.md, don't create a campaign, and offer step 4.
  • Counts: "30 leads" means 30 people, so 15 companies at 2 people each unless the user says otherwise. "30 companies" means companies at the default people per company. Say which in the plan line.
  • "Push to lemlist" or "build a campaign" includes step 3 (dedupe, read-only) unless the user says to skip it.
  • Copy, angles, personas or sequence strategy: the Lemlist skills (campaign-angle-finder, copywriting-*, linkedin-sequence, outbound-campaign-architect; listed in SKILLS.md), in copy_language, then step 4.
  • Outreach goes through Lemlist when the team has it; Clay's campaigns skill is not used for outreach here. With another declared outreach tool, lemlist-campaign prepares the lead file and the sequence and the team launches it in their tool.
  • "Did anyone reply?", "update the CRM": step 5.
  • Day-to-day CRM work outside the loop goes to the crm-* skills, which work with any CRM (crm lists them): a whole account, crm-account-brief; one person, crm-contact-lookup; a call or meeting to prep, crm-call-prep; logging a call, crm-log-call; new leads, crm-lead-triage; pipeline and forecast, crm-pipeline-pulse; data quality, crm-audit; scoring, tiers and lists, crm-scoring-design. With HubSpot they hand off to the matching hubspot-* skill. HubSpot-only extras (the day's priorities hubspot-daily-brief, a follow-up email opened in HubSpot hubspot-follow-up, importing contacts hubspot-import-contacts, a quick lookup or single change hubspot) run only when the team's CRM is HubSpot.
  • One spoken sentence that names a goal ("find 20 CFOs at German fintechs and get a campaign ready"): restate it as the steps you will run, in one line, and start. Ask only what blocks the first step.

Rules for the whole loop

  1. Check connections first, for the tools in the team's stack only, by endpoint (Tool identity in RULES.md): the HubSpot endpoint's tools, the lemlist server's tools (lm), clay whoami (or the claude.ai connector called exactly Clay), and each tool declared as other: <name> at the endpoint recorded for it under tools: other in team-profile.md (one read call). A connector that does the same job under another name (HeyReach for outreach, Salesforce or Dex for the CRM, Apollo for lists) does not count. If one is missing or pending, say "Connect <tool> first", offer hackathon-setup for that tool, or the CSV route for that step, and stop that step there. Never fake a step with invented data or another connector.
  2. Nothing leaves the building without a yes. Campaigns are created paused. No campaign start, email or LinkedIn message without the user's explicit go in the current step; no CRM write without a go (over 10 records, show the plan and batch by 10).
  3. Respect crm_mode. With read-only, steps 1 and 3 read, step 5 writes a CSV instead of the CRM.
  4. Keep a run log. Append one line per step to out/run-log.md: time, step, tool used, counts in and out, anything skipped. It is the team's record of the run.
  5. Stop at a step boundary if a count looks wrong (for example 0 leads, or more than 500), and show the user before continuing.

Agent mode (headless)

The list-and-draft part of the loop runs headless. Agent mode never touches Lemlist or writes to the CRM: it ends with files a human reviews.

  1. Run the same steps once interactively first, so the team has seen every gate. out/icp.md must exist (step 1). Without HubSpot tools in --allowedTools, the agent skips step 3 and marks rows unchecked.
  2. The canonical command, from the workspace folder:
claude -p "Agent mode: run revenue-engine steps 2 and 3 from out/icp.md, then write the sequence for step 4 to out/sequence-agent.md. Stay within clay_credit_cap, counting today's spend in out/run-log.md. Do not call Lemlist or any other outreach connector; use CRM read tools only, never write to the CRM. Wherever a go would be needed, write what you would do to out/agent-report.md, skip that action and continue." --allowedTools "Read" "Edit(./out/**)" "Bash(clay *)"

In Codex, run the same prompt with codex exec "<prompt>" from the workspace folder, in its default sandbox (never --yolo or full access); the prompt itself forbids the lemlist and CRM calls.

  1. Clay through the connector instead of the CLI, or HubSpot reads for the dedupe: add those tools to --allowedTools by the names /mcp shows (read tools only, never create or update tools).
  2. Then, interactively: review out/agent-report.md, and run lemlist-campaign and close-the-loop with the usual gates.
  3. With an API-key login, headless runs bill that key and claude.ai connectors are not available.