Extend signal schema

From aiskillstore/marketplace · View interactive version

Extend signal schema is an AI agent skill from the GitHub repository aiskillstore/marketplace. 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.

How to use this skill

Skill file

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:

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:
  1. Confirm:

not in afi-reactor (orchestration) or afi-token (economics).

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:

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:

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:

Or, if schemas are split by stage:

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:
  1. Add clear comments explaining:
  1. Preserve existing fields:
  1. 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:

5. Update validators (if needed)

If the new field requires validation logic:

  1. Locate the relevant validator in validators/:
  1. Add validation logic if needed:
  1. Keep validators deterministic where possible:

6. Add or update tests

Where test patterns exist:

  1. Add unit tests for the new field:
  1. Update existing tests if schema changed:
  1. Example test locations:

If no test patterns exist yet, leave a clearly marked TODO and surface this

in your summary.


7. Validate and build

Run at least:

If relevant tests exist and are safe to run:

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:

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:

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

risk_on, risk_off, neutral."

for market_risk, liquidity_risk, and execution_risk."

options/futures-only signals."

required with a migration strategy)."

close, reduce."

Do NOT Use This Skill For

→ Author the pipeline composition in afi-reactor (governed registries/manifests) instead.

→ Violates PoI/PoInsight design (escalate to human).

→ Belongs in afi-token (escalate to human).

→ Belongs in afi-gateway (escalate to human).

→ Requires explicit approval (escalate to human).


Migration Strategy Guidance

When adding fields that may break backwards compatibility:

For Optional Fields (Safe)

For Required Fields (Breaking)

Always document the migration strategy in your summary.


Example: Adding an Optional Field

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

Summary:


Example: Adding a Required Field with Default

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

Summary:


Last Updated: 2025-11-27

Maintainers: AFI Core Team

Charter: afi-config/codex/governance/droids/AFI_DROID_CHARTER.v0.1.md

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.