cangjie-enum

Explain Cangjie enum definition rules, usage patterns, and Equatable interface implementation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill clarifies the intricacies of defining and using enumeration types in the Cangjie language, addressing potential pitfalls and advanced features.

Core Features & Use Cases

  • Enum Definition Rules: Understand syntax, constructor variations (named, unnamed, same-name), and scope limitations.
  • Enum Usage: Learn how to create enum values, handle name conflicts, and leverage features like member functions.
  • Equatable Interface: Grasp how to enable == comparisons for enums using the @Derive[Equatable] macro.
  • Use Case: When encountering complex data structures or state representations in Cangjie, this Skill provides the precise guidance needed to implement them correctly using enums.

Quick Start

Explain the rules for defining a Cangjie enum with named and unnamed constructors.

Frequently Asked Questions about cangjie-enum

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

FAQPage Schema
How do I define an enum in Cangjie with named and unnamed constructors?

To define an enum in Cangjie, you use specific syntax rules that allow both named and unnamed constructors. This Skill explains how to create enumeration values using these constructor variations and navigate scope limitations.

How do I implement Equatable interface comparisons for Cangjie enum types?

You implement Equatable comparisons for Cangjie enum types by applying the `@Derive[Equatable]` macro. This enables direct `==` comparisons between enumeration instances without manually writing the equality logic.

Can I use member functions and recursive definitions in Cangjie enums?

Yes, Cangjie enums support adding member functions to encapsulate behavior within the type. This Skill covers the rules for recursive enum definitions and how to manage potential name conflicts during usage.

What are the rules for handling name conflicts in Cangjie enum constructors?

Handling name conflicts in Cangjie enum constructors requires understanding scope limitations and same-name constructor variations. This Skill clarifies how to define and instantiate enums correctly to avoid scope errors.

When should I use Cangjie enums for complex data structures?

You should use Cangjie enums when representing complex data structures or state representations. This Skill provides guidance on implementing these structures correctly using features like member functions and the Equatable interface.