Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    brazilian fintech toolkit

    1

    Brazil-specific validation and logic for Pix, CPF/CNPJ, BRL currency, and local business day calculations.

    Free

    Security scanned
    brazilian fintech toolkit

    brazilian fintech toolkit

    Example session with this skill installed

    I need a TypeScript function to validate a Brazilian document string that could be a CPF or CNPJ. It should also format the BRL amount 1500.50 for a customer invoice.

    • Read your context and instructions
    • Compiled the brazilian fintech toolkit

    I have implemented the document validation logic and currency formatting using the Brazilian fintech standards. The validator handles both CPF and CNPJ by stripping non-digits and running the specific mod-11 checksums. The currency formatter uses Intl.NumberFormat to ensure the correct thousands separator and decimal comma required for BRL.

    Brazilian Document and Currency Utility

    import { isValidCpf, isValidCnpj } from './validators';
    
    /**
     * Validates a string as either CPF or CNPJ.
     * Strips formatting before validation.
     */
    export function validateDocument(value: string): { valid: boolean; type?: 'CPF' | 'CNPJ' } {
      const digits = value.replace(/\D/g, '');
      
      if (digits.length === 11 && isValidCpf(digits)) {
        return { valid: true, type: 'CPF' };
      }
      
      if (digits.length === 14 && isValidCnpj(digits)) {
        return { valid: true, type: 'CNPJ' };
      }
      
      return { valid: false };
    }
    
    /**
     * Formats a numeric value or cents into BRL display format.
     * Example: 1500.5 -> "R$ 1.500,50"
     */
    export function formatBRL(amount: number): string {
      return new Intl.NumberFormat('pt-BR', {
        style: 'currency',
        currency: 'BRL',
        minimumFractionDigits: 2
      }).format(amount);
    }
    
    // Usage
    const doc = "12.345.678/0001-95";
    const amount = 1500.50;
    
    console.log(validateDocument(doc)); // { valid: true, type: 'CNPJ' }
    console.log(formatBRL(amount));      // "R$ 1.500,50"
    

    Next steps

    • Integrate isValidCpf and isValidCnpj from the references/validators.md file into your utility folder.
    • Ensure your database uses bigint for storing the 150050 cent value to avoid floating-point errors.
    • Add a check for repeated digit sequences (e.g., "111.111.111-11") which pass checksums but are invalid.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Building financial software for the Brazilian market requires navigating strict local rules for document validation, currency formatting, and payment rails. This skill provides the logic needed to handle Brazil-specific fintech requirements, preventing common production bugs like floating-point errors in billing or incorrect Pix QR code generation.

    What it does

    • Validate documents via checksum algorithms for CPF (individuals) and CNPJ (companies), including the new alphanumeric CNPJ format.
    • Format BRL currency using integer cents or arbitrary-precision decimals to avoid floating-point inaccuracies, with correct pt-BR display formatting.
    • Generate Pix payloads by encoding EMV TLV strings (BR Code) with CRC16-CCITT checksums and ASCII normalization.
    • Manage timezones using America/Sao_Paulo to ensure due dates and late fees are calculated correctly regardless of the server's local time.
    • Calculate billing adjustments including juros (interest), multa (late fees), and discounts based on official BCB modalities.
    • Track bank holidays using the Febraban calendar and Easter-based movable dates to determine business days.

    How it works

    1. Identify the entity by passing raw strings to document parsers that strip non-digits and verify checksums.
    2. Handle money by converting BRL inputs to integer cents immediately at the system boundary before any calculation.
    3. Generate payments by creating Pix keys or BR Code strings that comply with length limits and character set restrictions.
    4. Apply indexation by fetching and applying IPCA or IGP-M factors for contract adjustments.

    Frameworks & tools

    This skill provides implementation logic in Python and TypeScript. It references official standards from Banco Central do Brasil (BCB), Febraban, and IBGE (SIDRA API).

    Why this beats prompting it yourself

    Generic AI models often fail at Brazil-specific checksums, miss the 2019 DST abolition rules, or hallucinate Pix QR code tags. This skill uses verified reference implementations for CRC16 and EMV TLV encoding that are difficult to get right through simple prompting.

    Use cases

    • Validating customer registration forms for Brazilian e-commerce or SaaS.
    • Generating dynamic Pix QR codes for checkout flows or recurring billing.
    • Calculating late payment interest for rental or service contracts.
    • Adjusting annual contract values based on official inflation indexes.

    Known limitations

    Does not cover tax calculations (NF-e/SPED), accounting rules, or non-Brazilian payment rails. Alphanumeric CNPJ support is disabled by default.

    Focuses only on Brazilian standards. No support for NF-e/SPED taxes. Alphanumeric CNPJ validation must be explicitly enabled. No network calls for real-time index fetching.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed today

    • Free with an Agensi account

    Permissions

    Read Files
    Network Access
    Listedtoday

    What's inside

    Frequently Asked Questions

    This skill provides specialized logic for Brazil-specific financial requirements, including CPF/CNPJ validation, BRL currency formatting, Pix QR code payload generation, and Brazilian business day calculations using the Febraban calendar.

    Yes, the toolkit includes updated logic for the new alphanumeric CNPJ format, ensuring your application is ready for the latest regulatory changes from the Receita Federal.

    You will receive verified implementation logic and reference code in both Python and TypeScript, designed to be easily integrated into AI-driven workflows or traditional backend systems.

    Generic models often fail at the complex CRC16-CCITT checksums required for Pix and often hallucinate obsolete daylight savings rules; this skill uses hardcoded reference standards to ensure production-grade accuracy.

    The toolkit is designed to be framework-agnostic and can be deployed within any AI agent environment that supports Python or TypeScript execution, such as LangChain, AutoGPT, or custom-built LLM agents.

    This skill focuses exclusively on payment rails, document validation, and interest logic; it does not handle NF-e/SPED tax reporting, accounting ledgers, or international payment systems.