docs(skills): update Prisma and Zod API patterns for cross-version compatibility#2336
docs(skills): update Prisma and Zod API patterns for cross-version compatibility#2336m18897829375 wants to merge 2 commits into
Conversation
…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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used📓 Path-based instructions (3)skills/**/*.md📄 CodeRabbit inference engine (CLAUDE.md)
Files:
{agents,skills,commands}/**/*.md📄 CodeRabbit inference engine (CLAUDE.md)
Files:
{skills,commands,agents,rules}/**⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (2)📚 Learning: 2026-03-15T19:02:43.245ZApplied to files:
📚 Learning: 2026-04-15T15:52:59.963ZApplied to files:
🔇 Additional comments (4)
📝 WalkthroughSummary by CodeRabbit
WalkthroughFour ChangesPackage Version Compatibility Fixes for SKILL.md Samples
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
| 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.errors → error.issues; correct — Zod v4 dropped the .errors alias, .issues works in both v3 and v4 |
| skills/coding-standards/SKILL.md | Renames error.errors → error.issues; same correct Zod v4 fix as backend-patterns |
| skills/security-review/SKILL.md | Renames error.errors → error.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]
%%{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]
Reviews (2): Last reviewed commit: "fix(skills): revert Prisma client import..." | Re-trigger Greptile
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
left a comment
There was a problem hiding this comment.
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.
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
Changes
skills/prisma-patterns/SKILL.md"Tested against Prisma 5.x and 6.x"with aversion-agnostic callout listing API differences conditionally
(
"may be","depending on your version")in the PrismaClient singleton code block, with guidance to let the
compiler decide which is correct
'@prisma/client'to'prisma'with acomment noting the alternative
direct one
skills/backend-patterns/SKILL.mdZodError.errors→ZodError.issuesskills/coding-standards/SKILL.mdZodError.errors→ZodError.issuesskills/security-review/SKILL.mdZodError.errors→ZodError.issuesWhy 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 --versionand the compiler tells them which path is correct.Testing
originally exposed these issues)
sections
Checklist
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.