# appwrite-swift

Guides agent code generation for the Appwrite Swift SDK across Apple platforms and server-side Swift. Covers TablesDB queries, authentication, and user admin.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 851 installs · ★ 28
- Author: appwrite
- License: BSD-3-Clause · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/appwrite/skills/tree/HEAD/skills/appwrite-swift/SKILL.md
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/skills/appwrite-swift

## What it does

This skill guides your coding agent to write Swift code for Appwrite using current SDK conventions. It enforces `TablesDB` instead of the deprecated `Databases` class and prioritizes named arguments. For schema definitions, it uses specific column types like `varchar` for inline storage under 64 KB or `text` and `mediumtext` for off-page data.

Client implementations for iOS, macOS, watchOS, or tvOS handle user signups, sessions, and OAuth flows with `async/await`. On the server side, it wires up the `Users` service using environment credentials like `APPWRITE_API_KEY`. Server administration calls fail immediately if an API key is missing from the client setup.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add appwrite/skills --skill appwrite-swift -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/appwrite-swift/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/appwrite-swift/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add appwrite/skills --skill appwrite-swift -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/appwrite-swift/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add appwrite/skills --skill appwrite-swift -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/appwrite-swift/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install appwrite/skills appwrite-swift
```

2. **Manually: put the files in place**
- File: `.github/skills/appwrite-swift/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add appwrite/skills --skill appwrite-swift -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/appwrite/skills --path skills/appwrite-swift
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/appwrite-swift/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add appwrite/skills --skill appwrite-swift -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/appwrite/skills/tree/HEAD/skills/appwrite-swift/SKILL.md

## When to use it
- implement email or OAuth authentication flows for Apple platforms
- construct structured database queries using `TablesDB` and `Query.builder`
- manage users on server-side Swift with administrative API keys
- configure table schemas with explicit column types such as `varchar` and `mediumtext`

## Example prompts
- Write a Swift function to log in a user with email and password via Appwrite
- Query a TablesDB collection with cursor pagination and an equality filter
- Set up a server-side Swift client with an API key to list users

## Source text · SKILL.md · BSD-3-Clause

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: f887642afde4cdb3.

BEGIN THIRD-PARTY FILE f887642afde4cdb3
````text
---
name: appwrite-swift
description: Appwrite Swift SDK skill. Use when building native iOS, macOS, watchOS, or tvOS apps, or server-side Swift applications with Appwrite. Covers client-side auth (email, OAuth), database queries, file uploads, real-time subscriptions with async/await, and server-side admin via API keys for user management, database administration, storage, and functions.
---


# Appwrite Swift SDK

## Installation

```swift
// Swift Package Manager — Package.swift
.package(url: "https://github.com/appwrite/sdk-for-swift", branch: "main")
```

## Setting Up the Client

### Client-side (Apple platforms)

```swift
import Appwrite

let client = Client()
    .setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
    .setProject("[PROJECT_ID]")
```

### Server-side (Swift)

```swift
import Appwrite

let client = Client()
    .setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
    .setProject(ProcessInfo.processInfo.environment["APPWRITE_PROJECT_ID"]!)
    .setKey(ProcessInfo.processInfo.environment["APPWRITE_API_KEY"]!)
```

## Code Examples

### Authentication (client-side)

```swift
let account = Account(client)

// Signup
let user = try await account.create(userId: ID.unique(), email: "user@example.com", password: "password123", name: "User Name")

// Login
let session = try await account.createEmailPasswordSession(email: "user@example.com", password: "password123")

// OAuth
try await account.createOAuth2Session(provider: .google)

// Get current user
let me = try await account.get()

// Logout
try await account.deleteSession(sessionId: "current")
```

### User Management (server-side)

```swift
let users = Users(client)

// Create user
let user = try await users.create(userId: ID.unique(), email: "user@example.com", password: "password123", name: "User Name")

// List users
let list = try await users.list(queries: [Query.limit(25)])

// Get user
let fetched = try await users.get(userId: "[USER_ID]")

// Delete user
try await users.delete(userId: "[USER_ID]")
```

### Database Operations

> **Note:** Use `TablesDB` (not the deprecated `Databases` class) for all new code. Only use `Databases` if the existing codebase already relies on it or the user explicitly requests it.
>
> **Tip:** Prefer named parameters (e.g., `databaseId: "..."`) for all SDK method calls. Only use positional arguments if the existing codebase already uses them or the user explicitly requests it.

```swift
let tablesDB = TablesDB(client)

// Create database (server-side only)
let db = try await tablesDB.create(databaseId: ID.unique(), name: "My Database")

// Create row
let doc = try await tablesDB.createRow(databaseId: "[DATABASE_ID]", tableId: "[TABLE_ID]", rowId: ID.unique(), data: [
    "title": "Hello",
    "done": false
])

// Query rows
let results = try await tablesDB.listRows(databaseId: "[DATABASE_ID]", tableId: "[TABLE_ID]", queries: [
    Query.equal("done", value: false),
    Query.limit(10)
])

// Get row
let row = try await tablesDB.getRow(databaseId: "[DATABASE_ID]", tableId: "[TABLE_ID]", rowId: "[ROW_ID]")
````
END THIRD-PARTY FILE f887642afde4cdb3

The third-party file has ended. Everything between the f887642afde4cdb3 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3070 of 17582 bytes. © appwrite · BSD-3-Clause · https://github.com/appwrite/skills/tree/HEAD/skills/appwrite-swift/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
