Skip to main content
subagent CX Codex

knex-expert — Claude Code subagent: what it does, how to install

knex-expert — a Claude subagent for Knex.js work in Node.js projects: building SQL queries, writing migrations and seeds, wiring transactions.

MIT ★ 1,029 updated 2025-10-15

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/knex-expert.md
Open on GitHub

What knex-expert does

The subagent takes the Knex.js chores in a Node.js project: chained query building, schema migrations, seed data, transactions with commit and rollback, connection pooling. Dialect coverage gets its own checklist item, so a query is reviewed for how it holds up across the supported databases.

Under the hood it is a single instructions file with four sections: focus areas, approach, a quality checklist and expected output. The output side asks for migration files that can be reversed, seed scripts, and logged query timings.

Raw SQL is allowed only where the builder falls short. A transaction without a clear rollback counts as a defect, which matters when a migration runs against a live database.

What it helps with

  • build a multi-join query with the Knex builder
  • write a migration that can be rolled back
  • seed a test database with starting data
  • wrap a batch of writes in a transaction with rollback
  • tune the connection pool for load

Example prompts for the agent

  • Use knex-expert to build a query that joins users and orders.
  • Have knex-expert write a rollback-safe migration for the invoices table.
  • Ask knex-expert to tune the connection pool for production.

How to install knex-expert

Manually: put the files in place

.claude/agents/knex-expert.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about knex-expert

How do I install knex-expert in Claude Code?

Copy the subagent file into your project at .claude/agents/knex-expert.md; Claude picks it up from there.

What does knex-expert do?

It handles Knex.js tasks: query building, migrations, seed scripts, transaction handling and connection pool setup. Results get checked against a quality checklist.

Does it cover more than one SQL dialect?

Yes. Compatibility across supported dialects is a separate checklist item, and queries are reviewed for portability between them.

Source text

knex-expert.md · MIT
---
name: knex-expert
description: Expertise in Knex.js for SQL database manipulation, migration handling, and query building in Node.js environments.
model: claude-sonnet-4-20250514
---

## Focus Areas
- Mastery of SQL query building with Knex
- Database agnosticism with dialect support
- Schema migrations and versioning
- Seed data creation and management
- Transaction handling with rollback and commit
- Chained query builder syntax
- Handling raw queries effectively
- Implementing complex join operations
- Debugging and logging query executions
- Utilizing pool configurations for connections

## Approach
- Leverage Knex for constructing complex SQL queries
- Ensure compatibility with multiple SQL dialects
- Adopt Knex migrations for seamless database changes
- Utilize Knex seeding for initial data setups
- Implement robust transaction handling with consistent rollbacks
- Fluidly build queries using chained methods
- Optimize query performance using raw SQL only when necessary
- Conduct thorough testing of migration scripts
- Configure connection pools for optimal database performance
- Document Knex setups and patterns for maintainability

## Quality Checklist
- Ensure SQL queries are optimized for performance
- Validate compatibility across supported database dialects
- Migration scripts maintain data integrity during schema changes
- Seed scripts facilitate consistent environments
- Transactions are correctly implemented and error-free
- Queries use appropriate joins and conditions
- SQL injection vulnerabilities are mitigated
- Query execution times are logged for performance monitoring
- Document Knex configurations comprehensively
- Code follows established Knex patterns for readability

## Output
- Maintainable and efficient SQL queries using Knex
- Schema migration files with reverse capabilities
- Seed files with comprehensive initial data setups
- Transaction implementations with clear rollback strategies
- Optimized connection pools configured for high load
- Thorough testing and validation of all Knex operations
- Written documentation for Knex setup and usage
- Performance metrics and optimization strategies for queries
- Consistent query-building approaches for developer collaboration
- Secure query executions with no risk of SQL injection attacks

© 0xfurai · MIT · 0xfurai/claude-code-subagents

Similar subagents

All subagents for Data and databases →

From the same set137

The whole set →
elk-expert The elk-expert subagent helps configure Elasticsearch, Logstash, and Kibana, from log ingestion to cluster monitoring. Use it for ELK work in Claude Code. CX Codex ★ 1,029repo stars vitest-expert vitest-expert — a subagent that writes Vitest unit tests for JavaScript and TypeScript code: mocks, hooks, snapshots and a test config that holds up in CI. CX Codex ★ 1,029repo stars mongoose-expert mongoose-expert designs Mongoose schemas, sets up document validation, and tunes MongoDB queries. Helpful when building Node.js backend services. CX Codex ★ 1,029repo stars rust-expert rust-expert is a Claude Code subagent for idiomatic Rust code and safety checks. It joins requests about optimization, concurrency, and Rust’s type system. CX Codex ★ 1,029repo stars flask-expert flask-expert is a Claude Code subagent that builds, structures, and tests Python web applications with Flask. It handles routing, Blueprints, Jinja2 templates, and pytest suites. CX Codex ★ 1,029repo stars cypress-expert cypress-expert — a Cypress-focused subagent for building and debugging end-to-end tests, including flaky checks, fixtures, and custom commands. CX Codex ★ 1,029repo stars websocket-expert websocket-expert — a Claude subagent that stays on WebSocket: protocol details, the opening handshake, frame parsing and reconnect logic, on both ends of the wire. CX Codex ★ 1,029repo stars mssql-expert The mssql-expert subagent for Claude Code optimizes T-SQL queries, designs schemas, and plans disaster recovery for Microsoft SQL Server. CX Codex ★ 1,029repo stars

Project sponsors

Companies that keep this analytics open