Base official convert farcaster miniapp to app

From jiayaoqijia/cryptoskill · View interactive version

Base official convert farcaster miniapp to app is an AI agent skill from the GitHub repository jiayaoqijia/cryptoskill. Converts Farcaster miniapp SDK projects into regular Base/web apps. Starts with an interactive quiz to choose between the default regular-app conversion and a narrowly isolated Farcaster surface when something truly needs to remain separate. Handles wagmi connectors, providers, auth, SDK actions, ma

How to use this skill

Skill file

Convert Farcaster Miniapp to Base App

Convert a Farcaster miniapp into a normal app on Base. The default outcome is a regular web app that works in the Base app browser and on the open web, with Farcaster Mini App host coupling removed.

If some Farcaster functionality truly needs to survive, keep it separate from the main app surface. Prefer read-only data first. Only preserve Mini App-specific behavior when the user explicitly insists, and isolate it behind a dedicated route or page rather than carrying it through the whole app.

Core Principle

Always separate these decisions:

  1. Remove Mini App host/runtime coupling.
  2. Decide whether any Farcaster-facing functionality should remain.
  3. If something remains, keep it isolated from the main app and avoid introducing new vendor dependencies by default.

Do not automatically turn "keep some Farcaster functionality" into "migrate to Neynar." If a project already uses Neynar and the user wants to keep an isolated Farcaster-only area, you may preserve that existing integration. Do not introduce new Neynar adoption as the default recommendation.

Quick Start

Follow these five phases sequentially:

  1. Discovery — Quick scan + quiz to choose a path
  2. Analysis — Detailed read-only analysis scoped to the chosen path
  3. Conversion — Remove Mini App SDK patterns and isolate any intentionally preserved Farcaster surface
  4. Cleanup — Remove dead code, env vars, and dependencies
  5. Verification — Type check, build, and summarize

Conversion Paths

The quiz should route the user into one of two paths:

| Path | Name | Who it's for | What happens |

|------|------|-------------|-------------|

| A | Regular App Default | Most projects | Strip Farcaster Mini App coupling and become a normal Base/web app |

| B | Isolated Farcaster Surface | The app still needs a small Farcaster-specific area | Convert the main app into a normal app, then keep only a separate Farcaster route/page for the remaining functionality |

Path B is still biased toward removing complexity:


Phase 0: Discovery

0A. Quick Scan (automated, no user interaction)

Run a lightweight scan before asking questions. Produce an internal tally:

  1. Detect framework from package.json (next, vite, react-scripts, @remix-run/*)
  2. Count Farcaster packages in dependencies and devDependencies
  3. Grep source files (.ts, .tsx, .js, .jsx) for:
  1. Identify the blast radius:

Use this tally to inform quiz suggestions. Do not dump raw scan output to the user before asking the quiz.

0B. Interactive Quiz

Ask these questions one at a time. Use the quick scan results to suggest the most likely answer.

Q1 (always ask):

Based on my scan, your project has [X] files using the Farcaster SDK with [summary of what is used].

Which outcome do you want?

- (a) Regular app everywhere — remove Farcaster-specific behavior and just keep a normal Base/web app

- (b) Regular app first, plus a separate Farcaster area — keep the main app clean, but preserve a small isolated route/page if really needed

Q2 (always ask):

How deeply is the Mini App SDK used today?

- (a) Minimal — mostly sdk.actions.ready() and a few helpers

- (b) Moderate — some context, openUrl, profile links, or conditional isInMiniApp logic

- (c) Heavy — auth, wallet connector, notifications, compose flows, or host-specific behavior

Q3 (ask if Q1 = b):

What is the smallest Farcaster feature set you actually need to preserve?

- (a) Read-only only — profile or cast display, links out to Farcaster profiles, maybe a small social page

- (b) Some Farcaster-specific interactions — there is a separate page/path that still needs more than read-only behavior

- (c) Not sure — analyze what is isolated already and recommend the smallest keep-surface possible

Q4 (ask if Q1 = b and there is existing isolated Farcaster code or existing Neynar usage):

Does the project already have an isolated Farcaster-only route/page or integration that you want to keep as-is if possible?

- (a) Yes — preserve only that isolated surface

- (b) No — prefer removing it unless there is a very strong reason to keep it

Q5 (ask if quick auth or other Mini App auth is present):

After conversion, what should the main app use for authentication?

- (a) SIWE — wallet-based auth for the regular app

- (b) Existing non-Farcaster auth — keep whatever normal web auth already exists

- (c) No auth — remove auth entirely

0C. Path Selection

Map answers to a path:

| Desired outcome | Typical result |

|-----------------|----------------|

| Q1 = regular app everywhere | Path A — Regular App Default |

| Q1 = regular app first, plus separate Farcaster area | Path B — Isolated Farcaster Surface |

Then tighten the recommendation:

Announce the chosen path:

Based on your answers, I'll use Path [X]: [Name]. This will [one-sentence description]. I'll now do a detailed analysis of your project.

Record the quiz answers internally. They guide whether the agent should:

Proceed to Phase 1.


Phase 1: Analysis (Read-Only)

1A. Detect Framework

Read package.json:

1B. Scan for Farcaster Dependencies

List all packages matching:

1C. Grep for Farcaster Code

Search source files (.ts, .tsx, .js, .jsx) for:

SDK imports:

@farcaster/miniapp-sdk
@farcaster/miniapp-core
@farcaster/miniapp-wagmi-connector
@farcaster/frame-sdk
@farcaster/frame-wagmi-connector
@farcaster/quick-auth
@farcaster/auth-kit
@neynar/

SDK calls:

sdk.actions.ready
sdk.actions.openUrl
sdk.actions.close
sdk.actions.composeCast
sdk.actions.addMiniApp
sdk.actions.requestWalletAddress
sdk.actions.viewProfile
sdk.actions.viewToken
sdk.actions.sendToken
sdk.actions.swapToken
sdk.actions.signIn
sdk.actions.setPrimaryButton
sdk.actions.openMiniApp
sdk.quickAuth
sdk.context
sdk.isInMiniApp
sdk.getCapabilities
sdk.haptics
sdk.back
sdk.wallet

Connectors & providers:

farcasterMiniApp()
miniAppConnector()
farcasterFrame()
MiniAppProvider
MiniAppContext
useMiniApp
useMiniAppContext

Manifest & meta:

.well-known/farcaster.json
fc:miniapp
fc:frame

Environment variables:

NEYNAR_API_KEY
NEXT_PUBLIC_NEYNAR_CLIENT_ID
FARCASTER_
FC_

1D. Check Existing Web3 Setup

Look for:

1E. Check Separation Boundaries

Map where Farcaster logic currently lives:

Mark each location with one action:

1F. Report Findings

Create a path-scoped summary.

All paths include:

## Conversion Analysis — Path [X]: [Name]

**Framework:** [detected]
**Farcaster packages:** [list]
**Files with Farcaster code:** [count]

### Wagmi Connector
- File: [path]
- Current connector: [farcasterMiniApp / miniAppConnector / farcasterFrame / none]
- Other connectors: [list]
- Action: [replace with coinbaseWallet / leave existing wallet setup / remove only]

### MiniApp Provider
- File: [path]
- Pattern: [simple / complex]
- Consumers: [files importing from this]
- Action: [stub / remove / isolate]

### SDK Action Calls
[list each: file, what it does, action]

### Manifest & Meta
- Manifest route: [path or N/A]
- Meta tags: [file or N/A]

Path A additionally includes:

### Main App Outcome
- Action: remove Farcaster-specific UI and flows from the main app entirely

### Authentication
- Quick Auth used: [yes/no, file]
- Action: replace with SIWE / keep existing non-Farcaster auth / remove

### Existing Neynar Usage
- Package or files: [list or N/A]
- Action: remove entirely unless the user later re-scopes to Path B

### Environment Variables
[list all FC/Neynar vars that will be removed]

Path B additionally includes:

### Main App Outcome
- Action: convert the main app into a normal web app first

### Isolated Farcaster Surface
- Route/page to keep: [path or proposed path]
- Scope: [read-only / mixed / host-specific]
- Recommended target scope: [prefer read-only / quarantine existing behavior / remove]

### Authentication
- Quick Auth used: [yes/no, file]
- Main app action: replace with SIWE / keep existing non-Farcaster auth / remove
- Isolated Farcaster surface action: [remove auth coupling / preserve existing isolated flow only if explicitly requested]

### Existing Neynar Usage
- Package or files: [list or N/A]
- Action: [remove / keep only inside isolated surface]

### Environment Variables
- Remove from main app: [FC_*, FARCASTER_*, etc.]
- Keep only if isolated surface truly still needs them: [NEYNAR_API_KEY, etc. or N/A]

All paths end with:

### Potential Issues
- [ ] FID used as database primary key
- [ ] Farcaster colors in tailwind config
- [ ] `isInMiniApp` branches with unique else logic
- [ ] Components only meaningful inside Farcaster
- [ ] Farcaster code mixed into shared providers or root layout

Ask:

Does this analysis look correct? Ready to proceed with conversion?

STOP and wait for user confirmation before Phase 2.


Phase 2: Conversion

Steps are organized by feature area. Each step notes which paths it applies to and what to do differently for Path B.

2A. Wagmi Connector (All Paths)

Find the wagmi config file (lib/wagmi.ts, config/wagmi.ts, providers/wagmi-provider.tsx, etc.):

  1. Remove import of farcasterMiniApp or miniAppConnector from @farcaster/miniapp-wagmi-connector
  2. Remove the farcasterMiniApp() / miniAppConnector() call from the connectors array
  3. If no wallet connector remains, add:

```typescript

import { coinbaseWallet } from "wagmi/connectors";

coinbaseWallet({ appName: "<app name>" })

```

  1. If coinbaseWallet already exists, leave it as-is
  2. Clean up empty lines and stale imports

Skip this step if wagmi is not in the project.

2B. MiniApp Provider / Context (All Paths)

If the app has a shared Mini App provider, remove host/runtime assumptions from the main app.

Pattern A: simple provider

Replace with a safe stub:

'use client'

import React, { createContext, useContext, useMemo } from "react";

interface MiniAppContextType {
  context: undefined;
  ready: boolean;
  isInMiniApp: boolean;
}

const MiniAppContext = createContext<MiniAppContextType | undefined>(undefined);

export function useMiniAppContext() {
  const context = useContext(MiniAppContext);
  if (context === undefined) {
    throw new Error("useMiniAppContext must be used within a MiniAppProvider");
  }
  return context;
}

export default function MiniAppProvider({ children }: { children: React.ReactNode }) {
  const value = useMemo(
    () => ({
      context: undefined,
      ready: true,
      isInMiniApp: false,
    }),
    []
  );

  return <MiniAppContext.Provider value={value}>{children}</MiniAppContext.Provider>;
}

Preserve export style and hook names so consumers do not break.

Pattern B: complex provider

2C. Authentication

The main app should use normal web auth, not Mini App auth.

Default rule for both paths:

SIWE Replacement Pattern

Client-side (e.g. useSignIn.ts):

1. Get wallet address from useAccount() (wagmi)

2. Create a SIWE message with siwe

3. Sign with useSignMessage() (wagmi)

4. Send signature + message to the backend for verification

Server-side (e.g. app/api/auth/sign-in/route.ts):

1. Parse the SIWE message

2. Verify the signature with siwe or viem

3. Use recovered wallet address as the normal app identity

If FID is used as a database primary key:

Path B note:

2D. SDK Action Calls

2D-1. Main replacements for both paths

| Original | Replacement |

|----------|-------------|

| sdk.actions.ready() | Remove entirely |

| sdk.actions.openUrl(url) | window.open(url, "_blank") |

| sdk.actions.close() | window.close() or remove |

| sdk.actions.composeCast(...) | Remove from the main app |

| sdk.actions.addMiniApp() | Remove call and UI |

| sdk.actions.requestWalletAddress() | Remove; wagmi handles wallet access |

| sdk.actions.viewProfile(fid) | window.open(\https://warpcast.com/~/profiles/${fid}\, "_blank") |

| sdk.actions.viewToken(opts) | window.open(\https://basescan.org/token/${opts.token}\, "_blank") |

| sdk.actions.sendToken(opts) | Replace with wagmi flow if the feature matters, otherwise remove |

| sdk.actions.swapToken(opts) | Remove call and UI unless there is a real app-specific swap feature outside Farcaster |

| sdk.actions.signIn(...) | Remove; auth handled by normal web auth |

| sdk.actions.setPrimaryButton(...) | Remove entirely |

| sdk.actions.openMiniApp(...) | Remove from the main app |

| sdk.isInMiniApp() | Remove conditional and keep the non-Farcaster branch |

| sdk.context | Remove from the main app |

| sdk.getCapabilities() | Remove or replace with async () => [] |

| sdk.haptics.* | Remove entirely |

| sdk.back.* | Remove entirely |

| sdk.wallet.* | Remove; wagmi handles wallet access |

For conditional isInMiniApp branches:

// BEFORE
if (isInMiniApp) {
  sdk.actions.openUrl(url);
} else {
  window.open(url, "_blank");
}

// AFTER
window.open(url, "_blank");

Always keep the normal web branch.

2D-2. Path B overrides

Path B does not mean "recreate everything." It means "keep the main app clean and preserve the smallest separate Farcaster surface possible."

2E. Optional Read-Only Farcaster Data (Path B only)

If the user wants an isolated Farcaster surface, prefer read-only data first.

Create lib/farcaster-readonly.ts (or equivalent) only if the app needs it:

const HUB_URL = "https://hub.farcaster.xyz";

export async function getUserData(fid: number) {
  const res = await fetch(`${HUB_URL}/v1/userDataByFid?fid=${fid}`);
  if (!res.ok) throw new Error(`Hub user data fetch failed: ${res.status}`);
  return res.json();
}

export async function getCastsByFid(fid: number, pageSize = 25) {
  const res = await fetch(`${HUB_URL}/v1/castsByFid?fid=${fid}&pageSize=${pageSize}`);
  if (!res.ok) throw new Error(`Hub casts fetch failed: ${res.status}`);
  return res.json();
}

Then:

2F. Manifest Route (All Paths)

Delete .well-known/farcaster.json route:

If the .well-known directory becomes empty, delete it.

2G. Meta Tags (All Paths)

In root layout or metadata files, remove:

2H. Dependencies

All paths — remove:

Path A — also remove:

Path B — remove by default:

All paths — add only if truly needed:

Do not add new Neynar packages as part of the default conversion.

2I. Farcaster-Specific Routes & Components

Path A:

Path B:


Phase 3: Cleanup

3A. Update `package.json`

All paths — remove Mini App packages:

Path A — also remove:

Path B — remove unless still isolated and intentionally preserved:

All paths — add if introduced:

3B. Environment Variables

Path A — remove from all .env* files:

Path B — remove from the main app by default:

Only keep NEYNAR_* vars if the isolated surface explicitly still depends on existing Neynar integration.

Also update env validation schemas (env.ts, env.mjs, zod schemas, etc.).

3C. Dead Code Cleanup

3D. Tailwind Colors

If tailwind.config.ts or tailwind.config.js includes Farcaster brand colors such as farcaster: "#8B5CF6", remove them unless that branding is intentionally kept inside an isolated Farcaster-only surface.

3E. Install Dependencies

Tell the user:

npm install

Phase 4: Verification

4A. Search for Remaining References

All paths — search for:

@farcaster
farcasterMiniApp
miniAppConnector
sdk.actions
sdk.quickAuth
sdk.context
fc:miniapp
fc:frame

Path A — also search for:

@neynar
NEYNAR_API_KEY
NEXT_PUBLIC_NEYNAR_CLIENT_ID
api.neynar.com

Path B — if Neynar was intentionally preserved:

Report any source matches, ignoring node_modules, lock files, and git history.

4B. Type Check

npx tsc --noEmit

Report and fix type errors.

4C. Build Check

npm run build

Report and fix build errors.

4D. Conversion Summary

## Conversion Complete — Path [X]: [Name]

**Files modified:** [count]
**Files deleted:** [count]
**Files created:** [count, if any]
**Packages removed:** [list]
**Packages added:** [list, if any]

### What was done
- [x] Removed Farcaster Mini App wagmi connector
- [x] Stubbed or removed Mini App provider/context
- [x] Replaced Mini App auth with normal web auth or removed it
- [x] Removed or replaced SDK action calls
- [x] Deleted manifest route
- [x] Removed Farcaster meta tags
- [x] Cleaned up dependencies and env vars

Path B summary additionally includes:

- [x] Kept the main app as a normal web app
- [x] Confined remaining Farcaster functionality to a dedicated route/page
- [x] Preferred read-only Farcaster data where possible
- [x] Removed Farcaster host/runtime coupling from shared app infrastructure

All paths end with:

### Manual steps
- [ ] Run `npm install`
- [ ] Test wallet connection flow
- [ ] If FID migration is needed, migrate from FID-based identity to wallet address
- [ ] If Path B preserves a Farcaster-only area, verify it stays isolated from the main app shell

### Verification
- TypeScript: [pass/fail]
- Build: [pass/fail]
- Remaining Farcaster references: [none / list]

Edge Cases

No wagmi

Skip Phase 2A. Do not introduce wagmi unless the app actually needs wallet connectivity.

No auth system

Skip Phase 2C. Do not add SIWE unnecessarily.

`@farcaster/frame-sdk` (older)

Treat identically to @farcaster/miniapp-sdk.

Monorepo

Ask which workspace(s) to convert. Only modify those.

FID as database primary key

Do not change schema automatically. Flag it and warn in Phase 4.

Conditional `isInMiniApp` branches

Always keep the normal web branch and remove the Mini App branch.

Components with no non-Farcaster purpose

Delete them entirely in Path A. In Path B, keep them only if they live inside the isolated Farcaster route/page.

Existing Neynar usage

If the project already uses Neynar:

Read-only is usually enough

If the user says they want to "keep Farcaster stuff," bias toward:

Do not assume they want write access, notifications, or host/runtime behavior.

Quiz ambiguity

If the scan and quiz conflict, point it out and ask the user to confirm the smaller keep-surface first.


Security

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.