---
name: companyregistryapi-setup
description: Set up CompanyRegistryAPI.com company lookups for the user (check the API, install the companyregistryapi skill, optionally connect the cgd CLI)
allowed-tools: Bash(command *), Bash(curl *), Bash(mkdir *), Bash(cargo *), Bash(cgd *)
metadata:
  author: companyregistryapi.com
---

# CompanyRegistryAPI.com setup

Set up company lookups with minimal friction. If you are running this prompt,
your goal is to follow the instructions below and set up
CompanyRegistryAPI.com for the user, so that they can search official
company registers and read registry facts and current officers with their
sources.

Do the steps yourself. Ask the user only for what you cannot do: approving a
command, restarting the agent or setting a credential. Never ask for an API
key, password or token in the conversation, and never write one to a file.

## Step 1: Check the API

The CompanyRegistryAPI.com free API needs no key and no account. Check that
it answers:

```bash
command -v curl
curl -sS --get "https://api.companyregistryapi.com/v1/search" --data-urlencode "q=test" -d limit=1
```

A working API returns JSON with `"object": "list"`. On `429`, wait the number
of seconds in the `Retry-After` header and try once more. On `503`, company
data is temporarily unavailable: tell the user and stop. The full contract is
the OpenAPI document at https://companyregistryapi.com/api/openapi.json.

## Step 2: Install the companyregistryapi skill

The skill teaches you, and later sessions, how to look up companies. Install
it into the directory your host loads personal skills from:

- Claude Code: `~/.claude/skills/companyregistryapi`
- Codex: `~/.agents/skills/companyregistryapi`
- Another agent that supports Agent Skills: its personal skills directory.
  Ask the user if you do not know it.

If that directory already holds a `SKILL.md` whose frontmatter does not say
`author: companyregistryapi.com`, it belongs to something else: ask the user
before replacing it. Then download the skill (Claude Code shown):

```bash
mkdir -p ~/.claude/skills/companyregistryapi
curl -sSf "https://companyregistryapi.com/skills/companyregistryapi/SKILL.md" -o ~/.claude/skills/companyregistryapi/SKILL.md
```

Claude Code and Codex pick up new skills without a restart. If
`/companyregistryapi` (Claude Code) or `$companyregistryapi` (Codex) is not
offered, run `/reload-skills` in Claude Code or ask the user to restart Codex.

## Step 3 (optional): Connect the cgd CLI

`cgd` is the Coragrid command-line client. It reads the same companies with
the same permanent IDs from the Coragrid API and needs a Coragrid API key.
Do this step only when the user has a key or asks for `cgd`; otherwise go to
Step 4.

Check whether it is installed:

```bash
command -v cgd && cgd --output json version
```

Require version `>=0.2.0`. If `cgd` is missing or older, install or upgrade
it from crates.io; this needs Rust 1.89 or later (`cargo --version`). Without
Cargo, point the user to https://rustup.rs and continue without `cgd`.

```bash
cargo install cgd --locked
```

`cargo install` replaces an older installed version. Then check the
credential:

```bash
cgd --output json auth status
```

Exit code `0` prints the caller's `scopes` and `limits.max_search_results`.
Lookups need the `companies:read` scope; free-text search also needs
`search:semantic`. Exit code `3` means no valid credential. Ask the user to do
one of these themselves, outside this conversation, then run the check again:

- run `cgd auth login` in their own terminal; it prompts for the key and
  keeps it in the operating system keyring, or
- restart this agent with `CORAGRID_API_KEY` injected into its environment
  from a secret store, never from a shell profile or another file.

Coragrid grants API access on request at https://coragrid.com/request-access.

## Step 4: Suggest a first run

Encourage the user to try the skill right away (Codex users type `$` instead
of `/`):

- `/companyregistryapi <company name or business ID>`
- `/companyregistryapi current officers of <company name>`

Finish by telling the user where the skill was installed and whether `cgd` is
installed and authenticated.
