Agent skill

Sync Upstream

by nyaruka in nyaruka/phonenumbers

Sync this Go port with a new upstream google/libphonenumber release — regenerate the embedded metadata and reconcile the ported Java logic.

MITAuto-check passedBusiness, Finance & HR

Install Sync Upstream

skills CLI
$ npx skills add nyaruka/phonenumbers --skill sync-upstream -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nyaruka/phonenumbers sync-upstream --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nyaruka/phonenumbers.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/sync-upstream .claude/skills/sync-upstream && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sync-upstream
GitHub stars
1.6k
Token cost
~2.8k tokens
SKILL.md length
1,168 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Sync this Go port with a new upstream google/libphonenumber release — regenerate the embedded metadata and reconcile the ported Java logic.

  • Works in 2 steps: Metadata regen (mechanical) → Code reconciliation (judgment)
  • The user says sync with upstream
  • SKILL.md covers Argument, Phase 1 — Metadata regen…, Phase 2 — Code reconciliation… and Finalize
  • Calls git and go; reaches github.com

What it does

Sync Upstream is an agent skill from nyaruka/phonenumbers. Sync this Go port with a new upstream google/libphonenumber release — regenerate the embedded metadata and reconcile the ported Java logic. Takes an optional argument — data (metadata regen only), code (code reconciliation only), or empty for both. Use when the user says "sync with upstream", "do an upstream sync", "reconcile against libphonenumber", "pull the latest libphonenumber", bump to a new libphonenumber version, or invokes /sync-upstream. SYNC.md holds the state (baseline version + deliberate…

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR, covering Accounting and bookkeeping. It works with Java. The repository describes itself as: Go port of Google's libphonenumber library. The licence is MIT.

When your agent uses it

  • The user says sync with upstream
  • Do an upstream sync
  • Reconcile against libphonenumber
  • Pull the latest libphonenumber

Example prompts

  • “sync with upstream”
  • “do an upstream sync”
  • “reconcile against libphonenumber”
  • “/sync-upstream”

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Metadata regen (mechanical)
  2. Code reconciliation (judgment)

What it can do on your machine

Read from SKILL.md and the folder at commit d586aeb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sync Upstream loads about 2.8k tokens when it runs. Until then it costs about 142 tokens; SKILL.md has 1,168 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~142
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nyaruka/phonenumbers at commit d586aeb, republished under its MIT licence (© nyaruka). 1,168 words, ~2,846 tokens.

Download SKILL.mdSave it as .claude/skills/sync-upstream/SKILL.md (or your agent's skills folder).
name
sync-upstream
description
Sync this Go port with a new upstream google/libphonenumber release — regenerate the embedded metadata and reconcile the ported Java logic. Takes an optional argument — `data` (metadata regen only), `code` (code reconciliation only), or empty for both. Use when the user says "sync with upstream", "do an upstream sync", "reconcile against libphonenumber", "pull the latest libphonenumber", bump to a new libphonenumber version, or invokes /sync-upstream. SYNC.md holds the state (baseline version + deliberate divergences); this skill is the procedure.

Sync with upstream libphonenumber

This package is a Go port of google/libphonenumber, tracking its Java reference implementation. A sync is two independent operations — do them in order, but understand they're different in kind:

  1. Metadata regen — mechanical. Rebuild the embedded data/ blobs from a new upstream release. Fully automated by cmd/buildmetadata.
  2. Code reconciliation — judgment. Port new Java logic changes into the Go files. Can't be automated; this is the real reason SYNC.md exists.

State lives in SYNC.md: the code baseline (Code reconciled against vX.Y.Z) and the deliberate divergences (what we intentionally do not port). Read it first. The embedded-metadata version is tracked separately in the generated metadata/version.go (metadata.Version) — never hand-edit that.

Run everything from the repo root (/Users/rowan/nyaruka/phonenumbers).

Argument

The skill takes one optional argument selecting which operation(s) to run:

  • /sync-upstream data — Phase 1 only (metadata regen). An automated metadata update can invoke this mode directly.
  • /sync-upstream code — Phase 2 only (code reconciliation, against the metadata version already built — see the note at the top of Phase 2).
  • /sync-upstream — both phases, in order.

Whichever mode runs, finish with Finalize below: commit the changes and stop. This skill never releases — no tag, no push, no CHANGELOG.md. The user cuts releases separately with /release.


Phase 1 — Metadata regen (mechanical)

sh
go run ./cmd/buildmetadata            # latest upstream release
# go run ./cmd/buildmetadata v9.0.32  # or pin a specific tag

This resolves the target tag, wipes and re-clones upstream into _build/ (a shallow --depth=1 checkout at the target tag — gitignored), rebuilds every embedded blob (data/, metadata/data/, carrier/data/, geocoding/data/, timezone/data/), and rewrites the generated metadata/version.go with the tag it built from.

Then:

sh
go test ./...

Review the diff. The only files that may change are the embedded blobs (data/, metadata/data/, carrier/data/, geocoding/data/, timezone/data/) and the generated metadata/version.go:

  • No changes at all → the metadata is already up to date; nothing to commit for Phase 1. In data mode report that and stop; in a full sync continue to Phase 2 (the code baseline may still lag the metadata version).
  • Changes outside that set → something is wrong; stop and report the unexpected changes without committing.

In data mode, that's the whole job — skip to Finalize. Phase 1 has already bumped metadata/version.go, and the Code reconciled against baseline in SYNC.md stays where it is (the two versions are tracked separately for exactly this case).

The target tag you built becomes the new code baseline once Phase 2 reconciles against it.


Phase 2 — Code reconciliation (judgment)

Goal: apply any upstream Java logic changes between the old baseline (SYNC.md) and the target to each Go port. The target is the tag Phase 1 built — in code-only mode, the version already in metadata/version.go (metadata.Version), i.e. reconcile the code up to where the embedded metadata already is.

Get both tags side by side for diffing

Phase 1 leaves _build/ as a shallow clone at the target tag. In code-only mode _build/ may be missing (it's gitignored) — recreate it at the target first:

sh
TARGET=v9.0.32    # metadata.Version, from metadata/version.go
git clone --depth=1 --branch "$TARGET" https://github.com/google/libphonenumber _build

Then fetch the baseline tag into it so you can diff tree-to-tree (no merge base needed — git diff A B compares trees):

sh
BASE=v9.0.31      # from SYNC.md "Code reconciled against"
git -C _build fetch --depth=1 origin tag "$BASE"
Diff each ported source, baseline→target

The per-file headers are the source of truth for the Go→Java mapping — every reconcilable file carries a // Port of <upstream/path>. header. Enumerate them:

sh
grep -rn "Port of" --include='*.go' . | grep -v _test.go | grep -v _build/

For each upstream path P, diff it across the window and reconcile anything non-trivial:

sh
git -C _build diff "$BASE" "$TARGET" -- "$P"

The mapping (kept current; if files move, the headers win and this table is refreshed):

Goupstream Java path
phonenumberutil.go, enums.gojava/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
asyoutypeformatter.gojava/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java
shortnumberinfo.gojava/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumberInfo.java
phonenumbermatcher.gojava/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java
phonenumbermatch.gojava/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatch.java
errors.gojava/libphonenumber/src/com/google/i18n/phonenumbers/NumberParseException.java
internal/regexcache/java/libphonenumber/src/com/google/i18n/phonenumbers/internal/RegexCache.java
internal/regexbasedmatcher/java/libphonenumber/src/com/google/i18n/phonenumbers/internal/RegexBasedMatcher.java, .../internal/MatcherApi.java
metadata/source.go, alternateformats.gojava/libphonenumber/src/com/google/i18n/phonenumbers/metadata/source/*, .../MetadataLoader.java
carrier/java/carrier/src/com/google/i18n/phonenumbers/PhoneNumberToCarrierMapper.java
geocoding/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java
timezone/java/geocoder/src/com/google/i18n/phonenumbers/PhoneNumberToTimeZonesMapper.java
internal/prefixmapper/java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/*
internal/metadatabuilder/tools/java/common/src/com/google/i18n/phonenumbers/BuildMetadataFromXml.java

internal/serialize and internal/stringbuilder are Go-specific scaffolding (gzip/binary decode; a java.lang.StringBuilder stand-in) with no upstream logic to reconcile — skip them.

The corresponding upstream tests move in lockstep. The Go tests mirror the Java test classes (e.g. PhoneNumberUtilTest → phonenumberutil_test.go and friends); diff those too and port new cases:

sh
git -C _build diff "$BASE" "$TARGET" -- "$(echo "$P" | sed 's#/src/#/test/#')"
Show full SKILL.md (538 more words)Show less
Reconcile

For each non-empty diff, translate the relevant change into the Go port. While doing so:

  • Preserve upstream source order. The core ports keep their functions/methods in the same order as the upstream Java so the next sync's diff lines up — maintain that as you reconcile. A few files are deliberately reorganized for Go idiom and don't follow upstream order (metadata/source.go, internal/regexcache, internal/regexbasedmatcher, internal/prefixmapper); that's expected.
  • Java-shaped over idiomatic — in ports. Inside a // Port of … file, keep constructs close to the Java so the next diff lines up, even when a linter (gopls modernize, staticcheck) suggests a more idiomatic Go form — e.g. don't rewrite an index for loop as for i := range n, or a manual scan as slices.Contains. Let those modernizations ride in with upstream when the Java itself changes. Non-ported code (cmd/, CI, build glue, and Go-specific scaffolding like internal/serialize / internal/stringbuilder) has no Java counterpart to track, so make it fully idiomatic.
  • Honor deliberate divergences. Check SYNC.md before porting something back; some upstream code is intentionally absent (e.g. Mockito-style metadata-source injection tests, Java iterator semantics with no Go equivalent). Don't re-introduce it. If you make a new intentional divergence, record it.
  • Keep it a port, not an enhancement. Match libphonenumber's behaviour; don't add API.
  • Mirror Java's visibility. A symbol that is public in Java is exported in Go; one that is private/package-private/@VisibleForTesting stays unexported (lower-case camelCase). Constants especially: REGION_CODE_FOR_NON_GEO_ENTITY is the only public static final upstream, so it is the lone exported constant — every other ported regex/char-class/length-limit/mapping is unexported. The deliberate exceptions are the Go-idiomatic Err* vars (standing in for Java's checked exceptions) and the public enum types. Don't export a new internal just because it's a package-level const/var.
  • Java overloads → distinct Go names. Go can't overload, so a set of Java methods sharing a name maps to several Go funcs: give one the bare PascalCase name and suffix the rest with the parameter(s) that distinguish them. Follow the established pattern — Parse/ParseToNumber, IsNumberMatch/IsNumberMatchWithNumbers/IsNumberMatchWithOneNumber, GetExampleNumberForType/GetExampleNumberForTypeInRegion, IsPossibleNumber/IsPossibleNumberFromRegion, IsNumberGeographical/IsNumberGeographicalForType. Porting an overload that already exists upstream is faithful porting, not the "don't add API" case above — fill the gap rather than skipping it. Which overload keeps the bare name (and the exact suffix) is a judgment call; flag new public names in the PR.
  • Don't hand-edit generated files (metadata/version.go, *.pb.go) or the data/ blobs — those come from Phase 1 / protoc.

Then make it green:

sh
go test ./...

Finalize

If code was reconciled (Phase 2 ran), update SYNC.md (state only):

  1. Bump the Code reconciled against version to the target tag.
  2. If anything new was intentionally left unported, add it under Deliberate divergences.

Then, with go test ./... green, commit the changes:

  • Metadata only (data mode): commit the blobs and metadata/version.go with the message Updated metadata to <tag>, where <tag> is the upstream tag it was built from (metadata.Version in metadata/version.go), e.g. Updated metadata to v9.0.33.
  • Code reconciliation: record what was reconciled (and the version) in the commit message — git history is the sync log, so SYNC.md doesn't keep one.

Stop there. Do not push, tag, or touch CHANGELOG.md — those belong to the release process. Finish by reporting that the changes are committed and a release can be cut with /release.

Leave public-facing text (commit messages, comments) describing the software in general terms.

© nyaruka, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/sync-upstream of nyaruka/phonenumbers.

Open the folder on GitHubat commit d586aeb

Compare with similar skills

Sync Upstream next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sync Upstream compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sync Upstream this skillnyaruka/phonenumbers1.6k—~2.8kAutomated safety check: PassMIT
Longbridge Value Investinghelsome/folio2692 repos~1.2kAutomated safety check: PassMIT
Radiology Tablehuang-sir1/radiology-skills1.9k—~1.3kAutomated safety check: PassCustom licence
Odoo Agency Fleet Reviewerpipe-org/mcp-odoo420—~699Automated safety check: PassMIT
Beancount Closebex-co/beancount-io295—~1.4kAutomated safety check: PassMIT
ERPClaw ERP Controlleravansaber/erpclaw114—~15kAutomated safety check: PassGPL-3.0

Similar skills

  • Value investing analysis using Graham (NCAV/net-net/defensive-investor) and Buffett (economic moat/ROE/FCF) methodologies.

    269 GitHub starsUsed in 2 repos~1.2k tokens
    Business, Finance & HRAuto-check passed
  • Radiology Table

    huang-sir1/radiology-skills

    Create/audit editable publication tables with source reconciliation; not figures or statistical inference.

    1.9k GitHub stars~1.3k tokensUpdated 17 days ago
    Business, Finance & HRAuto-check passed
  • Odoo Agency Fleet Review

    erpipe-org/mcp-odoo

    Review many client Odoo databases at once through odoo-mcp's cross-instance tools — fleet-wide accounting health, per-client aging, partial-failure triage — for agencies and partners managing 5–50…

    420 GitHub stars~699 tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Beancount Close

    bex-co/beancount-io

    Close an accounting period in a Beancount ledger by reconciling each active account through beancount-reconcile, checking assertions and recurring gaps, reviewing flags, then proposing a commit with…

    295 GitHub stars~1.4k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • ERPClaw ERP Controller

    avansaber/erpclaw

    Operates the ERPClaw self-hosted ERP in plain language: accounting, invoicing, inventory, purchasing, tax, HR, payroll and reports, treating the ERP as the single source of truth.

    114 GitHub stars~15k tokensUpdated 2 days ago
    Business, Finance & HRAuto-check passed
  • Forward Implementation First

    Vuk97/forward-implementation-first

    Keeps an agent building and validating real output instead of servicing its own bookkeeping.

    176 GitHub stars~1.8k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed

Works with

Questions about Sync Upstream

What does Sync Upstream do?

Sync this Go port with a new upstream google/libphonenumber release — regenerate the embedded metadata and reconcile the ported Java logic. Sync Upstream is an agent skill from nyaruka/phonenumbers. Sync this Go port with a new upstream google/libphonenumber release — regenerate the embedded metadata and reconcile the ported Java logic.

When should I use Sync Upstream?

Sync Upstream fits situations like: the user says sync with upstream; do an upstream sync; reconcile against libphonenumber; pull the latest libphonenumber.

How do I install Sync Upstream in Claude Code?

Run `npx skills add nyaruka/phonenumbers --skill sync-upstream -a claude-code`. Or copy the skill folder (.claude/skills/sync-upstream in nyaruka/phonenumbers) into .claude/skills/sync-upstream in your project. Claude Code loads it when a task matches its description.

How do I install Sync Upstream in Codex?

Run `npx skills add nyaruka/phonenumbers --skill sync-upstream -a codex`. Or copy the skill folder (.claude/skills/sync-upstream in nyaruka/phonenumbers) into .agents/skills/sync-upstream in your project. Codex loads it when a task matches its description.

Can I use Sync Upstream in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nyaruka/phonenumbers --skill sync-upstream -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sync-upstream, .gemini/skills/sync-upstream, .github/skills/sync-upstream and .opencode/skills/sync-upstream in your project.

What does Sync Upstream need to run?

Going by SKILL.md and its folder, Sync Upstream needs the command-line tools its instructions call (git and go).

Does Sync Upstream access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Sync Upstream safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sync Upstream use?

Sync Upstream is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sync Upstream use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Sync Upstream?

Skills that share tags, products or a category with Sync Upstream: Longbridge Value Investing (helsome/folio, 269 stars), Radiology Table (huang-sir1/radiology-skills, 1.9k stars), Odoo Agency Fleet Review (erpipe-org/mcp-odoo, 420 stars) and Beancount Close (bex-co/beancount-io, 295 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sync Upstream?

nyaruka (a GitHub organization) maintains it in nyaruka/phonenumbers, which has 1,605 GitHub stars. The repository was last updated on October 2, 2026.

Source: nyaruka/phonenumbers on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.