Claude Skill

gmail-to-crm-pipeline

Uses MCP Connectors to read Gmail inbound leads, score them by ICP fit, draft personalized responses, and log qualified leads to your CRM. Turns your inbox into an automated pipeline.

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download onewave-ai-claude-skills-gmail-to-crm-pipeline-97b5147.zip · 14 KB
Part of onewave-ai/claude-skills — 67 skills

Install

skills CLI npx skills add https://github.com/OneWave-AI/claude-skills/tree/main/gmail-to-crm-pipeline
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install onewave-ai-claude-skills@llmmart
Git git clone https://github.com/OneWave-AI/claude-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole onewave-ai/claude-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Gmail-to-CRM Pipeline

Turn a Gmail inbox into a structured sales pipeline using Claude's MCP Connectors -- the Gmail connector reads and drafts email, and the Supabase connector persists CRM data. No external scripts or API keys required.

Workflow

  1. Connect. Verify the Gmail and Supabase MCP Connectors are available. On first run, create the CRM tables and seed config. Load ICP config from the pipeline_config table. See references/configuration.md (first run, error handling) and references/crm-schema.md.
  2. Search. Run the targeted Gmail search queries to find unread lead emails over the time window (default: last 24 hours). Collect unique message IDs and deduplicate. See references/gmail-retrieval.md.
  3. Parse. Read each unique message, strip signatures and disclaimers, and extract the structured field set. See references/gmail-retrieval.md.
  4. Extract. Build the lead profile (contact, company, inquiry, metadata) for each email. Set missing fields to null rather than guessing. See references/lead-extraction.md.
  5. Score. Score each lead on ICP fit (0-40), intent (0-35), and urgency (0-25), then apply adjustment modifiers. Map the total to a qualification tier and priority. See references/scoring-model.md.
  6. Draft. For each qualified lead (score >= 25), draft a personalized, tier-appropriate response and save it as a Gmail draft. Never auto-send. See references/response-templates.md.
  7. Log. Check for duplicates, then insert or update the lead in Supabase, log activity, and set the next action by priority. See references/crm-schema.md.
  8. Report. Query the pipeline snapshot and generate lead-pipeline-report.md in the working directory, then display the executive summary. See references/pipeline-report.md.

Between runs, handle manual lead commands (mark contacted, move stage, disqualify, add note, schedule follow-up, query leads) and ICP/search customization. See references/configuration.md.

Hard Rules

  • Never auto-send email -- always create drafts for the user to review and send.
  • Never store raw email bodies or credentials in Supabase or any report; store structured data and key quotes only.
  • Treat all lead and email content as confidential.

Contents

  • references/gmail-retrieval.md -- Gmail MCP tools, search queries, parsing rules, extracted field set.
  • references/lead-extraction.md -- Lead profile JSON schema and extraction guidelines.
  • references/scoring-model.md -- ICP, intent, urgency scoring tables; tier mapping; adjustment rules.
  • references/response-templates.md -- Per-tier response templates, personalization rules, anti-patterns, draft creation.
  • references/crm-schema.md -- Supabase MCP tools, table DDL, logging procedure and SQL.
  • references/pipeline-report.md -- Report Markdown structure and reporting SQL queries.
  • references/configuration.md -- First-run setup, customization, manual commands, error handling, privacy, invocation triggers.
Files (claude-skills)
  • references
    • configuration.md 3.3 KB
      # Configuration, Commands, and Operations
      
      ## First Run Setup
      
      On the very first run:
      
      1. **Check Supabase connection:** Use `mcp__claude_ai_Supabase__list_projects` to verify connectivity.
      2. **Create tables:** Run the schema migration if tables do not exist (see `crm-schema.md`).
      3. **Seed config:** Insert default ICP configuration.
      4. **Ask the user** for:
         - Their name (for email signatures)
         - Their calendar link (for booking calls)
         - Primary industries they serve
         - Target company sizes
         - Any custom lead source search queries
      5. **Store config** in the `pipeline_config` table.
      
      ## Customizing ICP Scoring
      
      Users can update their ICP at any time by saying things like:
      - "We only work with enterprise companies"
      - "Add healthcare to our target industries"
      - "Ignore leads from education sector"
      
      Update the `pipeline_config` table accordingly and recalculate scores for recent leads if needed.
      
      ## Adjusting Search Queries
      
      Users can add custom Gmail search queries:
      - "Also check for emails with subject 'audit' or 'compliance'"
      - "Ignore emails from recruiters"
      - "Add a filter for emails mentioning 'Kubernetes'"
      
      ## Manual Lead Actions
      
      Support these commands when the user provides direction:
      
      - **"Mark [lead] as contacted"** -- Update stage, log activity.
      - **"Move [lead] to proposal stage"** -- Update stage, prompt for proposal details.
      - **"Disqualify [lead]"** -- Set stage to 'lost', log reason.
      - **"Add note to [lead]"** -- Append to notes field, log activity.
      - **"Schedule follow-up for [lead] on [date]"** -- Update next_action_date, log activity.
      - **"Show me all hot leads"** -- Query and display P1 leads.
      - **"What happened with [company]?"** -- Show full lead history and activity log.
      
      ## Error Handling
      
      - **Gmail connector not available:** Inform the user they need to enable the Gmail MCP Connector in Claude Code settings. Provide setup instructions.
      - **Supabase connector not available:** Offer to output lead data as local JSON/CSV files instead of database logging.
      - **No matching emails found:** Report "No new lead emails found in the last 24 hours" and show the pipeline snapshot from existing CRM data.
      - **Rate limiting:** If Gmail API limits are hit, pause and resume. Process in batches of 10 if more than 20 emails found.
      - **Malformed emails:** Log parsing errors, skip the email, and flag it for manual review in the report.
      - **Duplicate detection failure:** Default to creating a new lead record with a note about a potential duplicate.
      
      ## Privacy and Security
      
      - **Never log email passwords or auth tokens** in any output.
      - **Never include full email bodies** in the pipeline report -- only summaries and key quotes.
      - **Draft responses stay as drafts** -- never auto-send.
      - **Supabase connection** uses the MCP Connector's managed auth -- no raw credentials in the skill.
      - **PII handling:** Treat lead data in Supabase as confidential; do not include it in any files shared externally.
      - **Email content:** Do not store raw email HTML/body in Supabase; store only extracted structured data and summaries.
      
      ## Invocation Triggers
      
      Invoke this skill when the user says things like:
      - "Check my email for leads"
      - "Process my inbox"
      - "Run the lead pipeline"
      - "Any new leads today?"
      - "Check Gmail for demo requests"
      - "Score my inbound leads"
      - "Draft responses to new leads"
      - "Generate a pipeline report"
      - "How's my pipeline looking?"
      
    • crm-schema.md 6.9 KB
      # CRM Logging (Supabase)
      
      Use the Supabase MCP Connector to log all lead data to the CRM database.
      
      ## Available Supabase MCP Tools
      
      - `mcp__claude_ai_Supabase__execute_sql` -- Execute SQL queries
      - `mcp__claude_ai_Supabase__list_tables` -- List existing tables
      - `mcp__claude_ai_Supabase__apply_migration` -- Apply schema migrations
      - `mcp__claude_ai_Supabase__list_projects` -- List Supabase projects
      
      On first run, check if the required tables exist. If not, create them with `mcp__claude_ai_Supabase__apply_migration`.
      
      ## Table: `leads`
      
      ```sql
      CREATE TABLE IF NOT EXISTS leads (
        id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
        created_at TIMESTAMPTZ DEFAULT now(),
        updated_at TIMESTAMPTZ DEFAULT now(),
      
        -- Contact info
        contact_name TEXT NOT NULL,
        contact_email TEXT NOT NULL,
        contact_phone TEXT,
        contact_role TEXT,
        contact_linkedin TEXT,
      
        -- Company info
        company_name TEXT,
        company_domain TEXT,
        company_size TEXT CHECK (company_size IN ('startup', 'smb', 'midmarket', 'enterprise', 'unknown')),
        company_industry TEXT,
      
        -- Inquiry details
        inquiry_type TEXT NOT NULL CHECK (inquiry_type IN (
          'demo_request', 'partnership', 'rfp', 'referral',
          'pricing_inquiry', 'general_inquiry', 'support_question'
        )),
        inquiry_summary TEXT NOT NULL,
        specific_services TEXT[],
        pain_points TEXT[],
        timeline TEXT,
        budget_signals TEXT,
      
        -- Scoring
        score_total INTEGER NOT NULL DEFAULT 0,
        score_icp INTEGER NOT NULL DEFAULT 0,
        score_intent INTEGER NOT NULL DEFAULT 0,
        score_urgency INTEGER NOT NULL DEFAULT 0,
        qualification TEXT NOT NULL CHECK (qualification IN ('sql', 'mql', 'iql', 'unqualified')),
        priority TEXT NOT NULL CHECK (priority IN ('P1', 'P2', 'P3', 'P4')),
        score_adjustments JSONB DEFAULT '[]'::jsonb,
      
        -- Source tracking
        source TEXT NOT NULL DEFAULT 'gmail',
        source_detail TEXT,
        gmail_message_id TEXT UNIQUE,
        gmail_thread_id TEXT,
        received_date TIMESTAMPTZ,
        forwarded_by TEXT,
      
        -- Response tracking
        response_drafted BOOLEAN DEFAULT false,
        response_draft_id TEXT,
        response_draft_text TEXT,
        response_sent BOOLEAN DEFAULT false,
        response_sent_date TIMESTAMPTZ,
      
        -- Pipeline tracking
        stage TEXT NOT NULL DEFAULT 'new' CHECK (stage IN (
          'new', 'contacted', 'qualifying', 'proposal', 'negotiation', 'won', 'lost', 'nurture'
        )),
        next_action TEXT,
        next_action_date TIMESTAMPTZ,
        assigned_to TEXT,
        notes TEXT,
        tags TEXT[]
      );
      
      -- Indexes for common queries
      CREATE INDEX IF NOT EXISTS idx_leads_email ON leads(contact_email);
      CREATE INDEX IF NOT EXISTS idx_leads_company ON leads(company_domain);
      CREATE INDEX IF NOT EXISTS idx_leads_score ON leads(score_total DESC);
      CREATE INDEX IF NOT EXISTS idx_leads_stage ON leads(stage);
      CREATE INDEX IF NOT EXISTS idx_leads_created ON leads(created_at DESC);
      CREATE INDEX IF NOT EXISTS idx_leads_qualification ON leads(qualification);
      CREATE INDEX IF NOT EXISTS idx_leads_gmail_msg ON leads(gmail_message_id);
      ```
      
      ## Table: `lead_activity_log`
      
      ```sql
      CREATE TABLE IF NOT EXISTS lead_activity_log (
        id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
        lead_id UUID NOT NULL REFERENCES leads(id) ON DELETE CASCADE,
        created_at TIMESTAMPTZ DEFAULT now(),
        activity_type TEXT NOT NULL CHECK (activity_type IN (
          'email_received', 'email_drafted', 'email_sent',
          'score_updated', 'stage_changed', 'note_added',
          'call_scheduled', 'call_completed', 'meeting_booked',
          'proposal_sent', 'follow_up_scheduled'
        )),
        description TEXT NOT NULL,
        metadata JSONB DEFAULT '{}'::jsonb
      );
      
      CREATE INDEX IF NOT EXISTS idx_activity_lead ON lead_activity_log(lead_id);
      CREATE INDEX IF NOT EXISTS idx_activity_type ON lead_activity_log(activity_type);
      CREATE INDEX IF NOT EXISTS idx_activity_created ON lead_activity_log(created_at DESC);
      ```
      
      ## Table: `pipeline_config`
      
      ```sql
      CREATE TABLE IF NOT EXISTS pipeline_config (
        id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
        config_key TEXT UNIQUE NOT NULL,
        config_value JSONB NOT NULL,
        updated_at TIMESTAMPTZ DEFAULT now()
      );
      
      -- Default ICP configuration
      INSERT INTO pipeline_config (config_key, config_value) VALUES
        ('icp_primary_industries', '["Technology", "SaaS", "Financial Services", "Healthcare Tech", "Professional Services"]'::jsonb),
        ('icp_secondary_industries', '["E-commerce", "Manufacturing", "Education", "Real Estate Tech", "Media"]'::jsonb),
        ('icp_target_company_sizes', '["midmarket", "enterprise"]'::jsonb),
        ('icp_target_roles', '["C-suite", "VP", "Director", "Head of"]'::jsonb),
        ('response_calendar_link', '"https://calendly.com/PLACEHOLDER"'::jsonb),
        ('response_sender_name', '"PLACEHOLDER"'::jsonb),
        ('daily_report_recipients', '[]'::jsonb)
      ON CONFLICT (config_key) DO NOTHING;
      ```
      
      ## Logging Procedure
      
      For each processed lead, execute these steps in order.
      
      ### Step a: Check for Duplicates
      
      ```sql
      SELECT id, score_total, stage FROM leads
      WHERE gmail_message_id = '[message_id]'
         OR (contact_email = '[email]' AND company_domain = '[domain]' AND created_at > now() - interval '30 days')
      LIMIT 1;
      ```
      
      If a duplicate is found:
      - Same `gmail_message_id`: Skip (already processed).
      - Same contact + company within 30 days: Update the existing lead with the new interaction, log to `lead_activity_log`, and apply the Repeat Inquiry Bonus (+8 points).
      
      ### Step b: Insert New Lead
      
      ```sql
      INSERT INTO leads (
        contact_name, contact_email, contact_phone, contact_role, contact_linkedin,
        company_name, company_domain, company_size, company_industry,
        inquiry_type, inquiry_summary, specific_services, pain_points, timeline, budget_signals,
        score_total, score_icp, score_intent, score_urgency, qualification, priority,
        score_adjustments,
        source, source_detail, gmail_message_id, gmail_thread_id, received_date, forwarded_by,
        response_drafted, response_draft_text, next_action, next_action_date
      ) VALUES (
        -- [extracted values from lead profile]
      );
      ```
      
      ### Step c: Log Activity
      
      ```sql
      INSERT INTO lead_activity_log (lead_id, activity_type, description, metadata)
      VALUES (
        '[new_lead_id]',
        'email_received',
        'Inbound [inquiry_type] from [contact_name] at [company_name]',
        '{"subject": "[subject]", "score": [score], "qualification": "[qual]"}'::jsonb
      );
      ```
      
      If a draft was created:
      
      ```sql
      INSERT INTO lead_activity_log (lead_id, activity_type, description, metadata)
      VALUES (
        '[new_lead_id]',
        'email_drafted',
        'Auto-drafted [priority] response for review',
        '{"draft_id": "[gmail_draft_id]", "template_tier": "[hot/warm/cool]"}'::jsonb
      );
      ```
      
      ### Step d: Set Next Action
      
      Based on lead priority, set the appropriate next action:
      
      ```
      P1 (HOT):  next_action = "Review and send draft response"
                 next_action_date = now()
      
      P2 (WARM): next_action = "Review draft, personalize, and send"
                 next_action_date = now() + interval '4 hours'
      
      P3 (COOL): next_action = "Review and send nurture response"
                 next_action_date = now() + interval '24 hours'
      
      P4 (COLD): next_action = "Review -- may not require response"
                 next_action_date = now() + interval '48 hours'
      ```
      
    • gmail-retrieval.md 3.2 KB
      # Gmail Connection and Email Retrieval
      
      Use the Gmail MCP Connector (first-party MCP integration in Claude Code, launched February 2026) to access the inbox. The connector handles authentication through Claude's MCP Connectors infrastructure -- no OAuth setup or API key management.
      
      ## Available Gmail MCP Tools
      
      - `mcp__claude_ai_Gmail__gmail_search_messages` -- Search messages with Gmail query syntax
      - `mcp__claude_ai_Gmail__gmail_read_message` -- Read full message content by ID
      - `mcp__claude_ai_Gmail__gmail_read_thread` -- Read an entire email thread
      - `mcp__claude_ai_Gmail__gmail_create_draft` -- Create a draft reply
      - `mcp__claude_ai_Gmail__gmail_list_drafts` -- List existing drafts
      - `mcp__claude_ai_Gmail__gmail_list_labels` -- List Gmail labels
      - `mcp__claude_ai_Gmail__gmail_get_profile` -- Get user profile info
      
      ## Search Queries to Execute
      
      Run multiple targeted searches to catch all lead types.
      
      ```
      Query 1 - Form Submissions:
        is:unread subject:(demo OR trial OR "get started" OR "sign up" OR "contact us" OR "request info")
      
      Query 2 - Partnership Inquiries:
        is:unread subject:(partnership OR collaborate OR integration OR "work together" OR referral)
      
      Query 3 - Direct Outreach / RFPs:
        is:unread subject:(proposal OR RFP OR consulting OR engagement OR "looking for" OR "need help")
      
      Query 4 - Warm Referrals:
        is:unread subject:(introduction OR intro OR referral OR "meet" OR "connecting you")
      
      Query 5 - Pricing/Service Inquiries:
        is:unread subject:(pricing OR rates OR "how much" OR services OR scope OR availability)
      ```
      
      **Time Window:** Default to the last 24 hours. If a different window is specified (e.g., "check the last week"), adjust the `after:` parameter accordingly.
      
      **Deduplication:** Track message IDs across all searches. Process a repeated message ID only once. Assign it to the highest-priority lead category it matched.
      
      ## Read and Parse Each Email
      
      For every unique lead email, use `mcp__claude_ai_Gmail__gmail_read_message` to retrieve full content.
      
      Extract these fields:
      
      | Field | Source | Notes |
      |---|---|---|
      | `sender_name` | From header | Parse "Display Name <email>" format |
      | `sender_email` | From header | Normalize to lowercase |
      | `sender_domain` | From header | Extract domain from email |
      | `subject` | Subject header | Original subject line |
      | `received_date` | Date header | ISO 8601 format |
      | `body_text` | Message body | Plain text, stripped of signatures and disclaimers |
      | `thread_id` | Gmail thread ID | For tracking conversations |
      | `message_id` | Gmail message ID | Unique identifier |
      | `has_attachments` | Message metadata | Boolean |
      | `cc_recipients` | CC header | List of CC'd parties (may indicate stakeholders) |
      
      ## Email Parsing Rules
      
      1. **Strip signatures:** Remove everything after common signature delimiters (`--`, `Sent from my iPhone`, `Best regards,` followed by name/title block).
      2. **Strip disclaimers:** Remove legal/confidentiality notices at the bottom.
      3. **Strip forwarded headers:** If forwarded, extract the original sender info but note it was forwarded.
      4. **Preserve formatting intent:** Keep bullet points and numbered lists as structured data.
      5. **Handle HTML:** If only an HTML body is available, extract meaningful text content and ignore markup.
      
    • lead-extraction.md 3 KB
      # Lead Data Extraction
      
      For each email, extract the lead profile below using the body, subject, sender info, and contextual clues.
      
      ## Lead Profile Schema
      
      ```json
      {
        "contact": {
          "name": "string -- full name of the person reaching out",
          "email": "string -- sender email address",
          "phone": "string|null -- phone number if mentioned in email or signature",
          "role": "string|null -- job title or role if mentioned",
          "linkedin": "string|null -- LinkedIn URL if included in signature"
        },
        "company": {
          "name": "string|null -- company name from domain, signature, or email body",
          "domain": "string -- extracted from email domain",
          "size_estimate": "string|null -- startup/smb/midmarket/enterprise based on clues",
          "industry": "string|null -- industry if determinable from context"
        },
        "inquiry": {
          "type": "string -- one of: demo_request, partnership, rfp, referral, pricing_inquiry, general_inquiry, support_question",
          "summary": "string -- 1-2 sentence summary of what they need",
          "specific_services": ["string -- list of specific services or capabilities mentioned"],
          "pain_points": ["string -- specific problems or challenges mentioned"],
          "timeline": "string|null -- any timeline or deadline mentioned",
          "budget_signals": "string|null -- any budget or pricing context mentioned"
        },
        "metadata": {
          "source": "string -- gmail",
          "source_detail": "string -- which search query matched",
          "message_id": "string",
          "thread_id": "string",
          "received_date": "string -- ISO 8601",
          "forwarded_by": "string|null -- if this was a forwarded intro",
          "cc_stakeholders": ["string -- CC'd email addresses that may be stakeholders"]
        }
      }
      ```
      
      ## Extraction Guidelines
      
      - **Company name:** First check the email domain (ignore generic domains like gmail.com, yahoo.com, outlook.com, hotmail.com). Then the email signature. Then the body text.
      - **Role/Title:** Check the email signature block first. Then check if they mention their role in the body ("I'm the CTO at..." or "As head of marketing...").
      - **Company size:** Infer from signals -- domain recognition, language used ("our team of 5" vs "our enterprise"), email signature complexity, presence of standardized disclaimers.
      - **Industry:** Infer from company name, domain, services mentioned, or explicit industry references.
      - **Timeline:** Look for explicit dates, relative time references ("next quarter", "by end of month", "ASAP", "exploring for 2026"), or urgency language.
      - **Budget signals:** Look for references to budget, pricing expectations, "allocated budget", "looking to spend", or comparison to existing vendor costs.
      
      ## Handling Ambiguous or Incomplete Data
      
      1. Set the field to `null` rather than guessing.
      2. Add a note in the `extraction_notes` field explaining what is missing.
      3. Flag the lead for manual review if critical fields (name, company, what they need) are missing.
      4. For generic email domains (gmail, yahoo, etc.), flag that company identification requires manual lookup.
      
    • pipeline-report.md 3.7 KB
      # Daily Pipeline Report
      
      After processing all emails, generate a daily pipeline report and save it as a local Markdown file.
      
      **Report File:** Save to the current working directory as `lead-pipeline-report.md`.
      
      ## Report Structure
      
      ```markdown
      # Lead Pipeline Report
      **Generated:** [Current date and time]
      **Period:** [Start date] to [End date]
      **Processed by:** Gmail-to-CRM Pipeline Skill
      
      ---
      
      ## Executive Summary
      
      - **New leads today:** [count]
      - **Total pipeline value:** [count of active leads across all stages]
      - **Hot leads (P1):** [count] -- RESPOND IMMEDIATELY
      - **Warm leads (P2):** [count] -- respond today
      - **Cool leads (P3):** [count] -- respond within 48h
      - **Unqualified (P4):** [count]
      - **Average lead score:** [avg] / 100
      - **Drafts ready for review:** [count]
      
      ---
      
      ## Hot Leads -- Immediate Action Required
      
      ### 1. [Contact Name] -- [Company Name] (Score: [X]/100)
      - **What they need:** [1-sentence summary]
      - **Role:** [Title] | **Company size:** [size] | **Industry:** [industry]
      - **Urgency:** [timeline/urgency details]
      - **Key quote:** "[Most important sentence from their email]"
      - **Draft status:** Ready for review in Gmail Drafts
      - **Recommended action:** [specific next step]
      
      [Repeat for each hot lead]
      
      ---
      
      ## Warm Leads -- Same-Day Response
      
      ### 1. [Contact Name] -- [Company Name] (Score: [X]/100)
      - **What they need:** [summary]
      - **Key qualifying questions to ask:** [2-3 questions]
      - **Draft status:** Ready for review
      - **Recommended action:** [next step]
      
      [Repeat for each warm lead]
      
      ---
      
      ## Cool Leads -- Nurture Track
      
      | # | Contact | Company | Score | Type | Next Action |
      |---|---------|---------|-------|------|-------------|
      | 1 | [name]  | [co]    | [X]   | [type] | [action]  |
      
      ---
      
      ## Unqualified / Not Leads
      
      | # | Sender | Subject | Reason |
      |---|--------|---------|--------|
      | 1 | [name] | [subj]  | [why not qualified] |
      
      ---
      
      ## Pipeline Snapshot (All Active Leads)
      
      | Stage | Count | Avg Score | Oldest Lead |
      |-------|-------|-----------|-------------|
      | New | [n] | [avg] | [date] |
      | Contacted | [n] | [avg] | [date] |
      | Qualifying | [n] | [avg] | [date] |
      | Proposal | [n] | [avg] | [date] |
      | Negotiation | [n] | [avg] | [date] |
      
      **Leads at risk (no activity in 7+ days):**
      - [Lead name] -- [company] -- last activity [date] -- [stage]
      
      ---
      
      ## Score Distribution
      
      - 90-100: [count] leads (exceptional fit)
      - 75-89:  [count] leads (strong fit)
      - 50-74:  [count] leads (moderate fit)
      - 25-49:  [count] leads (low fit)
      - 0-24:   [count] leads (not qualified)
      
      ---
      
      ## Recommendations
      
      1. [Specific actionable recommendation based on today's leads]
      2. [Pattern observed -- e.g., "3 leads from fintech this week -- consider targeted content"]
      3. [Follow-up reminder -- e.g., "2 warm leads from Monday still unanswered"]
      ```
      
      ## Report Data Sources
      
      To populate the pipeline snapshot and historical data, query Supabase:
      
      ```sql
      -- Pipeline snapshot by stage
      SELECT stage, COUNT(*) as count, AVG(score_total) as avg_score,
             MIN(created_at) as oldest
      FROM leads
      WHERE stage NOT IN ('won', 'lost')
      GROUP BY stage;
      
      -- Leads at risk (no recent activity)
      SELECT l.contact_name, l.company_name, l.stage,
             MAX(a.created_at) as last_activity
      FROM leads l
      LEFT JOIN lead_activity_log a ON a.lead_id = l.id
      WHERE l.stage NOT IN ('won', 'lost', 'nurture')
      GROUP BY l.id, l.contact_name, l.company_name, l.stage
      HAVING MAX(a.created_at) < now() - interval '7 days'
         OR MAX(a.created_at) IS NULL;
      
      -- Score distribution
      SELECT
        CASE
          WHEN score_total >= 90 THEN '90-100'
          WHEN score_total >= 75 THEN '75-89'
          WHEN score_total >= 50 THEN '50-74'
          WHEN score_total >= 25 THEN '25-49'
          ELSE '0-24'
        END as range,
        COUNT(*) as count
      FROM leads
      WHERE created_at > now() - interval '30 days'
      GROUP BY range
      ORDER BY range DESC;
      ```
      
    • response-templates.md 4.2 KB
      # Response Drafting
      
      For each qualified lead (score >= 25), draft a personalized email response. Keep the tone warm, helpful, and consultative -- never salesy or pushy.
      
      ## HOT Lead Response Template (75-100 points)
      
      ```
      Objective: Get a call booked within 48 hours
      Tone: Enthusiastic but professional, specific and knowledgeable
      Length: 150-200 words
      Structure:
        1. Acknowledge their specific need (reference their exact words)
        2. Brief credibility statement (1 sentence, relevant to their ask)
        3. Confirm you can help with [specific thing they mentioned]
        4. Propose 2-3 specific meeting times this week
        5. Warm sign-off
      ```
      
      **Example HOT Response Pattern:**
      
      ```
      Subject: Re: [Original Subject]
      
      Hi [First Name],
      
      Thanks for reaching out about [specific need they mentioned]. This is exactly
      the kind of [project/challenge/initiative] we specialize in.
      
      [One sentence of relevant credibility -- e.g., "We recently helped a similar
      [industry] company [achieve specific result]."]
      
      I'd love to learn more about [specific detail from their email] and discuss
      how we might be able to help. Would any of these work for a quick intro call?
      
        - [Day], [Time] [Timezone]
        - [Day], [Time] [Timezone]
        - [Day], [Time] [Timezone]
      
      Or feel free to grab a time that works for you: [calendar link placeholder]
      
      Looking forward to connecting.
      
      Best,
      [User's name]
      ```
      
      ## WARM Lead Response Template (50-74 points)
      
      ```
      Objective: Qualify further with 2-3 discovery questions
      Tone: Curious, helpful, genuinely interested
      Length: 120-180 words
      Structure:
        1. Thank them for reaching out (reference what they mentioned)
        2. Show understanding of their situation
        3. Ask 2-3 specific qualifying questions
        4. Offer to set up a call once you understand more
        5. Warm sign-off
      ```
      
      **Qualifying Questions to Choose From (pick 2-3 most relevant):**
      
      - "What's driving the timeline for this?"
      - "How is your team currently handling [the problem they mentioned]?"
      - "Have you explored other solutions for this, or is this a new initiative?"
      - "Who else on your team would be involved in evaluating this?"
      - "What does success look like for this project?"
      - "What's the scope you're envisioning -- are we talking about [small scope] or [large scope]?"
      - "Is there a specific budget range you're working within?"
      
      ## COOL Lead Response Template (25-49 points)
      
      ```
      Objective: Provide value, stay top of mind, nurture
      Tone: Helpful, educational, no pressure
      Length: 100-150 words
      Structure:
        1. Thank them for their interest
        2. Provide a helpful insight related to their inquiry
        3. Share a relevant resource (case study, blog post, guide)
        4. Leave the door open for further conversation
        5. Warm sign-off
      ```
      
      ## Response Personalization Rules
      
      Every drafted response MUST:
      
      1. **Use their first name** -- never "Dear Sir/Madam" or "To Whom It May Concern".
      2. **Reference their specific ask** -- pull exact phrases or concepts from their email.
      3. **Match their energy** -- if they wrote casually, respond casually; if formal, be formal.
      4. **Acknowledge their company** -- mention their company by name if known.
      5. **No jargon dumping** -- do not list services; speak to their problem.
      6. **No attachments** -- keep it conversational, save collateral for follow-up.
      7. **Clear next step** -- every response must have ONE clear call to action.
      
      ## Response Anti-Patterns (NEVER Do These)
      
      - Do NOT start with "I hope this email finds you well".
      - Do NOT use "per my last email" or "as per your request".
      - Do NOT include a full company capabilities overview.
      - Do NOT mention pricing in the first response (unless they asked specifically).
      - Do NOT use buzzwords like "synergy," "leverage," "circle back," "touch base".
      - Do NOT write more than 200 words for any initial response.
      - Do NOT use exclamation marks more than once.
      - Do NOT be presumptuous about their budget or timeline.
      
      ## Creating the Draft in Gmail
      
      After composing, use `mcp__claude_ai_Gmail__gmail_create_draft` to save it as a draft. The draft should:
      
      - Be set as a reply to the original message (use the thread_id).
      - Include the original subject with "Re:" prefix.
      - NOT be sent automatically -- always save as draft for user review.
      
      **CRITICAL: Never auto-send emails. Always create drafts for the user to review and send manually.**
      
    • scoring-model.md 4.7 KB
      # Lead Scoring Model
      
      Apply a multi-dimensional scoring model to each lead. Total score (0-100) determines qualification status and priority.
      
      ## A. ICP Fit Score (0-40 points)
      
      Measures how well the lead matches the firm's target customer.
      
      ```
      Company Size Alignment:
        Enterprise (1000+ employees)      = 15 points
        Mid-market (100-999 employees)    = 12 points
        SMB (10-99 employees)             = 8 points
        Startup/Micro (1-9 employees)     = 4 points
        Unknown                           = 5 points (neutral)
      
      Industry Alignment (configure per firm):
        Primary target industries         = 15 points
        Secondary/adjacent industries     = 10 points
        Neutral industries                = 5 points
        Misaligned industries             = 2 points
        Unknown                           = 5 points (neutral)
      
      Role/Authority:
        C-suite, VP, Director (decision maker)        = 10 points
        Manager, Head of (influencer)                 = 7 points
        Individual contributor                        = 4 points
        Unknown role                                  = 3 points
      ```
      
      **Default Target Industries for Consulting Firm:**
      - Primary: Technology, SaaS, Financial Services, Healthcare Tech, Professional Services
      - Secondary: E-commerce, Manufacturing, Education, Real Estate Tech, Media
      
      Users can customize these by providing their ICP definition. Ask on first run if no ICP config exists.
      
      ## B. Intent Score (0-35 points)
      
      Measures the strength of buying intent based on language analysis.
      
      ```
      Inquiry Type:
        RFP / Formal proposal request     = 12 points
        Demo / Trial request               = 10 points
        Pricing inquiry                    = 9 points
        Referral / Introduction            = 8 points
        Partnership inquiry                = 6 points
        General inquiry                    = 4 points
        Support question (not a lead)      = 0 points
      
      Language Signals (cumulative, max 15 points):
        Mentions specific services by name          = +4
        Describes a concrete problem/pain point     = +4
        Asks about process, timeline, or next steps = +3
        References competitor or current vendor     = +3
        Mentions team/stakeholder involvement       = +2
        Uses vague/exploratory language only        = +1
      
      Engagement Depth:
        Long, detailed email (200+ words)    = 8 points
        Medium email (50-200 words)          = 5 points
        Short email (under 50 words)         = 2 points
      ```
      
      ## C. Urgency Score (0-25 points)
      
      Measures how time-sensitive the opportunity is.
      
      ```
      Explicit Timeline:
        Deadline within 2 weeks            = 12 points
        Deadline within 1 month            = 9 points
        Deadline within 1 quarter          = 6 points
        Vague future timeline              = 3 points
        No timeline mentioned              = 1 point
      
      Urgency Language (cumulative, max 8 points):
        "ASAP" / "urgent" / "immediately"          = +4
        "This week" / "this month"                 = +3
        "Soon" / "in the near future"              = +2
        "Exploring" / "researching"                = +1
      
      Contextual Urgency (max 5 points):
        Regulatory deadline mentioned       = +5
        Board/executive mandate             = +4
        Competitive pressure                = +3
        Budget expiring                     = +5
        Seasonal/event driven               = +3
      ```
      
      ## Score Interpretation and Qualification
      
      ```
      Total Score Range: 0-100 points
      
      HOT LEAD (75-100):
        - Qualification: Sales-Qualified Lead (SQL)
        - Action: Respond within 2 hours, book a call
        - Priority: P1 -- immediate attention
        - Draft: Eager, specific, offer calendar link
      
      WARM LEAD (50-74):
        - Qualification: Marketing-Qualified Lead (MQL)
        - Action: Respond within 24 hours, ask qualifying questions
        - Priority: P2 -- same-day response
        - Draft: Warm, curious, ask 2-3 discovery questions
      
      COOL LEAD (25-49):
        - Qualification: Information-Qualified Lead (IQL)
        - Action: Respond within 48 hours, nurture
        - Priority: P3 -- respond when time allows
        - Draft: Helpful, educational, offer resources
      
      COLD / NOT A LEAD (0-24):
        - Qualification: Unqualified
        - Action: Polite response or no action
        - Priority: P4 -- low priority
        - Draft: Brief acknowledgment, redirect if needed
      ```
      
      ## Score Adjustment Rules
      
      Apply these modifiers after initial scoring:
      
      1. **Referral Bonus:** Warm introduction from a known contact -- add +10 points.
      2. **Multi-stakeholder Bonus:** Multiple people CC'd from the same company -- add +5 points.
      3. **Repeat Inquiry Bonus:** This person/company has emailed before (check CRM) -- add +8 points.
      4. **Generic Domain Penalty:** Sender uses gmail/yahoo/outlook AND no company identified -- subtract -5 points.
      5. **Auto-generated Penalty:** Email appears auto-generated (newsletter, notification) -- subtract -15 points.
      6. **Spam Signals Penalty:** Email contains spam signals (ALL CAPS subject, excessive exclamation marks, too-good-to-be-true language) -- subtract -20 points.
      
  • SKILL.md 3.2 KB
    ---
    name: gmail-to-crm-pipeline
    description: Uses MCP Connectors to read Gmail inbound leads, score them by ICP fit, draft personalized responses, and log qualified leads to your CRM. Turns your inbox into an automated pipeline.
    tools: Read, Write, Bash, Grep, WebSearch
    model: inherit
    ---
    
    # Gmail-to-CRM Pipeline
    
    Turn a Gmail inbox into a structured sales pipeline using Claude's MCP Connectors -- the Gmail connector reads and drafts email, and the Supabase connector persists CRM data. No external scripts or API keys required.
    
    ## Workflow
    
    1. **Connect.** Verify the Gmail and Supabase MCP Connectors are available. On first run, create the CRM tables and seed config. Load ICP config from the `pipeline_config` table. See `references/configuration.md` (first run, error handling) and `references/crm-schema.md`.
    2. **Search.** Run the targeted Gmail search queries to find unread lead emails over the time window (default: last 24 hours). Collect unique message IDs and deduplicate. See `references/gmail-retrieval.md`.
    3. **Parse.** Read each unique message, strip signatures and disclaimers, and extract the structured field set. See `references/gmail-retrieval.md`.
    4. **Extract.** Build the lead profile (contact, company, inquiry, metadata) for each email. Set missing fields to `null` rather than guessing. See `references/lead-extraction.md`.
    5. **Score.** Score each lead on ICP fit (0-40), intent (0-35), and urgency (0-25), then apply adjustment modifiers. Map the total to a qualification tier and priority. See `references/scoring-model.md`.
    6. **Draft.** For each qualified lead (score >= 25), draft a personalized, tier-appropriate response and save it as a Gmail draft. Never auto-send. See `references/response-templates.md`.
    7. **Log.** Check for duplicates, then insert or update the lead in Supabase, log activity, and set the next action by priority. See `references/crm-schema.md`.
    8. **Report.** Query the pipeline snapshot and generate `lead-pipeline-report.md` in the working directory, then display the executive summary. See `references/pipeline-report.md`.
    
    Between runs, handle manual lead commands (mark contacted, move stage, disqualify, add note, schedule follow-up, query leads) and ICP/search customization. See `references/configuration.md`.
    
    ## Hard Rules
    
    - Never auto-send email -- always create drafts for the user to review and send.
    - Never store raw email bodies or credentials in Supabase or any report; store structured data and key quotes only.
    - Treat all lead and email content as confidential.
    
    ## Contents
    
    - `references/gmail-retrieval.md` -- Gmail MCP tools, search queries, parsing rules, extracted field set.
    - `references/lead-extraction.md` -- Lead profile JSON schema and extraction guidelines.
    - `references/scoring-model.md` -- ICP, intent, urgency scoring tables; tier mapping; adjustment rules.
    - `references/response-templates.md` -- Per-tier response templates, personalization rules, anti-patterns, draft creation.
    - `references/crm-schema.md` -- Supabase MCP tools, table DDL, logging procedure and SQL.
    - `references/pipeline-report.md` -- Report Markdown structure and reporting SQL queries.
    - `references/configuration.md` -- First-run setup, customization, manual commands, error handling, privacy, invocation triggers.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related