A public SDK is a contract consumer, not a service mirror
Family: Rule
Disclosure class: PUBLIC-PRACTICE
Maturity: Draft
A client SDK should make an intentionally public interface easier to use. It should not reproduce the private service, control plane, orchestration logic, credential store, or internal data model behind that interface.
Start from a versioned public contract
Before adding client code, identify the exact public contract/version the SDK consumes.
The SDK may provide ergonomic types, validation, transport adapters, retries that are safe under the public idempotency contract, examples, and compatibility helpers. It should not invent behavior that the public contract does not promise.
If the public contract is not stable enough to implement independently, fix the contract before growing the SDK.
Keep dependency direction outward
The SDK may depend on reviewed public/shared contract packages. Protected service implementation must not become a direct or transitive client dependency.
Do not vendor a private monorepo, import a server package for convenience, or generate client code from private schemas that reveal more than the intended public interface.
Review the final distributed package, not only source imports.
Authority stays outside the SDK
An SDK can authenticate a caller, construct a request, validate local input, and present an operation result. Those conveniences do not grant server-side or resource-owner authority.
The receiving system still evaluates the policy/consent required for the exact effect.
Do not encode hidden policy tables, privileged fallback rules, managed credentials, or private routing/selection logic in the SDK merely to make calls feel seamless.
Credentials follow the integration contract
Document whether the SDK uses user-supplied credentials, a managed-service flow, an already-authenticated local session, or another deliberate mode.
The SDK should not silently move credentials or sessions across trust boundaries, and one failed access mode must not automatically authorize another mode.
Preserve failure and uncertainty semantics
Expose enough of the public contract for callers to distinguish deterministic rejection from accepted/running/completed/failed/unknown outcomes where the API supports long-lived effects.
Do not convert a timeout into a false definitive failure if the operation may still have happened. Provide the public reconciliation mechanism instead.
Compatibility requires evidence
Before claiming support for a runtime/API version, test the SDK against that exact contract and record limitations.
Useful public-safe tests include:
- request/result schema compatibility;
- unsupported-version rejection;
- denial/error mapping;
- idempotency/retry behavior promised by the contract;
- unknown-outcome reconciliation;
- serialization round trips;
- synthetic credential and target examples;
- forbidden/private dependency checks;
- final-package audit.
A type checker passing against one local implementation is not cross-version compatibility proof.
Keep examples synthetic
Examples and fixtures should use invented identities, resources, revisions, credentials, and payloads. Do not turn real customer state, captured sessions, private endpoints, or production logs into SDK documentation.
Completion test
Before releasing an SDK package, a reviewer should be able to identify its public contract/version, dependency allowlist, credential mode, authority boundary, failure/reconciliation semantics, compatibility evidence, and final distribution contents.
If using the SDK requires understanding or shipping private service internals, the boundary is not ready for public client packaging.
# A public SDK is a contract consumer, not a service mirror
**Family:** Rule
**Disclosure class:** `PUBLIC-PRACTICE`
**Maturity:** Draft
A client SDK should make an intentionally public interface easier to use. It should not reproduce the private service, control plane, orchestration logic, credential store, or internal data model behind that interface.
## Start from a versioned public contract
Before adding client code, identify the exact public contract/version the SDK consumes.
The SDK may provide ergonomic types, validation, transport adapters, retries that are safe under the public idempotency contract, examples, and compatibility helpers. It should not invent behavior that the public contract does not promise.
If the public contract is not stable enough to implement independently, fix the contract before growing the SDK.
## Keep dependency direction outward
The SDK may depend on reviewed public/shared contract packages. Protected service implementation must not become a direct or transitive client dependency.
Do not vendor a private monorepo, import a server package for convenience, or generate client code from private schemas that reveal more than the intended public interface.
Review the final distributed package, not only source imports.
## Authority stays outside the SDK
An SDK can authenticate a caller, construct a request, validate local input, and present an operation result. Those conveniences do not grant server-side or resource-owner authority.
The receiving system still evaluates the policy/consent required for the exact effect.
Do not encode hidden policy tables, privileged fallback rules, managed credentials, or private routing/selection logic in the SDK merely to make calls feel seamless.
## Credentials follow the integration contract
Document whether the SDK uses user-supplied credentials, a managed-service flow, an already-authenticated local session, or another deliberate mode.
The SDK should not silently move credentials or sessions across trust boundaries, and one failed access mode must not automatically authorize another mode.
## Preserve failure and uncertainty semantics
Expose enough of the public contract for callers to distinguish deterministic rejection from accepted/running/completed/failed/unknown outcomes where the API supports long-lived effects.
Do not convert a timeout into a false definitive failure if the operation may still have happened. Provide the public reconciliation mechanism instead.
## Compatibility requires evidence
Before claiming support for a runtime/API version, test the SDK against that exact contract and record limitations.
Useful public-safe tests include:
- request/result schema compatibility;
- unsupported-version rejection;
- denial/error mapping;
- idempotency/retry behavior promised by the contract;
- unknown-outcome reconciliation;
- serialization round trips;
- synthetic credential and target examples;
- forbidden/private dependency checks;
- final-package audit.
A type checker passing against one local implementation is not cross-version compatibility proof.
## Keep examples synthetic
Examples and fixtures should use invented identities, resources, revisions, credentials, and payloads. Do not turn real customer state, captured sessions, private endpoints, or production logs into SDK documentation.
## Completion test
Before releasing an SDK package, a reviewer should be able to identify its public contract/version, dependency allowlist, credential mode, authority boundary, failure/reconciliation semantics, compatibility evidence, and final distribution contents.
If using the SDK requires understanding or shipping private service internals, the boundary is not ready for public client packaging.