skills/afi-protocol/extend-signal-schema/SKILL.md
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.
npx skillsauth add aiskillstore/marketplace extend-signal-schemaInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
Before changing anything, you MUST:
Read:
afi-core/AGENTS.mdschemas/Confirm:
afi-reactor (orchestration) or afi-token (economics).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.
The caller should provide, in natural language or structured form:
string, number, enum, object, arrayIf any of this information is missing, ask clarifying questions or produce a minimal, clearly-labeled stub with TODOs and conservative defaults.
When this skill is invoked, follow this sequence:
In your own words, summarize:
This summary should be short and precise, so humans can quickly confirm the intent.
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 schemaschemas/signal_finalization_request_schema.ts — Finalization request schemaschemas/validator_metadata_schema.ts — Validator metadata schemaOr, if schemas are split by stage:
schemas/raw_signal_schema.tsschemas/enriched_signal_schema.tsschemas/analyzed_signal_schema.tsschemas/scored_signal_schema.tsDo not modify these yet; just understand the current structure.
In the target schema file:
Add new fields with appropriate Zod types:
.optional() for optional fields.default(value) for fields with defaults.enum([...]) for enumerated values.min(), .max(), .regex() for validation rulesAdd clear comments explaining:
Preserve existing fields:
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 ...
});
If the schema has corresponding TypeScript types:
export type Signal = z.infer<typeof SignalSchema>;
runtime/types.ts or schemas/index.tsIf the new field requires validation logic:
Locate the relevant validator in validators/:
validators/SignalScorer.ts — Signal scoring logicvalidators/index.ts — Validator registryAdd validation logic if needed:
Keep validators deterministic where possible:
Where test patterns exist:
Add unit tests for the new field:
Update existing tests if schema changed:
Example test locations:
tests/ — Vitest unit testssignal_schema_test/ — Schema-specific test suitesIf no test patterns exist yet, leave a clearly marked TODO and surface this in your summary.
Run at least:
npm run build in afi-coreIf 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.
When using this skill, you MUST NOT:
Modify orchestration logic in afi-reactor:
Introduce PoI/PoInsight as signal fields:
poi, poinsight, proof_of_intelligence, or similar fields.Touch token/economics:
Modify Eliza agents or gateways:
Touch infra/ops:
Perform large sweeping refactors:
Break backwards compatibility:
If a request forces you towards any of the above, STOP and escalate.
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.
"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."
"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).
When adding fields that may break backwards compatibility:
.optional().default(value) to provide backwards compatibilityAlways document the migration strategy in your summary.
Request: "Add an optional macro_regime field to Enriched signals."
Summary:
universal_signal_schema.ts)macro_regime
enum(["risk_on", "risk_off", "neutral"])schemas/universal_signal_schema.ts (added field)schemas/index.ts (re-exported type)Request: "Make content field required for all signals."
Summary:
universal_signal_schema.ts)content
string (min 1, max 280).default("") for backwards compatibilityschemas/universal_signal_schema.ts (changed optionality)tests/signal_schema.test.ts (updated tests)Last Updated: 2025-11-27
Maintainers: AFI Core Team
Charter: afi-config/codex/governance/droids/AFI_DROID_CHARTER.v0.1.md
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.