ZATCA: Instructions file for Claude Code

CLAUDE.md

ZATCA CLAUDE.md is an instructions file for Claude Code from SallaApp/ZATCA. It costs 1,882 tokens per session, scanned A, original, MIT.

Project-specific instructions for SallaApp/ZATCA, a PHP library for Saudi Arabia's electronic-invoicing requirements. The project handles QR codes, certificates, and digitally signed invoice XML.

In plain words
What is it for?
Use them when developing or testing the ZATCA library, including QR-code generation, certificate onboarding, invoice signing, and XML handling.
Why use it?
They provide the repository's technology choices, architecture, and commands before coding begins. This reduces the risk of changing the library in a way that breaks its invoicing workflow.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is SallaApp/ZATCA's own configuration. It tells Claude Code how to work on ZATCA itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ZATCA configures →

Reuse

Borrowing it

Nothing to install: this file belongs to SallaApp/ZATCA. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/SallaApp/ZATCA/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/SallaApp/ZATCA

Made for: Claude Code.

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 ZATCA CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/sallaapp/zatca/claude-md/github.svg)](https://agentmods.dev/instructions/sallaapp/zatca/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/sallaapp/zatca/claude-md"><img src="https://agentmods.dev/badge/instructions/sallaapp/zatca/claude-md/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 ZATCA CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/sallaapp/zatca/claude-md"><img src="https://agentmods.dev/badge/instructions/sallaapp/zatca/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,882 This file is loaded in full into every session.
When invoked 1,882 The same file — it is already loaded in full.
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.01882 $0.01882
Opus 5.5 $0.00753 $0.00753
Sonnet 5.5 $0.00376 $0.00376
Haiku 4.5 $0.00188 $0.00188

Measured 26d ago against content hash dc45fde16d4c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ZATCA CLAUDE.md 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 26d 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.

CLAUDE.md · 62 lines

How it starts

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

ZATCA (salla/zatca)

A pure-PHP Composer library that implements ZATCA (Fatoora) e-invoicing primitives for Saudi Arabia: Phase 1 TLV-encoded QR code generation, and Phase 2 CSR generation, certificate handling, and XAdES signing of UBL 2.1 invoices with the QR code embedded. It does not build the UBL XML (that is salla/einvoicing) and does not call the ZATCA API (that is services/zatca-einvoicing).

Stack

  • PHP >= 8.0 · ext-mbstring · ext-dom · ext-openssl with EC support (used at runtime by GenerateCSR)
  • phpseclib/phpseclib ~3.0 — EC keys, ECDSA signing, X.509 parsing
  • robrichards/xmlseclibs ^3.1 — XML digital-signature helpers
  • josemmo/uxml ^0.1.4 — UBL XML DOM/XPath manipulation
  • chillerlan/php-qrcode ^5.0 — QR image rendering (v5 since release 4.0.0)
  • phpunit/phpunit ~8.0 (dev) · no Laravel, no framework coupling

Run / test / build

composer install
composer test                                  # = phpunit, config in phpunit.xml
./vendor/bin/phpunit --filter SignInvoiceTest

This repo has no unit-test workflow (.github/workflows/ only has lint-pr.yaml). The suite also runs in services/zatca-einvoicing CI, whose phpunit.xml includes vendor/salla/zatca/tests as the zatca testsuite, so run that service's tests against your branch before tagging a release.

Architecture

  • src/GenerateQrCode.php — fromArray(Tag[]) then toTLV(), toBase64(), or render($options, $file) (image via chillerlan).
  • src/Tag.php — base TLV tag (tag id + UTF-8 value, packed binary in __toString).
  • src/Tags/ — Seller(1), TaxNumber(2), InvoiceDate(3), InvoiceTotalAmount(4), InvoiceTaxAmount(5), InvoiceHash(6), InvoiceDigitalSignature(7), PublicKey(8), CertificateSignature(9, simplified invoices only).
  • src/GenerateCSR.php — GenerateCSR::fromRequest(CSRRequest)->initialize()->generate() returns Models/CSR (secp256k1 private key + CSR). Writes a temp OpenSSL config to sys_get_temp_dir(), swaps the certificate-template string per environment, then deletes it.
  • src/Models/CSRRequest.php — fluent CSR subject builder (make(), setUID(), setSerialNumber(), setInvoiceType(), setCurrentZatcaEnv(), …); throws Exception/CSRValidationException on the few checks it has. Those checks are shallow: setUID() checks only length 15 and a leading/trailing 3 (it does not check that the value is all digits), and setCountryName() checks only length 2. The setOrganizationalUnitName() "11th digit is 1, so OU must be 10 digits" rule never fires, because strpos($uid, '1', 10) == 1 can never be true. Callers must enforce the ZATCA rules themselves: the UID (VAT number) is exactly 15 digits, starting and ending with 3; if its 11th digit is 1 (a VAT group), the organizational unit name must be the 10-digit TIN of the group member.
  • src/Models/InvoiceSign.php — (new InvoiceSign($xml, Certificate))->sign(): removes ext:UBLExtensions, cac:Signature, and the QR AdditionalDocumentReference; hashes the C14N XML (SHA-256); ECDSA-signs; builds UBLExtensions; rebuilds the QR; returns Models/Invoice (getInvoice(), getHash(), getQRCode(), getCertificate()).
  • src/Helpers/Certificate.php — wraps the CSID certificate + private key; getHash(), getPlainPublicKey(), getAuthorizationHeader() (Basic auth for the ZATCA API), getCertificateSignature(), getFormattedIssuerDN().
  • src/Helpers/UXML.php — UXML wrapper; toTagsArray() reads UBL fields and returns the 8 or 9 Tag[] for the QR.
  • src/Helpers/UblExtension.php — builds the <ext:UBLExtensions> XAdES signature block.
  • Namespace Salla\ZATCA\ maps to src/; tests Salla\ZATCA\Test\ map to tests/ (fixtures in tests/Unit/files/).

Read the full file on GitHub · 62 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. 26d ago Changed · +14 lines · +800 tokens per session dc45fde16d4c
  2. 2mo ago First seen · 48 lines · 1,082 tokens per session scan A 0976deacd894

Subscribe to this mod's changes

ZATCA CLAUDE.md is an instructions file published in the GitHub repository SallaApp/ZATCA (168 stars, last pushed 7d ago), licensed MIT. It adds 1,882 tokens to every session, about $0.0075 per session on Opus 5.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-08-30.

Related

ZATCA CLAUDE.md compared with instructions from other repositories

ZATCA CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ZATCA CLAUDE.mdSallaApp/ZATCAInstructions file1687d agoMITA1,882Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot