cangjie-type-system

Document Cangjie static type system subtyping, variance, and conversion rules.

2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-type-system-zhenzhizhi12
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-type-system
Source: https://github.com/zhenzhizhi12/NexusAgent/tree/main/.opencode/skills/common-skill-l1/type_system
Command: npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-type-system-zhenzhizhi12

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill clarifies the intricate rules of Cangjie's type system, including subtyping, variance, and type conversions, ensuring correct and predictable code behavior.

Core Features & Use Cases

  • Subtyping: Understand class inheritance, interface implementation, tuple, and function type relationships.
  • Variance: Grasp covariant, contravariant, and invariant rules for generic types.
  • Type Conversion: Learn explicit conversions for numeric types, Runes, and safe casting with is and as operators.
  • Use Case: When encountering complex generic type definitions or needing to ensure safe type casting in Cangjie, consult this Skill for precise rules.

Quick Start

Explain the subtyping relationship between a derived class and its base class in Cangjie.

Frequently Asked Questions about cangjie-type-system

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does subtyping work in the Cangjie programming language?

Cangjie subtyping establishes type relationships through class inheritance, interface implementation, tuple covariance, and function contravariance or covariance to ensure predictable static type behavior.

What are the variance rules for generics in Cangjie?

Cangjie generics variance rules define covariant, contravariant, and invariant behaviors for user-defined generic types and built-in types, dictating how generic instances relate to each other.

How do I perform safe type casting and explicit conversions in Cangjie?

Safe type casting in Cangjie uses the `is` and `as` operators, while explicit type conversions handle numeric types and Runes to ensure correct value transformations.

When do I need to consult Cangjie type system variance rules?

You need Cangjie type system variance rules when encountering complex generic type definitions or needing to ensure safe type casting to prevent runtime type errors.

Can I use tuple covariance and function contravariance together in Cangjie?

Yes, Cangjie's static type system explicitly supports both tuple covariance and function contravariance or covariance simultaneously to govern complex type relationships safely.