شعار Effect Boundary Validation

Effect Boundary Validation

المجتمع
jpoehnelt
effect-boundary-validation

Decode untrusted data once at ingress with Effect Schema (v4) and pass typed values downstream. Use for HTTP bodies, params and query strings, webhooks, RPC and message payloads, MCP tool arguments, env and config, JSON.parse, stored JSON or rows, third-party API responses, unsafe casts, or porting Zod/Valibot schemas.

نظرة عامة

الناشرjpoehnelt
المستودعskills
اسم المهارةeffect-boundary-validation
النجوم
23
التفريعات
1
الملفات المرفقة
1
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 1

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها jpoehnelt على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Effect Boundary Validation في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/jpoehnelt/skills/tree/main/effect-boundary-validation
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jpoehnelt/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/effect-boundary-validation .claude/skills/effect-boundary-validation
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Effect Boundary Validation في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Effect Boundary Validation تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Effect Boundary Validation بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Boundary validation

Decode untrusted data once, at the ingress, then pass the decoded type downstream. TypeScript types, satisfies, and as casts are not runtime validation. Assumes Effect v4 Schema, imported the way the repo's import policy says (the effect root or effect/Schema); see effect for errors and runners.

Repo facts (from AGENTS.md): where shared wire schemas live, retired schema libraries, safe-decode helpers, ast-grep boundary rules, the public error shape, and check and test commands.

Inventory the boundary

Run scripts/boundary-audit.sh [--ban MODULE]... [--rule RULE_ID]... [paths] on the changed paths. It lists parse and cast sites, signature checks, and decode sites, fails on imports of any --ban module (for example --ban zod --ban valibot; a text search, so enforce a ban structurally with an ast-grep rule), and runs the named ast-grep rules when the repo has sgconfig.yml. For each change, name:

  1. The ingress point (route, webhook, message or topic handler, RPC method, upstream response, env read, stored row).
  2. The owning schema: shared wire schemas live in the contract package when several packages consume them; local-only shapes stay beside their consumer.
  3. Checks that run before decoding: signature or MAC, bearer token or session, origin.
  4. The decoded internal type.
  5. What the caller sees on failure and what is logged.

Policy: requests strict, responses tolerant

  • Request decoders reject excess fields: Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" }) where the contract is strict.
  • Response decoders use the default mode, which ignores added fields, so a newer server never breaks an older client. Keep error code unions open to future codes.
  • Persistence compatibility (old stored shapes) is decoded locally, for example with decodeUnknownOption; it never widens the shared contract.
  • Change a shared schema first, then producers and consumers together, with a test pinning both policies.

Signed and raw input

  • Bound every body or frame with a byte budget before buffering or decoding. Reject oversized input with a typed error; never truncate silently.
  • Read the exact bytes, verify the signature or MAC on those bytes, and only then parse. Never verify a decoded and re-serialized value.
  • Compare MACs and tokens in constant time.
  • Keep gates distinct: signature-gated routes, intentionally public routes, and session-authenticated routes. An origin check is not authentication.
  • Binary frames go through the protocol codec first; then validate the decoded struct before persistence. Never trust lengths or field ranges from the wire.
  • Privileged state (billing, roles) comes from verified events and stored rows, never from client-supplied claims.

Implement

  • Treat input as unknown. Decode with Schema.decodeUnknownEffect inside Effect, or decodeUnknownExit/decodeUnknownResult/decodeUnknownOption when a value is easier to branch on. Build decoders once at module scope, not per call, and do not validate a boundary with Schema.is.
  • Porting from Zod: .strict() is { onExcessProperty: "error" }; .passthrough()/.loose() is Schema.StructWithRest(struct, [Schema.Record(Schema.String, Schema.Unknown)]) (v4 strips unknown keys by default and has no preserve mode); z.coerce.number() is Schema.NumberFromString or FiniteFromString; JSON in a string is Schema.fromJsonString; instanceof ZodError is Schema.isSchemaError.
  • Apply Schema.Trim before length or format checks on user text. Brand IDs at ingress with Schema.brand.
  • LLM structured output: pass the Effect Schema to the provider so it derives JSON Schema; prefer Schema.Finite over Schema.Number, which admits "Infinity"/"NaN" strings.
  • Database driver generics (run<T>, query<T>) are casts. Decode projection rows that are JSON or loosely typed.
  • Narrowing a persisted literal union makes old rows undecodable. Never decode stored rows against a narrowed schema under orDie (or any defect conversion) unless the query filters to the same set; one leftover row otherwise kills the whole read.
  • Error envelopes (RPC failures, stored errors) decode with an explicit envelope schema, never by matching message text.
  • Return a generic public error; never echo raw input, tokens, secrets, or internal causes into responses or logs.
  • Do not re-validate downstream; transform the decoded value explicitly.

Verify

  • boundary-audit.sh shows no banned imports, and every parse or cast site feeds a decode or reads trusted local data.
  • Tests cover valid input, malformed JSON or bytes, missing and wrong-typed fields, the excess-field policy, oversized payloads, and bad signatures or auth, where branch behavior is uncertain.
  • The repo's lint, ast-grep rules, type check, and focused tests pass.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Effect Boundary Validation؟

Decode untrusted data once at ingress with Effect Schema (v4) and pass typed values downstream. Use for HTTP bodies, params and query strings, webhooks, RPC and message payloads, MCP tool arguments, env and config, JSON.parse, stored JSON or rows, third-party API responses, unsafe casts, or porting Zod/Valibot schemas.

لماذا تستخدم Effect Boundary Validation على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Effect Boundary Validation عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Effect Boundary Validation في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/jpoehnelt/skills/tree/main/effect-boundary-validation. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Effect Boundary Validation؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Effect Boundary Validation؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Effect Boundary Validation معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Effect Boundary Validation مجانية؟

نعم. نشرها jpoehnelt على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇