Vigiar
1
0
Derivar
Você já tinha feito uma derivação do repositório agent-skills, anteriormente
0
agent-skills/skills/connect-domain/SKILL.md
2026-11-28 15:28:03 +02:00

5,9 KiB

name description
connect-domain Point a domain registered or hosted at Interweb Mozambique to a Interweb Mozambique VPS, a hosting plan or an outside service, by checking the nameservers and creating the right DNS records through the Interweb Mozambique API, then checking that it works. Use when the user says "connect my domain", "point my domain to my server", "my site does not open on my domain" or wants www and the root domain to work.

Connect a domain

A guided task that combines the manage-domains, manage-dns, manage-vps and manage-hosting skills.

Setup

  • API address: https://api.interweb.co.mz/v1. It is fixed for Interweb Mozambique: never ask the user for another address.
  • API key: always read it from the INTERWEB_API_KEY environment variable. Check it without printing it: test -n "$INTERWEB_API_KEY" && echo set || echo missing
  • If it is missing, ask the user to create a key in the API Center (https://www.meu.interweb.co.mz/api-center.php) with domains:read, dns:read and dns:write (plus vps:read or hosting:read to find the target), then to run export INTERWEB_API_KEY="sandbox_..." and restart Claude Code (or the editor).
  • sandbox_ keys read the real account but only simulate writes and never charge. prod_ keys change the account and can charge. GET /v1/token gives the mode in data.mode and the permissions in data.permissions. Suggest a sandbox_ key for a first try.
  • Never print, log or commit the key, and never put it in code that runs in a browser or a mobile app. In code, read it from the environment.

Every request looks like this:

curl -sS "https://api.interweb.co.mz/v1/PATH" -H "Authorization: Bearer $INTERWEB_API_KEY" -H "Accept: application/json"

Rules

  • Before anything that charges, deletes data or cannot be undone, tell the user exactly what will happen (with the price, when the API gives one) and wait for a clear yes.
  • Send an Idempotency-Key header on purchases, sends and other POST requests that accept it, and reuse the same value if you retry the same request: IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid).
  • Lists come in pages: ?page=1&per_page=100, and meta.total_pages says how many there are.
  • Long operations answer 202 with an action_id. Follow them with GET /v1/actions/{action_id} every 10 to 20 seconds until status is done or failed.
  • Answer the user in the language they write in, and show amounts with the currency the API returns.

Steps

  1. Find the domain. GET /v1/domains/{domain}. If it is not in the account, the user changes the DNS where the domain is managed: give them the records from step 3 and stop.
  2. Check the DNS is ours. GET /v1/domains/{domain}/dns and look at meta.dns_enabled. If it is false, the domain uses other nameservers: either the user changes the records there, or, with their clear consent, set our nameservers with the manage-domains skill (this moves the whole zone, including email).
  3. Find the target.
    • VPS: GET /v1/servers and take ip (and an IPv6 address if the user has one).
    • Hosting plan: GET /v1/services/{id} gives the domain of the plan. For an extra domain on the same plan, add it with POST /v1/services/{id}/addon-domains first.
    • Outside service: ask the user for the IP or the host name the service gave them.
  4. Plan the records and show them before changing anything:
    • Root: @ A <ip> (and AAAA for IPv6).
    • www: www CNAME mybusiness.co.mz or www A <ip>.
    • Existing records with the same name and type that point elsewhere will be replaced: list them and ask.
    • Never touch MX, SPF TXT or the records of the mail host unless the user asked for email changes.
  5. Apply. Validate each record with POST /v1/domains/{domain}/dns/validate, then create or update it. Keep the backup id shown in GET /v1/domains/{domain}/dns/backups in case the user wants to undo.
  6. Check. dig +short mybusiness.co.mz A and dig +short www.mybusiness.co.mz (or nslookup). It can take up to the old TTL to spread.
  7. HTTPS. On a hosting plan, run POST /v1/services/{id}/ssl/autossl once the domain points there. On a VPS, the web server gets the certificate (for example Caddy does it on its own, see deploy-to-vps).

When something fails

  • 409 cname_conflict: a CNAME cannot live next to other records with the same name. Remove or change the other record first, with the user's consent.
  • 409 account_email_domain: the account login email is on this domain, so mail records are changed in Meu Interweb (https://www.meu.interweb.co.mz).
  • The site still does not open after DNS is right: check that the server answers on ports 80 and 443 and that the site is set up for that domain.

Errors

Errors look like {"error": {"code", "message", "correlation_id", "details"}}. Act on code, never on the text of message.

HTTP code What to do
401 unauthorized The key is missing, wrong or revoked. Ask the user to check INTERWEB_API_KEY.
402 insufficient_credit Not enough account credit, and nothing was charged. Give the user details.add_funds_url.
403 insufficient_scope The key lacks a permission. Name it and ask for a key that has it.
403 spending_limit_exceeded The purchase goes over the key spending limit. Nothing was charged.
404 not_found Wrong id, or it is not in this account.
409 conflict and others Read details.reason and explain it in plain words.
422 validation_failed Fix the field named in details and try again.
429 rate_limited Wait for the Retry-After seconds, then try once more.
5xx internal_error, upstream_error Try again later. If the user contacts support, give them the correlation_id.

More