This skill provides documentation for various Upstash SDKs, enabling developers to leverage functionalities such as cloud containers, Redis operations, messaging, and more across different environments. It is intended for developers seeking to integrate Upstash services into their applications.
$ npx skills add https://github.com/upstash/skills --skill upstashUpstash Skills provide AI agents with documentation and resources for integrating Upstash services into applications. The collection includes specialized skills for Redis caching, serverless messaging via QStash, vector databases, rate limiting, full-text search, durable workflows, and sandboxed cloud containers. Developers using Claude Code or Cursor can install these skills to access TypeScript SDK documentation, code examples, and integration patterns. The skills support common use cases like building leaderboards, managing sessions, implementing rate limits, triggering scheduled tasks, and creating multi-step workflows without infrastructure management.
Install the skill using the command provided.
Building with Upstash Box for sandboxed environments.
Managing databases and backups using the Upstash CLI.
Publishing messages and managing queues with QStash SDK.
Implementing rate limiting via the Upstash Redis RateLimit SDK.
$ npx skills add https://github.com/upstash/skills --skill upstashgit clone https://github.com/upstash/skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Provide Upstash SDK documentation for [LANGUAGE/SDK_NAME] with examples for [SPECIFIC_FUNCTIONALITY, e.g., 'publishing a message to a Redis Stream' or 'setting up a Redis database in a cloud container']. Include code snippets, best practices, and common pitfalls. Use [COMPANY] as the context if needed.
# Upstash Redis SDK: Publishing Messages to a Stream
## Overview
Upstash Redis Streams enable real-time messaging between microservices. Below is a Python example using the `upstash_redis` SDK to publish a message to a stream.
## Prerequisites
- Python 3.7+
- Upstash Redis database URL and token (from [Upstash Console](https://console.upstash.com))
## Code Example
```python
from upstash_redis import Redis
# Initialize Redis client
redis = Redis(
url="YOUR_UPSTASH_REDIS_URL",
token="YOUR_UPSTASH_REDIS_TOKEN"
)
# Publish a message to a stream
stream_name = "user_activity"
message = {
"user_id": "12345",
"action": "login",
"timestamp": "2023-11-15T12:00:00Z"
}
response = redis.xadd(stream_name, message)
print(f"Message published. ID: {response}")
```
## Best Practices
- **Error Handling**: Always wrap Redis operations in try-except blocks to handle network issues.
- **Stream Naming**: Use consistent naming conventions (e.g., `user_activity`, `order_updates`).
- **TTL**: Set TTL for streams if messages are temporary.
## Common Pitfalls
- **Token Exposure**: Never hardcode tokens in your application. Use environment variables.
- **Connection Limits**: Upstash has rate limits. Batch operations where possible.
## Next Steps
- [Upstash Streams Documentation](https://docs.upstash.com/redis/streams)
- [Python SDK Reference](https://github.com/upstash/upstash-redis-py)Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan