AgentSkillsCN

Primitive

原始数据

SKILL.md

Add New Lumina Primitive

All primitive code lives under my-tutoring-app/src/components/lumina/. Do NOT search in src/components/primitives/, src/services/, src/types/, src/registry/, or src/catalog/ — those paths do not exist.

Required Reading

Before starting, read the full checklist:

  • my-tutoring-app/src/components/lumina/docs/ADDING_PRIMITIVES.md

Exact File Paths (6-7 files)

StepFileAction
1lumina/primitives/visual-primitives/<domain>/<Name>.tsxCreate React component with exported data interface
2lumina/types.tsAdd to ComponentId union type + re-export data type
3lumina/service/<domain>/gemini-<name>.tsCreate Gemini generator service (import type from component)
4lumina/service/registry/generators/<domain>Generators.tsRegister generator with registerGenerator()
5lumina/service/manifest/catalog/<domain>.tsAdd ComponentDefinition entry for AI selection
6lumina/config/primitiveRegistry.tsxRegister UI component for rendering
7lumina/evaluation/types.ts(Optional) Add metrics type if primitive supports evaluation

All paths above are relative to my-tutoring-app/src/components/.

Domain Directories

DomainComponent DirGenerator DirCatalogGenerator RegistryTester Component
astronomyprimitives/visual-primitives/astronomy/service/astronomy/catalog/astronomy.tsgenerators/astronomyGenerators.tscomponents/AstronomyPrimitivesTester.tsx
mathprimitives/visual-primitives/math/service/math/catalog/math.tsgenerators/mathGenerators.tscomponents/MathPrimitivesTester.tsx
engineeringprimitives/visual-primitives/engineering/service/engineering/catalog/engineering.tsgenerators/engineeringGenerators.tscomponents/EngineeringPrimitivesTester.tsx
physicsprimitives/visual-primitives/physics/service/physics/catalog/physics.tsgenerators/physicsGenerators.tscomponents/PhysicsPrimitivesTester.tsx
scienceprimitives/visual-primitives/science/service/science/catalog/science.tsgenerators/scienceGenerators.tsN/A
literacyprimitives/visual-primitives/literacy/service/literacy/catalog/literacy.tsgenerators/literacyGenerators.tsN/A
mediaprimitives/visual-primitives/media/service/media/catalog/media.tsgenerators/mediaGenerators.tsN/A
assessmentprimitives/visual-primitives/assessment/service/assessment/catalog/assessment.tsN/AN/A
coreprimitives/visual-primitives/core/service/core/catalog/core.tsgenerators/coreGenerators.tsN/A

Index Files to Update

When adding a new domain or generator, also update these index files:

  • lumina/service/registry/generators/index.ts — import new generator registry files
  • lumina/service/manifest/catalog/index.ts — import and spread new catalog arrays

Key Patterns

  1. Single source of truth: Define and export the data interface in the component file. The generator imports it — never redefine it.
  2. Evaluation by default: If the primitive is interactive, use the evaluable pattern with usePrimitiveEvaluation hook and set supportsEvaluation: true in the primitive registry.
  3. Progressive difficulty: For complex primitives, implement explore → practice → apply phases.

Reference Examples

  • Component: lumina/primitives/visual-primitives/engineering/TowerStacker.tsx
  • Generator: lumina/service/astronomy/gemini-mission-planner.ts
  • Generator registry: lumina/service/registry/generators/astronomyGenerators.ts
  • Catalog: lumina/service/manifest/catalog/astronomy.ts
  • Primitive registry: lumina/config/primitiveRegistry.tsx
  • Types: lumina/types.ts
  • Evaluation types: lumina/evaluation/types.ts

Workflow

  1. Ask the user for: primitive name, domain, purpose, interactive or display-only, grade range
  2. Read ADDING_PRIMITIVES.md and at least one reference example from the same domain
  3. Read lumina/types.ts and lumina/config/primitiveRegistry.tsx to see current registrations
  4. Create all files following the checklist in order (steps 1-7)
  5. Add the new primitive to the relevant tester component (e.g., lumina/components/EngineeringPrimitivesTester.tsx for engineering domain, lumina/components/AstronomyPrimitivesTester.tsx for astronomy, etc.)
  6. Report all files created/modified

PRD Reference

Primitive specs and requirements are documented in:

  • lumina/docs/space-primitives-prd.md — Astronomy/space primitives