Skip to main content

AI Agent Skills

Persian Tools ships a set of 28 Agent Skill cards — one per public utility — under /skills in the repository. When you load them into an AI coding assistant (Claude Code, Cursor, Copilot, etc.), the retriever pulls the relevant SKILL.md on demand so the agent answers with the real function names, types, edge cases, and pitfalls — not invented APIs.
If you’ve ever asked an AI agent for extractCardNumbers(...) and gotten back a confidently wrong signature for a function that’s actually named extractCardNumber (singular), this is the fix.

Why Skills?

Real signatures

Each SKILL.md is generated from the actual src/modules/<name>/ exports. No hallucinated parameters or non-existent helpers.

Edge cases documented

Empty input, mixed Persian/Arabic digits, ZWNJ handling, return-type unions — captured per skill so the agent doesn’t have to guess.

Composition recipes

Cross-references between skills (e.g. extractCardNumbersverifyCardNumberdigits) so the agent assembles working pipelines.

Tree-shake friendly

Each skill names its single import (import { Bill } from "@persian-tools/persian-tools") so the agent produces tree-shakable code by default.

Install into your agent

bunx skills add @persian-tools/persian-tools
While the public skills registry CLI is being finalised, copy the skills/ folder into your project’s .claude/skills/ (or your agent’s equivalent) directly — the on-disk format is final.

What every SKILL.md contains

Each card follows the Claude Code Skills front-matter spec:
---
name: <kebab-case-name>
description: <when to load — used by the retriever>
license: MIT
metadata:
  author: Ali Torki
  homepage: https://github.com/persian-tools/persian-tools
  version: "1.0.0"
---
The body always includes:
  1. Import signature — exact import { … } from "@persian-tools/persian-tools" plus the CommonJS equivalent.
  2. Public exports — function/class signatures pulled directly from src/modules/<name>/.
  3. Behaviour rules — input shapes, return-type unions, what triggers throws.
  4. Edge cases — empty input, mixed-digit, Arabic-keyboard, ZWNJ-laden inputs.
  5. Common pitfalls — drift between popular community docs and current code; “this function doesn’t exist” warnings.
  6. Composition recipes — typical pipelines combining 2–3 utilities.
  7. References — tests and related skills.

The 28 skills, grouped by domain

🔢 Numbers & digits

SkillWhat it covers
digitsPersian (۰-۹) ↔ Arabic-Indic (٠-٩) ↔ English digit conversion + autoConvertDigitsToEN
commasThousands-separator add/remove (addCommas, removeCommas)
numberToWordsNumber → Persian words, with ordinal mode
wordsToNumberPersian words → number, fuzzy mode, digit-system output
moneyWordsToNumberMoney phrase → number with toman/rial detection, formal vs colloquial
addOrdinalSuffixAppend Persian ordinal suffix (سهسوم)
removeOrdinalSuffixStrip Persian ordinal suffix (سومسه)

📝 Text processing

SkillWhat it covers
isPersianPersian-script detection + autoArabicToPersian
isArabicArabic-script detection and Persian-vs-Arabic distinction
toPersianCharsNormalize Arabic-script chars (ي/ك) to Persian (ی/ک) with template preservation
halfSpaceInsert ZWNJ (نیم‌فاصله) between Persian prefixes/suffixes/compounds
URLfixDecode percent-encoded Persian URLs (function is urlFix, note camelCase)
slugifyURL-safe slugs from Persian text (slugify, createSlug, slugifyWithNumbers, slugifySimple)
textAnalyzerFull Persian text analysis — function is analyzeText (NOT textAnalyzer) + helpers

🏛️ Iranian identifier validation

SkillWhat it covers
nationalIdNational ID (کد ملی) verify + generate + city-prefix lookup
getPlaceByIranNationalIdCity/province lookup from the leading 3 digits of a National ID
legalIdLegal ID (شناسه ملی, 11-digit company ID) validation
phoneNumberMobile number validate / normalize (+980) / operator detail

💳 Banking

SkillWhat it covers
verifyCardNumberIranian card-number validation (Luhn + BIN whitelist)
getBankNameFromCardNumberIssuing bank from card BIN
extractCardNumbersPull card numbers from free-text — function is extractCardNumber (singular)
shebaSheba/IBAN validation + bank info — function is isShebaValid (not verifySheba)
billUtility-bill Bill class — parse bill ID + payment ID + barcode

🌍 Geography & vehicles

SkillWhat it covers
findCapitalByProvinceProvince name → capital city
findProvinceFromCoordinate(longitude, latitude) → { fa, en } province
numberplateIranian license plate parser (cars + motorcycles) — use getNumberPlateInfo

⏱️ Time

SkillWhat it covers
timeAgoJalali date string → “X قبل/بعد” Persian phrase
remainingTimeGregorian target → structured countdown + Persian toString()

How retrieval composes

The skills are intentionally narrow — one per utility — and cross-reference each other rather than duplicate domain knowledge:
isPersian, isArabic, toPersianChars, halfSpace, digits

Used by every higher-level skill (validators, parsers, formatters)

nationalId, sheba, phoneNumber, moneyWordsToNumber, …
A typical agent retrieval flow:
  1. User says: “validate this card number from a chat message”
  2. Retriever picks: extractCardNumbers (primary) + verifyCardNumber + digits (digit normalization)
  3. Agent reads the three SKILL.md files and produces a correct pipeline — for example:
import {
	autoConvertDigitsToEN,
	extractCardNumber,
	verifyCardNumber,
	getBankNameFromCardNumber,
} from "@persian-tools/persian-tools";

const text = autoConvertDigitsToEN(userMessage);
const candidates = extractCardNumber(text, { checkValidation: true });
const valid = candidates
	.filter((c) => c.isValid)
	.map((c) => ({
		number: c.pure,
		bank: getBankNameFromCardNumber(c.pure),
	}));

Maintainer-side skills

The 28 skills above are user-facing — one per public utility. For contributor-facing skills that guide adding new modules, writing tests, keeping the bundle small, or cutting a release, see the .agents/ directory:
SkillPurpose
persian-module-authorNew-module checklist
persian-text-expertPersian language domain reference
iranian-validation-expertChecksum algorithm reference
persian-test-authorVitest house style
bundle-size-guardianTree-shaking + .skip.ts convention
persian-tools-releaseRelease flow

Adding or editing a skill

  1. Each skill lives in skills/<module-name>/SKILL.md with valid YAML front-matter.
  2. The description field is what the retriever matches on — include literal triggers (function names, Persian terms, common synonyms).
  3. The import signature must match the real src/modules/<name>/ exports. If the source changes, the skill should change with it.
  4. Cross-reference other skills by name (see the X skill) — don’t duplicate their content.
  5. Update the skills README table.

External references

Claude Code Skills spec

The official front-matter format and retrieval semantics

skills/ on GitHub

Browse all 28 SKILL.md files

Source code

The src/modules/ directory each skill documents

npm package

@persian-tools/persian-tools