Home › Pulumi › Pulumi (TypeScript) CLAUDE.md

Pulumi (TypeScript) CLAUDE.md

CLAUDE.md for Pulumi infrastructure in TypeScript: stacks and config, secrets, component resources, and preview-only rules.

Claude Code (CLAUDE.md)Pulumi

How to use

Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

CLAUDE.mdDownload  
# CLAUDE.md: Pulumi (TypeScript)

## Commands
- `npm run build` (tsc) · `npm test` (unit tests with mocks) · `pulumi preview --stack <stack> --diff`
- **Never run `pulumi up`, `pulumi destroy`, `pulumi refresh --yes`, `pulumi state delete`, or `pulumi stack rm` unless explicitly asked.** Show the preview instead.

## Structure
- `index.ts` composes components; reusable pieces are `ComponentResource` classes in `components/` with typed args interfaces and `registerOutputs`.
- Pass `{ parent: this }` to child resources in components so names and deletion order stay right.
- Stack differences live in `Pulumi.<stack>.yaml` config, read via `new pulumi.Config()` with `require`/`get` and typed defaults. No `if (stack === "prod")` scattered around; centralize it.

## Rules
- Secrets: `pulumi config set --secret dbPassword ...` and `config.requireSecret(...)`; never commit plain secrets or log Outputs that contain them.
- Outputs are async: combine with `pulumi.interpolate` or `pulumi.all([...]).apply(...)`. Don't create resources inside `apply` callbacks.
- Don't hard-code physical names unless needed; let Pulumi auto-name. Renaming a resource's logical name replaces it; use `aliases` to avoid replacement.
- Protect stateful production resources with `protect: true`; set `retainOnDelete` where data must survive.
- Tag/label everything via a shared `defaultTags` transform or provider config.
- Pin provider package versions in `package.json`.

## Testing
Unit tests use `pulumi.runtime.setMocks` to assert on resource properties; policy packs (CrossGuard) if configured.

## In summaries
List resources to be created, updated, and especially replaced or deleted from the preview.

More: all Pulumi rules · all Claude Code (CLAUDE.md) rules

Related rules

AWS CDK (TypeScript) CLAUDE.md

CLAUDE.md for AWS CDK v2 apps in TypeScript: constructs, least-privilege grants, snapshot tests, and safe deploys.

Claude Code (CLAUDE.md)AWS CDK

Kubernetes & Helm CLAUDE.md

CLAUDE.md for Kubernetes manifests and Helm 3 charts: resources, probes, security context, and safe rollouts.

Claude Code (CLAUDE.md)Kubernetes / Helm

Ansible Windsurf rules

Windsurf rules for Ansible playbooks and roles: FQCN modules, idempotency, check mode, vault secrets, and ansible-lint.

WindsurfAnsible

Docker & Compose AGENTS.md

AGENTS.md for containerized projects: lean multi-stage Dockerfiles, Docker Compose for local dev, and image security.

AGENTS.mdDocker

Dockerfile Copilot path instructions

Path-specific Copilot instructions for Dockerfiles and compose files: multi-stage builds, non-root, and pinned images.

GitHub CopilotDocker

GitHub Actions workflow rules

Cursor rules for writing secure, fast GitHub Actions workflows: permissions, pinning, caching, and concurrency.

CursorGitHub Actions

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.