jpskill.com
🛠️ 開発・MCP コミュニティ

extend-signal-schema

afi-coreの信号スキーマとバリデーターを、決定性を保ちつつ、PoI/PoInsight設計やAFI Droid憲章に従って安全に拡張・改良し、関連する境界線を遵守するSkill。

📜 元の英語説明(参考)

Safely extend or refine AFI signal schemas and closely-related validators in afi-core, while preserving determinism, respecting PoI/PoInsight design, and obeying the AFI Droid Charter and AFI Core AGENTS.md boundaries.

🇯🇵 日本人クリエイター向け解説

一言でいうと

afi-coreの信号スキーマとバリデーターを、決定性を保ちつつ、PoI/PoInsight設計やAFI Droid憲章に従って安全に拡張・改良し、関連する境界線を遵守するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o extend-signal-schema.zip https://jpskill.com/download/17016.zip && unzip -o extend-signal-schema.zip && rm extend-signal-schema.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17016.zip -OutFile "$d\extend-signal-schema.zip"; Expand-Archive "$d\extend-signal-schema.zip" -DestinationPath $d -Force; ri "$d\extend-signal-schema.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して extend-signal-schema.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → extend-signal-schema フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Skill: extend-signal-schema (afi-core)

目的

このスキルは、afi-core で シグナルスキーマを拡張または改良 し、Raw、Enriched、Analyzed、または Scored シグナルスキーマに新しいフィールドや検証ルールを追加する必要がある場合に使用します。

このスキルは、変更が以下であることを保証します。

  • 安全: 可能な限り後方互換性があり、明確な移行パスがある
  • 統制: AFI Droid Charter、AFI Droid Playbook、および afi-core/AGENTS.md に準拠している
  • 正確: PoI/PoInsight はバリデーターレベルの特性であり、シグナルフィールドではない
  • テスト済み: スキーマの変更には、最小限のテストカバレッジが含まれている

このスキルは、主に schema-validator-droid および、シグナルスキーマとバリデーターを扱う将来の afi-core ドロイドによって使用されます。


前提条件

何かを変更する前に、必ず以下を行ってください。

  1. 読む:

    • afi-core/AGENTS.md
    • AFI Droid Charter
    • AFI Droid Playbook
    • schemas/ 内の対象スキーマファイル
  2. 確認:

    • 要求された変更が、afi-reactor (オーケストレーション) または afi-token (経済) ではなく、afi-core (シグナル言語/検証) に属している。
    • 変更によって、PoI/PoInsight がシグナルフィールドとして導入されない。
    • 変更によって、スマートコントラクト、Eliza 設定、またはデプロイメント/インフラリポジトリの編集が必要にならない。

要件が不明確な場合、または AGENTS.md または Charter に違反していると思われる場合は、STOP し、賢く振る舞おうとせずに、人に明確化を求めてください。


期待される入力

呼び出し元は、自然言語または構造化された形式で以下を提供する必要があります。

  • 対象ライフサイクルステージ: Raw、Enriched、Analyzed、または Scored
  • フィールド名: 追加または改良するフィールド
  • 型/形状: 例: stringnumberenumobjectarray
  • 任意性: 必須または任意?任意の場合、デフォルトは何ですか?
  • 説明: フィールドの意味と使用法の簡単な説明
  • 後方互換性: 移行に関する懸念事項や破壊的な変更はありますか?

これらの情報のいずれかが欠落している場合は、明確化のための質問をするか、TODO と保守的なデフォルトを含む、最小限で明確にラベル付けされたスタブを作成してください。


ステップバイステップの手順

このスキルが呼び出されたら、次の手順に従ってください。

1. 要求された変更を言い換える

あなた自身の言葉で、以下を要約してください。

  • どのライフサイクルステージ (Raw/Enriched/Analyzed/Scored) が変更されているか
  • どのフィールドが追加または変更されているか
  • 各フィールドの型、任意性、および目的
  • 後方互換性または移行に関する懸念事項

この要約は、人間が意図を迅速に確認できるように、短く正確である必要があります。


2. スキーマファイルを見つける

関連するスキーマファイルを特定します。通常は次のとおりです。

  • schemas/universal_signal_schema.ts — メインシグナルスキーマ (すべてのステージをカバーする可能性があります)
  • schemas/pipeline_config_schema.ts — パイプライン構成スキーマ
  • schemas/signal_finalization_request_schema.ts — 最終処理リクエストスキーマ
  • schemas/validator_metadata_schema.ts — バリデーターメタデータスキーマ

または、スキーマがステージごとに分割されている場合は、次のようになります。

  • schemas/raw_signal_schema.ts
  • schemas/enriched_signal_schema.ts
  • schemas/analyzed_signal_schema.ts
  • schemas/scored_signal_schema.ts

まだこれらを変更しないでください。現在の構造を理解するだけです。


3. Zod スキーマを更新する

対象のスキーマファイルで:

  1. 新しいフィールドを追加 し、適切な Zod 型を使用します。

    • オプションのフィールドには .optional() を使用します
    • デフォルト値を持つフィールドには .default(value) を使用します
    • 列挙された値には .enum([...]) を使用します
    • 検証ルールには .min().max().regex() を使用します
  2. 明確なコメントを追加 して、以下を説明します。

    • フィールドの目的と使用法
    • フィールドが設定されるタイミング (どのライフサイクルステージ)
    • 制約または検証ルール
  3. 既存のフィールドを保持 します。

    • 既存のフィールドをサイレントに名前変更または削除しないでください
    • フィールドを非推奨にする場合は、明確にマークし、移行ガイダンスを提供します
  4. :

// schemas/universal_signal_schema.ts

export const SignalSchema = z.object({
  // ... 既存のフィールド ...

  // ✨ NEW: マクロレジーム分類 (Enriched ステージ)
  // 値: "risk_on" (強気センチメント)、"risk_off" (防御的)、"neutral"
  macro_regime: z.enum(["risk_on", "risk_off", "neutral"]).optional(),

  // ... スキーマの残りの部分 ...
});

4. 関連する型のエクスポートを更新する

スキーマに対応する TypeScript 型がある場合:

  1. 推論された型をエクスポート します。
export type Signal = z.infer<typeof SignalSchema>;
  1. スキーマを参照する レジストリインターフェースを更新 します。
    • runtime/types.ts または schemas/index.ts を確認してください
    • エクスポートされた型が更新されたスキーマと一致することを確認してください

5. バリデーターを更新する (必要な場合)

新しいフィールドに検証ロジックが必要な場合:

  1. validators/関連するバリデーターを見つけ ます。

    • validators/SignalScorer.ts — シグナルスコアリングロジック
    • validators/index.ts — バリデーターレジストリ
  2. 必要に応じて 検証ロジックを追加 します。

    • 必須フィールドを確認します
    • ビジネスルールに対してフィールド値を検証します
    • 非決定的な動作を文書化します
  3. 可能な限りバリデーターを決定的に保ち ます。

    • ランダムな値、タイムスタンプ、または外部 API 呼び出しを避けます
    • 非決定的な場合は、明確に文書化します

6. テストを追加または更新する

テストパターンが存在する場合:

  1. 新しいフィールドの 単体テストを追加 します。

    • 有効な値をテストします
    • 無効な値をテストします (検証に失敗するはずです)
    • オプションと必須の動作をテストします
  2. スキーマが変更された場合は 既存のテストを更新 します。

    • 古いスキーマの形状を想定するテストを修正します
    • 新しいフィールドの新しいテストケースを追加します
  3. テストの場所の例:

    • tests/ — Vitest 単体テスト
    • signal_schema_test/ — スキーマ固有のテストスイート

まだテストパターンが存在しない場合は、明確にマークされた TODO を残し、このことを要約に含めてください。


7. 検証とビルド

少なくとも以下を実行します。

  • afi-corenpm run build

関連するテストが存在し、実行しても安全な場合:

  • npm test または npm run test:run (Vitest)

ビルドが失敗した場合は、スキルを「成功」としてマークしないでください。代わりに、停止し、エラー出力を収集し、最小限で明確な解説とともに表面化させてください。


ハードバウンダリ

これを使用する場合

(原文はここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Skill: extend-signal-schema (afi-core)

Purpose

Use this skill when you need to extend or refine signal schemas in afi-core, adding new fields or validation rules to the Raw, Enriched, Analyzed, or Scored signal schemas.

This skill ensures changes are:

  • Safe: Backwards compatible where possible, with clear migration paths
  • Governed: Aligned with AFI Droid Charter, AFI Droid Playbook, and afi-core/AGENTS.md
  • Correct: PoI/PoInsight remain validator-level traits, NOT signal fields
  • Tested: Schema changes include minimal test coverage

This skill is primarily used by schema-validator-droid and any future afi-core droids that work on signal schemas and validators.


Preconditions

Before changing anything, you MUST:

  1. Read:

    • afi-core/AGENTS.md
    • AFI Droid Charter
    • AFI Droid Playbook
    • Target schema file(s) in schemas/
  2. Confirm:

    • The requested change belongs in afi-core (signal language/validation), not in afi-reactor (orchestration) or afi-token (economics).
    • The change does not introduce PoI/PoInsight as signal fields.
    • The change does not require editing smart contracts, Eliza configs, or deployment/infra repos.

If any requirement is unclear or appears to violate AGENTS.md or Charter, STOP and ask for human clarification instead of trying to be clever.


Inputs Expected

The caller should provide, in natural language or structured form:

  • Target lifecycle stage: Raw, Enriched, Analyzed, or Scored
  • Field name(s): The field(s) to add or refine
  • Type/shape: e.g., string, number, enum, object, array
  • Optionality: Required or optional? If optional, what's the default?
  • Description: Brief explanation of field meaning and usage
  • Backwards compatibility: Any migration concerns or breaking changes?

If any of this information is missing, ask clarifying questions or produce a minimal, clearly-labeled stub with TODOs and conservative defaults.


Step-by-Step Instructions

When this skill is invoked, follow this sequence:

1. Restate the requested change

In your own words, summarize:

  • Which lifecycle stage (Raw/Enriched/Analyzed/Scored) is being modified
  • Which field(s) are being added or changed
  • The type, optionality, and purpose of each field
  • Any backwards compatibility or migration concerns

This summary should be short and precise, so humans can quickly confirm the intent.


2. Locate the schema files

Identify the relevant schema file(s), typically:

  • schemas/universal_signal_schema.ts — Main signal schema (may cover all stages)
  • schemas/pipeline_config_schema.ts — Pipeline configuration schema
  • schemas/signal_finalization_request_schema.ts — Finalization request schema
  • schemas/validator_metadata_schema.ts — Validator metadata schema

Or, if schemas are split by stage:

  • schemas/raw_signal_schema.ts
  • schemas/enriched_signal_schema.ts
  • schemas/analyzed_signal_schema.ts
  • schemas/scored_signal_schema.ts

Do not modify these yet; just understand the current structure.


3. Update the Zod schema

In the target schema file:

  1. Add new fields with appropriate Zod types:

    • Use .optional() for optional fields
    • Use .default(value) for fields with defaults
    • Use .enum([...]) for enumerated values
    • Use .min(), .max(), .regex() for validation rules
  2. Add clear comments explaining:

    • Field purpose and usage
    • When the field is populated (which lifecycle stage)
    • Any constraints or validation rules
  3. Preserve existing fields:

    • Do NOT silently rename or remove existing fields
    • If deprecating a field, mark it clearly and provide migration guidance
  4. Example:

// schemas/universal_signal_schema.ts

export const SignalSchema = z.object({
  // ... existing fields ...

  // ✨ NEW: Macro regime classification (Enriched stage)
  // Values: "risk_on" (bullish sentiment), "risk_off" (defensive), "neutral"
  macro_regime: z.enum(["risk_on", "risk_off", "neutral"]).optional(),

  // ... rest of schema ...
});

4. Update related type exports

If the schema has corresponding TypeScript types:

  1. Export the inferred type:
export type Signal = z.infer<typeof SignalSchema>;
  1. Update any registry interfaces that reference the schema:
    • Check runtime/types.ts or schemas/index.ts
    • Ensure exported types match the updated schema

5. Update validators (if needed)

If the new field requires validation logic:

  1. Locate the relevant validator in validators/:

    • validators/SignalScorer.ts — Signal scoring logic
    • validators/index.ts — Validator registry
  2. Add validation logic if needed:

    • Check for required fields
    • Validate field values against business rules
    • Document any non-deterministic behavior
  3. Keep validators deterministic where possible:

    • Avoid random values, timestamps, or external API calls
    • If non-deterministic, document clearly

6. Add or update tests

Where test patterns exist:

  1. Add unit tests for the new field:

    • Test valid values
    • Test invalid values (should fail validation)
    • Test optional vs required behavior
  2. Update existing tests if schema changed:

    • Fix tests that expect old schema shape
    • Add new test cases for new fields
  3. Example test locations:

    • tests/ — Vitest unit tests
    • signal_schema_test/ — Schema-specific test suites

If no test patterns exist yet, leave a clearly marked TODO and surface this in your summary.


7. Validate and build

Run at least:

  • npm run build in afi-core

If relevant tests exist and are safe to run:

  • npm test or npm run test:run (Vitest)

Do not mark the skill as "successful" if the build fails. Instead, stop, gather error output, and surface it with minimal, clear commentary.


Hard Boundaries

When using this skill, you MUST NOT:

  • Modify orchestration logic in afi-reactor:

    • Do NOT edit DAG wiring, pipeline execution, or orchestration code.
    • Schema changes belong in afi-core; DAG wiring belongs in afi-reactor.
  • Introduce PoI/PoInsight as signal fields:

    • Do NOT add poi, poinsight, proof_of_intelligence, or similar fields.
    • PoI/PoInsight are validator-level traits, NOT signal-level fields.
    • If a request asks for this, STOP and escalate.
  • Touch token/economics:

    • Do NOT modify smart contracts, emissions, or tokenomics in afi-token.
  • Modify Eliza agents or gateways:

    • Do NOT edit Eliza agent configs, character specs, or runtime behavior.
    • Do NOT modify afi-gateway.
  • Touch infra/ops:

    • Do NOT modify deployment configs, Terraform, K8s, or CI/CD.
  • Perform large sweeping refactors:

    • Do NOT restructure the entire schema architecture without explicit approval.
    • Do NOT rename or remove existing fields without a migration strategy.
  • Break backwards compatibility:

    • Do NOT remove required fields without a deprecation path.
    • Do NOT change field types in breaking ways without human approval.

If a request forces you towards any of the above, STOP and escalate.


Output / Summary Format

At the end of a successful extend-signal-schema operation, produce a short summary that includes:

  • Lifecycle stage(s) modified: Raw, Enriched, Analyzed, or Scored
  • Fields added/changed: List each field with:
    • Field name
    • Type (string, number, enum, object, etc.)
    • Optionality (required or optional)
    • Brief description
  • Files created/modified:
    • Schema file(s)
    • Validator file(s) (if any)
    • Type export file(s)
    • Test file(s)
  • Build/test results: Pass or fail
  • Backwards compatibility: Any breaking changes or migration notes
  • TODOs or open questions: Any human decision points

Aim for something a human maintainer can read in under a minute to understand exactly what changed and why.


Example Usage Patterns

Use This Skill For

  • "Add an optional macro_regime field to Enriched signals with enum values risk_on, risk_off, neutral."

  • "Extend the Scored schema to include a risk_breakdown object with sub-scores for market_risk, liquidity_risk, and execution_risk."

  • "Add a derivative_underlier string field to Analyzed signals for options/futures-only signals."

  • "Add a required content field to all signals (already exists, but make it required with a migration strategy)."

  • "Refine the action field to include new enum values: buy, sell, hold, close, reduce."

Do NOT Use This Skill For

  • "Wire the new schema into the DAG pipeline." → Use add-dag-node skill in afi-reactor instead.

  • "Add PoInsight as a field on Scored signals." → Violates PoI/PoInsight design (escalate to human).

  • "Modify token emissions based on signal scores." → Belongs in afi-token (escalate to human).

  • "Update Eliza agent character specs to use the new field." → Belongs in afi-gateway (escalate to human).

  • "Add a new validator that calls an external API." → Requires explicit approval (escalate to human).


Migration Strategy Guidance

When adding fields that may break backwards compatibility:

For Optional Fields (Safe)

  • Add field with .optional()
  • No migration needed
  • Document when the field is populated

For Required Fields (Breaking)

  • Option 1: Add as optional first, then require in a future version
  • Option 2: Add with .default(value) to provide backwards compatibility
  • Option 3: Provide explicit migration script or guidance

Always document the migration strategy in your summary.


Example: Adding an Optional Field

Request: "Add an optional macro_regime field to Enriched signals."

Summary:

  • Stage modified: Enriched (via universal_signal_schema.ts)
  • Field added: macro_regime
    • Type: enum(["risk_on", "risk_off", "neutral"])
    • Optionality: Optional
    • Description: Macro regime classification for market sentiment
  • Files modified:
    • schemas/universal_signal_schema.ts (added field)
    • schemas/index.ts (re-exported type)
  • Build/test results: ✅ Pass
  • Backwards compatibility: ✅ Safe (optional field)
  • TODOs: None

Example: Adding a Required Field with Default

Request: "Make content field required for all signals."

Summary:

  • Stage modified: All stages (via universal_signal_schema.ts)
  • Field changed: content
    • Type: string (min 1, max 280)
    • Optionality: Required (was optional)
    • Migration: Added .default("") for backwards compatibility
  • Files modified:
    • schemas/universal_signal_schema.ts (changed optionality)
    • tests/signal_schema.test.ts (updated tests)
  • Build/test results: ✅ Pass
  • Backwards compatibility: ⚠️ Breaking change mitigated with default value
  • TODOs: Consider removing default in v2.0 after migration period

Last Updated: 2025-11-27 Maintainers: AFI Core Team Charter: afi-config/codex/governance/droids/AFI_DROID_CHARTER.v0.1.md