kiota-typescript
Copilot instructions61 starsChanged 3 months agoMITView on GitHub
This is a Lerna monorepo using npm workspaces. All packages are under packages/. Always use npm ci to restore the dependencies required by the repository. Do not use npm install as a substitute for restoring the existing lockfile. Only core contributors may add or update dependencies. Before changing a dependency, core contributors must run ./scripts/configure-private-npm-feed.ps1 to configure and authenticate the private Azure Artifacts npm feed and clear the npm cache. Dependency changes must be resolved through that feed to ensure…
The file
We split this copilot-instructions.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 34
Always use npm ci to restore the dependencies required by the repository.
- Very specific: line 70
All packages target both Node.js and browser.
- Distinctive: line 86
All code changes must include corresponding test coverage: If adding a new feature or fixing a bug, add or update tests to cover the change.
- Very specific: line 88
Use vitest as the test framework.
- Very specific: line 89
Run coverage with npx lerna run test:coverage --scope @microsoft/<package-name> to verify coverage.
- Distinctive: line 90
When fixing a bug, add a regression test that would have caught the bug before your fix.
≈ “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
Copilot Instructions for kiota-typescript
Build, Test, and Lint
This is a Lerna monorepo using npm workspaces. All packages are under packages/.
# Restore the exact dependencies from package-lock.json
npm ci
# Full build (includes prettier check + clean)
npm run build
# Build a single package
npx lerna run build --scope @microsoft/kiota-abstractions
# Run all tests (node + browser)
npm test
# Run node tests for a single package
npx lerna run test:node --scope @microsoft/kiota-serialization-json
# Run a single test file directly
npx vitest run --config packages/abstractions/vite.config.mts test/someFile.ts
# Lint
npm run lint
# Format check / fix
npm run prettier:check
npm run prettier:writeAlways use npm ci to restore the dependencies required by the repository. Do not use npm install as a substitute for restoring the existing lockfile.
Only core contributors may add or update dependencies. Before changing a dependency, core contributors must run ./scripts/configure-private-npm-feed.ps1 to configure and authenticate the private Azure Artifacts npm feed and clear the npm cache. Dependency changes must be resolved through that feed to ensure every package is available there.
Package dependencies are local (e.g., kiota-http-fetchlibrary depends on kiota-abstractions). Build dependent packages first when testing downstream packages.
Architecture
Kiota is a code generator for OpenAPI-described APIs. This repo provides the TypeScript/JavaScript runtime libraries that generated clients depend on.
Package hierarchy (dependency flows downward)
@microsoft/kiota-bundle (convenience: bundles all defaults)
├── kiota-http-fetchlibrary (RequestAdapter impl using fetch + middleware pipeline)
├── kiota-serialization-json (JSON parse/serialize)
├── kiota-serialization-text (plain text parse/serialize)
├── kiota-serialization-form (form URL-encoded parse/serialize)
├── kiota-serialization-multipart (multipart form data)
└── kiota-abstractions (core interfaces: RequestAdapter, Parsable, serialization contracts)
@microsoft/kiota-authentication-azure (Azure Identity-based auth provider)
@microsoft/kiota-authentication-spfx (SPFx-based auth provider)Core abstractions pattern
RequestAdapter– translatesRequestInformationinto HTTP calls; implemented byFetchRequestAdapterParsable/ParsableFactory– interfaces for (de)serializable models; generated code implements theseParseNode/SerializationWriter– per-format reader/writer (JSON, text, form, multipart)ParseNodeFactory/SerializationWriterFactory– factory pattern for content-type dispatch- Backing Store – optional dirty-tracking layer for models (in
abstractions/src/store/) - Middleware pipeline –
fetch-based handler chain (retry, redirect, compression, telemetry, etc.) inpackages/http/fetch/src/middlewares/
Dual environment support
All packages target both Node.js and browser. Some packages have src/browser/ directories with browser-specific implementations. Tests run via vitest in both environments (test:node and test:browser scripts).
Key Conventions
- ESM-only – all packages use
"type": "module"with ES6 module output - License header required – every
.tssource file must start with the Microsoft copyright block comment (enforced by eslintheader/headerrule) - Prefer arrow functions – eslint
prefer-arrow/prefer-arrow-functionsis enabled - Conventional Commits – commit messages MUST follow the format:
<type>(optional scope): <description>. Valid types:feat,fix,perf,refactor,test,style,docs,build,ci,chore. Usefeatfor new features (bumps minor),fixfor bug fixes (bumps patch). Add aBREAKING CHANGE:footer to trigger a major version bump. This format is required to support the automated release-please process. - Independent versioning – each package is versioned independently via release-please
- JSDoc required –
eslint-plugin-jsdoc/recommended-typescript-erroris enforced on all source - TypeScript strict mode –
strict: truewith all strict sub-options enabled - Output directory – compiled output goes to
dist/es/viatsc+tsc-alias - No
any–@typescript-eslint/no-explicit-anyis set to warn
Testing Requirements
- All code changes must include corresponding test coverage. If adding a new feature or fixing a bug, add or update tests to cover the change.
- Tests live in
test/directories alongside the source in each package. - Use
vitestas the test framework. Tests should run in both Node.js (test:node) and browser (test:browser) environments where applicable. - Run coverage with
npx lerna run test:coverage --scope @microsoft/<package-name>to verify coverage. Coverage reports use Istanbul. - When fixing a bug, add a regression test that would have caught the bug before your fix.
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.

