Rfc Validacion logo

Rfc Validacion

Community
elimorals
rfc-validacion

Valida estructuralmente Registro Federal de Contribuyentes (RFC) mexicano para personas físicas (13 caracteres) y personas morales (12 caracteres). Verifica formato regex, homoclave, fechas válidas, palabras inconvenientes prohibidas por SAT, y RFCs genéricos (XAXX010101000 nacional, XEXX010101000 extranjero). Útil antes de timbrar CFDI para detectar capturas erróneas, contrastar contra lista negra del SAT (69-B EFOS), y normalizar formato. Usar siempre que el usuario pegue un RFC para validar, capture datos de cliente, importe lista de contactos con RFCs, valide CFDI, validate RFC, check taxpayer ID Mexico. NO usar para CURP (es otra cosa, 18 caracteres distintos) ni para identificaciones de otros países.

Overview

Publisherelimorals
RepositorySkills_MX
Skill namerfc-validacion
Stars
29
Forks
5
Bundled files
2
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by elimorals on GitHub. Read the source before you install it.

Installation

Install the Rfc Validacion AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/elimorals/Skills_MX/tree/main/_shared/rfc-validacion
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/elimorals/Skills_MX.git /tmp/Skills_MX
mkdir -p .claude/skills
cp -r /tmp/Skills_MX/_shared/rfc-validacion .claude/skills/rfc-validacion
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Rfc Validacion in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Rfc Validacion on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Rfc Validacion is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Validación de RFC

Validador estructural de RFC mexicano. Esta primera línea de defensa atrapa el 95% de errores de captura antes de mandar al PAC.

Reglas de estructura

Persona Moral (PM) — 12 caracteres

  • 3 letras derivadas del nombre/razón social: ABC (puede contener & o Ñ)
  • 6 dígitos de fecha de constitución AAMMDD
  • 3 caracteres homoclave: 2 alfanuméricos derivados del nombre + dígito verificador (0-9 o A)

Ejemplo: SAT970701NN3 (Servicio de Administración Tributaria, 1 jul 1997, homoclave NN3).

Persona Física (PF) — 13 caracteres

  • 4 letras derivadas del nombre completo (apellido paterno + materno + nombre)
  • 6 dígitos fecha de nacimiento AAMMDD
  • 3 caracteres homoclave alfanumérica

Ejemplo: GODE561231GR8 (ejemplo de la documentación SAT: Emma Gómez Díaz, nacida 31 dic 1956).

Regex de validación

PM:  ^[A-ZÑ&]{3}\d{6}[A-Z0-9]{3}$
PF:  ^[A-ZÑ&]{4}\d{6}[A-Z0-9]{3}$

Validaciones que aplica este skill

  1. Formato: regex anterior. Si no matchea, RFC inválido por estructura.

  2. Fecha embebida válida: los 6 dígitos centrales deben ser fecha real. 970230 no es válido (febrero no tiene 30). 001301 no es válido (mes 13).

  3. Año razonable:

    • PF: fecha de nacimiento entre 1900-01-01 y hoy. RFC con fecha futura es inválido.
    • PM: fecha de constitución entre 1900-01-01 y hoy.
  4. Palabras inconvenientes prohibidas por SAT: las primeras 3-4 letras no pueden formar palabras consideradas obscenas, ofensivas o malsonantes. El SAT publica un listado. Las más conocidas:

    BUEI, BUEY, CACA, CACO, CAGA, CAGO, CAKA, CAKO, COGE, COJA, COJE, COJI,
    COJO, CULO, FETO, GUEY, JOTO, KACA, KACO, KAGA, KAGO, KOGE, KOJO, KAKA,
    KULO, MAME, MAMO, MEAR, MEAS, MEON, MIAR, MION, MOCO, MULA, PEDA, PEDO,
    PENE, PUTA, PUTO, QULO, RATA, RUIN

    Si las 4 primeras letras forman una de estas, el SAT habría sustituido por una variante (típicamente cambia una letra por X). El RFC original NO existe y debe corregirse.

  5. Caracter & y Ñ: válidos en PM (representan personas morales con esos caracteres en razón social). Algunos sistemas los rechazan por error; SAT sí los acepta.

  6. RFCs genéricos (válidos pero con uso restringido):

    • XAXX010101000 — público en general nacional. Solo válido con UsoCFDI S01 y como receptor.
    • XEXX010101000 — público en general extranjero. Solo válido como receptor con ResidenciaFiscal y NumRegIdTrib.
  7. Dígito verificador (último carácter): se calcula con módulo 11 sobre los 12 primeros caracteres (PM se rellena con un espacio a la izquierda), con el diccionario 0-9 → 0-9, A-N → 10-23, & → 24, O-Z → 25-36, espacio → 37, Ñ → 38 y pesos 13…2. Residuo 0 → 0; 11 − residuo = 10 → A. Si no coincide es casi seguro un error de captura (alerta, no error: el padrón SAT es la fuente definitiva). Los RFC genéricos no lo cumplen y se exentan. Los 2 primeros caracteres de la homoclave dependen del nombre completo y no se pueden verificar sin el padrón. Implementado en scripts/validar_rfc.py (digito_verificador_ok).

Verificación contra SAT (opcional)

El SAT expone un endpoint de validación masiva de RFC: https://siat.sat.gob.mx/app/qr/faces/pages/mobile/validadorqr.jsf (consulta individual por web) y la API de validación masiva mediante el aplicativo "Validador de RFC" (descarga lote, requiere FIEL).

Si está disponible la integración, este skill puede:

  • Confirmar que el RFC existe en el padrón
  • Verificar que está activo (no cancelado)
  • Detectar si está en el listado 69-B del SAT (Empresas que Facturan Operaciones Simuladas — EFOS). Crítico: si un cliente o proveedor está en 69-B, las facturas con él pueden ser desconocidas por el SAT.

En modo mock (sin integración), este skill solo aplica las validaciones estructurales 1-7.

Salida esperada

json
{
  "rfc_input": "gode561231gr8",
  "rfc_normalizado": "GODE561231GR8",
  "tipo": "PF",
  "valido_estructura": true,
  "fecha_embebida": "1956-12-31",
  "es_generico": false,
  "digito_verificador_ok": true,
  "alertas": [],
  "verificacion_sat": {
    "consultada": false,
    "razon": "Integración SAT no configurada — solo validación estructural"
  }
}

Si inválido:

json
{
  "rfc_input": "MAJG891332ABC",
  "valido_estructura": false,
  "errores": [
    "Fecha embebida inválida: Mes inválido: 13"
  ]
}

Casos edge

  • RFCs con prefijo XX que parezcan genéricos pero no lo son: solo los dos publicados arriba son genéricos válidos.
  • Sistemas legacy que separan PM en 3+6+3 con guiones (SAT-970701-NN3): normalizar quitando separadores antes de validar.
  • Personas físicas que cambiaron de nombre legalmente: el RFC NO cambia (las letras derivan del nombre al momento del registro).

Integración con otros skills

  • Antes de invocar cfdi-emision, este skill debe correr sobre RFC del emisor y receptor.
  • Útil en compliance-lfpdppp para validar registros de clientes en avisos de privacidad.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Rfc Validacion AI skill do?

Valida estructuralmente Registro Federal de Contribuyentes (RFC) mexicano para personas físicas (13 caracteres) y personas morales (12 caracteres). Verifica formato regex, homoclave, fechas válidas, palabras inconvenientes prohibidas por SAT, y RFCs genéricos (XAXX010101000 nacional, XEXX010101000 extranjero). Útil antes de timbrar CFDI para detectar capturas erróneas, contrastar contra lista negra del SAT (69-B EFOS), y normalizar formato. Usar siempre que el usuario pegue un RFC para validar, capture datos de cliente, importe lista de contactos con RFCs, valide CFDI, validate RFC, check t...

Why use Rfc Validacion on TypingMind?

Because you install it once and use it with any model. Rfc Validacion is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Rfc Validacion in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/elimorals/Skills_MX/tree/main/_shared/rfc-validacion. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Rfc Validacion?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Rfc Validacion?

As many as you like. As long as a model supports skills, you can use Rfc Validacion with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Rfc Validacion AI skill free?

Yes. It is published on GitHub by elimorals under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇