Provides guidance on using CrestApps Orchard Core phone-number services: parsing, E.164 normalization, validation, display formatting, region/country-code lookup, and time-zone lookup via IPhoneNumberService and the PhoneNumber value type.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate code and configuration for the CrestApps Phone Numbers services. This infrastructure module provides parsing, validation, E.164 normalization, region lookup, country-code lookup, and phone-number time-zone lookup.
CrestApps.OrchardCore.PhoneNumbers in the web/startup project. Code that only consumes the contracts references CrestApps.OrchardCore.PhoneNumbers.Abstractions (namespace CrestApps.OrchardCore.PhoneNumbers).CrestApps.OrchardCore.PhoneNumbers; it is marked dependency-only and normally activates through a dependent feature.IPhoneNumberService rather than parsing numbers with string manipulation.PhoneNumber value type (built with IPhoneNumberService.TryParse), not as raw strings. DNC registries require it.FormatForDisplay; store and dial E.164.+.GetTimeZones only with an E.164 number and allow for zero, one, or multiple IANA time-zone ids.CrestApps.OrchardCore.PhoneNumbers.Verifications, not this module.{ "steps": [...] }.sealed modifier, except for View Models.| Item | Value |
|---|---|
| Package | CrestApps.OrchardCore.PhoneNumbers |
| Feature | Phone Numbers Services, ID CrestApps.OrchardCore.PhoneNumbers (dependency only, category Phone Verification) |
| Contracts package | CrestApps.OrchardCore.PhoneNumbers.Abstractions |
| Service | IPhoneNumberService (singleton) |
| Implementation | DefaultPhoneNumberService (libphonenumber) |
| Canonical value type | PhoneNumber (readonly record struct, always E.164 or empty) |
| Normalized standard | E.164 |
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.PhoneNumbers"
],
"disable": []
}
]
}
The feature has EnabledByDependencyOnly = true. Enabling DNC Registry or Phone Number Verifications activates it automatically; explicitly enabling it is useful for a custom module that consumes IPhoneNumberService.
IPhoneNumberService Operations| Method | Use |
|---|---|
TryFormatToE164 | Parse input and obtain canonical E.164 output |
FormatForDisplay | Format a number for reading (grouped, without the country code when local to regionCode); unparseable input is returned unchanged |
IsValidNumber | Validate input for a given region |
GetTimeZones | Obtain IANA time-zone ids associated with an E.164 number |
GetRegionCode | Determine an ISO alpha-2 region from an E.164 number |
GetCountryCode | Obtain an international calling code from a region |
GetSupportedRegions | Build an allow-list or region picker |
An E.164 number includes +, country calling code, and subscriber number, for example +17024993350.
Normalize as soon as user input reaches your application. Store the normalized value when parsing succeeds, and show a validation error otherwise.
using CrestApps.OrchardCore.PhoneNumbers;
namespace MyCompany.OrchardCore.Contacts;
public sealed class ContactPhoneNormalizer
{
private readonly IPhoneNumberService _phoneNumberService;
public ContactPhoneNormalizer(IPhoneNumberService phoneNumberService)
{
_phoneNumberService = phoneNumberService;
}
public bool TryNormalize(string input, string regionCode, out string e164Number)
{
return _phoneNumberService.TryFormatToE164(input, regionCode, out e164Number);
}
}
For a local number such as 702-499-3350, pass US. For a number that already begins with +, a region can be omitted when calling the service.
Do not strip non-digits yourself before invoking the service. Formatting characters, prefixes, and regional numbering rules must be interpreted by the phone-number service.
PhoneNumber Value TypePhoneNumber holds a number that is E.164 by construction, so a consumer never has to guess the format. Build it once, at the boundary:
using CrestApps.OrchardCore.PhoneNumbers;
if (_phoneNumberService.TryParse(model.PhoneNumber, model.RegionCode, out var phoneNumber))
{
// phoneNumber.Value is "+17024993350", phoneNumber.Digits is "17024993350".
var registered = await registry.GetRegisteredNumbersAsync([phoneNumber], cancellationToken);
}
| Member | Use |
|---|---|
TryParse(rawNumber, regionCode, out PhoneNumber) | Extension on IPhoneNumberService; parses and normalizes in one step |
PhoneNumber.TryFromE164 / FromE164 | Wrap a value that is already E.164 (FromE164 throws otherwise) |
PhoneNumber.IsE164 | Shape check only (leading +, no leading zero, at most 15 digits) |
HasValue, Value, Digits | Inspect the number; default(PhoneNumber) has no value |
GetRegionCode(PhoneNumber) | Extension returning the region, or null for an empty number |
PhoneNumber serializes to JSON as its E.164 string through PhoneNumberJsonConverter.
To compare a stored raw value that may not have parsed, use PhoneNumberComparisonKey.For(canonical, rawValue) (the E.164 value when known, otherwise the digits) or AllFor(...) for every key a lookup should try.
Use IsValidNumber when only validity is required:
if (!_phoneNumberService.IsValidNumber(model.PhoneNumber, model.RegionCode))
{
ModelState.AddModelError(nameof(model.PhoneNumber), "Enter a valid phone number.");
}
Prefer TryFormatToE164 when the valid result also needs to be stored. It avoids a second parse and gives the comparison key required by DNC and verification workflows.
GetRegionCode returns the ISO 3166-1 alpha-2 region for an E.164 number or null when unavailable. GetCountryCode returns the numeric calling code for a known region and 0 when the region is unknown.
var regionCode = _phoneNumberService.GetRegionCode("+17024993350");
var callingCode = _phoneNumberService.GetCountryCode("US");
var regions = _phoneNumberService.GetSupportedRegions();
Treat the returned region as phone-number metadata, not an address or residency assertion. Numbers can be ported and countries can share calling codes.
GetTimeZones returns IANA identifiers associated with an E.164 number:
var timeZones = _phoneNumberService.GetTimeZones("+17024993350");
A result can be empty if it cannot be determined. It can also contain multiple entries where a calling range spans zones. Ask the user to choose when precise scheduling depends on one location. Do not silently treat a phone-number time zone as the account or tenant time zone.
Store raw input only when it is necessary for auditing or editor display. Use E.164 as the index and unique-comparison value:
public sealed class ContactPhoneRecord
{
public string DisplayNumber { get; set; } = string.Empty;
public string NormalizedPhoneNumber { get; set; } = string.Empty;
public string RegionCode { get; set; } = string.Empty;
}
Normalize and validate NormalizedPhoneNumber before a record is saved. Do not include a local number and its region in a global unique index because the same digits represent different numbers in different regions.
To find records by a number someone types, keep one index row per normalized number and compare the E.164 value with StartsWith, which a database index can seek. Never search a phone number with Contains (LIKE '%…%') on display text or a JSON column: no index answers it, and on a large tenant the page and its count each scan every row. The Omnichannel Contacts and Leads list search (CrestApps.OrchardCore #1337) does exactly this: a search written like a number matches only numbers, through OmnichannelContactPhoneNumberIndex and its covering index IDX_OCPhone_NumberDocument (NormalizedPhoneNumber, DocumentId), and no longer the display text.
public sealed class SupplierPhoneIndex : MapIndex
{
public string ContentItemId { get; set; }
public string NormalizedPhoneNumber { get; set; }
}
public sealed class SupplierPhoneIndexProvider : IndexProvider<ContentItem>
{
private readonly IPhoneNumberService _phoneNumberService;
public SupplierPhoneIndexProvider(IPhoneNumberService phoneNumberService)
{
_phoneNumberService = phoneNumberService;
}
public override void Describe(DescribeContext<ContentItem> context)
=> context.For<SupplierPhoneIndex>()
// Only content items have rows, but a supplier with two numbers has two: not SingleRecordPerDocument().
.ExclusiveToDocumentType()
.When(item => item.Published && item.Has<SupplierPart>())
.Map(item => item.As<SupplierPart>().PhoneNumbers
.Select(raw => _phoneNumberService.TryParse(raw, "US", out var number) ? number.Value : null)
.Where(value => value is not null)
.Distinct(StringComparer.Ordinal)
.Select(value => new SupplierPhoneIndex { ContentItemId = item.ContentItemId, NormalizedPhoneNumber = value }));
}
// Search: read a national entry in a default country so the prefix is E.164, then seek the index.
// var prefix = typed.StartsWith('+') ? typed : $"+1{digits}";
// session.Query<ContentItem, SupplierPhoneIndex>(index => index.NormalizedPhoneNumber.StartsWith(prefix));
Add a database index on (NormalizedPhoneNumber, DocumentId) in the migration so the search is answered from the index alone. SupplierPart is your own part with a List<string> PhoneNumbers.
For a field that must keep whatever was typed (a customer, order or checkout contact phone), use PhoneNumberNormalization.ToE164OrTrimmed (in CrestApps.OrchardCore.PhoneNumbers.Abstractions) instead of rejecting invalid input:
// phoneNumberService may be null (for example when the Phone Numbers feature is off); the number is then only trimmed.
var stored = PhoneNumberNormalization.ToE164OrTrimmed(model.Phone, _phoneNumberService, address?.Country);
x12, ext. 12, #12), a second number, a note, or digits E.164 would drop is kept as typed (trimmed). Empty input returns null.regionCode is the ISO 3166-1 alpha-2 country a number without a country code is read in, such as the country of the record's address; null accepts only numbers with a country code.PhoneCountryCodes.NormalizeCallingCode("1") returns +1, and PhoneCountryCodes.NormalizeRegionCode("us") returns US.Commerce uses this for the customer record, the order, the checkout contact step and the store profile.
| Feature | How it uses Phone Numbers |
|---|---|
CrestApps.OrchardCore.PhoneNumbers.Verifications | Stores and revalidates provider verification results on content items; see orchardcore-phone-number-verifications |
CrestApps.OrchardCore.DncRegistry | Normalizes imports and checks do-not-call records |
CrestApps.OrchardCore.TimeZones | Provides friendly editor labels for IANA zones, not phone-number discovery |
CrestApps.OrchardCore.Omnichannel.Managements | Indexes every contact number in E.164 (OmnichannelContactPhoneNumberIndex) for caller and sender matching and for the Contacts and Leads list search, which matches a number-like entry by E.164 prefix against every number of any type (after the phone number backfill; before it, the primary Cell and Home columns); see orchardcore-omnichannel-management |
CrestApps.OrchardCore.Telephony | The soft phone keypad normalizes a valid national number to E.164 before dialing so outbound screening can canonicalize it; see orchardcore-telephony |
Phone Numbers itself does not manage external verification providers, send SMS, create a content type, or supply an admin page.
| Situation | Recommended action |
|---|---|
| Local number has no region | Require an explicit region picker |
TryFormatToE164 returns false | Reject or retain as unverified user input, never compare it as canonical data |
GetTimeZones returns no values | Ask for location or fall back to user-selected preferences |
| Multiple time zones are returned | Ask the user to select one for schedule-sensitive behavior |
Unknown region passed to GetCountryCode | Handle the 0 result and do not construct an E.164 prefix |
US for every local number.+ and can overflow.LIKE or OR a number search with a display-text search; seek a normalized-number index by prefix.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, phone-number, e164, libphonenumber, normalization
/crestapps-orchardcore:orchardcore-phone-numbersfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts./orchardcore-addressesSkill for the CrestApps Orchard Core Addresses module (CrestApps.OrchardCore.Addresses, Addresses.Countries, Addresses.GooglePlaces). Covers the immutable Address value shared by customers, checkout, orders, shipping and taxation, per-country address formats from Google address data with AddAddressesCore, IAddressFormatProvider and AddressFormat, IAddressValidator and AddressProblem, IAddressFormatter, the AddressEditor shape with IAddressEditorService and AddressEditorOptions, CreateAddressEditorAsync and CreateAddressDisplayAsync, ICountryService and managed Country content items, address suggestions through IAddressAutocompleteProvider, ContactInfo, NamedAddress and IShippingAddressBook, the Google Places provider with its protected API key, the address-autocomplete rate-limit group, and the ManageAddressSuggestions permission. Use it when requests mention Orchard Core addresses, international address formats, address validation, a country list, address autocomplete or Google Places./orchardcore-advanced-seoSkill for the CrestApps Orchard Core Advanced SEO module (CrestApps.OrchardCore.Seo), which publishes schema.org structured data as one JSON-LD graph per page and for NLWeb answers. Covers the Schema.org part (SchemaOrgPart, SchemaOrgPartSettings with SchemaType and property mappings from Content, Fixed, Editor or Liquid sources), the StructuredDataSettings site settings and their deployment step, the ManageAdvancedSeoSettings permission, Orchard Core SEO, Search, Products and Reviews integration, the getSchemaOrgOptions, configureContentTypeSchemaOrg and configureSiteStructuredData AI tools, describing pages in code with IPageStructuredData, the structured-data tag helper and the structured_data Liquid filter, and extending with IStructuredDataProvider, ContentPartStructuredDataProvider and SelfDescribingParts. Use this skill when requests mention schema.org, JSON-LD, structured data, rich results, Google required properties, product or article markup, or Advanced SEO in Orchard Core./orchardcore-agentic-commerceSkill for the CrestApps Orchard Core Agentic Commerce module (CrestApps.OrchardCore.AgenticCommerce), which lets AI agents such as Gemini and ChatGPT buy from the store with the Universal Commerce Protocol (UCP), the Agentic Commerce Protocol (ACP) and the AP2 mandates extension (preview). Covers every feature (UCP, account linking, catalog and cart, MCP and A2A bindings, ACP, Agent Product Feeds, AP2), the /.well-known/ucp and /.well-known/acp.json discovery documents, checkout session endpoints, agent platforms and their sign-in, AgenticCommerceSettings, store signing keys in Secrets, idempotency, payment handlers (Stripe shared payment tokens, Google Pay, test credentials), delegated 3-D Secure, embedded checkout, signed order updates, the AgentPlatforms recipe step, and extending with IAgentPaymentHandler, IUcpProfileContributor, IUcpCheckoutExtension and IAgentOrderPublisher. Use it when requests mention agentic commerce, selling through AI agents, UCP, ACP, AP2, agent checkout or agent product feeds./orchardcore-agreementsSkill for the CrestApps Orchard Core Agreements module (CrestApps.OrchardCore.Agreements), support and maintenance contracts with accounts. Covers the Agreement record with its SA- number, status, period and covered hours (a block or a monthly allowance with rounding), Content > Agreements, the account Service tab, the ManageAgreements and ViewAgreements permissions, the Agreements recipe and deployment step, module terms in Properties with IAgreementTermsValidator, IAgreementUsageProvider and IAgreementBalanceService, the hourly lifecycle task with IAgreementObserver, account manager notifications, and the Agreement Usage and Burn-down reports. Use this skill when requests mention service agreements, support contracts, prepaid or retainer hours, entitlements or agreement expiry. Strong matches include Agreement, AgreementHours, AgreementStatus, AgreementBalance, AgreementUsage, IAgreementManager, IAgreementObserver and TicketAgreementTerms.Other plugins' skills for the same job