nfe

Implements Brazilian NF-e model 55 generation, signing, SEFAZ transmission, and recovery workflows.

Updated May 13, 2026
One-click install
npx skills add https://github.com/Hinten/next_erp --skill nfe-hinten
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nfe
Source: https://github.com/Hinten/next_erp/tree/main/.claude/skills/nfe
Command: npx skills add https://github.com/Hinten/next_erp --skill nfe-hinten

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Brazilian electronic invoicing (NF-e) requires exact compliance with SEFAZ's MOC 7.0 specification and its amending Notas Técnicas — thousands of PDF pages covering XML layout, XMLDSig signing, SOAP transmission, sync/async response handling, contingency modes, and hundreds of rejection codes. This Skill distills that specification into actionable references so NF-e code can be implemented, debugged, and reviewed without re-reading the source documents. ## Core Features & Use Cases - End-to-end lifecycle guidance: Covers the full NF-e flow — building infNFe XML via the XSD-codegen serializer, computing the 44-digit chave de acesso, enveloped XMLDSig signing with A1 certificates, SOAP transmission, and protocol processing. - Current regulatory coverage: Tracks NT 2025.001 (mandatory sync mode for lote=1, 7-day emission window), NT 2025.002 (Reforma Tributária — IBS/CBS/IS groups, 4-digit cStat), and NT 2026.007 (LCC-RFB cadastral validation, cStat 178–186). - Production failure recovery: Documents duplicidade handling (cStat 204/539/218/205/635), consumo indevido (656) avoidance, contingency modes (EPEC, SVC-AN/RS), and the pendente-de-retorno recovery loop. - Use Case: When a homologação test suddenly fails with cStat=181, consult the Skill to learn that NT 2026.007 now requires every CNPJ in the document to exist in the LCC-RFB, and that a CPF recipient bypasses the rule. ## Quick Start Ask the agent to implement or debug an NF-e feature — for example, 'implement the cancelamento event for an authorized NF-e' — and it will load the relevant reference files automatically.

Frequently Asked Questions about nfe

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement NF-e emission with SEFAZ in Brazil?

Build the infNFe XML from order data using an XSD-derived serializer, compute the 44-digit chave de acesso, sign infNFe with enveloped XMLDSig using an A1 certificate, then POST via SOAP to NfeAutorizacao. Persist the chave before sending so lost responses are recoverable via consSitNFe.

Why does SEFAZ return cStat 452 for my NF-e lote?

Since NT 2025.001 (production 03/11/2025), a lote containing exactly one NF-e must use indSinc=1 (synchronous mode). Sending indSinc=0 with a single NF-e is rejected with cStat 452. Infer indSinc from the lote size and parse both response envelope shapes.

What is the difference between NF-e sync and async transmission?

Sync mode (indSinc=1, mandatory for lote=1) returns protNFe inline in the response. Async mode (lote of 2-50) returns an nRec receipt that must be polled via consReciNFe until cStat=104, then the protNFe array is read.

How do I handle NF-e duplicidade rejections like cStat 204 or 539?

Duplicidade codes (204, 205, 218, 539, 635) mean an NF-e with the same natural key already reached SEFAZ — they are recoverable, not fatal. Do not resend; call consSitNFe with the chave to retrieve the actual authorization status and protocol.

When do the IBS/CBS Reforma Tributária fields become mandatory in NF-e?

Per NT 2025.002, the Grupo UB (item) and Grupo W03 (totals) for IBS/CBS/IS are mandatory in homologação from 01/07/2026 and in production from 03/08/2026 for CRT=3 issuers. Missing groups trigger cStat 1115. Simples Nacional follows on 04/01/2027.

Why is my homologação NF-e rejected with cStat 181?

NT 2026.007 requires every CNPJ in the document to exist in the LCC-RFB (Receita Federal registry replica) with status 02-Ativa. The traditional test CNPJ 99999999000191 is not registered, so use a CPF recipient (tag E03) instead, which is outside the rule's scope.