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

typespec

Copilot instructions5.9k starsChanged 4 months agoMITView on GitHub

ALWAYS follow these instructions first and only fall back to additional search and context gathering if the information here is incomplete or found to be in error. TypeSpec is a language for defining cloud service APIs and shapes. This monorepo contains the TypeSpec compiler, standard library packages, tools, documentation, and various language client emitters. [!IMPORTANT] These instructions do NOT apply to the language emitter packages (http-client-csharp, http-client-java, http-client-python). Those packages are excluded from the pnpm workspace and do not require…

  • Installs packages

Trending

Quiet since September.about the whole repository

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 3 mentionsMar 2026: 8 mentionsApr 2026: 2 mentionsMay 2026: 2 mentionsJun 2026: 0 mentionsJul 2026: 3 mentionsAug 2026: 2 mentionsSep 2026: 3 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/typespec repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/typespec

The biggest 5 of 37 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 37

Talked about on GitHub, Bluesky and Hacker News (37 times).

On GitHub · 32

27 more on GitHub

On Bluesky · 4

On Hacker News · 1

  • Sep 20, 2024TypeSpec1 point · 1 comment

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

23 rules. About 0 are common, 1 is distinctive, and 22 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 22

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    CRITICAL: Run all tests: pnpm test (takes ~5 minutes, NEVER CANCEL - set timeout to 10+ minutes)

    line 28
  2. Very specific:

    Run E2E tests: pnpm test:e2e and node e2e/e2e-tests.ts (~1 minute)

    line 29
  3. Very specific:

    Run tests with coverage: pnpm test:ci

    line 30
  4. Very specific:

    Run tests in watch mode (in specific package): pnpm test:watch

    line 31
  5. Very specific:

    Check formatting: pnpm format:check (~1 minute)

    line 35
  6. Very specific:

    Run linting: pnpm lint (~1 minute)

    line 37
  7. Very specific:

    ALWAYS: run the full build process after repository clone: pnpm install && pnpm build

    line 42
  8. Very specific:

    Start watch mode: pnpm watch

    line 43
  9. Very specific:

    Test TypeSpec compilation works:

    line 44
  10. Very specific:

    Always format and lint before completing changes: pnpm format && pnpm lint:fix

    line 57
  11. Very specific:

    Basic functionality test: Create and compile a simple TypeSpec file as shown above

    line 84
  12. Very specific:

    Build validation: Run full build to ensure no build breaks: pnpm build

    line 85
  13. Very specific:

    Test validation: Run relevant tests: pnpm test

    line 86
  14. Very specific:

    Code quality: Ensure formatting and linting pass: pnpm format:check && pnpm lint

    line 87
  15. Very specific:

    Start development server: pnpm start (runs on port 4321)

    line 92
  16. Very specific:

    Add change description: pnpm change add

    line 108
  17. Very specific:

    Check catalog usage: pnpm check-catalog

    line 112
  18. Very specific:

    If builds fail with watch mode conflicts, run: pnpm clean && pnpm build

    line 116
  19. Very specific:

    If TypeScript compilation fails, check that compiler built first: pnpm -r --filter "@typespec/compiler" build

    line 118
  20. Very specific:

    Always run the linting and the formatting commands before any commit.

    line 123
  21. Very specific:

    Avoid committing pnpm-lock.yaml unless absolutely necessary.

    line 125
  22. Very specific:

    When the work is done, run pnpm chronus add to add a changelog entry.

    line 131
  23. Distinctive:

    When pushing changes and creating pull requests, push to your personal fork and open PRs against the main Microsoft fork's main branch.

    line 159

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

TypeSpec Copilot Instructions

ALWAYS follow these instructions first and only fall back to additional search and context gathering if the information here is incomplete or found to be in error.

TypeSpec is a language for defining cloud service APIs and shapes. This monorepo contains the TypeSpec compiler, standard library packages, tools, documentation, and various language client emitters.

[!IMPORTANT] These instructions do NOT apply to the language emitter packages (http-client-csharp, http-client-java, http-client-python). Those packages are excluded from the pnpm workspace and do not require using pnpm.

Essential Setup and Build Commands

Prerequisites and Installation

  • Install Node.js LTS:
  • Install pnpm globally: npm install -g pnpm
  • Install dependencies: pnpm install (takes ~1.5 minutes)
  • Install Playwright browsers (optional for UI testing): npx playwright install

Building the Project

  • CRITICAL: Build the entire project: pnpm build (takes ~7 minutes, NEVER CANCEL - set timeout to 15+ minutes)
  • Build in watch mode for development: pnpm watch
  • Build specific package: pnpm -r --filter "<package-name>..." build
  • Clean build artifacts: pnpm clean

Testing and Validation

  • CRITICAL: Run all tests: pnpm test (takes ~5 minutes, NEVER CANCEL - set timeout to 10+ minutes)
  • Run E2E tests: pnpm test:e2e and node e2e/e2e-tests.ts (~1 minute)
  • Run tests with coverage: pnpm test:ci
  • Run tests in watch mode (in specific package): pnpm test:watch

Code Quality

  • Check formatting: pnpm format:check (~1 minute)
  • Format code: pnpm format
  • Run linting: pnpm lint (~1 minute)
  • Fix lint issues: pnpm lint:fix

Essential TypeSpec Development Workflow

  1. ALWAYS run the full build process after repository clone: pnpm install && pnpm build
  2. Start watch mode: pnpm watch
  3. Test TypeSpec compilation works:

    # Create test project
    mkdir test-tsp && cd test-tsp
    echo 'import "@typespec/rest"; import "@typespec/openapi3"; op ping(): void;' > main.tsp
    echo '{"dependencies": {"@typespec/compiler": "latest", "@typespec/rest": "latest", "@typespec/openapi3": "latest"}}' > package.json
    
    # Install and compile
    /path/to/typespec/packages/compiler/cmd/tsp.js install
    /path/to/typespec/packages/compiler/cmd/tsp.js compile main.tsp --emit @typespec/openapi3
  4. Always format and lint before completing changes: pnpm format && pnpm lint:fix

Repository Structure

Key Packages (packages/)

  • compiler: Core TypeSpec compiler and CLI tool
  • http, rest, openapi3: Standard HTTP/REST API libraries
  • versioning: API versioning support
  • json-schema: JSON Schema emitter
  • prettier-plugin-typespec: Code formatting support
  • typespec-vscode, typespec-vs: Editor extensions
  • playground: Interactive TypeSpec playground
  • website: Documentation website (typespec.io)

Important Directories

  • /packages/: All TypeSpec packages and libraries
  • /e2e/: End-to-end integration tests
  • /website/: Documentation website source
  • /eng/: Build engineering and automation scripts
  • /.github/workflows/: CI/CD pipeline definitions

Manual Validation After Changes

ALWAYS perform these validation steps after making changes:

  1. Basic functionality test: Create and compile a simple TypeSpec file as shown above
  2. Build validation: Run full build to ensure no build breaks: pnpm build
  3. Test validation: Run relevant tests: pnpm test
  4. Code quality: Ensure formatting and linting pass: pnpm format:check && pnpm lint

Website Development

  • Navigate to website: cd website
  • Start development server: pnpm start (runs on port 4321)
  • Build website: pnpm build
  • The website includes documentation, API references, and the playground

Critical Timing and Performance Notes

  • NEVER CANCEL long-running commands - builds can take 7+ minutes, tests 5+ minutes
  • Set explicit timeouts: Build commands need 15+ minutes, test commands need 10+ minutes
  • Package installation: ~1.5 minutes
  • Full rebuild from clean state: ~7 minutes
  • Full test suite: ~5 minutes
  • Lint check: ~1 minute
  • E2E tests: ~1 minute

Common Development Tasks

  • Add change description: pnpm change add
  • Generate external signatures: pnpm gen-compiler-extern-signature
  • Regenerate samples: pnpm regen-samples
  • Regenerate docs: pnpm regen-docs
  • Check catalog usage: pnpm check-catalog

Troubleshooting

  • If builds fail with watch mode conflicts, run: pnpm clean && pnpm build
  • For installation issues, try: pnpm install-conflict
  • If TypeScript compilation fails, check that compiler built first: pnpm -r --filter "@typespec/compiler" build
  • For VS Code extension development, ensure you have the workspace open at the repository root

Commit instructions

  • Always run the linting and the formatting commands before any commit. In particular, always run pnpm format before committing.
  • Follow conventional commits.
  • Avoid committing pnpm-lock.yaml unless absolutely necessary.

Pull Request instructions

Changelog entries

When the work is done, run pnpm chronus add to add a changelog entry. The valid change kinds are defined in .chronus/config.yaml. Do NOT use feat, docs, patch, minor, or major — these are not valid change kinds.

If a PR affects multiple packages with different types of changes, create a separate changelog entry for each. For example, if the PR adds a feature to @typespec/http and fixes a bug in @typespec/openapi3, run pnpm chronus add twice to create two separate changelog entries — one with feature for @typespec/http and one with fix for @typespec/openapi3. Do NOT bundle different change types into a single entry.

Changelog message guidelines

  • Provide a clear description based on the initial issue description.
  • Only add an area tag when the package has multiple areas and the change targets a secondary area; use bracket format like [converter] or [formatter] (for example, a secondary openapi3 converter change should start with [converter]). Avoid generic area prefixes like core - and do not add any area tag for single-area packages.
  • For new features, include a short code block in the changelog entry that showcases the new functionality; skip code blocks for simple bug fixes.

TDD approach

  • Always start by defining additional unit tests/updating existing unit tests to fulfill the requirements first. Then make changes to the code accordingly. If you are following the TDD (Test Driven Development) approach, make sure to run the tests and see them fail before implementing the code changes.

Branch Naming Conventions

Out-of-sync / hotfix releases

Out-of-sync releases and hotfix releases follow the same flow using a publish/ branch:

  • Pattern: publish/<package>-release-<MM-DD> (e.g., publish/python-release-03-26)
  • These branches skip certain CI checks (consistency, external-integration) and auto-publish on merge
  • For out-of-sync releases, the PR targets main
  • For hotfix releases, the PR targets the corresponding release/* branch (e.g., release/v0.60) instead of main

Branch and PR Workflow

  • When creating new branches or worktrees, base them off the main Microsoft fork's main branch (Microsoft/typespec). This remote might be called upstream or origin depending on your local git setup — the key point is to always branch from the main Microsoft fork, not a personal fork.
  • When pushing changes and creating pull requests, push to your personal fork and open PRs against the main Microsoft fork's main branch.

Available Task Instructions

  • Testserver Generation: Instructions for generating TypeSpec HTTP spec test servers
  • http-client-csharp Development: Instructions for developing the C# HTTP client
  • http-client-java Development: Instructions for developing the TypeSpec library for Java client.
  • TCGC Upgrade: Instructions for TCGC version on emitters. Activate with: tcgc upgrade <emitter-name> <new-version>

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.