← All skills
Agent Buildingv1.0.0 · 2026-08-07
Env And Keys Setup
An agent is only useful if it can reach your tools. Two ideas do all the work: an API is the language two pieces of software speak, and an API key is the password proving your agent may use the service — generated once, pasted into `.env`, used silently forever after.
What it does
- Know the two kinds of key
- Know the three ways you pay
- Pull only your agent's stack
- Build the .env
- Enforce the four security rules
SKILL.md
--- name: env-and-keys-setup description: Set up an AI agent's API keys and .env file — which keys the agent needs, simple key vs OAuth, cost models, and the four security rules that keep credentials safe. Use when asked to set up API keys, create a .env file, connect an agent to WordPress or Gemini or Tavily, understand tokens vs keys, work out why social publishing is so hard, handle a leaked key, or someone says 'the agent can't reach my tools'. For the folder around .env, see agent-folder-scaffold. For WordPress specifically, see wordpress-api-connector. metadata: version: 1.0.0 --- # Env and keys setup An agent is only useful if it can reach your tools. Two ideas do all the work: an **API** is the language two pieces of software speak, and an **API key** is the password proving your agent may use the service — generated once, pasted into `.env`, used silently forever after. The distinction that saves days of frustration: **there are two kinds of key, and one is much harder.** ## Before you start | Input | Why | | --- | --- | | Which agent you are building | You get the keys for THIS agent first, not all 17 at once | | The agent's .env + .gitignore, already created together | Keys need somewhere safe before the first one is generated | | Billing awareness per tool | Free tier, pre-pay credits, or subscription — know which before connecting | ## Step 1 — Know the two kinds of key | Type | What it is | Used by | | --- | --- | --- | | **Simple API key** (easy) | A single secret string. Generate, paste, done | Gemini, ElevenLabs, Heygen, KIE, Higgsfield, Suno, Tavily, Firecrawl, OpenAI, Claude | | **OAuth token** (harder) | Permission to act *as you* on your account: build a small developer app, approve permissions, token expires and refreshes | LinkedIn, Instagram, Facebook, Gmail — **this is why social publishing is the hardest part** | For LinkedIn and Instagram, use a bridge service rather than fighting raw OAuth — the course's own recommendation. ## Step 2 — Know the three ways you pay **Free tier** (a monthly allowance, then stop or pay) · **pre-pay credits** (load money, pay per generation — common for image and video) · **subscription** (flat fee). Always know which one a tool uses *before* you connect it — pre-pay and pay-per-use keys can drain fast. ## Step 3 — Pull only your agent's stack The starter stacks, from the playbook: | Agent | Keys you need | | --- | --- | | SEO agent | WordPress + Google AI Studio + Tavily + Firecrawl + Semrush + Claude | | LinkedIn agent | Claude + a publishing bridge + Google AI Studio for images | | Reel/video agent | Claude + Firecrawl + ElevenLabs + Heygen/Higgsfield + Suno/KIE + a publishing bridge | | Research agent | Claude + Tavily + Firecrawl + Apify + Perplexity | | Bulk ads creative | Claude + KIE/Higgsfield/Google AI Studio for images at volume | ## Step 4 — Build the .env One private file, every key, labelled by group: ``` # ---- Publishing ---- WP_SITE_URL=https://yourdomain.com WP_APPLICATION_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx # ---- Media ---- GOOGLE_AI_STUDIO_API_KEY=AIza... ELEVENLABS_API_KEY=... # ---- Research ---- TAVILY_API_KEY=tvly-... FIRECRAWL_API_KEY=fc-... # ---- Brain ---- ANTHROPIC_API_KEY=sk-ant-... ``` Generate a key, paste it, label it. Scripts load it with an env loader — **never a value hardcoded in a skill file**, because skills get shared and copied; `.env` does not. ## Step 5 — Enforce the four security rules 1. **Never share the .env file.** Not in a screenshot, not in a group, not on public GitHub. It is in `.gitignore` from birth. 2. **One key per tool, named so you recognise it.** 3. **Rotate every few months; revoke instantly if one leaks.** 4. **Watch spend.** Set billing limits and alerts on pre-pay and pay-per-use keys. ## Output ``` # Key setup: <agent> Stack: <keys for THIS agent only> | Key | Kind (simple/OAuth) | Cost model | In .env as | Billing alert set? | .env: labelled by group ✓ · .gitignore first line ✓ · nothing hardcoded ✓ OAuth needs: <none / bridge chosen for LinkedIn-Instagram> Rotation date: <a few months out, in the calendar> ``` ## When it breaks | What you see | What it means | The fix | | --- | --- | --- | | Agent "can't reach" a tool | Key missing, mislabelled, or not loaded from .env | Check the exact variable name the script expects | | Days lost on LinkedIn/Instagram | Fighting raw OAuth | Use a bridge — that is the course's own answer | | A key appears in a screenshot or repo | Rule 1 broken | Revoke and regenerate NOW; rotation is instant on a leak | | Surprise bill from an image tool | Pre-pay/pay-per-use unwatched | Billing limits and alerts, rule 4 | | Key works locally, fails for teammate | Key hardcoded in a shared skill file | Keys live only in .env; the skill reads the variable | | 17 tabs of signups, no agent | Collecting keys before building | This agent's stack only; the next agent earns its own keys | | Token stopped working after weeks | OAuth expiry — they refresh by design | Expected behaviour; the bridge or refresh flow handles it | Never "test quickly" by pasting a key directly into a prompt, a skill file, or a chat. Every one of those surfaces is shareable, and a shared key is a leaked key. ## Rules - **Keys live in .env and nowhere else**, because skills get shared and copied and .env does not. - **This agent's stack only**, because 17 keys before one working agent is procrastination with extra billing risk. - **Know the cost model before connecting**, because pre-pay drains silently and rule 4 exists for a reason. - **Leak means revoke now**, because rotation on schedule is hygiene but rotation on leak is an emergency. - **Bridge over raw OAuth for social**, because the course's honest position is that OAuth apps are the hardest part and marketers shouldn't fight them alone. ## Related skills - **agent-folder-scaffold** — creates .env and .gitignore together, before keys. - **wordpress-api-connector** — the WordPress application password, step by step. - **token-budgeter** — the other kind of token: usage, not passwords. - **claude-md-writer** — the driver never contains a key, only the variable name.
Reviews
Sign in to leave a review.
