# Dsql on rails

> Dsql on rails is an open-source agent skill for developer tools. Guides an agent through building and testing Rails apps on Aurora DSQL. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/sorah/config/tree/master/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails
- **Repository:** https://github.com/sorah/config
- **GitHub stars:** 31
- **License:** MIT
- **Skill name:** dsql-on-rails
- **Collection:** https://github.com/sorah/config
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill covers running a Rails application on Amazon Aurora DSQL, from connection settings and adapter patches to development, test and CI against real clusters. It explains the differences from PostgreSQL that matter in practice: optimistic concurrency control with retried transactions, no savepoints, one DDL statement per transaction, and IAM-only authentication with short sessions.

The skill ships reference files to copy into a project, including database configuration, a rake task set for initialising, creating and migrating per-developer schemas, a psql wrapper script that attaches a fresh IAM token, and a RuboCop cop that flags bare transactions. It also describes role layout, schema changes through psqldef with async indexes, and RSpec setup that replaces transactional fixtures with cleanup and conflict-retry helpers.

The guidance expects an existing Rails project with the pg, aws-sdk-dsql and pg-aws_rds_iam gems, access to DSQL clusters and AWS credentials. Project conventions documented in the repository take precedence over the skill's defaults.

## When your agent uses it

> This skill should be used when building, extending, or testing a Rails app on Amazon Aurora DSQL, or when moving a Rails app onto DSQL. Use it when writing a transaction, a uniqueness check, a schema change, a spec, a rake task, or CI for such an app, even if the user only says "add a model" or "fix this flaky spec" in such an app. Signs include `aws-sdk-dsql`, `pg-aws_rds_iam`, `aws_rds_iam_auth_token_generator`, a `*.dsql.<region>.on.aws` host, `ActiveRecord::SerializationFailure` with `OC000`/`OC001`, `retryable_transaction`, `non_idempotent_transaction`, `create index async`, `script/pdsql`, or the user mentioning "DSQL", "Aurora DSQL", or "OCC". Provides connection settings and adapter patches, OCC-aware transactions, schema constraints with psqldef, roles, per-developer schemas, RSpec setup, and CI against real clusters. Project-specific conventions always take priority.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs Ruby scripts](https://github.com/sorah/config/tree/HEAD/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails)
- [Network calls found in its scripts](https://github.com/sorah/config/tree/HEAD/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails)
- [License: MIT](https://github.com/sorah/config/tree/HEAD/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails)

## Features

- **OCC-aware transactions:** Wrappers that retry optimistic concurrency conflicts and a cop that flags unsafe transaction usage.
- **Connection and adapter setup:** IAM token generation, SSL settings and patches for the Rails PostgreSQL adapter on DSQL.
- **Schema management with psqldef:** Guidance on applying schema files, async index creation and waiting for index jobs.
- **Role and schema layout:** Permission roles, login roles and per-developer schemas with SQL bootstrap statements.
- **RSpec test helpers:** Database cleanup without transactional fixtures, OCC retry around examples and conflict triggers.
- **CI against real clusters:** Guidance on latency, parallel test splitting and a pooled schema design for CI jobs.

## Good for

- Set up a new Rails app to connect to Aurora DSQL with IAM tokens
- Make a Rails model write wrapped in a retry-safe transaction
- Add a unique index to a DSQL-backed table without breaking deploys
- Fix a flaky RSpec example that fails on optimistic concurrency conflicts
- Create per-developer dev and test schemas on a shared DSQL cluster
- Configure a CI job that runs the Rails suite against a DSQL cluster

## Install

### Claude Code

This skill ships in the `sorah-guides` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add sorah/config
/plugin install sorah-guides@sorah-marketplace
```

Or copy only this skill to `~/.claude/skills/dsql-on-rails`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/dsql-on-rails &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails" ~/.claude/skills/dsql-on-rails &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/dsql-on-rails` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/dsql-on-rails` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/dsql-on-rails &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails" ~/.agents/skills/dsql-on-rails &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/dsql-on-rails` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/dsql-on-rails` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/dsql-on-rails &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails" ~/.cursor/skills/dsql-on-rails &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/dsql-on-rails` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/sorah/config.git --path claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails
```

Or copy the folder to `~/.gemini/skills/dsql-on-rails` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/dsql-on-rails`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/dsql-on-rails &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails" ~/.copilot/skills/dsql-on-rails &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/dsql-on-rails` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/sorah/config.git
```

Then copy `config/claude/marketplace/plugins/sorah-guides/skills/dsql-on-rails` into your agent's skills folder as `dsql-on-rails`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does Dsql on rails need Ruby on Rails?

Yes. It targets Rails apps using ActiveRecord, RSpec and rake tasks on Aurora DSQL.

### Which gems does Dsql on rails require?

The production gems are pg, aws-sdk-dsql and pg-aws_rds_iam. Tests use database_rewinder, timecop, test-prof and, for CI, parallel_tests.

### Can Dsql on rails run without a real DSQL cluster?

No. The guidance states there is no local DSQL emulator, so development and tests run against real clusters.

### Does Dsql on rails replace the schema tooling for my app?

It builds on the sqldef-on-rails skill and replaces several of its tasks for DSQL, such as async index creation and per-statement DDL.

### How do I install Dsql on rails in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/dsql-on-rails to use it in all your projects, or to .claude/skills/dsql-on-rails in one project. Or install the sorah-guides plugin, which includes it: /plugin marketplace add sorah/config, then /plugin install sorah-guides@sorah-marketplace.

### Does Dsql on rails run scripts?

Yes. It runs Ruby scripts. Its scripts contain network calls. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Dsql on rails?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Dsql on rails?

The closest alternatives to Dsql on rails are Sqldef on rails, Rails, Database migrations, Schema exploration and Go database.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Sqldef on rails](https://ai-powered.com/skills/sqldef-on-rails): Sqldef on rails is an open-source agent skill for databases.
- [Rails](https://ai-powered.com/skills/rails-sorah): Rails is an open-source agent skill for developer tools.
- [Database migrations](https://ai-powered.com/skills/database-migrations-nabwinsaud): Database migrations is an open-source agent skill for databases.
- [Schema exploration](https://ai-powered.com/skills/schema-exploration): Schema exploration is an open-source agent skill for developer tools.
- [Go database](https://ai-powered.com/skills/go-database): Go database is an open-source agent skill for databases.
- [Planning oracle to postgres migration integration testing](https://ai-powered.com/skills/planning-oracle-to-postgres-migration-integration-testing): Planning oracle to postgres migration integration testing is an open-source agent skill for databases.
- [Scaffolding oracle to postgres migration test project](https://ai-powered.com/skills/scaffolding-oracle-to-postgres-migration-test-project): Scaffolding oracle to postgres migration test project is an open-source agent skill for databases.
- [Reviewing oracle to postgres migration](https://ai-powered.com/skills/reviewing-oracle-to-postgres-migration): Reviewing oracle to postgres migration is an open-source agent skill for databases.

---
Source: https://ai-powered.com/skills/dsql-on-rails
