Skip to content

AI Integration Guide

AI-Friendly Documentation

Rebuy provides machine-readable documentation indexes designed for AI assistants and LLM-powered development tools.

llms.txt Files

File Size URL Purpose
Index 17.3KB llms.txt Compact index with page descriptions
Full Content 963.3KB llms-full.txt Complete documentation dump

Use the index for quick lookups. Use full content when you need deep context.

On-Page AI Menu

Every documentation page includes an Ask AI dropdown below the title with these options:

Option Action
Ask Claude Opens Claude.ai with the page pre-loaded for Q&A
Ask ChatGPT Opens ChatGPT with the page pre-loaded for Q&A
Copy MD Copies the page's raw markdown to your clipboard
View MD Opens the raw markdown file in a new tab

The View MD option is useful when you want to share a direct link to the markdown source, or when using tools that prefer raw markdown URLs.

Using with AI Tools

Claude Code

Option 1: Fetch llms.txt for context:

curl -s https://developers.rebuyengine.com/llms.txt

Option 2: Install the skill for guided workflows:

mkdir -p .claude/skills/building-rebuy-features
curl -o .claude/skills/building-rebuy-features/SKILL.md \
  https://developers.rebuyengine.com/assets/skills/building-rebuy-features.md

ChatGPT / Other LLMs

Start your conversation with:

Read https://developers.rebuyengine.com/llms.txt and use it as context for my questions.

Then ask your Rebuy integration question.

Claude.ai Projects

  1. Create a new project
  2. Add https://developers.rebuyengine.com/llms.txt as a web source
  3. Or upload the skill file as a project knowledge file

Claude Code Skill

The skill provides guided workflows for building Rebuy integrations. Download the skill directly or copy the content below to .claude/skills/building-rebuy-features/SKILL.md:

---
name: building-rebuy-features
description: >-
  Builds custom Rebuy integrations including widget templates, event listeners,
  REST API calls, Smart Cart apps, and headless/Hydrogen setups. Use when
  customizing Rebuy widgets, listening to cart events, calling the Rebuy API,
  or integrating with Shopify Hydrogen.
---

## Quick Start

1. **Fetch the documentation index:**
   ```
   https://developers.rebuyengine.com/llms.txt
   ```

2. **For complete context:**
   ```
   https://developers.rebuyengine.com/llms-full.txt
   ```

3. **Identify the feature type** below and find relevant docs in the index.

> **Note:** Documentation filenames below (e.g., `widget-custom-templates.md`) correspond to entries in llms.txt. Fetch the index to get full URLs.

## Feature Types

### Custom Widget Templates

Customize HTML/Vue.js templates for product recommendation widgets.

**Docs:** `widget-custom-templates.md`, `bundle-builder-custom-template.md`, `modal-custom-templates.md`

**Pattern:**
```html
<script type="text/template" data-rebuy-id="rebuy-recommended-template">
  <div v-if="products.length > 0" class="rebuy-widget">
    <!-- Vue.js template with Rebuy data bindings -->
  </div>
</script>

Available data: products, settings, addToCart(product), formatMoney(cents)

Smart Cart Customization

Customize the slide-out cart drawer.

Docs: smart-cart.md, smart-cart-custom-template.md, smart-cart-methods.md, smart-cart-event-listeners.md

Note: V2 Smart Cart templates are managed in the Rebuy admin UI, not code.

Event Listeners

React to Rebuy lifecycle events for custom integrations.

Docs: event-listeners.md, cart-event-listeners.md, smart-cart-event-listeners.md, widget-event-listeners.md

Pattern:

document.addEventListener('rebuy:cart.add', function(event) {
  const { cart, item } = event.detail;
  // Your custom logic
});

Common events: rebuy:cart.ready, rebuy:cart.add, rebuy:smartcart.show, rebuy:widget.ready

API Integrations

Call Rebuy REST APIs for headless or server-side integrations.

Docs: recommended.md, top-sellers.md, trending-products.md, api-custom-endpoints.md

Base URL: https://rebuyengine.com/api/v1/

curl -H "x-rebuy-api-key: YOUR_API_KEY" \
  "https://rebuyengine.com/api/v1/products/recommended?shopify_product_ids=123"

Smart Cart Apps

Build custom apps that appear inside Smart Cart.

Docs: building-your-smartcart-app.md, smart-cart-methods-smart-cart-apps.md

Headless / Hydrogen

Integrate Rebuy in headless Shopify stores.

Docs: headless-sdk-overview.md, core-sdk-getting-started.md, hydrogen-sdk-getting-started.md

NPM Packages: @rebuy/core-sdk, @rebuy/hydrogen-sdk

Public JavaScript API

The window.Rebuy object exposes:

Module Purpose
Rebuy.Cart Cart operations
Rebuy.SmartCart Smart Cart control
Rebuy.Widgets Widget management
Rebuy.SmartSearch Search functionality
Rebuy.SmartCollections Collection pages
Rebuy.util Helper functions

Common Patterns

// Listen for cart updates
document.addEventListener('rebuy:cart.change', (e) => {
  console.log('Cart updated:', e.detail.cart);
});

// Add to cart programmatically
Rebuy.Cart.addItem({ id: variantId, quantity: 1 });

// Wait for Rebuy to initialize
document.addEventListener('rebuy:ready', () => {
  console.log(Rebuy.Cart.getCart());
});

// Show/hide Smart Cart
Rebuy.SmartCart.show();
Rebuy.SmartCart.hide();

Resources

  • Full Docs: https://developers.rebuyengine.com
  • llms.txt: https://developers.rebuyengine.com/llms.txt
  • Full Context: https://developers.rebuyengine.com/llms-full.txt ```

What's in llms.txt?

The index includes entries for every documentation page:

  • API Reference - REST endpoints for recommendations, analytics, search
  • JavaScript API - Cart, Smart Cart, Widgets, Events, Utilities
  • Headless SDKs - Core SDK and Hydrogen integration
  • Custom Templates - Widget, Smart Cart, Modal templates
  • Event Listeners - All Rebuy lifecycle events

Each entry includes the page URL and a brief description to help AI tools find the right documentation quickly.

See something that needs updating? Suggest an edit