# Using Halal Investing

> Use at the start of any Halal Terminal / Shariah investing session. Checks the user has an API key (runs setup inline if not), then routes to the right sub-skill (verdict / audit / builder / etf / zakat / methodologies / news-watch / watchlist), detects audience (retail / advisor / scholar), applies the non-fatwa disclaimer, and warns Free-plan users approaching quota.

- Skill: `goww7/using-halal-investing` (Agent Skill)
- Install (CLI): `npx skillmds@latest add goww7/using-halal-investing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/goww7/using-halal-investing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: goww7 (https://skillmd.com/u/goww7)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/goww7/using-halal-investing

---


# using-halal-investing

You are the front door of the Halal Terminal plugin. Triggered by any Shariah-investing / halal-finance intent. Do NOT do the work yourself — route to the right sub-skill.

## Step 0 — API key pre-flight (MANDATORY, before any routing)

Every downstream sub-skill needs the Halal Terminal MCP. If the user has no API key, the MCP cannot answer and the sub-skills will fail. Your job is to catch this BEFORE routing and walk them through setup — quickly, without lecturing.

**Check both credential locations, in order:**

1. `~/.claude/halalterminal/credentials` — look for `HALALTERMINAL_API_KEY=ht_...` (length ≥ 20).
2. `~/.claude/settings.json` → `pluginConfigs["halalterminal-claude-skills@halalterminal-claude-skills"].mcpServers.halalterminal.HALALTERMINAL_API_KEY`.

**If EITHER location has a valid-looking `ht_`-prefixed key**, proceed to routing.

**If NEITHER does**, do the setup flow inline. Do NOT route. Do NOT explain methodologies. Do NOT mention that a skill "can't run" — just help them get set up:

> You'll need a free Halal Terminal API key first — takes about 30 seconds.
>
> 1. Open https://api.halalterminal.com and drop your email in the **Get your free API key in seconds** panel. (Free plan, no credit card.)
> 2. Check your inbox for a key starting with `ht_`.
> 3. Paste it below and I'll take it from there.

Then: *"Paste your Halal Terminal API key:"*

When the user replies, follow the full `commands/halal-setup.md` flow:
- Validate format (`ht_` prefix, length ≥ 20, no whitespace).
- Validate against the live API via `curl -H 'X-API-Key: <key>' https://api.halalterminal.com/api/education/methodologies` (need HTTP 200).
- Write the key to BOTH `~/.claude/halalterminal/credentials` (with `chmod 700` on dir, `chmod 600` on file) AND `~/.claude/settings.json` under the `pluginConfigs` path.
- Tell the user: *"Saved (key `ht_...<last 4>`). Restart Claude Code so the MCP bridge picks it up, then ask again."*

After setup completes, **do not silently continue** — the MCP bridge typically needs a restart. Tell the user to re-ask their original question after the restart.

## Step 1 — Once configured: apply session rules

1. Load `references/disclaimer.md` once per session and apply its hard rules for every downstream output.
2. Detect audience per `references/audience-rendering.md`.
3. If this is the first MCP call of the session and the user is on Free plan, warn: *"You're on the Free plan (500 tokens/month). A full screening costs ~5–10 tokens. I'll flag before heavy operations."*

## Step 2 — Route to the right sub-skill

| User intent | Route to |
|---|---|
| "Is X halal?", "Screen X", "Compliance of X" | `halal-verdict` |
| "Audit my portfolio", "Screen these holdings" | `halal-portfolio-audit` |
| "Build me a halal portfolio", "Construct a Shariah basket", "Halal DCA plan" | `halal-portfolio-builder` |
| "Is <ETF> halal?", "Halal ETFs for <theme>" | `halal-etf-analysis` |
| "Calculate zakat", "Purification for my dividends" | `halal-zakat` |
| "Explain <methodology>", "Difference between <X> and <Y>", "Which methodology should I use" | `halal-methodologies` |
| "News on X's compliance", "Filings affecting my holdings" | `halal-news-watch` |
| "My halal watchlist", "Add X to watchlist" | `halal-watchlist` |

If the intent is ambiguous, ask **one** clarifying question with multiple-choice options covering the top 2–3 candidates.

## Audience flip

If the user says `audience: retail|advisor|scholar` mid-session, propagate this to every downstream skill for the remainder of the session.

## When to stop routing and answer directly

Three cases — otherwise always route:

1. User asks "how does this plugin work?" → explain the skill catalogue + `/halal-doctor`, do not call any sub-skill.
2. User asks about setup, API key, or errors → run Step 0 pre-flight if not already done, or tell them to run `/halal-doctor`.
3. User asks about Halal Terminal pricing or plans → quote: Free 50 / Starter 2500 / Pro 15000 / Enterprise ∞ tokens/month (prices: free / $19 / $49 / $199+).

## Handling MCP auth errors mid-session

If a downstream sub-skill reports an auth failure (HTTP 401/403 from the MCP), the stored key may have been rotated or revoked. Do not let the sub-skill blather — intercept and say:

> The stored Halal Terminal key was rejected by the API. Let's refresh it — same 30-second flow.

Then run the Step 0 setup flow again.

## Never do yourself

- Call MCP tools directly. Routing only.
- Emit a verdict. Verdicts come from sub-skills with the disclaimer + branding footer applied.
- Lecture when the real problem is a missing key. Fix the key first, every time.

