# swift-valkey

Guides coding agents on using Valkey and Redis in Swift with the valkey-swift package, cluster routing, and pub/sub.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · ★ 62
- Author: wendylabsinc
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/wendylabsinc/claude-skills/tree/HEAD/swift-valkey/SKILL.md
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/skills/swift-valkey

## What it does

The skill provides idiomatic code patterns for interacting with Valkey and Redis using Swift concurrency. It focuses on the `valkey-swift` package, demonstrating connection setup and command execution with native `async/await`.

Guidance covers key-value operations with conditional writes, hashes, queues using lists, sets, and leaderboards via sorted sets. It also covers pipelining multiple operations in one round-trip, executing `MULTI`/`EXEC` transactions, consuming `pub/sub` streams, and matching errors with `ValkeyClientError`.

In clustered environments, the guidance explains routing shards via hash tags like `{user:123}`. Custom setups require configuring `ValkeyClient.Configuration` to define explicit TLS options, passwords, and timeout values.

## Install

### Claude Code (native platform)

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

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

### Codex

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

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

### Cursor

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

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install wendylabsinc/claude-skills swift-valkey
```

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

### Gemini CLI

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

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

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add wendylabsinc/claude-skills --skill swift-valkey -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/wendylabsinc/claude-skills/tree/HEAD/swift-valkey/SKILL.md

## When to use it
- connect Swift applications to Valkey or Redis clusters
- implement pub/sub listeners and publishers with async streams
- batch operations using Redis transactions or pipelining
- configure hash tags to pin related keys to a single shard
- handle connection drops and timeouts via `ValkeyClientError`

## Example prompts
- Write a Swift function to cache session tokens in Valkey with a one-hour expiration.
- Show how to subscribe to Valkey pub/sub channels using valkey-swift.
- Set up a Valkey cluster connection in Swift with hash tags for user profiles.

## Similar
- [mcp-builder](https://affpapa.org/en/nevibecode/skills/mcp-builder.md) — skill · 130949 installs
- [claude-api](https://affpapa.org/en/nevibecode/skills/claude-api.md) — skill · 74198 installs
- [lark-im](https://affpapa.org/en/nevibecode/skills/lark-im.md) — skill · 472900 installs
- [lark-event](https://affpapa.org/en/nevibecode/skills/lark-event.md) — skill · 466800 installs
- [caveman-discover](https://affpapa.org/en/nevibecode/skills/caveman-discover.md) — skill · 104400 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs

From the same set: [wendylabsinc/claude-skills](https://affpapa.org/en/nevibecode/by/wendylabsinc/claude-skills.md) — 25 cards

---
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
