cangjie-annotation

Explain Cangjie built-in annotations for source introspection and conditional compilation.

1|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/SunriseSummer/CangjieDocValidator --skill cangjie-annotation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-annotation
Source: https://github.com/SunriseSummer/CangjieDocValidator/tree/main/.github/skills/inner_annotation
Command: npx skills add https://github.com/SunriseSummer/CangjieDocValidator --skill cangjie-annotation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers understand and effectively use Cangjie SDK's built-in annotations for source code location, conditional compilation, performance optimization, ABI stability, metadata tagging, and deprecation management.

Core Features & Use Cases

  • Source Location: Get package, file, and line number information.
  • Conditional Compilation: Use @When to compile code based on OS, architecture, or build mode.
  • Performance: Optimize foreign function calls with @FastNative.
  • ABI Stability: Ensure backward compatibility with @Frozen.
  • Metadata: Add runtime-readable attributes with @Attribute.
  • Deprecation: Mark APIs for removal with @Deprecated.
  • Use Case: When writing platform-specific code in Cangjie, use @When to ensure the correct implementation is compiled for each target operating system.

Quick Start

Explain the usage of the @sourceLine() annotation in Cangjie.

Frequently Asked Questions about cangjie-annotation

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

FAQPage Schema
Can I add runtime-readable metadata to my Cangjie source code?

Yes, use the `@Attribute` annotation in Cangjie to tag your source code with metadata. This provides runtime-readable attributes for better code attribution and introspection.

What is the best way to get source code location information in Cangjie?

Use built-in Cangjie source location annotations like `@sourcePackage`, `@sourceFile`, and `@sourceLine` to perform source code introspection and retrieve package, file, and line number details.

How do I optimize foreign function calls for performance in Cangjie?

Apply the `@FastNative` annotation to your foreign function calls in Cangjie to optimize execution performance. This directive specifically tunes external function integration.

How can I ensure ABI stability and backward compatibility for a Cangjie SDK?

Use the `@Frozen` annotation in Cangjie to freeze your Application Binary Interface. This ensures backward compatibility by preventing structural changes that break dependent code.

How do I mark deprecated APIs for removal in Cangjie?

Apply the `@Deprecated` annotation to mark outdated APIs in Cangjie. This manages deprecation by signaling that specific functions or interfaces are scheduled for future removal.

Can I add runtime-readable metadata to my Cangjie source code?

Yes, use the `@Attribute` annotation in Cangjie to tag your source code with metadata. This provides runtime-readable attributes for better code attribution and introspection.