Skip to content
Back to skills

Api Integration

ASecurity

Implement REST route handlers, ORM queries, WebSocket telemetry, or SSE endpoints in the main web app, or consume those APIs from clients. NOT for schema-only changes or deployment/infra config.

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
ai-agentsapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add atretyak1985/swarmery --skill api-integration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Integration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Integration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/atretyak1985-api-integration/badge)](https://www.skillsdirectory.com/skills/atretyak1985-api-integration)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-integration
description: "Implement REST route handlers, ORM queries, WebSocket telemetry, or SSE endpoints in the main web app, or consume those APIs from clients. NOT for schema-only changes or deployment/infra config."
version: "1.0.0"
owner: "swarmery-core"
allowed-tools: Read, Write, Grep, Glob
docs:
  status: reviewed
  source_sha: 608ee7571769
  updated: 2026-08-06
---

# Purpose

Produce tested integration code connecting the platform's layers: REST route handlers in the main app (project.json -> `mainApp`), ORM queries, server-side WebSocket clients for device/edge telemetry (project.json -> `device`), and SSE endpoints fanning real-time data to browsers. Generated code follows project conventions; patterns use Drizzle ORM — adapt to the project's actual ORM (project.json -> `stack.db`).

# Rules (never violate)

- Verify the real ORM schema before writing; STOP and ask if table or column names are missing or ambiguous — never code against a guessed schema.
- Always `getDb()` (lazy init), `await auth()` with 401 on authenticated routes, `dynamic = 'force-dynamic'` on session/env-reading routes, Zod on all external data.
- Never hardcode environment-specific values (URLs, hostnames, API keys) — use `getServerEnv()`; refuse if asked.
- Every `useEffect` opening an EventSource/WebSocket returns a cleanup function.
- Never overwrite an existing file without reading it and informing the user first.
- After any write, run `api-contract` to verify field alignment across layers.

# Resources

- Read `resources/integration-patterns.md` when writing code — the six reference patterns (REST handler, ORM queries, lazy DB init, WebSocket, SSE, EventSource hook).
- Read `resources/procedure-and-checks.md` when executing a task — the 8-step procedure, self-check, common mistakes, escalation, failure modes, and a full worked example.

# How to use

## What it does

Writes the integration code connecting your layers: a REST route handler, an ORM query, a server-side WebSocket client ingesting device telemetry, or an SSE endpoint fanning it out. It checks your real schema before writing, then applies project conventions throughout.

## When to use it

- A new route handler under `apps/<mainApp>/src/app/api/**/route.ts`.
- An ORM select, insert, update, or delete in a handler or Server Component.
- A WebSocket telemetry subscription, SSE endpoint, or browser `EventSource` hook.

Not for schema-only changes (`api-contract`), deploy manifests (the project's infra pack skills), style review (`code-standards`/`code-quality`), or metrics/tracing (compose with `observability`).

## How to invoke

```
Skill(skill: "core:api-integration")
```

Describe the integration in plain words: `task` (required), `entity` (required), and optionally `integration_type` (`rest`, `orm`, `websocket`, `sse`) — inferred when omitted.

## Worked example

```
Skill(skill: "core:api-integration")
"Add a route handler to get a single order by ID with its line items."
```

The skill greps the schema to confirm the `orders` and join tables exist, globs the target path to check nothing gets overwritten, then writes the handler: session check, ID parsed with 400 on bad input, a `getDb()` query with two left joins, 404 on empty result. You get the file path, the pattern applied, and an `api-contract` check confirming field alignment.

## Related

- `api-contract` — mandatory after any write; `code-standards`/`code-quality` — review existing code; `observability` — metrics and tracing.

Files in this skill

  • SKILL.md3.5 KB
  • resources/integration-patterns.md4.8 KB
  • resources/procedure-and-checks.md7.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.