cangjie-extension

Extend Cangjie types with functions, properties, and interface implementations.

4|1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-extension-junjiechen0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-extension
Source: https://github.com/JunjieChen0/NJUST/tree/main/.njust-ai/skills/cangjie-extend
Command: npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-extension-junjiechen0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables developers to extend existing Cangjie language types by adding new functionality such as member functions, properties, and interface implementations, without introducing new state or breaking existing code.

Core Features & Use Cases

  • Direct extensions: add functions and properties to existing types.
  • Interface extensions: implement interfaces for existing types without modifying their definitions.
  • Generic extensions: extend generic types with constraints and specialized behavior.
  • Adhere to access rules and orphan rules to maintain module boundaries and safe cross-package usage.

Quick Start

Extend a visible type with a new public function and test it in your codebase.

Frequently Asked Questions about cangjie-extension

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

FAQPage Schema
How do I add new functions to existing Cangjie language types without modifying their original definitions?

You can extend Cangjie language types by using direct extensions to add new member functions and properties, or interface extensions to implement interfaces, without introducing new state or breaking existing code.

Can I implement interfaces for existing types in Cangjie across different packages?

Yes, interface extensions allow implementing interfaces for existing types, but you must adhere to access rules and orphan rules to maintain module boundaries and ensure safe cross-package usage.

How do generic extensions work in Cangjie for specialized type behavior?

Generic extensions in Cangjie allow you to extend generic types with specific constraints and specialized behavior, applying new functionalities only when the generic type parameters meet the defined access-rule constraints.

What are the visibility controls and orphan rules for Cangjie extension blocks?

Cangjie extension blocks enforce specific visibility controls and orphan rules that dictate extension syntax, preventing unauthorized cross-package modifications and maintaining safe module boundaries during export and import behavior.

When should I use direct extensions versus interface extensions in Cangjie?

Use direct extensions to simply add functions and properties to existing types, whereas interface extensions are utilized when you need existing types to satisfy specific interface contracts without altering their core definitions.

Why do my Cangjie extensions fail when accessing types from another package?

Cross-package Cangjie extensions fail when violating orphan rules or visibility controls, which are explicitly implemented to maintain module boundaries and regulate safe export and import behavior across extension blocks.