Add afip-constancia skill#113
Conversation
Fetch the official ARCA (ex-AFIP) Constancia de Inscripción for an Argentine CUIT from the public web form (no Clave Fiscal). Returns the parsed fiscal situation plus the official PDF artifact as a single JSON envelope. Includes a zero-dependency helper that enforces a strict output contract shared with the typed companion npm package @ar-agents/constancia. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 46859a3. Configure here.
| raw.tipoPersona === "juridica" || | ||
| /sociedad|s\.?a\.?|s\.?r\.?l\.?|asociaci/i.test(den) | ||
| ? "juridica" | ||
| : "fisica"; |
There was a problem hiding this comment.
Regex falsely classifies many physical persons as juridica
High Severity
The s\.?a\.? alternation in the tipoPersona regex matches the bare substring "sa" anywhere in the denomination, with no word boundaries or anchors. Extremely common Argentine names like "ROSA", "CASAS", "SAAVEDRA", "SALVADOR", "CASADO" all contain "sa" and would be incorrectly classified as "juridica". Additionally, even when raw.tipoPersona is explicitly "fisica" (correctly scraped), the regex override still fires, discarding the accurate value.
Reviewed by Cursor Bugbot for commit 46859a3. Configure here.


What
Adds the
afip-constanciaskill: fetch the official ARCA (ex-AFIP) Constancia de Inscripción for an Argentine CUIT from the public web form (afip.gob.ar/genericos/constanciainscripcion/) — no Clave Fiscal, no login.Returns one JSON envelope: the parsed fiscal situation (régimen / monotributo categoría / responsable inscripto, domicilio fiscal, actividades CLAE, impuestos, fecha de inscripción) plus the official PDF document with its código verificador.
Why it's a good fit
This is a high-demand Argentine surface (every alta-de-proveedor, KYC, expediente, and licitación needs the constancia) with no public API for the PDF — browser automation is the only path, exactly browse's strength. Same pattern/structure as the existing
company-researchskill (frontmatter, procedural runbook, ascripts/helper instead of fragile inline pipelines).Notes for review
scripts/emit_constancia.mjsis zero-dependency (Node builtins only) and normalizes scraped fields into a fixed JSON shape; a "not registered" CUIT and any failure map to explicit{found:false}/{error}rather than fabricated data.@ar-agents/constancia, part of the open-source Arg toolkit) sharing this exact output contract — one artifact, two surfaces. The skill is fully standalone; the package is not required to run it.Note
Low Risk
Low risk because this PR only adds a new standalone skill and a small zero-dependency Node helper, without modifying existing runtime logic. Primary risk is contract/edge-case correctness when normalizing scraped fields into the strict JSON output.
Overview
Introduces the new
afip-constanciaskill, documenting a browser-driven flow to query ARCA’s public Constancia de Inscripción form for a CUIT, detect the not registered case, extract key fiscal fields, and capture the official PDF.Adds
scripts/emit_constancia.mjs, a zero-dependency normalizer that converts loosely-scraped input into the strict, single-line JSON output contract, including explicit{found:false}and{error:...}outcomes and optionalpdf(base64/url/codigoVerificador) handling.Reviewed by Cursor Bugbot for commit 46859a3. Bugbot is set up for automated code reviews on this repo. Configure here.