Applies DB2 DDL, DCLGEN, cursor, and migration-script conventions for precision, nullability, access paths, and reconciliation evidence. Use when reading or writing DB2 schema and migration artifacts.
These conventions apply to DB2 DDL, DCLGEN output, and migration scripts matched by the applyTo globs. They are authoritative for how this repository states DB2 structure and proves migrated data. The installed DB2 catalog wins for actual definitions; record the divergence when a script and the catalog disagree.
Evidence Before Schema
A target column definition cites the DB2 DDL, the DCLGEN structure, or the PIC clause it came from. A definition derived from sampled data is a hypothesis and must be labeled as one.
Nullability, defaults, and key constraints are behavior. NOT NULL WITH DEFAULT and a nullable column with an application-supplied default are different systems; map each explicitly.
Conventions
Rule
Rationale
Map DECIMAL(p,s) and COMP-3 to exact decimal types end to end.
One pass through binary floating point breaks reconciliation.
State the fractional precision when mapping TIMESTAMP.
Source precision often exceeds the target default and rounds silently.
Keep the legacy key column alongside a new surrogate key.
Reconciliation needs the original identity until sign-off.
Justify every foreign key with DDL or cited program behavior.
A relationship enforced only in COBOL is a hypothesis.
Prove uniqueness against real data before adding a unique constraint.
A failing unique index on load means the assumption was wrong.
Add a constraint only when the legacy system rejects the value.
A new constraint turns a load into silent data loss.
Preserve the ordinal for every OCCURS group mapped to a child table.
Occurrence position drives reports and first-entry logic.
Record the cursor ORDER BY, or state that order is not guaranteed.
Legacy output can look ordered without an ordering clause.
Reproduce SQLCODE +100 as an empty result, not an error.
Empty-result branches are business behavior.
Migration Script Safety
Migration scripts are re-runnable against an empty target and never mutate the legacy source. Credentials come from the environment or a managed identity, never from a script or a connection string in version control. A destructive step requires an explicit flag and a recorded approval.
Reconciliation Evidence
A migration is reconciled when the numbers exist, not when the script succeeds. Record row counts, occurrence totals, per-column aggregates at full precision, null counts, distinct counts for key columns, and a deterministic sampled diff. Report every check that could not run, with the blocking reason.
Do / Do Not
Do
Do not
Cite DDL, DCLGEN, or PIC for every mapped column.
Infer a type from a sample value.
Decide null, blank, and default meaning per column.
Apply one blanket null mapping to a table.
Store occurrence groups as child tables with ordinals.
Flatten OCCURS into numbered columns.
Report reconciliation with actual numbers.
Write "counts match" without values.
Use synthetic fixtures.
Copy production extracts into tests.
Checklist Before Opening a PR
Every column mapping cites DDL, DCLGEN, or a PIC clause.
Monetary and quantity columns use exact decimal types in every layer.
Null, default, sign, and length decisions are explicit per column.
Keys, unique constraints, and indexes cite the evidence that justifies them.
Occurrence groups keep identity, order, and actual counts.
Empty-result behavior matches the legacy SQLCODE +100 paths.
Reconciliation reports actual numbers, and unrun checks say so.
Scripts are re-runnable, carry no credentials, and gate destructive steps.
No production or regulated data appears in fixtures, logs, or examples.
1---2name: db2-schema3description: Applies DB2 DDL, DCLGEN, cursor, and migration-script conventions for precision, nullability, access paths, and reconciliation evidence. Use when reading or writing DB2 schema and migration artifacts.4---56<!-- Generated from harness/github-copilot/plugins/mainframe-cobol-db2/instructions/db2-schema.instructions.md by harness/claude-code/scripts/convert_from_copilot.py. Edit the source, not this file. -->78# DB2 Schema and Migration Conventions910These conventions apply to DB2 DDL, DCLGEN output, and migration scripts matched by the `applyTo` globs. They are authoritative for how this repository states DB2 structure and proves migrated data. The installed DB2 catalog wins for actual definitions; record the divergence when a script and the catalog disagree.1112## Evidence Before Schema1314A target column definition cites the DB2 DDL, the DCLGEN structure, or the `PIC` clause it came from. A definition derived from sampled data is a hypothesis and must be labeled as one.1516Nullability, defaults, and key constraints are behavior. `NOT NULL WITH DEFAULT` and a nullable column with an application-supplied default are different systems; map each explicitly.1718## Conventions1920| Rule | Rationale |21| --- | --- |22| Map `DECIMAL(p,s)` and `COMP-3` to exact decimal types end to end. | One pass through binary floating point breaks reconciliation. |23| State the fractional precision when mapping `TIMESTAMP`. | Source precision often exceeds the target default and rounds silently. |24| Keep the legacy key column alongside a new surrogate key. | Reconciliation needs the original identity until sign-off. |25| Justify every foreign key with DDL or cited program behavior. | A relationship enforced only in COBOL is a hypothesis. |26| Prove uniqueness against real data before adding a unique constraint. | A failing unique index on load means the assumption was wrong. |27| Add a constraint only when the legacy system rejects the value. | A new constraint turns a load into silent data loss. |28| Preserve the ordinal for every `OCCURS` group mapped to a child table. | Occurrence position drives reports and first-entry logic. |29| Record the cursor `ORDER BY`, or state that order is not guaranteed. | Legacy output can look ordered without an ordering clause. |30| Reproduce `SQLCODE +100` as an empty result, not an error. | Empty-result branches are business behavior. |3132## Migration Script Safety3334Migration scripts are re-runnable against an empty target and never mutate the legacy source. Credentials come from the environment or a managed identity, never from a script or a connection string in version control. A destructive step requires an explicit flag and a recorded approval.3536## Reconciliation Evidence3738A migration is reconciled when the numbers exist, not when the script succeeds. Record row counts, occurrence totals, per-column aggregates at full precision, null counts, distinct counts for key columns, and a deterministic sampled diff. Report every check that could not run, with the blocking reason.3940## Do / Do Not4142| Do | Do not |43| --- | --- |44| Cite DDL, DCLGEN, or `PIC` for every mapped column. | Infer a type from a sample value. |45| Decide null, blank, and default meaning per column. | Apply one blanket null mapping to a table. |46| Store occurrence groups as child tables with ordinals. | Flatten `OCCURS` into numbered columns. |47| Report reconciliation with actual numbers. | Write "counts match" without values. |48| Use synthetic fixtures. | Copy production extracts into tests. |4950## Checklist Before Opening a PR5152- [ ] Every column mapping cites DDL, DCLGEN, or a `PIC` clause.53- [ ] Monetary and quantity columns use exact decimal types in every layer.54- [ ] Null, default, sign, and length decisions are explicit per column.55- [ ] Keys, unique constraints, and indexes cite the evidence that justifies them.56- [ ] Occurrence groups keep identity, order, and actual counts.57- [ ] Empty-result behavior matches the legacy `SQLCODE +100` paths.58- [ ] Reconciliation reports actual numbers, and unrun checks say so.59- [ ] Scripts are re-runnable, carry no credentials, and gate destructive steps.60- [ ] No production or regulated data appears in fixtures, logs, or examples.
Run npx skillmds@latest add paulasilvatech/db2-schema in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Applies DB2 DDL, DCLGEN, cursor, and migration-script conventions for precision, nullability, access paths, and reconciliation evidence. Use when reading or writing DB2 schema and migration artifacts. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
paulasilvatech (@paulasilvatech) published this skill. Their other Agent Skills are listed on their SkillMD profile.