cangjie-generic

Explain Cangjie generic declarations, constraints, type variance, and type aliases.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you understand and utilize the powerful generic programming features of the Cangjie language, enabling you to write more flexible, reusable, and type-safe code.

Core Features & Use Cases

  • Generic Declarations: Learn how to declare generic functions, classes, interfaces, structs, and enums.
  • Constraints & Type Aliases: Understand how to apply constraints using where clauses and define type aliases for cleaner code.
  • Type Variance: Grasp the concepts of covariance, contravariance, and invariance in generic types.
  • Use Case: When developing a data structure like a List or Dictionary in Cangjie, you'll use generics to ensure it can hold any type of element while maintaining type safety.

Quick Start

Explain the concept of generic type parameters in Cangjie.

Frequently Asked Questions about cangjie-generic

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

FAQPage Schema
How do I use generics in Cangjie to create type-safe data structures?

Cangjie generics allow you to declare generic functions, classes, and structs to build reusable data structures like a List while maintaining strict type safety for any element type.

What are generic constraints and how do they work in Cangjie?

Generic constraints in Cangjie are applied using where clauses to enforce specific type rules on generic parameters, ensuring that only compliant types are accepted by your generic classes and functions.

How does type variance work for generic types in Cangjie?

Type variance in Cangjie generics defines how generic types handle covariance, contravariance, and invariance, dictating the assignability and hierarchical relationships between instantiated generic types.

Can I define generic interfaces and enums in the Cangjie language?

Yes, you can define generic interfaces and enums in Cangjie, extending type-safe reusability to complex type definitions and allowing flexible contract implementations across your codebase.

Do I need to understand Cangjie syntax to use generic programming features?

Yes, effective application of generic programming requires a solid understanding of the Cangjie syntax and type system to properly declare types, apply constraints, and manage type aliases.

How do I use type aliases with Cangjie generics to simplify complex declarations?

You can define type aliases in Cangjie to create cleaner, more readable code by providing simplified names for complex generic type parameters and instantiated generic classes.