Skip to content

Commit c4e45a9

Browse files
committed
feat: improve AGENTS.md gotchas, remove hardcoded counts, add AI agents section to README
1 parent eff7f14 commit c4e45a9

3 files changed

Lines changed: 64 additions & 49 deletions

File tree

AGENTS.md

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# @roxyapi/sdk — Agent Guide
22

3-
TypeScript SDK for RoxyAPI. 8 spiritual/metaphysical domains, 113 endpoints, one API key. Zero runtime dependencies.
3+
TypeScript SDK for RoxyAPI. Multi-domain spiritual and metaphysical intelligence API. One API key, fully typed, zero runtime dependencies.
44

55
> Before writing any code with this SDK, read `docs/llms-full.txt` in this package for the complete method reference with examples.
66
77
## Install and initialize
88

9+
```bash
10+
npm install @roxyapi/sdk
11+
```
12+
913
```typescript
1014
import { createRoxy } from '@roxyapi/sdk';
1115

@@ -16,27 +20,26 @@ const roxy = createRoxy(process.env.ROXY_API_KEY!);
1620

1721
## Domains
1822

19-
Type `roxy.` to see all 10 namespaces:
20-
21-
| Namespace | Methods | What it covers |
22-
|-----------|---------|----------------|
23-
| `roxy.astrology` | 23 | Western astrology: natal charts, horoscopes, synastry, moon phases, transits |
24-
| `roxy.vedicAstrology` | 42 | Vedic/Jyotish: birth charts, dashas, nakshatras, panchang, KP system |
25-
| `roxy.tarot` | 10 | 78-card Rider-Waite-Smith: spreads, daily pulls, yes/no, Celtic Cross |
26-
| `roxy.numerology` | 13 | Life path, expression, soul urge, personal year, karmic analysis |
27-
| `roxy.crystals` | 12 | Crystal healing properties, zodiac/chakra pairings, birthstones |
28-
| `roxy.iching` | 9 | I Ching: 64 hexagrams, trigrams, coin casting, daily readings |
29-
| `roxy.angelNumbers` | 4 | Angel number meanings, pattern analysis, daily guidance |
30-
| `roxy.dreams` | 5 | Dream symbol dictionary (2,000+ symbols) |
31-
| `roxy.location` | 3 | City geocoding for birth chart coordinates |
32-
| `roxy.usage` | 1 | API usage stats and subscription info |
23+
Type `roxy.` to see all available namespaces. Type `roxy.{domain}.` to see every method in that domain.
24+
25+
| Namespace | What it covers |
26+
|-----------|----------------|
27+
| `roxy.astrology` | Western astrology: natal charts, horoscopes, synastry, moon phases, transits, compatibility |
28+
| `roxy.vedicAstrology` | Vedic/Jyotish: birth charts, dashas, nakshatras, panchang, KP system, doshas, yogas |
29+
| `roxy.tarot` | Rider-Waite-Smith deck: spreads, daily pulls, yes/no, Celtic Cross, custom layouts |
30+
| `roxy.numerology` | Life path, expression, soul urge, personal year, karmic analysis, compatibility |
31+
| `roxy.crystals` | Crystal healing properties, zodiac/chakra pairings, birthstones, search |
32+
| `roxy.iching` | I Ching: hexagrams, trigrams, coin casting, daily readings |
33+
| `roxy.angelNumbers` | Angel number meanings, pattern analysis, daily guidance |
34+
| `roxy.dreams` | Dream symbol dictionary and interpretations |
35+
| `roxy.location` | City geocoding for birth chart coordinates |
36+
| `roxy.usage` | API usage stats and subscription info |
3337

3438
## Critical patterns
3539

3640
### GET endpoints — use `path` for URL parameters
3741

3842
```typescript
39-
// Path params go in { path: { ... } }
4043
const { data } = await roxy.astrology.getDailyHoroscope({
4144
path: { sign: 'aries' },
4245
});
@@ -72,6 +75,14 @@ const { data } = await roxy.numerology.calculateLifePath({
7275
});
7376
```
7477

78+
### Query parameters
79+
80+
```typescript
81+
const { data } = await roxy.crystals.searchCrystals({
82+
query: { q: 'amethyst' },
83+
});
84+
```
85+
7586
### Error handling
7687

7788
```typescript
@@ -81,24 +92,14 @@ const { data, error, response } = await roxy.astrology.getDailyHoroscope({
8192

8293
if (error) {
8394
// error is { error: string } on 4xx/5xx
84-
console.error(error);
95+
console.error('Status:', response?.status, 'Error:', error);
8596
return;
8697
}
87-
// data is fully typed here
98+
// data is fully typed after error check
8899
console.log(data.sign, data.overview);
89100
```
90101

91-
### Query parameters
92-
93-
```typescript
94-
const { data } = await roxy.crystals.searchCrystals({
95-
query: { q: 'amethyst' },
96-
});
97-
98-
const { data } = await roxy.dreams.searchDreamSymbols({
99-
query: { q: 'flying' },
100-
});
101-
```
102+
Common error codes: `401` invalid/missing API key, `403` subscription expired or limit reached, `429` rate limited, `404` resource not found.
102103

103104
## Common tasks
104105

@@ -131,17 +132,20 @@ const city = cities[0];
131132
// Use city.latitude and city.longitude in chart requests
132133
```
133134

134-
## What NOT to do
135+
## Gotchas
135136

136-
- Do not call endpoints with raw `fetch` — use the typed SDK methods
137-
- Do not hardcode the base URL — `createRoxy` sets it
138-
- Do not expose the API key client-side — call from server/API routes only
139-
- Do not guess method names — type `roxy.domain.` and use autocomplete
140-
- Parameters are `{ path }`, `{ body }`, or `{ query }` — not positional arguments
137+
- **Parameters are objects, not positional.** Always `{ path: {...} }`, `{ body: {...} }`, or `{ query: {...} }` — never positional arguments.
138+
- **Do not guess method names.** Type `roxy.domain.` and let autocomplete show available methods. Method names come from `operationId` in the OpenAPI spec, not URL paths.
139+
- **Do not use raw `fetch`.** The SDK handles auth headers, base URL, and typed responses.
140+
- **Do not expose API keys client-side.** Call Roxy from server code, API routes, or server components only.
141+
- **Chart endpoints need coordinates.** Use `roxy.location.searchCities()` to get latitude/longitude before calling any birth chart or panchang method.
142+
- **Date format is `YYYY-MM-DD`, time is `HH:MM:SS`.** Both are strings. Timezone is optional (IANA format like `America/New_York`).
143+
- **All list endpoints may return paginated objects** (e.g. `{ items: [...], total: N }`) rather than raw arrays. Check the type.
144+
- **`data` and `error` are mutually exclusive.** If `error` is set, `data` is `undefined` and vice versa.
141145

142146
## Links
143147

144148
- Full method reference: `docs/llms-full.txt` (bundled in this package)
145149
- Interactive API docs: https://roxyapi.com/api-reference
146150
- Pricing and API keys: https://roxyapi.com/pricing
147-
- MCP setup for AI agents: https://roxyapi.com/docs/mcp
151+
- MCP for AI agents: https://roxyapi.com/docs/mcp

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![API Reference](https://img.shields.io/badge/api%20reference-roxyapi.com-blue)](https://roxyapi.com/api-reference)
66
[![Pricing](https://img.shields.io/badge/pricing-roxyapi.com-blue)](https://roxyapi.com/pricing)
77

8-
TypeScript SDK for [RoxyAPI](https://roxyapi.com). 8 domains, 120+ endpoints, one API key.
8+
TypeScript SDK for [RoxyAPI](https://roxyapi.com). Multiple domains, fully typed endpoints, one API key.
99

1010
Build astrology apps, tarot platforms, birth chart generators, and compatibility tools without writing a single calculation.
1111

@@ -107,7 +107,18 @@ if (error) {
107107

108108
## TypeScript
109109

110-
Every request and response is fully typed. IDE autocomplete shows available methods per domain and exact parameter shapes:no docs tab needed.
110+
Every request and response is fully typed. IDE autocomplete shows available methods per domain and exact parameter shapes — no docs tab needed.
111+
112+
## AI agents (Cursor, Claude Code, Copilot, Codex)
113+
114+
This package ships with bundled documentation that AI coding agents can read directly from `node_modules/`:
115+
116+
- **`AGENTS.md`** — Quick start, patterns, gotchas, and a common tasks reference table
117+
- **`docs/llms-full.txt`** — Complete method reference with code examples for every domain
118+
119+
AI agents that support `AGENTS.md` (Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Gemini CLI) will read it automatically. For other tools, point your agent to `node_modules/@roxyapi/sdk/AGENTS.md`.
120+
121+
Also available: [MCP server](https://roxyapi.com/docs/mcp) for AI agents that support the Model Context Protocol.
111122

112123
## Links
113124

docs/llms-full.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @roxyapi/sdk — Complete Method Reference
22

3-
> TypeScript SDK for RoxyAPI. 8 spiritual/metaphysical domains, 113 typed endpoints, zero runtime dependencies. Install: `npm install @roxyapi/sdk`
3+
> TypeScript SDK for RoxyAPI. Multi-domain spiritual and metaphysical intelligence API. Fully typed, zero runtime dependencies. Install: `npm install @roxyapi/sdk`
44

55
Every method returns `{ data, error, response }`. Parameters use `{ path }` for URL segments, `{ body }` for POST data, `{ query }` for query strings.
66

@@ -13,7 +13,7 @@ const roxy = createRoxy(process.env.ROXY_API_KEY!);
1313

1414
## Astrology (Western) — `roxy.astrology`
1515

16-
23 methods. Tropical zodiac, Placidus houses, NASA JPL DE405 validated positions.
16+
Tropical zodiac, Placidus houses, NASA JPL DE405 validated positions.
1717

1818
### Horoscopes
1919

@@ -149,7 +149,7 @@ const { data } = await roxy.astrology.getMoonCalendar({ path: { year: 2026, mont
149149

150150
## Vedic Astrology — `roxy.vedicAstrology`
151151

152-
42 methods. Sidereal zodiac (Lahiri ayanamsa), Placidus houses, KP system support.
152+
Sidereal zodiac (Lahiri ayanamsa), Placidus houses, KP system support.
153153

154154
### Birth Charts
155155

@@ -389,7 +389,7 @@ const { data } = await roxy.vedicAstrology.calculateShadbala({
389389

390390
## Tarot — `roxy.tarot`
391391

392-
10 methods. 78-card Rider-Waite-Smith deck (22 Major Arcana, 56 Minor Arcana).
392+
78-card Rider-Waite-Smith deck (22 Major Arcana, 56 Minor Arcana).
393393

394394
```typescript
395395
// List all 78 cards
@@ -429,7 +429,7 @@ const { data } = await roxy.tarot.castCustomSpread({
429429

430430
## Numerology — `roxy.numerology`
431431

432-
13 methods. Pythagorean system.
432+
Pythagorean system.
433433

434434
```typescript
435435
// Life Path number
@@ -492,7 +492,7 @@ const { data } = await roxy.numerology.getDailyNumber({ body: { date: '2026-03-2
492492

493493
## Crystals — `roxy.crystals`
494494

495-
12 methods. Healing properties, zodiac/chakra associations, birthstones.
495+
Healing properties, zodiac/chakra associations, birthstones.
496496

497497
```typescript
498498
// All crystals (paginated)
@@ -536,7 +536,7 @@ const { data } = await roxy.crystals.listCrystalPlanets();
536536

537537
## I Ching — `roxy.iching`
538538

539-
9 methods. 64 hexagrams, 8 trigrams, traditional coin casting.
539+
64 hexagrams, 8 trigrams, traditional coin casting.
540540

541541
```typescript
542542
// Cast a reading (3-coin method)
@@ -572,7 +572,7 @@ const { data } = await roxy.iching.getTrigram({ path: { identifier: 'heaven' } }
572572

573573
## Angel Numbers — `roxy.angelNumbers`
574574

575-
4 methods. 43 angel numbers with spiritual meanings.
575+
Angel numbers with spiritual meanings and pattern analysis.
576576

577577
```typescript
578578
// All angel numbers
@@ -592,7 +592,7 @@ const { data } = await roxy.angelNumbers.getDailyAngelNumber();
592592

593593
## Dreams — `roxy.dreams`
594594

595-
5 methods. 2,000+ dream symbol dictionary.
595+
Dream symbol dictionary and interpretations.
596596

597597
```typescript
598598
// Search symbols
@@ -615,7 +615,7 @@ const { data } = await roxy.dreams.getDailyDreamSymbol({ body: { date: '2026-03-
615615

616616
## Location — `roxy.location`
617617

618-
3 methods. Geocoding helper for birth chart coordinates.
618+
Geocoding helper for birth chart coordinates.
619619

620620
```typescript
621621
// Search cities (autocomplete)
@@ -633,7 +633,7 @@ const { data } = await roxy.location.getCitiesByCountry({ path: { iso2: 'IN' } }
633633

634634
## Usage — `roxy.usage`
635635

636-
1 method. Check your API usage and subscription.
636+
Check your API usage and subscription.
637637

638638
```typescript
639639
const { data } = await roxy.usage.getUsageStats();

0 commit comments

Comments
 (0)