Skip to content

Commit 8046901

Browse files
committed
fix(docs): verify all PHP examples in README + AGENTS against spec, add agent quality guidelines
1 parent d806e50 commit 8046901

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,11 @@ expect($roxy->astrology->getDailyHoroscope(sign: 'aries'))->toBe([
244244
- MCP for AI agents: <https://roxyapi.com/docs/mcp>
245245
- Sibling SDKs: TypeScript (`@roxyapi/sdk`), Python (`roxy-sdk`)
246246
- UI components: <https://github.com/roxyapi/ui>
247+
248+
## Quality guidelines for agents
249+
250+
- This SDK returns `array<string, mixed>` from every method. Access fields with `$result['key']['subkey']`, never `$result->key->subkey`. Object syntax throws `Error: Attempt to read property "key" on array`.
251+
- Method names match the OpenAPI spec's `operationId` verbatim (already camelCase). Params are camelCase named arguments matching the spec's `requestBody.properties`, path, and query names. Response field names match the spec's `responses.200.content.application/json.schema.properties` (drill into nested `.properties` for sub-objects, `.items.properties` for array items).
252+
- Sub-objects are arrays, not scalars. The natal-chart `ascendant` is `['sign' => ..., 'degree' => ...]`, not a string — `echo $chart['ascendant']['sign']`, not `echo $chart['ascendant']`.
253+
- `RoxyApiException` is a real PHP object — `$e->statusCode`, `$e->errorCode`, `$e->error` use object syntax. Only successful response payloads are arrays.
254+
- When in doubt, check the SDK source: `vendor/roxyapi/sdk/src/Generated/Resources/<Tag>Resource.php` lists every method with its full signature, and `vendor/roxyapi/sdk/specs/openapi.json` is the authoritative shape. Never invent method names, parameter names, or response fields.

0 commit comments

Comments
 (0)