add_type

gwexpyに新しい配列型(Array/Series/Field)とコレクションを実装する

16 stars

Best use case

add_type is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

gwexpyに新しい配列型(Array/Series/Field)とコレクションを実装する

Teams using add_type should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/add_type/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/add_type/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/add_type/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How add_type Compares

Feature / Agentadd_typeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

gwexpyに新しい配列型(Array/Series/Field)とコレクションを実装する

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Implement GWExPy Type

This skill guides the implementation of new array/field types in `gwexpy`, ensuring consistency with the existing class hierarchy, metadata management, and documentation standards.

## Workflow

### 1. Survey & Plan
*   **Identify Base Class**: Inherit from `gwexpy.types.Array`, `Array2D`, or similar.
*   **Metadata**: Determine new metadata slots needed (e.g., `_axis0_name`, `_unit`).
*   **Behavior**: Define slicing behavior (does it drop dimensions or maintain them?), arithmetic rules, and domain logic (FFT, etc.).

### 2. Implementation: Core Class
*   **File**: Create `gwexpy/types/yourtype.py`.
*   **Class Definition**:
    ```python
    class YourType(BaseArray):
        _metadata_slots = BaseArray._metadata_slots + ("_new_slot",)
    ```
*   **`__new__`**:
    *   Validate input structure (ndim, etc.).
    *   Initialize metadata slots (handling defaults).
    *   Call `super().__new__`.
*   **`__array_finalize__`**:
    *   Handle 3 creation scenarios: `obj` is None (explicit new), `obj` is subclass (view casting), `obj` is different type (copy/slice).
    *   Copy metadata from `obj` to `self`.
*   **Metadata-Preserving Indexing**: 
    `Field4D` 等の多次元クラスでは、インデックス操作 (`__getitem__`) 時に次元を落とさないことが推奨されます。整数インデックス `i` を `slice(i, i+1)` に変換して処理することで、軸の数とメタデータ(軸名称や単位)を一貫して維持できます。詳細は `manage_field_metadata` スキルを参照してください。
*   **Transpose/Swapaxes**:
    *   Override to update axis-dependent metadata if applicable.

### 3. Implementation: Collections
*   **File**: `gwexpy/types/yourtype_collections.py` (or inside the same file if small).
*   **List Class**: Inherit `list`. Add batch methods (e.g., `process_all`).
*   **Dict Class**: Inherit `dict`. Add batch methods.

### 4. Integration
*   **Export**: Add the new classes to `gwexpy/types/__init__.py`.
*   **Docs**:
    *   Create `docs/reference/en/YourType.md` and `docs/reference/ja/YourType.md`.
    *   Add to `docs/reference/{en,ja}/index.rst`.

### 5. Testing
*   **Location**: `tests/types/test_yourtype.py`.
*   **Coverage**:
    *   Construction (from array, from list, with units).
    *   Metadata persistence.
    *   Slicing behavior (key feature).
    *   Arithmetic operations.
    *   Collection behavior.

## Key Considerations

*   **Quantity Compatibility**: gwexpy types are often subclasses of `astropy.units.Quantity`. Ensure `unit` handling works.
*   **Axis Management**: If managing axes, use `AxisApiMixin` or look at `Array3D`/`Array4D` for how to sync separate axis properties with the array shape.
*   **Documentation**: Always provide both English and Japanese API references.

Related Skills

Advanced Typescript Type Level

16
from diegosouzapw/awesome-omni-skill

Master TypeScript type-level programming with conditional types, mapped types, template literals, and infer patterns. Use when writing advanced types, creating utility types, or solving complex type challenges.

advanced-typescript-patterns

16
from diegosouzapw/awesome-omni-skill

Advanced TypeScript patterns for TMNL. Covers conditional types, mapped types, branded types, generic constraints, type inference, and utility type composition. Pure TypeScript patterns beyond Effect Schema.

advanced-types

16
from diegosouzapw/awesome-omni-skill

Advanced TypeScript types including generics, conditionals, and mapped types

add-event-type

16
from diegosouzapw/awesome-omni-skill

Add a new event type to the frontend feed system with corresponding React component. Use when user mentions "new event", "add event type", "event block", "new block type", or wants to display new agent output types.

add-error-type

16
from diegosouzapw/awesome-omni-skill

Add a new custom error type for domain-specific errors. Use when creating errors for specific business rules or HTTP status codes. Triggers on "add error", "custom error", "error type".

scaffold-bulk-review-prototypes

16
from diegosouzapw/awesome-omni-skill

Review all prototypes at once for cross-prototype consistency, coverage gaps, ADR follow-through, and scope discipline. Use for a full audit of all prototypes.

qwen_training_data_miner_prototype

16
from diegosouzapw/awesome-omni-skill

Qwen Training Data Miner (Prototype)

prototype-to-production

16
from diegosouzapw/awesome-omni-skill

Convert design prototypes (HTML, CSS, Figma exports) into production-ready components. Analyzes prototype structure, extracts design tokens, identifies reusable patterns, and generates typed React components. Adapts to existing project tech stack with React + TypeScript as default.

archetype-designer

16
from diegosouzapw/awesome-omni-skill

Design and manage TraitorSim agent archetypes with OCEAN personality traits, stat biases, and gameplay profiles. Use when creating new archetypes, modifying personality traits, defining character types, or when asked about archetype design, OCEAN traits, Big Five personality, or character templates.

write-data-type-ref

16
from diegosouzapw/awesome-omni-skill

Write a reference documentation page for a specific data type in ZIO Blocks. Use when the user asks to document a data type, write an API reference for a type, or create a reference page for a class/trait/object.

typespec-m365-copilot-typespec-create-agent

16
from diegosouzapw/awesome-omni-skill

Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot Use when: the task directly matches typespec create agent responsibilities within plugin typespec-m365-copilot. Do not use when: a more specific framework or task-focused skill is clearly a better match.

typespec-create-agent

16
from diegosouzapw/awesome-omni-skill

Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot