AgentSchema
Copilot instructions26 starsChanged 10 months agoMITView on GitHub
AgentSchema is a TypeSpec-based schema definition project that generates runtime libraries for C#, Python, TypeScript, and Go. The project defines a specification for AI agents with structured metadata, inputs, outputs, tools, and templates. See detailed instructions in .github/instructions/ for specific file types.
The file
We split this copilot-instructions.md into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 46
Test Runtimes: - Run tests in each runtime folder
- Very specific: line 75
All models use namespace AgentSchema.
- Very specific: line 76
Use @sample() decorator to provide example values for test generation
- Very specific: line 77
Use @shorthand() for alternate scalar representations
- Very specific: line 78
Use @abstract for base types with polymorphic children
- Very specific: line 98
Add @sample() decorator with example value
- Distinctive: line 100
Run tests in all runtimes
- Very specific: line 104
Create or edit .tsp file with new model
- Very specific: line 105
Import it in main.tsp if it's a new file
- Very specific: line 106
Add @sample() decorators for test generation
- Very specific: line 122
Use AgentSchema.Core namespace - use AgentSchema only
- Distinctive: line 135
Use these for common tasks:
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AgentSchema Project Instructions
Project Overview
AgentSchema is a TypeSpec-based schema definition project that generates runtime libraries for C#, Python, TypeScript, and Go. The project defines a specification for AI agents with structured metadata, inputs, outputs, tools, and templates.
Quick Reference
- Schema Source:
agentschema-emitter/lib/model/*.tsp(TypeSpec files) - Emitter Source:
agentschema-emitter/src/(TypeScript + Nunjucks templates) - Generated Output:
runtime/,schemas/,docs/src/content/docs/reference/
See detailed instructions in .github/instructions/ for specific file types.
Project Structure
AgentSchema/
├── agentschema-emitter/ # Self-contained TypeSpec emitter package
│ ├── lib/model/ # .tsp files defining the schema (source of truth)
│ ├── src/ # Emitter source code
│ │ ├── templates/ # Nunjucks templates for code generation
│ │ │ ├── csharp/
│ │ │ ├── python/
│ │ │ ├── typescript/
│ │ │ └── go/
│ │ ├── csharp.ts # C# code generator
│ │ ├── python.ts # Python code generator
│ │ ├── typescript.ts # TypeScript code generator
│ │ └── go.ts # Go code generator
│ └── dist/ # Compiled emitter output
├── runtime/ # Generated runtime libraries
│ ├── csharp/ # C# library (AgentSchema.dll)
│ ├── python/ # Python package (agentschema)
│ ├── typescript/ # TypeScript/npm package (agentschema)
│ └── go/ # Go module (agentschema)
├── schemas/ # Generated JSON/YAML schemas
└── docs/ # Astro documentation siteBuild Workflow
- Edit TypeSpec (
agentschema-emitter/lib/model/*.tsp) - Define or modify schema - Build Emitter (
agentschema-emitter/) -npm run build - Generate Code (
agentschema-emitter/) -npm run generate - Test Runtimes - Run tests in each runtime folder
Key Commands
# Build the emitter
cd agentschema-emitter && npm run build
# Generate all runtime code
cd agentschema-emitter && npm run generate
# Run tests
cd runtime/csharp && dotnet test
cd runtime/python/agentschema && uv run pytest tests/
cd runtime/typescript/agentschema && npm test
cd runtime/go/agentschema && go test ./...Code Generation Architecture
- TypeSpec models define the schema with
@sampleand@shorthanddecorators - Emitter (
agentschema-emitter) parses TypeSpec AST and generates code via Nunjucks templates - Templates produce idiomatic code for each language with serialization/deserialization logic
- Tests are auto-generated alongside the runtime code
Important Conventions
TypeSpec Files
- All models use
namespace AgentSchema;(notAgentSchema.Core) - Use
@sample()decorator to provide example values for test generation - Use
@shorthand()for alternate scalar representations - Use
@abstractfor base types with polymorphic children
Generated Code Characteristics
- C#: PascalCase properties,
FromJson/FromYaml/ToJson/ToYamlmethods - Python: snake_case internally,
load()/save()/to_json()/to_yaml()methods - TypeScript: camelCase properties,
fromJson/fromYaml/toJson/toYamlmethods
When Modifying the Emitter
- Edit source in
agentschema-emitter/src/ - Templates are in
src/templates/{language}/ - Rebuild with
npm run build(compiles TypeScript AND copies templates) - Regenerate and test all runtimes
Common Tasks
Adding a New Property to a Model
- Edit the
.tspfile inagentschema-emitter/lib/model/ - Add
@sample()decorator with example value - Regenerate code:
cd agentschema-emitter && npm run generate - Run tests in all runtimes
Adding a New Model Type
- Create or edit
.tspfile with new model - Import it in
main.tspif it's a new file - Add
@sample()decorators for test generation - Regenerate and verify tests pass
Modifying Code Generation Templates
- Edit
.njktemplate inagentschema-emitter/src/templates/{language}/ - Rebuild emitter:
npm run build - Regenerate:
npm run generate - Test affected runtime
Do NOT
- Edit files in
runtime/directly - they are auto-generated - Edit files in
schemas/directly - they are auto-generated - Edit files in
docs/src/content/docs/reference/directly - they are auto-generated - Forget to copy templates to
dist/after editing them - Use
AgentSchema.Corenamespace - useAgentSchemaonly
Related Instructions
For detailed guidance on specific areas:
- TypeSpec editing
- Emitter development
- Template editing
- Publishing packages
Prompt Files
Use these for common tasks:
- regenerate.prompt.md - Full rebuild workflow
- add-property.prompt.md - Adding properties to models
- add-model.prompt.md - Creating new model types
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

