platform-api-integration

Integrate Rubin Science Platform APIs from OpenAPI specifications with TypeScript and SWR hooks.

2|1|Updated Jan 7, 2021
One-click install
npx skills add https://github.com/lsst-sqre/squareone --skill platform-api-integration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: platform-api-integration
Source: https://github.com/lsst-sqre/squareone/tree/main/.claude/skills/platform-api-integration
Command: npx skills add https://github.com/lsst-sqre/squareone --skill platform-api-integration

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react, swr, next.js, and includes examples (resource) and references (resource) components.

What problem does it solve?

Integrating with multiple Rubin Science Platform (RSP) APIs, each with its own OpenAPI specification and authentication patterns, can be complex and time-consuming. This skill provides a comprehensive guide to streamline API discovery, type generation, data fetching, and mock API development.

Core Features & Use Cases

  • OpenAPI-Driven Integration: Guides on using OpenAPI specifications to discover endpoints, generate TypeScript types, and understand API schemas for Gafaelfawr (authentication) and Times Square (notebooks).
  • SWR-Based Data Fetching: Provides patterns for implementing robust, cached data fetching hooks with SWR, including error handling, polling, and pagination.
  • Authentication & Mocking: Covers handling Gafaelfawr's CSRF tokens, cookie-based authentication, and setting up mock API endpoints for efficient local development.
  • Use Case: When building a new feature that requires user authentication and token management from Gafaelfawr, use this skill to quickly find the relevant OpenAPI specs, generate types, implement SWR hooks with CSRF token handling, and set up local mocks.

Quick Start

Discover all available endpoints and their descriptions for the Gafaelfawr authentication API. WebFetch({ url: 'https://gafaelfawr.lsst.io/_static/openapi.json', prompt: 'Show me all endpoints and their descriptions' })

Frequently Asked Questions about platform-api-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate TypeScript types from OpenAPI specifications for RSP APIs?

TypeScript type generation from OpenAPI specs enables end-to-end type safety across API integrations. This Skill covers extracting OpenAPI specifications from RSP services like Gafaelfawr and Times Square, then generating corresponding TypeScript types to match endpoint schemas, reducing runtime errors and improving IDE autocomplete.

How do I set up SWR-based data fetching hooks for RSP API endpoints?

SWR-based hooks provide cached, automatic data fetching for API calls. This Skill guides implementing robust hooks with built-in error handling, polling, and pagination patterns, then integrating them into React and Next.js components to fetch data from RSP endpoints efficiently.

How do I handle CSRF tokens and cookie-based authentication with Gafaelfawr?

Gafaelfawr authentication requires CSRF token management and secure cookie handling. This Skill covers retrieving CSRF tokens from Gafaelfawr's OpenAPI specification, implementing token injection patterns, and configuring SWR hooks to automatically include cookies in authenticated requests.

Can I create mock APIs locally to test RSP integrations before deployment?

Mock API endpoints allow testing without hitting live services. This Skill provides patterns for setting up local mock API servers that replicate RSP endpoint behavior, enabling end-to-end integration testing during development and reducing dependency on staging environments.

What's the fastest way to discover all available RSP API endpoints and their parameters?

OpenAPI specifications provide complete endpoint documentation and parameter schemas. This Skill shows retrieving OpenAPI JSON from RSP services, parsing available endpoints, and understanding required and optional parameters to quickly identify the endpoints needed for your feature.

Does this Skill work with Next.js and React applications?

Yes. This Skill is built on React, SWR, and Next.js dependencies, providing patterns and examples specifically for Next.js applications and React components integrating with RSP APIs using these frameworks.

Related Skills