typespec-rust
AGENTS.md8 starsChanged 8 months agoMITView on GitHub
This repository contains the TypeSpec Rust emitter (@azure-tools/typespec-rust), a TypeScript-based code generator that produces Rust SDK client code from TypeSpec API specifications. It is a Microsoft open-source project. Always run commands from the packages/typespec-rust directory unless stated otherwise. The CI pipeline (Azure DevOps, defined in eng/pipelines/ci.yml) runs these checks on every PR: Always replicate these checks locally before opening a PR. The following skills are available under .github/skills/ and should be used for common workflows:
- Installs packages
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Always run commands from the packages/typespec-rust directory unless stated otherwise.
- Distinctive: line 46
All files must end with a newline character.
- Distinctive: line 62
Always replicate these checks locally before opening a PR.
- Distinctive: line 76
Run all linting, build, and test steps before submitting (use the validate skill).
- Distinctive: line 77
Keep PRs focused on a single change or feature.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md 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
<!-- cspell:words tcgcadapter MSRV -->AGENTS.md
Project Summary
This repository contains the TypeSpec Rust emitter (@azure-tools/typespec-rust), a TypeScript-based code generator that produces Rust SDK client code from TypeSpec API specifications. It is a Microsoft open-source project.
Prerequisites
- Node.js >= 20.0.0
- pnpm (version specified in
packageManagerfield ofpackage.json; do not use npm or yarn) - Rust at the minimum supported Rust version (MSRV) with clippy and rustfmt components (components are configured in
rust-toolchain.toml)
Setup
Always run commands from the packages/typespec-rust directory unless stated otherwise.
cd packages/typespec-rust
pnpm install
pnpm buildpnpm buildcompiles TypeScript todist/.pnpm watchruns the compiler in watch mode for iterative development.
Repository Layout
/packages/typespec-rust/— Main TypeScript emitter package (the only package)/packages/typespec-rust/src/— TypeScript emitter source codesrc/codegen/— Rust code generation logicsrc/codemodel/— Internal code model representationsrc/tcgcadapter/— TypeSpec Client Generator Core adaptersrc/emitter.ts— Emitter entry point
/packages/typespec-rust/test/— Generated Rust test crates and TypeScript unit teststest/spector/— Integration test crates generated from spector specstest/sdk/— SDK test cratestest/other/— Targeted test cratestest/tsp/— TypeSpec files used to generate test/other and test/sdk content
/eng/pipelines/— Azure DevOps CI/CD pipeline definitions/.vscode/cspell.json— Spell checking configuration/rust-toolchain.toml— Rust toolchain components (clippy, rustfmt)
Coding Standards
- All files must end with a newline character.
- The emitter automatically runs
cargo fmtpost-codegen if the Rust toolset is installed. - Spell checking from the repo root:
cspell -c .vscode/cspell.json .must succeed before committing.
CI Pipeline
The CI pipeline (Azure DevOps, defined in eng/pipelines/ci.yml) runs these checks on every PR:
- Build TypeScript emitter
- ESLint on TypeScript code
- TypeScript unit tests with coverage
- Regenerate all test crates and verify no uncommitted changes
- Build all generated Rust crates
- Clippy on generated Rust code
- Spector integration tests
Always replicate these checks locally before opening a PR.
Skills
The following skills are available under .github/skills/ and should be used for common workflows:
- build — Build the TypeSpec Rust emitter from source. Run after cloning, pulling changes, or modifying TypeScript source files.
- test — Run TypeScript unit tests and Rust integration tests. Use to verify emitter correctness after code changes.
- lint — Run all linting (ESLint, Clippy) and spell checking. Run before committing to catch issues early.
- regenerate — Regenerate Rust test crates from TypeSpec specifications. Run after modifying emitter source or TypeSpec files under
test/tsp/. - validate — Run the full CI validation workflow locally. Use as a final check before submitting a PR to ensure all pipeline steps will pass.
PR Guidelines
- Run all linting, build, and test steps before submitting (use the validate skill).
- Keep PRs focused on a single change or feature.
- Regenerate test crates and commit the updated generated code if the emitter output changes (use the regenerate skill).
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- buildSkill
- lintSkill
- regenerateSkill
- testSkill
- validateSkill
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.

