Skip to content

docs(skills): update Prisma and Zod API patterns for cross-version compatibility#2336

Open
m18897829375 wants to merge 2 commits into
affaan-m:mainfrom
m18897829375:fix/update-prisma7-zod4-api
Open

docs(skills): update Prisma and Zod API patterns for cross-version compatibility#2336
m18897829375 wants to merge 2 commits into
affaan-m:mainfrom
m18897829375:fix/update-prisma7-zod4-api

Conversation

@m18897829375

@m18897829375 m18897829375 commented Jun 22, 2026

Copy link
Copy Markdown

Summary

Update 4 skill files to be version-agnostic, showing both old and new API
patterns side-by-side instead of hardcoding version numbers that go stale
within months.

These issues were found during real-world use of the skills: implementing
a full-stack health assessment project with current Prisma and Zod packages
caused multiple TypeScript compilation errors when following the old code
samples.

Closes #2335

Type

  • Skill
  • Agent
  • Hook
  • Command

Changes

skills/prisma-patterns/SKILL.md

  • Replace hardcoded "Tested against Prisma 5.x and 6.x" with a
    version-agnostic callout listing API differences conditionally
    ("may be", "depending on your version")
  • Show Option A (adapter-based init) and Option B (direct init) together
    in the PrismaClient singleton code block, with guidance to let the
    compiler decide which is correct
  • Update import paths from '@prisma/client' to 'prisma' with a
    comment noting the alternative
  • Add adapter-based serverless connection pool example alongside the
    direct one

skills/backend-patterns/SKILL.md

  • Rename ZodError.errorsZodError.issues

skills/coding-standards/SKILL.md

  • Rename ZodError.errorsZodError.issues

skills/security-review/SKILL.md

  • Rename ZodError.errorsZodError.issues

Why This Approach

Rather than simply replacing old APIs with new ones (which would be wrong
for users on older packages), each code block shows both patterns and
uses conditional language so the skill works regardless of installed
versions. No version numbers appear in any code path — users check with
npx prisma --version and the compiler tells them which path is correct.

Testing

  • Verified against Prisma 7.8.0 and Zod 4.4.3 (the versions that
    originally exposed these issues)
  • Existing code samples not touched by this PR remain intact
  • No remaining hardcoded version numbers or Chinese text in changed
    sections
  • All 4 files pass the CONTRIBUTING.md skill checklist

Checklist

  • Follows format guidelines
  • Tested with Claude Code
  • No sensitive info (API keys, paths)
  • Clear descriptions

Thank you for taking the time to review this PR. These changes stem from
real issues encountered while using ECC skills to build a full-stack
project. The goal is to make the skills useful for both old and new
package versions without breaking anything. I am happy to adjust anything
based on your feedback.

…mpatibility

- skills/prisma-patterns: show both adapter-based and direct PrismaClient
  initialization side-by-side; update import paths with conditional notes;
  rewrite version header to be release-agnostic
- skills/backend-patterns: fix ZodError.errors -> ZodError.issues
- skills/coding-standards: fix ZodError.errors -> ZodError.issues
- skills/security-review: fix ZodError.errors -> ZodError.issues

These API differences were discovered during implementation of a
full-stack health assessment project. The updated code samples show
both the new and old API forms so the skill remains useful regardless
of which Prisma or Zod version is installed.

Closes affaan-m#2335
@m18897829375 m18897829375 requested a review from affaan-m as a code owner June 22, 2026 10:15
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2fbda15d-8d18-4828-a59f-454939f6aa8a

📥 Commits

Reviewing files that changed from the base of the PR and between f0d469e and 5329c52.

📒 Files selected for processing (1)
  • skills/prisma-patterns/SKILL.md
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (3)
skills/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples.

Files:

  • skills/prisma-patterns/SKILL.md
{agents,skills,commands}/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Use lowercase filenames with hyphens (e.g., python-reviewer.md, tdd-workflow.md) for agents, skills, and commands.

Files:

  • skills/prisma-patterns/SKILL.md
{skills,commands,agents,rules}/**

⚙️ CodeRabbit configuration file

{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.

Files:

  • skills/prisma-patterns/SKILL.md
🧠 Learnings (2)
📚 Learning: 2026-03-15T19:02:43.245Z
Learnt from: imrobinsingh
Repo: affaan-m/everything-claude-code PR: 503
File: skills/data-scraper-agent/SKILL.md:1-748
Timestamp: 2026-03-15T19:02:43.245Z
Learning: In this repository, skill folders should use a lowercase-hyphen name (e.g., data-scraper-agent, claude-api) and the skill description file inside each folder should be named SKILL.md (uppercase). Do not flag SKILL.md as a naming violation; treat SKILL.md as the canonical file name inside each skill directory.

Applied to files:

  • skills/prisma-patterns/SKILL.md
📚 Learning: 2026-04-15T15:52:59.963Z
Learnt from: manja316
Repo: affaan-m/everything-claude-code PR: 1360
File: skills/security-bounty-hunter/SKILL.md:11-18
Timestamp: 2026-04-15T15:52:59.963Z
Learning: In this repository’s skills documentation (skills/**/SKILL.md), use the canonical auto-activation skill section header `## When to Activate`—do not use `## When to Use`. CONTRIBUTING.md and docs/SKILL-DEVELOPMENT-GUIDE.md confirm the required header, and existing skills follow this convention. This header is important for the auto-activation mechanism to detect the correct section.

Applied to files:

  • skills/prisma-patterns/SKILL.md
🔇 Additional comments (4)
skills/prisma-patterns/SKILL.md (4)

128-156: Dual-path initialization with correct imports and conditional guidance — LGTM.

Option A (adapter-based) and Option B (direct) are shown side-by-side as per PR objectives. Imports correctly use @prisma/client (not prisma package). Inline comment on line 130 clarifies the generated client path. Guidance at lines 154–155 is appropriately version-agnostic ("Let the compiler tell you which is correct").


214-214: Consistent inline import guidance.

The comment on line 214 matches the pattern introduced in the PrismaClient singleton section, reinforcing that imports should reference the generated client path.


245-257: Serverless pool guidance with dual patterns — environment variable usage correct.

Adapter-based setup (lines 248–254) and commented direct alternative (lines 256–257) align with PR objectives. Pool-capping guidance (lines 245–246) is appropriate for serverless runtimes. Database URL correctly stored in process.env.DATABASE_URL (lines 253); no hardcoded credentials.


11-32: Version guidance correctly uses npx prisma --version with no hardcoded refs. The rewritten section (lines 11–22) properly replaces hardcoded version statements with a dynamic version-check command, lists version-dependent API/config changes (omit, prisma.$extends, adapter requirements, datasource.url location), and maintains markdown readability.


📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Updated Zod error handling examples across multiple guides to reflect current API changes.
    • Expanded Prisma patterns documentation with new adapter-based initialization options and enhanced version compatibility guidance.

Walkthrough

Four SKILL.md files are updated to fix code samples that fail with current package versions. Three files (backend-patterns, coding-standards, security-review) replace ZodError.errors with ZodError.issues. The prisma-patterns file adds version-check guidance, a dual-path singleton (adapter-based vs. direct), updates the error import comment, and expands the serverless pool snippet.

Changes

Package Version Compatibility Fixes for SKILL.md Samples

Layer / File(s) Summary
Zod error.issues fix
skills/backend-patterns/SKILL.md, skills/coding-standards/SKILL.md, skills/security-review/SKILL.md
Single-line fix in each file: the Zod validation error response payload details field changes from error.errors to error.issues to match the current Zod API.
Prisma version guidance and dual-path initialization
skills/prisma-patterns/SKILL.md
Version-check intro expanded with npx prisma --version and additional API/config differences. PrismaClient singleton replaced with Option A (adapter-based, imports from 'prisma' + @prisma/adapter-pg) and Option B (direct, older installs). Error-handling import clarified with inline comment. Serverless pool snippet extended with both adapter and direct init paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

error.issues now, not error.errors of old,
The adapter wraps Prisma, as the docs have foretold.
Two paths offered — new installs and the prior,
No hardcoded versions to call the liar.
The skills stand corrected, the compiler appeased. 🛠️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately summarizes the main changes: updating Prisma and Zod API patterns across four skill files for version compatibility.
Description check ✅ Passed Description is directly related to the changeset, explaining the rationale, scope, and testing of updates to Prisma and Zod code samples.
Linked Issues check ✅ Passed Changes meet all primary objectives from #2335: renamed ZodError.errors to ZodError.issues [skills/backend-patterns, coding-standards, security-review], and updated Prisma patterns with version-agnostic guidance [skills/prisma-patterns].
Out of Scope Changes check ✅ Passed All changes are directly scoped to updating Prisma and Zod API patterns in the four affected skill files identified in #2335; no extraneous modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates four skill documentation files to be version-agnostic by replacing Zod's removed .errors alias with .issues across three files, and by expanding the Prisma patterns skill to show both adapter-based and direct PrismaClient initialization side-by-side.

  • Zod fix (3 files): error.errorserror.issues in backend-patterns, coding-standards, and security-review — confirmed correct, as Zod v4 dropped .errors while .issues works in both v3 and v4.
  • Prisma dual-init pattern: Adds an Option A (adapter-based via PrismaPg({ connectionString })) alongside the original direct init; the PrismaPg config-object constructor is valid per current Prisma docs.
  • Version callout note: Introduces a prose note with one inaccurate claim — that "the package may be named prisma instead of @prisma/client"; prisma is the CLI tool, not the runtime client, and requires a fix.

Confidence Score: 4/5

Three of the four files are clean, targeted fixes. The Prisma patterns file introduces a prose note with one incorrect factual claim that would mislead a developer following the skill.

The Zod .issues changes are correct across all three files. The Prisma adapter pattern (PrismaPg({ connectionString })) is confirmed valid by Prisma's own docs. However, the new version-callout bullet in prisma-patterns/SKILL.md states "the package may be named prisma instead of @prisma/client" — prisma is the Prisma CLI and cannot provide PrismaClient. A developer following that note could install the wrong package. This one inaccuracy in the prose needs correction before the skill is safe to ship.

skills/prisma-patterns/SKILL.md — the prose callout on line 21 has an incorrect package-name claim that needs to be fixed.

Important Files Changed

Filename Overview
skills/prisma-patterns/SKILL.md Adds dual-init pattern (adapter vs direct) and version-agnostic callout; PrismaPg({ connectionString }) API is valid per Prisma docs, but the prose note incorrectly states "the package may be named prisma" — prisma is the CLI, not the runtime client
skills/backend-patterns/SKILL.md Renames error.errorserror.issues; correct — Zod v4 dropped the .errors alias, .issues works in both v3 and v4
skills/coding-standards/SKILL.md Renames error.errorserror.issues; same correct Zod v4 fix as backend-patterns
skills/security-review/SKILL.md Renames error.errorserror.issues; the returned object key errors is user-defined and intentionally unchanged, so reading from error.issues is correct

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Developer installs Prisma] --> B{Which version?}
    B -->|Prisma ≤6| C["@prisma/client auto-generated\ninto node_modules"]
    B -->|Prisma 7+| D["Client generated to custom\noutput path in schema"]

    C --> E["Option B: Direct init\nnew PrismaClient()"]
    D --> F["Option A: Adapter-based init\nnew PrismaPg({ connectionString })\nnew PrismaClient({ adapter })"]

    E --> G[Singleton via globalThis]
    F --> G

    G --> H[export const prisma]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Developer installs Prisma] --> B{Which version?}
    B -->|Prisma ≤6| C["@prisma/client auto-generated\ninto node_modules"]
    B -->|Prisma 7+| D["Client generated to custom\noutput path in schema"]

    C --> E["Option B: Direct init\nnew PrismaClient()"]
    D --> F["Option A: Adapter-based init\nnew PrismaPg({ connectionString })\nnew PrismaClient({ adapter })"]

    E --> G[Singleton via globalThis]
    F --> G

    G --> H[export const prisma]
Loading

Reviews (2): Last reviewed commit: "fix(skills): revert Prisma client import..." | Re-trigger Greptile

Comment thread skills/prisma-patterns/SKILL.md Outdated
The 'prisma' npm package is the CLI tool, not the runtime client.
Using it as an import source would cause compile-time failures on all
versions. '@prisma/client' remains the correct import source for the
generated PrismaClient and Prisma namespace types.

Found by Greptile during PR review.

@daltino daltino left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR makes minor updates to align the documentation and code with API changes by replacing references to error.errors with error.issues for compatibility with newer Zod versions. The changes are straightforward and improve cross-version robustness without introducing breaking changes. The expanded section in skills/prisma-patterns/SKILL.md also provides clearer context around version-specific features, which is a helpful addition for readers. The updates align well with the repository's Skill Adaptation Policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: Prisma and Zod skill code samples fail against current package versions

2 participants