agentleFS
MicrosoftKnown publishermicrosoft/AgentSchema/.github/copilot-instructions.md

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

    Test Runtimes: - Run tests in each runtime folder

    line 46
  2. Very specific:

    All models use namespace AgentSchema.

    line 75
  3. Very specific:

    Use @sample() decorator to provide example values for test generation

    line 76
  4. Very specific:

    Use @shorthand() for alternate scalar representations

    line 77
  5. Very specific:

    Use @abstract for base types with polymorphic children

    line 78
  6. Very specific:

    Add @sample() decorator with example value

    line 98
  7. Distinctive:

    Run tests in all runtimes

    line 100
  8. Very specific:

    Create or edit .tsp file with new model

    line 104
  9. Very specific:

    Import it in main.tsp if it's a new file

    line 105
  10. Very specific:

    Add @sample() decorators for test generation

    line 106
  11. Very specific:

    Use AgentSchema.Core namespace - use AgentSchema only

    line 122
  12. Distinctive:

    Use these for common tasks:

    line 135

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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 site

Build Workflow

  1. Edit TypeSpec (agentschema-emitter/lib/model/*.tsp) - Define or modify schema
  2. Build Emitter (agentschema-emitter/) - npm run build
  3. Generate Code (agentschema-emitter/) - npm run generate
  4. 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 @sample and @shorthand decorators
  • 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; (not AgentSchema.Core)
  • Use @sample() decorator to provide example values for test generation
  • Use @shorthand() for alternate scalar representations
  • Use @abstract for base types with polymorphic children

Generated Code Characteristics

  • C#: PascalCase properties, FromJson/FromYaml/ToJson/ToYaml methods
  • Python: snake_case internally, load()/save()/to_json()/to_yaml() methods
  • TypeScript: camelCase properties, fromJson/fromYaml/toJson/toYaml methods

When Modifying the Emitter

  1. Edit source in agentschema-emitter/src/
  2. Templates are in src/templates/{language}/
  3. Rebuild with npm run build (compiles TypeScript AND copies templates)
  4. Regenerate and test all runtimes

Common Tasks

Adding a New Property to a Model

  1. Edit the .tsp file in agentschema-emitter/lib/model/
  2. Add @sample() decorator with example value
  3. Regenerate code: cd agentschema-emitter && npm run generate
  4. Run tests in all runtimes

Adding a New Model Type

  1. Create or edit .tsp file with new model
  2. Import it in main.tsp if it's a new file
  3. Add @sample() decorators for test generation
  4. Regenerate and verify tests pass

Modifying Code Generation Templates

  1. Edit .njk template in agentschema-emitter/src/templates/{language}/
  2. Rebuild emitter: npm run build
  3. Regenerate: npm run generate
  4. 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.Core namespace - use AgentSchema only

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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.