crm-lead-pipeline-patterns

crm-lead-pipeline-patterns is a skill for Claude Code, Codex from luanpdd/kit-mcp. It costs 46 tokens per session (2,965 once invoked), scanned A, original, MIT.

Implementation patterns for a multi-tenant CRM lead pipeline in Supabase, including stages, ownership changes, audit records, and duplicate prevention.

In plain words
What is it for?
Use it to build validated lead stages, transfer ownership with an audit log, notify new owners, and prevent duplicate phone numbers or email addresses.
Why use it?
It helps keep lead movement, ownership, history, and contact data consistent across organizations.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is A trigger `validate_lead_stage_transition` deve usar `SELECT ... FOR UPDATE` em rows lidas para prevenir lost update quando 2 reps tentam mover o mesmo lead sim.

Good fit Use it to build validated lead stages, transfer ownership with an audit log, notify new owners, and prevent duplicate phone numbers or email addresses.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/luanpdd/kit-mcp
agentmods
npx agentmods add skills/luanpdd/kit-mcp/crm-lead-pipeline-patterns

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for crm-lead-pipeline-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/luanpdd/kit-mcp/crm-lead-pipeline-patterns/github.svg)](https://agentmods.dev/skills/luanpdd/kit-mcp/crm-lead-pipeline-patterns)
Your own site
<a href="https://agentmods.dev/skills/luanpdd/kit-mcp/crm-lead-pipeline-patterns"><img src="https://agentmods.dev/badge/skills/luanpdd/kit-mcp/crm-lead-pipeline-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for crm-lead-pipeline-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/luanpdd/kit-mcp/crm-lead-pipeline-patterns"><img src="https://agentmods.dev/badge/skills/luanpdd/kit-mcp/crm-lead-pipeline-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,965 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.02965
Opus 5 $0.00023 $0.01483
Sonnet 5 $0.00009 $0.00593
Haiku 4.5 $0.00005 $0.00297

Measured 7d ago against content hash 32dcd8d787d2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

crm-lead-pipeline-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

kit/skills/crm-lead-pipeline-patterns/SKILL.md · 345 lines

How it starts

The opening of the file, as written. The whole thing — 345 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CRM Lead Pipeline — Patterns Canônicos

Quando usar

LLM carrega esta skill ao implementar CRM lead pipeline em B2B multi-tenant. Trigger phrases:

  • "CRM lead pipeline", "sales pipeline stages"
  • "lead state machine Postgres", "transition validation"
  • "ownership transfer lead", "lead assignment"
  • "lead dedup phone email"
  • "integração WhatsApp CRM lead"

Regras absolutas

REGRA #1 (6 stages canônicos): Pipeline tem 6 stages: lead → qualified → proposal → negotiation → won | lost. Custom stages permitidos via prefix custom_* mas estes 6 são obrigatórios.

REGRA #2 (trigger PG > CHECK constraint): Validar transições via trigger BEFORE UPDATE com RAISE EXCEPTION, não apenas CHECK constraint. CHECK valida valor, mas não valida transição (lead → won direto = bug, deve passar por qualified+proposal+negotiation).

REGRA #3 (ownership transfer com audit): Mudança em leads.owner_id SEMPRE dispara: (a) notificação ao novo owner, (b) entry em audit_logs com previous_owner_id, new_owner_id, reason. Trigger AFTER UPDATE.

REGRA #4 (dedup unique constraints): unique(org_id, contact_phone) + unique(org_id, contact_email) em leads. Insert duplicado falha — app code precisa fazer lookup ANTES.

REGRA #5 (lookup ANTES de criar via WhatsApp): Webhook handler WhatsApp inbound: SELECT id FROM leads WHERE org_id=$1 AND contact_phone=$2. Se existe, append message à conversa do lead. Se não existe, criar lead novo com source='whatsapp_inbound'.

Patterns canônicos

Tabela leads

create table public.leads (
  id uuid primary key default gen_random_uuid(),
  org_id uuid not null references public.organizations(id) on delete cascade,
  dept_id uuid references public.departments(id) on delete set null,

  -- Contato
  contact_name text not null,
  contact_email text,
  contact_phone text,
  contact_company text,

  -- Pipeline
  stage text not null default 'lead'
    check (stage in ('lead', 'qualified', 'proposal', 'negotiation', 'won', 'lost')
           or stage like 'custom\_%'),
  source text,  -- 'whatsapp_inbound', 'website_form', 'manual', etc.

  -- Ownership
  owner_id uuid references auth.users(id) on delete set null,

  -- Dados financeiros
  expected_value numeric(12, 2),
  expected_close_date date,
  closed_at timestamptz,
  closed_reason text,

  -- Metadata
  metadata jsonb not null default '{}'::jsonb,
  created_at timestamptz not null default now(),
  updated_at timestamptz not null default now(),

  -- REGRA #4: dedup
  unique (org_id, contact_phone),
  unique (org_id, contact_email)
);

create index leads_org_stage_idx on public.leads (org_id, stage);
create index leads_org_owner_idx on public.leads (org_id, owner_id) where owner_id is not null;
create index leads_org_dept_idx on public.leads (org_id, dept_id) where dept_id is not null;

-- RLS: aplicar pattern multi-tenant-rls-hierarchy
alter table public.leads enable row level security;

create policy "leads_select_member" on public.leads
  for select to authenticated
  using (private.is_member_of(org_id));

create policy "leads_insert_with_permission" on public.leads
  for insert to authenticated
  with check (private.has_permission('create', 'leads', org_id));

create policy "leads_update_with_permission_or_owner" on public.leads
  for update to authenticated
  using (
    private.has_permission('update', 'leads', org_id)
    or owner_id = (select auth.uid())
  )
  with check (
    private.has_permission('update', 'leads', org_id)
    or owner_id = (select auth.uid())
  );

create policy "leads_delete_admin" on public.leads
  for delete to authenticated
  using (private.has_role(org_id, 'admin') or private.has_role(org_id, 'owner'));

create policy "leads_super_admin_bypass" on public.leads
  as permissive for all to authenticated
  using (private.is_super_admin())
  with check (private.is_super_admin());

Read the full file on GitHub · 345 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 345 lines · 46 tokens per session scan A 32dcd8d787d2

Subscribe to this mod's changes

crm-lead-pipeline-patterns is a skill published in the GitHub repository luanpdd/kit-mcp (1 stars, last pushed 3d ago), licensed MIT. It adds 46 tokens to every session and 2,965 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

stale-sweep

Sweep the googleapis/mcp-toolbox repo for issues and PRs with no real activity in N days (default 60), sort each by whose silence it is (the author's, ours, or nobody's), and draft the nudge or close comment. Use whenever a maintainer asks for a stale sweep, backlog cleanup, or an SLO check, e.g. "stale sweep", "find…

googleapis/mcp-toolbox · 159 tokens

record-gotchas

Capture surprises, workarounds, and rough edges hit while consuming the public surface of Prisma Next, Prisma Compute, or Prisma Postgres — anything a real user of these products would experience. Fires whenever an operator (or agent) writes a workaround, hits a surprising failure mode, or finds undocumented behaviour…

prisma/orm · 219 tokens

gh-issue

Size-audit, write, and split BanyanDB issues that somebody else or an automated TDD workflow can implement. Use whenever the user asks to file or revise an issue, decide whether an issue is too large, make an issue TDD-ready, turn a design into tickets, or split an umbrella into executable leaves. Do not draft or file…

apache/skywalking-banyandb · 91 tokens

dingtalk-ai-table

Read and manage DingTalk AI table records through the DingTalk AI Table MCP. Use this skill when the user explicitly refers to a DingTalk AI table, fields, or records.

wecode-ai/Wegent · 36 tokens

product-feature-tech-implement

A skill for delivering a product feature from a design document and existing source code through development, code review, and testing. It also creates a user guide and implementation summary.

digoal/blog · 471 tokens

write-prd

A product requirements document (PRD) writing skill that turns a product idea into a structured Markdown document with diagrams. A PRD describes what a product should do and the requirements needed to build it.

digoal/blog · 237 tokens