AgentSkillsCN

skill-authoring

为 @rytass 包编写 Claude Code 技能文档的指南(建立套件文件技能指南)。适用于创建新的包文档技能、撰写 SKILL.md 文件,或设计技能结构时使用。

SKILL.md
--- frontmatter
name: skill-authoring
description: Guide for creating Claude Code skills to document @rytass packages (建立套件文件 skill 指南). Use when creating new package documentation skills, writing SKILL.md files, or designing skill structure.

Package Documentation Skill Authoring Guide

This skill documents the methodology for creating Claude Code skills that document @rytass/* packages.

Overview

When creating skills for package documentation, follow this structured approach:

  1. Explore - Understand the package structure
  2. Plan - Design the skill architecture
  3. Implement - Write the skill files
  4. Refine - Add bilingual triggers and optimize

Phase 1: Exploration

1.1 Identify Package Scope

Determine which packages to document:

code
packages/{category}-*          # e.g., invoice-*, payments-*, storages-*

Questions to answer:

  • Is there a base package defining interfaces? (e.g., @rytass/invoice)
  • How many adapter implementations exist?
  • What is the relationship between packages?

1.2 Analyze Package Exports

For each package, identify:

CategoryWhat to Document
ClassesGateway, Entity, Allowance classes
InterfacesCore interfaces and their properties
EnumsAll enum values with descriptions
TypesType aliases and union types
FunctionsUtility functions with signatures
ConstantsExported constants and helpers

1.3 Understand Usage Patterns

Identify common operations:

  • Initialization / configuration
  • CRUD operations (create, read, update, delete)
  • Validation methods
  • Error handling patterns

Phase 2: Planning

2.1 Determine Skill Structure

Single Skill - For simple packages with limited scope

code
.claude/skills/{package-name}/
└── SKILL.md

Multi-File Skill - For complex packages (recommended for adapters)

code
.claude/skills/{package-name}/
├── SKILL.md              # Overview, quick start, comparison
├── {PROVIDER-1}.md       # Detailed reference
├── {PROVIDER-2}.md       # Detailed reference
└── ...

Dual Skill - When separating user vs developer concerns

code
.claude/skills/{package}-adapters/     # User-facing
.claude/skills/{package}-development/  # Developer-facing

2.2 Content Architecture

SKILL.md (Main File) - Keep under 500 lines

SectionPurpose
OverviewWhat the packages do, unified interface
Installationnpm install commands
Quick StartMinimal working examples
Feature ComparisonTable comparing providers
Detailed Docs LinksLinks to reference files

Reference Files - One per provider/component

SectionPurpose
ConstructorParameters and initialization
MethodsAll public methods with signatures
ClassesEntity and value object classes
TypesProvider-specific type definitions
Complete ExampleFull working code sample

2.3 Progressive Disclosure Pattern

code
SKILL.md (loaded first)
    │
    ├── Quick overview (always visible)
    ├── Common operations
    └── Links to details
            │
            └── PROVIDER.md (loaded on demand)
                    │
                    └── Full API reference

Benefits:

  • Reduces initial context load
  • Users get relevant detail only when needed
  • Keeps main file scannable

Phase 3: Implementation

3.1 YAML Frontmatter

yaml
---
name: package-name
description: Brief description with trigger words in English (中文觸發詞). Maximum 1024 characters.
---

Name Rules:

  • Lowercase letters, numbers, hyphens only
  • Maximum 64 characters
  • Should match directory name

Description Best Practices:

  • Include both English and Chinese trigger words
  • Format: English term (中文) for key concepts
  • Cover primary use cases
  • Include provider names if applicable

3.2 Description Template

code
{What it does} ({中文說明}). Use when {use case 1}, {use case 2 (中文)}.
Covers {topic 1} ({中文}), {topic 2} ({中文}).

Example:

code
Taiwan e-invoice integration (台灣電子發票整合). Use when working with
ECPay (綠界), EZPay (藍新). Covers issuing invoices (開立發票),
voiding (作廢), allowances (折讓).

3.3 Markdown Structure

Overview Section:

markdown
# Package Name

Brief description of the package family.

## Overview

| Package | Provider | Description |
|---------|----------|-------------|
| `@rytass/pkg-adapter-a` | Provider A (中文名) | Brief desc |
| `@rytass/pkg-adapter-b` | Provider B (中文名) | Brief desc |

Installation Section:

markdown
## Installation

\`\`\`bash
npm install @rytass/package-name
\`\`\`

Quick Start Section:

markdown
## Quick Start

### Provider A

\`\`\`typescript
import { ProviderAGateway } from '@rytass/pkg-adapter-a';

const gateway = new ProviderAGateway({
  // configuration
});

// Basic operation
const result = await gateway.operation({
  // parameters
});
\`\`\`

Method Documentation:

markdown
#### `methodName(options: OptionsType): Promise<ReturnType>`

Brief description.

**Parameters:**

| Option | Type | Required | Description |
|--------|------|----------|-------------|
| `param1` | `string` | Yes | Description |
| `param2` | `number` | No | Description (default: value) |

**Returns:** `Promise<ReturnType>`

**Example:**

\`\`\`typescript
const result = await gateway.methodName({
  param1: 'value',
});
\`\`\`

Phase 4: Refinement

4.1 Bilingual Trigger Words

Add Chinese keywords for Taiwan users:

English中文
invoice發票、電子發票
issue開立
void作廢
allowance折讓
payment付款、支付
storage儲存、存儲

4.2 Feature Comparison Tables

Always include a comparison table for multi-provider skills:

markdown
| Feature | Provider A | Provider B | Provider C |
|---------|:----------:|:----------:|:----------:|
| Feature 1 | Yes | Yes | No |
| Feature 2 | Yes | No | Yes |

Use :-----: for centered alignment with checkmarks.

4.3 Complete Examples

Every reference file should end with a complete, runnable example:

markdown
## Complete Example

\`\`\`typescript
import { Gateway, Type1, Type2 } from '@rytass/package';

async function main() {
  // 1. Initialize
  const gateway = new Gateway({ /* config */ });

  // 2. Create
  const entity = await gateway.create({ /* options */ });

  // 3. Query
  const found = await gateway.query({ /* options */ });

  // 4. Update/Modify
  const updated = await gateway.modify(entity, { /* options */ });

  // 5. Delete/Void
  await gateway.delete(entity);
}

main().catch(console.error);
\`\`\`

Checklist

Before finalizing a skill:

  • YAML frontmatter starts on line 1 (no blank lines before)
  • name is lowercase with hyphens only
  • description includes Chinese trigger words
  • description is under 1024 characters
  • SKILL.md is under 500 lines
  • All public methods documented
  • All types and enums documented
  • Installation instructions included
  • Quick start examples work
  • Feature comparison table included (if multi-provider)
  • Complete example at end of each reference file
  • Links to reference files use relative paths

Example: Invoice Skills Structure

Reference implementation from invoice-adapters and invoice-development:

code
.claude/skills/
├── invoice-adapters/           # User-facing skill
│   ├── SKILL.md               # Overview, quick start, comparison
│   ├── ECPAY.md               # ECPay full reference
│   ├── EZPAY.md               # EZPay full reference
│   ├── BANK-PRO.md            # BankPro full reference
│   └── AMEGO.md               # Amego full reference
│
└── invoice-development/        # Developer-facing skill
    ├── SKILL.md               # Base package overview
    ├── BASE-INTERFACES.md     # Interface specifications
    └── CREATE-ADAPTER.md      # How to create new adapter

Key decisions made:

  1. Split into user vs developer skills
  2. One reference file per provider
  3. Progressive disclosure for detailed API
  4. Chinese keywords in description for Taiwan users