agentleFS
AWSKnown publisheraws/jsii/AGENTS.md

jsii

AGENTS.md2.9k starsChanged 4 months agoApache-2.0View on GitHub

AI agent contributor guide for the aws/jsii repository.

Trending

Quiet this year.about the whole repository

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

Who's talking about aws/jsii

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

See all 16

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

On GitHub · 11

6 more on GitHub
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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.

The file

We split this AGENTS.md into the rules it gives an agent

10 rules. About 0 are common, 1 is distinctive, and 9 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.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Test fixtures (jsii-calc, @scope/*) are shared with the separate aws/jsii-compiler repository (which has its own copy under fixtures/)

    line 96
  2. Very specific:

    All requests carry an api discriminator field.

    line 111
  3. Very specific:

    Read .jsii assembly from the compiled npm package

    line 193
  4. Very specific:

    After modifying a target, run cd packages/jsii-pacmak && yarn test:update to update generated code snapshots.

    line 219
  5. Very specific:

    After modifying test fixtures, run yarn test:update in at least jsii-pacmak and jsii-reflect to update snapshots.

    line 236
  6. Distinctive:

    If you add a test and don't regenerate the report, the build will also fail.

    line 245
  7. Very specific:

    If compliance tests change, regenerate the compliance report (yarn compliance) and commit the updated …

    line 259
  8. Very specific:

    MUST NOT: add compliance tests to a language binding without adding them to the suite definition in tools/jsii-compliance/suite.ts

    line 266
  9. Very specific:

    MUST NOT: use type unions when avoidable — they degrade to Object/any in static languages

    line 268
  10. Very specific:

    MUST NOT: add circular dependencies between submodules — Lerna rejects cycles (rejectCycles: true)

    line 272

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

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

AGENTS.md

AI agent contributor guide for the aws/jsii repository.

Overview

  • jsii enables TypeScript libraries to be consumed naturally in Python, Java, C#/.NET, and Go — users write idiomatic code in their language while jsii handles cross-language interop.
  • Key packages in this monorepo:
    • packages/@jsii/kernel — Node.js process managing JS objects on behalf of host runtimes
    • packages/@jsii/runtime — Webpack-bundled runtime bootstrap
    • packages/@jsii/spec — Assembly schema definition (.jsii format)
    • packages/@jsii/python-runtime — Python host runtime
    • packages/@jsii/java-runtime — Java host runtime
    • packages/@jsii/dotnet-runtime — .NET host runtime
    • packages/@jsii/go-runtime — Go host runtime
    • packages/jsii-pacmak — Code generator producing language-specific packages from .jsii assemblies
    • packages/jsii-reflect — TypeScript reflection library for .jsii assemblies
    • packages/jsii-diff — API compatibility checker
    • packages/codemaker — Code generation utilities (indentation, file management)
    • packages/jsii-calc, packages/@scope/* — Test fixtures exercising the full type system
    • tools/jsii-compliance — Compliance suite and reporting tooling
    • tools/jsii-build-tools — Internal build utilities
  • Compiler and rosetta live in separate repositories:
  • Monorepo tooling: Yarn 4 workspaces (packageManager: yarn@4.13.0) + Lerna for build orchestration
  • Design tenets:
    • APIs must feel idiomatic in all target languages
    • Applications behave identically regardless of language (correctness over performance)
    • jsii does not attempt to support all TypeScript idioms — only those representable across all targets
    • Produced artifacts are compatible with each language's idiomatic package management tools

Contributor Principles

  1. Backwards compatibility of the jsii assembly format and kernel API is critical — never break existing consumers.
  2. Cross-language correctness must be verified — a change affecting one language target must be validated against all targets.
  3. Generated code must be idiomatic in each target language — follow each language's conventions and patterns.
  4. The jsii type system restrictions exist to ensure cross-language representability — do not relax them without careful consideration and validation across all targets.
  5. Snapshot tests must be updated when generated code changes — run yarn test:update to refresh snapshots.

Quick Reference Commands

CommandDescriptionScope
yarn install && yarn buildFull bootstrap and buildRepo root
cd packages/X && yarn buildBuild single packagePackage dir
yarn testFull test suite (includes compliance)Repo root
cd packages/X && yarn testTest single packagePackage dir
yarn test:updateUpdate all snapshotsRepo root
cd packages/X && yarn test:updateUpdate package snapshotsPackage dir
yarn lintLint all packagesRepo root
yarn lint:fixAuto-fix lint issuesRepo root
yarn complianceGenerate compliance reportRepo root
yarn upgrade:jsiiUpgrade jsii/rosetta versionsRepo root

Notes:

  • Builds use --concurrency=1 due to inter-package dependencies.
  • Monorepo uses Yarn 4 workspaces + Lerna orchestration.
  • For individual packages, use cd packages/X && yarn <script> (e.g., cd packages/@jsii/kernel && yarn test).

Codebase Layout

Packages

PathPurpose
packages/@jsii/kernelThe JavaScript kernel — manages objects and executes code
packages/@jsii/runtimeIPC wrapper around kernel (webpack-bundled for distribution)
packages/@jsii/specAssembly schema definition and validation
packages/@jsii/check-nodeNode.js version compatibility checks
packages/@jsii/python-runtimePython host runtime library
packages/@jsii/java-runtimeJava host runtime library
packages/@jsii/dotnet-runtime.NET host runtime library
packages/@jsii/go-runtimeGo host runtime library
packages/jsii-pacmakCode generator (targets: Python, Java, .NET, Go, JS)
packages/jsii-reflectStrongly-typed reflection library for .jsii assemblies
packages/jsii-diffAPI backwards compatibility checker
packages/jsii-configInteractive jsii configuration tool (experimental)
packages/codemakerCode generation utilities (indentation, file management)
packages/jsii-calcTest fixture library exercising the full type system
packages/@scope/*Additional test fixture packages (base, lib, base-of-base)
tools/jsii-complianceCompliance suite definition and report generation
tools/jsii-build-toolsInternal build utilities

Code Generation Targets

  • Targets live in packages/jsii-pacmak/lib/targets/
  • One file per language: python.ts, java.ts, dotnet.ts, go.ts, js.ts
  • Complex targets have subdirectories: dotnet/, go/, python/

Specifications & Docs

  • Specification documents: gh-pages/content/specification/
  • Architecture reference: docs/jsii-architecture-reference.md
  • Test fixtures (jsii-calc, @scope/*) are shared with the separate aws/jsii-compiler repository (which has its own copy under fixtures/)

Architecture

Two-Process Model

The host process (JVM, .NET CLR, CPython, Go runtime) communicates with a kernel process (Node.js) via JSON-encoded messages over STDIN/STDOUT pipes. The host never executes JavaScript directly — all JS execution happens in the kernel.

Host Process (Python/Java/.NET/Go)  ←→  Kernel Process (Node.js)
         STDIN/STDOUT JSON IPC

Kernel API

All requests carry an api discriminator field. The kernel supports 15 message types:

APIPurpose
loadLoad a jsii assembly (npm tarball) into the kernel
namingGet language-specific naming configuration
statsGet kernel statistics (object count)
createInstantiate an object
delDestroy an object reference (free memory)
invokeCall an instance method
sinvokeCall a static method
getRead an instance property
sgetRead a static property
setWrite an instance property
ssetWrite a static property
beginStart an async method invocation
endAwait an async method's result
callbacksList outstanding callback requests
completeFulfill a callback request

Callback Mechanism

When JavaScript code calls a method or property that was overridden in the host language, the kernel sends a callback request instead of a normal response. The host must: (1) execute the overridden method, (2) send a complete response with the result, (3) receive the original call's actual response. Callback types include InvokeCallback, GetCallback, and SetCallback.

Serialization

TypePassingWire Format
Primitives (bool, number, string)By valueJSON identity
EnumsBy value{"$jsii.enum": "fqn/ENTRY"}
DatesBy value{"$jsii.date": "ISO-8601"}
ListsBy valueJSON array
MapsBy value{"$jsii.map": {...}}
StructsBy value{"$jsii.struct": {"fqn": "...", "data": {...}}}
Class instancesBy reference{"$jsii.byref": "FQN@ID"}

Dual-Node Process

The @jsii/runtime spawns two node processes: a wrapper process manages IPC with the host via STDIN/STDOUT, while a core process runs the actual kernel communicating with the wrapper via FD#3. This separation exists because Java and C# cannot spawn child processes with additional open file descriptors.

Debugging

VariablePurpose
JSII_DEBUG=1Verbose IPC tracing to STDERR
JSII_DEBUG_TIMING=1Kernel API timing information
JSII_RUNTIMEOverride path to jsii-runtime (use local non-bundled version)
NODE_OPTIONSConfigure node runtime (e.g., --inspect-brk for debugger)

Type System

Type Mappings

jsii TypeTypeScript SourceNotes
BooleanbooleanPrimitive
NumbernumberAll floating point
StringstringUTF-8
ListArray<T>, T[]Passed by-value (copied across boundary)
Map{ [key: string]: T }Passed by-value
EnumenumCannot be downcast to value type
Anyany, unknownOpaque, implicitly nullable
VoidvoidNo return value
DateDateSpecial JSON serialization
ClassclassPassed by-reference
Interface (behavioral)interface IFooPrefixed with I
Structinterface FooNo I prefix, all readonly, no methods
PromisePromise<T>Only as method return type

Restrictions

  • Unsupported types: tuples, never, bigint, symbol
  • Struct vs Interface: interfaces prefixed with I are behavioral; without prefix they are structs (all properties readonly, no methods). Structs cannot extend behavioral interfaces and vice versa.
  • No method overloads — TypeScript overloads are not supported in the jsii type system
  • Liskov substitution — overridden methods must retain the exact same type signature (no covariant returns, no contravariant parameters)
  • Type unions — result in Object/any in statically typed languages; avoid when possible
  • Scope — restrictions only apply to declarations exported from the module's main entry point; internal code is unrestricted

Code Generation

Pipeline

  1. Read .jsii assembly from the compiled npm package
  2. Generate idiomatic source code for the target language
  3. Compile the generated source (language-specific toolchain)
  4. Package into publishable artifacts (wheel, JAR, NuGet, Go module)

Targets

FileLanguageOutput
python.tsPythonPyPI wheels (.whl)
java.tsJavaMaven JARs
dotnet.ts + dotnet/C# (.NET)NuGet packages (.nupkg)
go.ts + go/GoGo module source
js.tsJavaScriptnpm package (passthrough)

Notes:

  • Generated packages bundle the original JavaScript (npm tarball) inside the language-specific package.
  • Each generated package depends on the language's host runtime library (@jsii/*-runtime).
  • The .jsii assembly is included in the generated package for downstream consumers.
  • The codemaker package (packages/codemaker) provides code generation utilities (indentation management, file creation, code blocks) used by all targets.

Modifying a Target

  • The Python target (packages/jsii-pacmak/lib/targets/python.ts) is the recommended reference implementation to study when modifying or adding a code generation target.
  • Each target extends a base class and implements visitor methods that traverse the assembly's type system.
  • After modifying a target, run cd packages/jsii-pacmak && yarn test:update to update generated code snapshots.
  • For changes to the Python target that affect import behavior, lazy loading, or runtime type checking, follow the verification checklist in docs/target-python/import-verification.md.

Testing

Testing Layers

LayerToolPurpose
Unit testsJestPackage-level logic verification
Snapshot testsJest snapshotsGenerated code regression detection
Compliance suiteCustom frameworkCross-language behavioral consistency

Test Fixtures

  • jsii-calc and @scope/* packages serve as test fixtures exercising the full jsii type system (classes, interfaces, structs, enums, collections, async, overrides, etc.).
  • These fixtures are compiled with the jsii compiler and used by jsii-pacmak, jsii-reflect, and the runtime test suites.
  • After modifying test fixtures, run yarn test:update in at least jsii-pacmak and jsii-reflect to update snapshots.
  • The aws/jsii-compiler repository maintains its own copy of these fixtures under fixtures/.

Compliance Suite

  • Abstract test cases defined in tools/jsii-compliance/suite.ts.
  • Each language binding must implement the test cases individually.
  • Report generated via yarn compliance (or cd tools/jsii-compliance && yarn report).
  • Adding a compliance test to a language binding without adding it to the suite definition will cause the build to fail.
  • If you add a test and don't regenerate the report, the build will also fail.
  • Report file: gh-pages/content/specification/6-compliance-report.md (checked into source control).
  • Report statuses:
    • 🟢 — Test passes for this language
    • ⚪ — Test is not applicable for this language
    • ⭕ — Test is not implemented (yet) for this language
    • 🔴 — Test is failing for this language

PR Conventions

  1. PR titles follow conventional commit format: type[(scope)]: description
    • Allowed types: feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert
  2. Scope is optional — use the package name when the change is scoped to a single package (e.g., fix(jsii-pacmak): ...).
  3. PR body must confirm contribution under the Apache 2.0 license (by submitting, you agree to the Developer Certificate of Origin).
  4. If compliance tests change, regenerate the compliance report (yarn compliance) and commit the updated gh-pages/content/specification/6-compliance-report.md.

Anti-Patterns

  1. MUST NOT relax jsii type system restrictions without cross-language validation across all targets
  2. MUST NOT modify the kernel API protocol without updating all host runtime libraries (Python, Java, .NET, Go)
  3. MUST NOT change generated code patterns without updating snapshots (yarn test:update)
  4. MUST NOT add compliance tests to a language binding without adding them to the suite definition in tools/jsii-compliance/suite.ts
  5. MUST NOT introduce method overloads in test fixtures — they are not representable in the jsii type system
  6. MUST NOT use type unions when avoidable — they degrade to Object/any in static languages
  7. MUST NOT assume thread safety in runtime libraries — they are single-threaded by design
  8. MUST NOT modify @jsii/runtime bundled code directly — it is webpack-bundled; edit the source and rebuild
  9. MUST NOT break the $jsii.* serialization wire format without coordinating changes across all host runtimes simultaneously
  10. MUST NOT add circular dependencies between submodules — Lerna rejects cycles (rejectCycles: true)

Key References

ResourceLocation
Type system specificationgh-pages/content/specification/2-type-system.md
Kernel API specificationgh-pages/content/specification/3-kernel-api.md
Compliance suite specificationgh-pages/content/specification/4-standard-compliance-suite.md
Architecture referencedocs/jsii-architecture-reference.md
Python import/lazy-loading verification checklistdocs/target-python/import-verification.md
jsii compiler repositoryhttps://github.com/aws/jsii-compiler
jsii-rosetta repositoryhttps://github.com/aws/jsii-rosetta
jsii-superchain repositoryhttps://github.com/aws/jsii-superchain
Published documentationhttps://aws.github.io/jsii/
Contributing guideCONTRIBUTING.md

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.