# Extend AFI Signal Schemas Safely

Schema changes can break validators, downstream types, and migration paths. This skill guides Claude, Codex, and Claude Code through scoped AFI signal schema updates with tests and governance checks.

## Install

```bash
npx skillstore add afi-protocol/extend-signal-schema
```

## Metadata

- - Status: approved
- - Slug: afi-protocol-extend-signal-schema
- - Version: 1.0.0
- - Author: AFI-Protocol
- - GitHub username: AFI-Protocol
- - License: MIT
- - Repository: https://github.com/AFI-Protocol/afi-core/tree/main/.factory/skills/extend-signal-schema
- - Ref: main
- - Supported tools: Claude, Codex, Claude Code
- - Risk level: safe
- - Quality score: 80
- - Quality tier: silver
- - Public page: https://skillstore.pages.dev/skills/afi-protocol-extend-signal-schema
- - Manifest: https://skillstore.pages.dev/api/skills/afi-protocol-extend-signal-schema/manifest

## Capabilities

- Identifies the correct AFI signal lifecycle stage before changing schemas.
- Guides Zod field additions with optionality, defaults, enums, and validation rules.
- Keeps PoI and PoInsight as validator-level traits instead of signal fields.
- Prompts updates to related TypeScript exports and validators when needed.
- Requires build and test verification before reporting success.
- Produces concise change summaries with migration notes and open questions.

## Use Cases

- Add Optional Signal Metadata: Add a backwards-compatible field to an Enriched or Analyzed signal schema with validation and tests.
- Review Required Field Changes: Plan a required field change with defaults, migration notes, and explicit approval points.
- Keep Validators Aligned: Update schema-adjacent validators and exported types after a schema shape changes.

## Prompt Templates

### Add a Simple Optional Field

```
Add an optional field to the Enriched signal schema. The field name is macro_regime, the values are risk_on, risk_off, and neutral, and it should remain backwards compatible.
```

### Refine an Existing Field

```
Refine the action field validation for Scored signals. Keep existing values working, add close and reduce, update tests, and explain any compatibility impact.
```

### Add a Nested Risk Object

```
Extend the Scored signal schema with an optional risk_breakdown object containing market_risk, liquidity_risk, and execution_risk scores. Add validator checks and focused tests.
```

### Plan a Breaking Migration

```
Evaluate making content required across all signal lifecycle stages. Propose a migration-safe implementation, identify approval points, and do not edit files until the plan is confirmed.
```

## Limitations

- Only covers afi-core signal schemas and closely related validators.
- Does not modify orchestration, token economics, deployment, or agent runtime code.
- Requires human clarification for breaking changes or governance conflicts.
- Does not provide automated migrations without explicit repository support.

## Best Practices

- Start by confirming the lifecycle stage, field shape, optionality, and migration impact.
- Prefer optional fields or defaults when existing data may lack the new field.
- Run the build and focused schema tests before reporting the change as complete.

## Anti Patterns

- Do not add PoI or PoInsight as signal-level fields.
- Do not change orchestration, token economics, deployment, or agent runtime code through this skill.
- Do not remove or rename existing fields without an approved migration path.

## Security Audit

- - Safe to publish: true
- - Audited at: 2026-06-28T06:01:30.089\+00:00
- - Summary: Static analysis reported many high-risk patterns, but review found they are false positives caused by Markdown inline code, documentation examples, and ordinary words such as description. The skill is a procedural guide for schema changes and contains no executable script, no prompt injection attempt, no credential handling, and no data exfiltration behavior.

## Stats

- - Views: 236
- - Downloads: 5
- - Favorites: 0
- - Popularity score: 0
