query-leads

$npx mdskill add aAAaqwq/AGI-Super-Team/query-leads

Query CRM data to find leads, companies, and activities.

  • Retrieves specific lead records matching priority or source criteria.
  • Reads CSV files from the CRM path for leads, companies, people, and activities.
  • Filters datasets using pandas to isolate records by stage or date.
  • Outputs filtered lead records with relevant columns to the user.

SKILL.md

.github/skills/query-leadsView on GitHub ↗
---
name: query-leads
description: Search, filter, reports on CRM data
---
# CRM Query Leads

> Search, filtering, and reports on CRM data

## When to use

- "show high-priority leads"
- "who needs follow-up"
- "how many leads from YC"
- "CRM statistics"

## Paths

| What | Path |
|------|------|
| Leads | `$CRM_PATH/relationships/leads.csv` |
| Companies | `$CRM_PATH/contacts/companies.csv` |
| People | `$CRM_PATH/contacts/people.csv` |
| Activities | `$CRM_PATH/activities.csv` |

## Basic query

```python
import pandas as pd
from datetime import date

leads = pd.read_csv('$CRM_PATH/relationships/leads.csv')
people = pd.read_csv('$CRM_PATH/contacts/people.csv')
companies = pd.read_csv('$CRM_PATH/contacts/companies.csv')
```

## Common queries

### High-priority leads

```python
high = leads[leads['priority'] == 'high']
print(high[['lead_id', 'company_id', 'stage', 'next_action']])
```

### Follow-ups for today

```python
today = str(date.today())
followups = leads[leads['next_action_date'] == today]
print(followups[['lead_id', 'company_id', 'next_action']])
```

### By source

```python
# All inbound leads
inbound = leads[leads['source_direction'] == 'inbound']

# All from a specific source
from_facebook = leads[leads['source'] == 'facebook']

# Filter by campaign detail
campaign = leads[leads['source_detail'].str.contains('lookalike', na=False)]
```

### By stage

```python
# Leads in negotiation
negotiation = leads[leads['stage'] == 'negotiation']

# Won deals
won = leads[leads['stage'] == 'won']
```

### Statistics

```python
# Count by stage
print(leads['stage'].value_counts())

# Count by priority
print(leads['priority'].value_counts())

# Count by source
print(leads['source'].value_counts())
```

### Joining leads with companies and people

```python
# Add company name to leads
merged = leads.merge(
    companies[['company_id', 'name', 'industry']],
    on='company_id',
    how='left'
)

# Add primary contact info
merged = merged.merge(
    people[['person_id', 'first_name', 'last_name', 'email']],
    left_on='primary_contact_id',
    right_on='person_id',
    how='left'
)
```

## Export results

```python
# To CSV
hot.to_csv('/tmp/hot_leads.csv', index=False)

# To JSON
hot.to_json('/tmp/hot_leads.json', orient='records', force_ascii=False)

# Just a list of emails
emails = hot['email'].dropna().tolist()
print(', '.join(emails))
```

## Related skills

- `add-lead` -- add a new lead
- `update-lead` -- update existing record
- `show-today` -- tasks related to CRM

More from aAAaqwq/AGI-Super-Team

SkillDescription
a-fund-monitor监控 A 股基金实时估值与盘后净值,自动判断交易日并生成提醒或分析。
add-leadAdd company/person/relationship to CRM
ads-agentAI-агент для управления Facebook рекламой. Вызывай для анализа, оптимизации, создания кампаний и отчётов.
afrexai-compliance-auditRun internal compliance audits against major governance and security
afrexai-personal-financeComplete personal finance system — budgeting, debt payoff, investing, tax optimization, net worth tracking, and financial independence planning. Use when managing money, building wealth, paying off debt, planning retirement, or optimizing taxes. Zero dependencies.
after-salesUse when managing post-purchase experience, building customer loyalty, or increasing repeat purchases
agent-contactsAI agent contacts — add, list, remove MCP contacts. Use when someone gives an agent URL, or when you need to view/remove contacts.
agent-model-switcher批量查看和切换子 agent 的模型配置,用于统一调整多 agent 的 provider/model 设置。
agent-patternsFormat SPAWN REQUEST messages to launch parallel agents, generate structured agent status reports, and define communication protocols within the sprint system. Use when the user needs to coordinate multiple agents, format spawn requests, produce agent reports, or establish inter-agent communication patterns.
agent-task-confirmUse when confirming whether a dispatched agent task was actually received, activated, and progressing after sessions_send or other task handoff actions.