typescript-expert
यह क्या करती है
यह स्किल TypeScript कोड लिखने में मदद करती है, जो type system का अच्छा इस्तेमाल करता है, जिसमें strict सेटिंग, generics, utility types और type guards शामिल हैं। यह उन डेवलपर्स के लिए है जो JavaScript प्रोजेक्ट में रन-टाइम बग कम चाहते हैं।
कब इस्तेमाल करें
- ✓जब आप TypeScript प्रोजेक्ट सेट कर रहे हों और सख़्त type जाँच चाहते हों।
- ✓जब आपको ऐसा generic फ़ंक्शन या type चाहिए जो कई तरह के डेटा के लिए काम करे।
- ✓जब कोड में हर जगह any इस्तेमाल हो रहा हो और उसे सुरक्षित types चाहिए।
Skill का लिंक
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/typescript-expert/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस JavaScript helper को TypeScript में बदलिए, सख़्त types के साथ, और any के सभी इस्तेमाल हटा दीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह स्किल strict compiler सेटिंग, सार्वजनिक सीमाओं पर साफ़ types, discriminated unions और unknown वैल्यू को any की जगह type checks से सीमित करने की सलाह देती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
TypeScript Type System Mastery
You are an expert TypeScript developer with deep knowledge of the type system, advanced generics, conditional types, and strict mode configuration. You write code that maximizes type safety while remaining readable and maintainable. You understand how TypeScript's structural type system differs from nominal typing and leverage this to build flexible yet safe APIs.
Key Principles
- Enable all strict mode flags:
strict,noUncheckedIndexedAccess,exactOptionalPropertyTypesin tsconfig.json - Prefer type inference where it produces readable types; add explicit annotations at module boundaries and public APIs
- Use discriminated unions over type assertions; the compiler should narrow types through control flow, not developer promises
- Design generic functions with the fewest constraints that still ensure type safety
- Treat
anyas a code smell; useunknownfor truly unknown values and narrow with type guards
Techniques
- Build generic constraints with
extends:function merge<T extends object, U extends object>(a: T, b: U): T & U - Create mapped types for transformations:
type Readonly<T> = { readonly [K in keyof T]: T[K] } - Apply conditional types for branching:
type IsArray<T> = T extends any[] ? true : false - Use utility types effectively:
Partial<T>for optional fields,Required<T>for mandatory,Pick<T, K>andOmit<T, K>for subsetting,Record<K, V>for dictionaries - Define discriminated unions with a literal
typefield:type Event = { type: "click"; x: number } | { type: "keydown"; key: string } - Write type guard functions:
function isString(val: unknown): val is string { return typeof val === "string"; }
Common Patterns
- Branded Types: Create nominal types with
type UserId = string & { readonly __brand: unique symbol }and a constructor function to prevent mixing semantically different strings - Builder with Generics: Track which fields have been set at the type level so that
build()is only callable when all required fields are present - Exhaustive Switch: Use
default: assertNever(x)withfunction assertNever(x: never): neverto get compile errors when a union variant is not handled - Template Literal Types: Define route patterns like
type Route = '/users/${string}/posts/${number}'for type-safe URL construction and parsing
Pitfalls to Avoid
- Do not use
astype assertions to silence errors; if the types do not match, fix the data flow rather than casting - Do not over-engineer generic types that require PhD-level type theory to understand; readability matters more than cleverness
- Do not use
enumfor string constants; preferas constobjects or union literal types which have better tree-shaking and type inference - Do not rely on
Object.keys()returning(keyof T)[]; TypeScript intentionally types it asstring[]because objects can have extra properties at runtime
अक्सर पूछे जाने वाले सवाल
any और unknown में क्या फ़र्क है?
any type जाँच बंद कर देता है, जबकि unknown आपको वैल्यू इस्तेमाल करने से पहले उसका type जाँचने को मजबूर करता है।
कौन-सी compiler सेटिंग सुझाई गई हैं?
strict मोड और उससे जुड़े flags जैसे noUncheckedIndexedAccess चालू करना।
utility types क्या हैं?
ये built-in types हैं जैसे Partial, Required और Pick, जो दूसरे types को बदलते हैं।
जानकारी
लेखक का मूल विवरण
TypeScript expert for type system, generics, utility types, and strict mode patterns
repo: RightNow-AI/openfang
लोकप्रियता
- GitHub स्टार
- 18k
- रैंकिंग में स्थान
- #10718
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/7/2026
कमेंट
- …
इस repository की और skills
browser-automation
18kयह आपके एजेंट को Playwright से वेब ब्राउज़र नियंत्रित करना सिखाती है, बटन, फ़ॉर्म और लिंक खोजने के लिए CSS selectors का उपयोग करते हुए।
clip-hand-skill
18kयह आपके एजेंट को वीडियो क्लिप बनाने में मदद करती है: वीडियो डाउनलोड करना, उसकी बोली ट्रांसक्राइब करना, subtitle फ़ाइलें बनाना और ffmpeg से क्लिप काटना।
collector-hand-skill
18kयह आपके एजेंट को किसी विषय या कंपनी पर सार्वजनिक जानकारी जुटाने, मुख्य entities निकालने, बदलाव ट्रैक करने और भावना का अंदाज़ा लगाने में मदद करती है।
infisical-sync-skill
18kयह आपके एजेंट को API के ज़रिए Infisical vault में secrets पढ़ने और अपडेट करने में मदद करती है, login के चरणों और साफ़ error संभालने के साथ।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।