All skills
apollographql avatar

/apollo-connectors

@55e7707 official
by Apollo GraphQLapollographql/skills115 stars
13

Guide for integrating REST APIs into GraphQL supergraphs using Apollo Connectors with @source and @connect directives. Use this skill when the user: (1) mentions "connectors", "Apollo Connectors", or "REST Connector", (2) wants to integrate a REST API into GraphQL, (3) references @source or @connect directives, (4) works with files containing "# Note to AI Friends: This is an Apollo Connectors schema".

Use this Skill: https://skilld.dev/gh/apollographql/skills/apollo-connectors

This session only. Nothing lands on disk.

referencesmethods.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Available Methods

Methods are invoked using the -> operator. You MUST NOT make up method names - only use methods listed here.

Table of Contents

String Methods

Method Description Example
slice Returns a slice of a string firstTwo: countryCode->slice(0, 2)
size Returns the length of a string length: word->size

Object Methods

Method Description Example
entries Returns a list of key-value pairs pairs: object->entries
size Returns the number of properties count: object->size

Array Methods

Method Description Example
filter Returns items matching criteria even: numbers->filter(@->mod(2)->eq(0))
find Returns first matching item first: items->find(@.active)
first Returns the first item first: colors->first
get Returns item at index or key third: items->get(2)
joinNotNull Joins strings, ignoring nulls full: $([a, b])->joinNotNull(' ')
last Returns the last item last: colors->last
map Transforms each item wrapped: items->map({ name: @ })
slice Returns a slice of the array firstTwo: items->slice(0, 2)
size Returns the array length count: items->size

Array Method Examples

filter - Filter items by condition:

# Keep items where active is true
$.items->filter(@.active)

# Keep even numbers
$.numbers->filter(@->mod(2)->eq(0))

# Chain filters instead of using ->and
$.items->filter(@.active)->filter(@.price->gt(10))

find - Find first matching item:

# Find first active item
$.items->find(@.active)

# Find item with specific id
$.items->find(@.id->eq($args.id))

map - Transform items:

# Wrap each item
$.items->map({ value: @ })

# Extract nested field
$.users->map(@.profile.name)

joinNotNull - Concatenate strings:

# Join name parts with space
fullName: $([firstName, middleName, lastName])->joinNotNull(' ')

# Join address parts with comma
address: $([street, city, state])->joinNotNull(', ')

Logical Methods

Method Description Example
and True if all values are true both: a->and(b, c)
contains True if array contains value hasRed: colors->contains("red")
eq True if equal to argument isActive: status->eq("active")
gt True if greater than large: size->gt(100)
gte True if greater than or equal atLeast: count->gte(10)
in True if value is in list valid: status->in("a", "b", "c")
lt True if less than small: size->lt(50)
lte True if less than or equal within: count->lte(100)
ne True if not equal notEmpty: value->ne("")
not Inverts boolean inactive: isActive->not
or True if any value is true either: a->or(b)

Logical Method Examples

Comparisons:

# Check equality
isAdmin: role->eq("admin")

# Check inequality
notEmpty: value->ne("")

# Numeric comparisons
expensive: price->gt(100)
affordable: price->lte(50)

Boolean logic:

# AND - all must be true
valid: a->and(b, c)

# OR - any can be true
hasAccess: isAdmin->or(isOwner)

# NOT - invert
hidden: visible->not

Membership:

# Check if value is in list
validStatus: status->in("pending", "active", "complete")

# Check if array contains value
hasPremium: features->contains("premium")

Math Methods

Method Description Example
add Addition total: price->add(tax)
div Division avg: sum->div(count)
mod Modulo (remainder) rem: num->mod(5)
mul Multiplication area: width->mul(height)
sub Subtraction diff: total->sub(discount)

Math Method Examples

# Calculate total with tax
totalWithTax: subtotal->mul(1.08)

# Calculate average
average: total->div(count)

# Check if even
isEven: number->mod(2)->eq(0)

# Apply discount
finalPrice: price->sub(discount)

Type Coercion

Method Description Example
parseInt Convert to Int count: strCount->parseInt
toString Convert to String id: numId->toString

Type Coercion Examples

# String to integer
count: "42"->parseInt

# Integer to string for ID field
id: numericId->toString

# Parse and calculate
total: strPrice->parseInt->add(tax->parseInt)

Other Methods

Method Description Example
echo Returns its argument wrapped: value->echo({ data: @ })
jsonStringify Convert to JSON string json: obj->jsonStringify
match Replace value based on matches status: code->match([1, "one"], [2, "two"], [@, "other"])

Other Method Examples

echo - Useful for wrapping values:

# Wrap a value in an object
wrapped: items->echo({ data: @ })

# Use with transformations
result: value->echo({ original: @, doubled: @->mul(2) })

match - Map values to new values:

# Map status codes to strings
statusText: status->match(
  [1, "pending"],
  [2, "active"],
  [3, "complete"],
  [@, "unknown"]
)

# Map boolean to text
activeText: isActive->match(
  [true, "Yes"],
  [false, "No"]
)

jsonStringify - Convert to JSON:

# Serialize object for logging
serialized: data->jsonStringify

Source: SKILL.md on GitHub

1 warning6d5 checks · Risk SAFE
  • Gen Agent Trust Hub6d

    The skill is a comprehensive documentation and assistance tool for Apollo Connectors. It adheres to security best practices by using environment variables for secret management, restricted command execution via the rover CLI, and fetching resources from official vendor domains.

  • Socket6d

    No alerts

  • Snyk6d

    Risk: LOW · No issues

  • Runlayer7mo

    7/7 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 55e7707. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week
What it can do
Runs commands
metadata
{
  "author": "apollographql",
  "version": "1.0.1"
}
All 1 allowed tools
Bash(rover:*) Read Write Edit Glob Grep
Other metadata
compatibility
Requires rover CLI installed. Works with Claude Code and similar AI coding assistants.
  • graphql
  • apollo
  • rest-api
  • connectors
  • federation
  • schema
  • integration

README badge

README badge for apollographql/skills/apollo-connectors

Integrates REST APIs into GraphQL supergraphs using Apollo Connectors with @source and @connect directives. Targets the rover CLI workflow and follows a five-step process: research the API, implement the schema, validate with rover compose, execute with rover connector run, and test coverage.

Generated from the current SKILL.md.

What versions of Apollo federation and connectors does this skill support?
The skill uses federation v2.12 and connect v0.3 by default unless you specify otherwise.
Do I need rover CLI installed to use this skill?
Yes. The skill requires rover CLI installed and uses commands like `rover supergraph compose`, `rover connector run`, and `rover connector test`.
Can this skill integrate any REST API into GraphQL?
Yes. The skill handles REST API integration using @source and @connect directives, supporting GET/POST requests, headers, batching, and response field mapping.
Does this skill handle entity relationships and N+1 query patterns?
Yes. The skill creates entity relationships when ID fields are present and converts N+1 patterns using batching with the $batch variable.
What happens if composition or connector execution fails?
The skill follows a 5-step validation process that runs `rover supergraph compose` after schema changes and `rover connector run` before testing, catching errors before they reach production.

Generated from the current SKILL.md. These answers refresh after source changes.