dbops-changeset
Generates Liquibase database changesets via a structured workflow: resolve schema+instance (from context or via API discovery), confirm DB engine type, generate Liquibase YAML, and present for HITL review with Accept / Deny / Accept & Commit actions. Use when asked to create, modify, or drop database tables, columns, indexes, or constraints as a Liquibase changeset, generate a database migration, or fix a failed migration. Supports update mode (refine existing changeset) and error-recovery mode (fix a failed migration).
Harness · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add harness/harness-skills --skill dbops-changeset技能说明
name: dbops-changeset
description: >-
Generates Liquibase database changesets via a structured workflow:
resolve schema+instance (from context or via API discovery),
confirm DB engine type, generate Liquibase YAML, and present for
HITL review with Accept / Deny / Accept & Commit actions. Use when
asked to create, modify, or drop database tables, columns, indexes,
or constraints as a Liquibase changeset, generate a database
migration, or fix a failed migration. Supports update mode (refine
existing changeset) and error-recovery mode (fix a failed migration).
metadata:
author: Harness
version: 2.1.1
mcp-server: harness-mcp-v2
module: DBOPS
summary: Generate, refine, review, and execute Liquibase changesets with Harness DBOPS
license: Apache-2.0
compatibility: >-
Requires Harness MCP v2 dbops toolset
(resource types: database_schema, database_instance, database_default_authoring_instance,
database_snapshot_object, database_execute_llm_authoring_pipeline). Connector lookup uses
the connectors toolset connector resource. Review is done in chat (Accept / Deny /
Accept & Commit).
DBOPS Changeset Generation
Generate Liquibase database changesets from natural language descriptions, anchored to a real schema and instance from the Harness DBOPS service.
When to Use
When the user asks to:
- Create, add, modify, or drop tables, columns, indexes, constraints, or views as Liquibase changeset operations
- Generate a database migration or changeset
- Fix a failed migration or update an existing changeset
- Apply schema changes as Liquibase YAML
Prerequisites
The Skill tool loads this file (SKILL.md) automatically — do not Read it again.
Before generating Liquibase YAML, Read reference.md using the exact path listed in
the Skill tool result. It contains all Liquibase YAML rules, change types, rollback
patterns, batch migration guidelines, MongoDB JSON string requirements, and the
clarifying questions policy. Apply those rules in Step 4 when generating the changeset.
Full Workflow
Step 0: Check for Pre-Seeded Context (ALWAYS do this first)
At conversation start, the initial message may contain a JSON block with pre-selected identifiers injected by the Harness frontend UI:
{
"dbops_schema_id": "users-schema",
"dbops_instance_id": "prod-instance"
}
Read this JSON block (if present) before doing any tool calls.
| What's in context | What to do |
|---|---|
dbops_schema_id + dbops_instance_id | Skip Steps 1 AND 2 — but immediately fetch instance metadata via harness_get(resource_type="database_instance", resource_id="<dbops_instance_id>", dbschema_id="<dbops_schema_id>") to obtain connector (needed in Step 3) and check hasSnapshot (needed in Step 3-B). |
Only dbops_schema_id | Skip Step 1 — use this schema ID. Then go to Step 2-A |
| Neither | Full Steps 1 and 2 |
Step 1: Discover Database Schemas (skip if dbops_schema_id is in context)
Call harness_list for the available schemas:
harness_list(resource_type="database_schema")
The response is a plain JSON array of objects. Each object has:
identifier— used as the schema ID in subsequent callsname— human-readable namemigrationType—"Liquibase"or"Flyway"(only Liquibase supported)instanceCount— number of linked instancesprimaryDbInstanceId— the designated instance for LLM authoring (may be empty). If non-empty, Step 2-A uses this directly as theinstance_idwithout further discovery.
Disambiguation:
- If the array has one schema, select it automatically.
- If the array has multiple schemas, use
AskUserQuestion(selection mode): Show:[<name> (<identifier>) — <migrationType>, <instanceCount> instances]for each. - If the array is empty: "No database schemas found in this project. Create one in Harness DBOPS first."
- If
migrationTypeis"Flyway": "This skill supports Liquibase schemas only."
Step 2-A: Resolve Instance from Schema (when only dbops_schema_id is known)
When you have a schema_id but no instance_id (from context OR after Step 1 selection):
- Call
harness_getto fetch the full schema:
harness_get(resource_type="database_schema", dbschema_id="<schema_id>")
- Check the
primaryDbInstanceIdfield in the response:
- If set: use it as the
instance_id. Inform the user: "Using primary instance<primaryDbInstanceId>for schema<name>." Then fetch the instance to obtain theconnectorfield needed in Step 3:
harness_get(resource_type="database_instance", resource_id="<primaryDbInstanceId>",
dbschema_id="<schema_id>")
Read connector from the response.
- If empty or missing: fall through to Step 2-B.
Step 2-B: Auto-select Best Instance (when primaryDbInstanceId is empty)
Use the database_default_authoring_instance resource to let the server pick the best
instance (oldest with a metadata snapshot; falls back to oldest overall):
harness_get(resource_type="database_default_authoring_instance", dbschema_id="<schema_identifier>")
The response is { identifier: string, name: string, hasSnapshot: boolean, connector: string }.
Handling the response:
- If the tool call returns results: Use
identifieras theinstance_idandconnectoras the connector identifier for Step 3 (no separate instance detail fetch needed). Inform the user: "Using instance<name>(<identifier>) for schema<schema_name>." IfhasSnapshotistrue, the instance has metadata available for snapshot lookups — proceed to Step 3-B for any changeset intent (create, modify, or drop). Iffalse, skip Step 3-B entirely. - **Not fou