Skip to main content
Each recipe includes the problem, solution code, and rationale.

Parent-child hierarchies

Problem: Model resources that exist within other resources (projects in organizations, repos in orgs). Solution:
Why: Parent-child relationships let the SDK scope List() calls. The UI can show hierarchical navigation. Entitlements inherit context from their parent.

Display name fallbacks

Problem: Ensure resources always have a human-readable name. Solution:
Why: Empty display names break UIs and access reviews. Reviewers can’t approve access to “(blank)”.

Error handling

Wrap errors with context

Problem: Make errors traceable to their source. Solution:
Why: The connector name prefix makes it clear which connector produced the error. The %w verb preserves the error chain for errors.Is() and errors.As().

Distinguish retryable vs fatal errors

Problem: Let the SDK know which errors are worth retrying. Solution:
Why: The SDK handles retries for transient errors. Clear error messages for fatal errors help users fix configuration issues.

Check context cancellation in loops

Problem: Respect timeouts and cancellation in long-running operations. Solution:
Why: A cancelled context means “stop now.” Ignoring it wastes resources and can cause timeouts in subsequent operations.

Anti-patterns

Don’t buffer entire datasets

Don’t swallow errors

Don’t log sensitive data

Don’t mix resource types in grants