mcpField
A
add-to-existing-project

add-to-existing-project

github.com/tambo-aiDevelopment11.2k94 installsUpdated 3w ago
Repository

About add-to-existing-project

A skill for adding Tambo to an existing React project. It detects the stack and guides dependency installation, provider setup, and registration of an existing component while following project patterns.

Key features

  1. 01Detects frameworks and project configuration
  2. 02Confirms detected setup and preferences
  3. 03Installs Tambo and required dependencies
  4. 04Sets up provider to fit project patterns
  5. 05Registers an existing component

Use cases

  1. 01Integrating Tambo into an existing app
  2. 02Adapting setup to a Next.js router
  3. 03Adding Tambo without replacing established conventions

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/tambo-ai/tambo --skill add-to-existing-project

After installing, type/add-to-existing-projectin Claude Code to confirm it loaded.

Details

From the project README

Add Tambo to Existing Project

Detect tech stack and integrate Tambo while preserving existing patterns.

Workflow

  1. Detect tech stack - Analyze package.json and project structure
  2. Confirm with user - Present findings, ask about preferences
  3. Install dependencies - Add @tambo-ai/react and peer deps
  4. Create provider setup - Adapt to existing patterns
  5. Register first component - Demonstrate with existing component

Step 1: Detect Tech Stack

Check these files to understand the project:

# Key files to read
package.json           # Dependencies and scripts
tsconfig.json          # TypeScript config
next.config.*          # Next.js
vite.config.*          # Vite
tailwind.config.*      # Tailwind CSS
postcss.config.*       # PostCSS
src/index.* or app/    # Entry points
Detection Checklist
TechnologyDetection
Next.jsnext in dependencies, next.config.* exists
Vitevite in devDependencies, vite.config.* exists
Create React Appreact-scripts in dependencies
TypeScripttypescript in deps, tsconfig.json exists
Tailwindtailwindcss in deps, config file exists
Plain CSSNo Tailwind, CSS files in src/
Zodzod in dependencies
Other validationyup, joi, superstruct in deps

Step 2: Confirm with User

Present findings and ask:

I detected your project uses:
- Framework: Next.js 14 (App Router)
- Styling: Tailwind CSS
- Validation: No Zod (will need to add)
- TypeScript: Yes

Should I:
1. Install Tambo with these settings?
2. Use plain CSS instead of Tailwind for Tambo components?
3. Something else?

Step 3: Install Dependencies

# Core (always required)
npm install @tambo-ai/react

# If no Zod installed
npm install zod

Step 4: Create Provider Setup

Next.js App Router
// app/providers.tsx
"use client";
import { TamboProvider } from "@tambo-ai/react";
import { components } from "@/lib/tambo";

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <TamboProvider
      apiKey={process.env.NEXT_PUBLIC_TAMBO_API_KEY}
      components={components}
    >
      {children}
    </TamboProvider>
  );
}
// app/layout.tsx
import { Providers } from "./providers";

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}
Next.js Pages Router
// pages/_app.tsx
import { TamboProvider } from "@tambo-ai/react";
import { components } from "@/lib/tambo";

export default function App({ Component, pageProps }) {
  return (
    <TamboProvider
      apiKey={process.env.NEXT_PUBLIC_TAMBO_API_KEY}
      components={components}
    >
      <Component {...pageProps} />
    </TamboProvider>
  );
}
Vite / CRA
// src/main.tsx
import { TamboProvider } from "@tambo-ai/react";
import { components } from "./lib/tambo";
import App from "./App";

ReactDOM.createRoot(document.getElementById("root")!).render(
  <TamboProvider
    apiKey={import.meta.env.VITE_TAMBO_API_KEY}
    components={components}
  >
    <App />
  </TamboProvider>,
);

Step 5: Create Component Registry

// lib/tambo.ts (or src/lib/tambo.ts)
import { TamboComponent } from "@tambo-ai/react";

export const components: TamboComponent[] = [
  // Components will be registered here
];

Adapting to Existing Patterns

No Tailwind? Use Plain CSS

If project uses plain CSS or CSS modules, Tambo components can be styled differently:

// Skip --yes flag to customize styling during add
npx tambo add message-thread-full
# Select "CSS Modules" or "Plain CSS" when prompted
Existing Validation Library?

If using Yup/Joi instead of Zod, user can either:

  1. Add Zod just for Tambo schemas (recommended - small addition)
  2. Convert schemas (more work, not recommended)
Monorepo?

Run commands from the package that will use Tambo:

cd packages/web
npx tambo init --api-key=sk_...

Environment Variables

npx tambo init --api-key=sk_... automatically creates .env.local with the correct env var for your framework.

If manual setup is needed (monorepo, read-only filesystem), add the appropriate variable:

FrameworkVariable
Next.jsNEXT_PUBLIC_TAMBO_API_KEY
ViteVITE_TAMBO_API_KEY
CRAREACT_APP_TAMBO_API_KEY

Verification

After setup, verify by creating a simple test:

import { useTambo } from "@tambo-ai/react";

function TestComponent() {
  const { thread, isIdle } = useTambo();
  console.log("Tambo connected:", isIdle);
  return <div>Tambo is set up!</div>;
}

Comments

Markdown supported