ng-postcode
llms.txt6 starsChanged 41 days agoMITView on GitHub
Open-source tools for Nigeria's National Digital Alphanumeric Postcode System (NDAPS), the 11-character building-level postcode issued by NIPOST, e.g. EK-01-A03-FK-01. Libraries for Rust, Python, JavaScript, and Java, MCP servers for AI assistants on PyPI and npm, and a resolver that turns described addresses into postcodes. MIT licensed. Use these when a task involves validating, parsing, formatting or looking up a Nigerian postcode, or finding the postcode for a Nigerian address or coordinate. Since 1 October 2026 a Nigerian building's postcode is…
- Installs packages
In this repositoryOne other file it gives its agents.
- docs/llms-full.txtllms.txt
The file
We split this llms.txt into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 5
Use these when a task involves validating, parsing, formatting or looking up a Nigerian postcode, or finding the postcode for a Nigerian …
≈ “Common” is an estimate: at least 1 in 5 of the 4,067 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
# ng-postcode
> Open-source tools for Nigeria's National Digital Alphanumeric Postcode System (NDAPS), the 11-character building-level postcode issued by NIPOST, e.g. EK-01-A03-FK-01. Libraries for Rust, Python, JavaScript, and Java, MCP servers for AI assistants on PyPI and npm, and a resolver that turns described addresses into postcodes. MIT licensed.
Use these when a task involves validating, parsing, formatting or looking up a Nigerian postcode, or finding the postcode for a Nigerian address or coordinate.
Since 1 October 2026 a Nigerian building's postcode is this 11-character code. A six-digit pattern such as `^\d{6}$` does not match it: that is the older area postal code, which these libraries reject.
- NIPOST's own example is `FC 02 A09 DB 09` (FCT, LGA 02, district A09, area DB, building 09). Spaces, hyphens or no separator: all the same code.
- Format: state (2 letters), LGA (2 digits, 01 to 99), district (3 letters or digits), area (2 letters), building unit (2 digits, 01 to 99).
- Compact regex: `^[A-Z]{2}(0[1-9]|[1-9][0-9])[A-Z0-9]{3}[A-Z]{2}(0[1-9]|[1-9][0-9])$`
- Validation is offline and needs no key. Lookup, autocomplete and reverse geocoding call api.postcode.gov.ng and need a key from https://dashboard.postcode.gov.ng.
- A well-formed code is not necessarily assigned to a building; only the API confirms that.
- To pass a postcode between systems or agents, use a postcode reference: `{"code": "EK-01-A03-FK", "level": "area", "confidence": "medium"}`. Schema: https://adeniyikayodee.github.io/ng-postcode/schemas/postcode-reference.schema.json
- To pass a whole address, wrap that reference in an address record with `country: "NG"` and optional `state`, `lga`, `locality`, `street_address`, `description`, and `location`. It maps onto ISO 20022, FHIR, schema.org, vCard, and UPU's address layout for Nigeria: https://adeniyikayodee.github.io/ng-postcode/address-record
## Packages
- [ng-postcode for Python](https://pypi.org/project/ng-postcode/): `pip install ng-postcode`. `parse`, `parse_lenient`, `from_segments`, `is_valid`; add the `client` extra for sync and async API clients.
- [ng-postcode for Rust](https://docs.rs/ng-postcode): `cargo add ng-postcode`. `Postcode::parse`, `parse_lenient`, `from_segments`; features `serde`, `api`, `client`.
- [ng-postcode-js](https://www.npmjs.com/package/ng-postcode-js): `npm install ng-postcode-js`. On npm, `ng-postcode` is a different project. `parse`, `parseLenient`, `fromSegments`, `isValid`; `ng-postcode-js/api` and `ng-postcode-js/client` call the API with `fetch`.
- [ng-postcode for Java](https://central.sonatype.com/artifact/io.github.adeniyikayodee/ng-postcode): Maven `io.github.adeniyikayodee:ng-postcode` (offline, no dependencies) and `io.github.adeniyikayodee:ng-postcode-api` (API client), Java 17 or later. `Postcode.parse`, `parseLenient`, `fromSegments`, `isValid`.
- [ng-postcode-mcp](https://pypi.org/project/ng-postcode-mcp/): MCP server, run with `uvx ng-postcode-mcp`, or with `npx -y ng-postcode-mcp` for the Node edition, which has every tool except `resolve_address`. Tools: `validate_postcode`, `lookup_postcode`, `autocomplete_postcode`, `find_postcode_at_location`, `resolve_address`. Registry name `io.github.Adeniyikayodee/ng-postcode`.
- [ng-address-resolver](https://pypi.org/project/ng-address-resolver/): `pip install ng-address-resolver`. Import it as `ng_address`, e.g. `from ng_address import Resolver`. Resolves free-text Nigerian addresses to postcodes, only as precisely as the evidence allows. Pre-release.
- [WooCommerce plugin](https://wordpress.org/plugins/adeniyikayode-nigerian-postcode-for-woocommerce/): install from WordPress.org; source on [GitHub](https://github.com/Adeniyikayodee/ng-postcode-woocommerce). Checks and tidies the postcode at checkout, finds it from the customer's location, and makes shipping zones match on postcode prefixes.
- [SQL](https://github.com/Adeniyikayodee/ng-postcode/tree/main/sql): the postcode as a PostgreSQL domain and DuckDB macros, with `ng_postcode_parse`, `ng_postcode_format`, and `ng_postcode_truncate` for grouping by state, LGA, district, or area.
- [ng-postcode-polars](https://pypi.org/project/ng-postcode-polars/): `pip install ng-postcode-polars`, then `import ng_postcode_polars`. Polars expressions under `pl.col(...).ng`: `parse`, `parse_prefix`, `format`, `truncate`, `is_valid`. Compiled from the Rust core.
- [ng_postcode for PostgreSQL](https://github.com/Adeniyikayodee/ng-postcode/tree/main/native/pg): a native extension for PostgreSQL 14 to 18. Types `ng_postcode` and `ng_postcode_prefix` take 8 bytes and support B-tree and hash indexes. Install a package from the repository's Releases, then `CREATE EXTENSION ng_postcode`.
- [ng_postcode for DuckDB](https://github.com/Adeniyikayodee/ng-postcode-duckdb): a DuckDB extension in Rust with `ng_postcode_parse`, `ng_postcode_prefix_parse`, `ng_postcode_format`, `ng_postcode_truncate`, `ng_postcode_parent`, and `ng_postcode_within`. Install with `INSTALL ng_postcode FROM community; LOAD ng_postcode;` on DuckDB 1.5.6; other versions report the extension as not found.
- Convert a CSV file: `pip install ng-postcode`, then `ng-postcode --column postcode customers.csv --out checked.csv`. It adds the compact code, a status of valid, suggested, invalid, or empty, and the reason for each invalid row.
- [Nigerian address form](https://github.com/Adeniyikayodee/ng-postcode/tree/main/templates/nigerian-address-form): a React checkout form built with shadcn/ui and `ng-postcode-js`. Add it with `npx shadcn@latest add https://adeniyikayodee.github.io/ng-postcode/r/nigerian-address-form.json`. It returns the postcode as `FC-02-A09-DB-09` and a phone number as `+234` and ten digits, and exports `addressSchema` (zod) for the server.
- [Group records by place](https://adeniyikayodee.github.io/ng-postcode/group-by-place): count or select records by state, LGA, district, or area by cutting each code to a prefix with `truncate`.
## Docs
- [Guide](https://adeniyikayodee.github.io/ng-postcode/): install and usage for every package
- [llms-full.txt](https://adeniyikayodee.github.io/ng-postcode/llms-full.txt): every package's README in one file
- [Python README](https://github.com/Adeniyikayodee/ng-postcode/blob/main/python/README.md)
- [Rust README](https://github.com/Adeniyikayodee/ng-postcode/blob/main/CRATE.md)
- [JavaScript README](https://github.com/Adeniyikayodee/ng-postcode/blob/main/js/packages/ng-postcode-js/README.md)
- [Java README](https://github.com/Adeniyikayodee/ng-postcode/blob/main/java/README.md)
- [MCP server README](https://github.com/Adeniyikayodee/ng-postcode/blob/main/mcp/README.md): per-client setup and configuration
- [Resolver README](https://github.com/Adeniyikayodee/ng-postcode/blob/main/agent/README.md)
- [Integration notes for the NIPOST API](https://github.com/Adeniyikayodee/ng-postcode/blob/main/docs/api-differences.md)
## Optional
- [Shared test vectors](https://github.com/Adeniyikayodee/ng-postcode/tree/main/spec): the cases every implementation must pass
- [NIPOST API docs](https://docs.postcode.gov.ng)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

