Back to Skills

pulumi-best-practices

Load when the user is writing, reviewing, or debugging Pulumi TypeScript/Python programs; asks about Output<T> or apply() usage; wants to create ComponentResource classes; needs to refactor resources without destroying them (aliases); is setting up secrets or config; or is configuring a pulumi preview/up CI workflow. Also load for questions about resource dependency order, parent/child resource relationships, or pulumi.interpolate.

63stars4forksUpdated 7/25/2026

Security Assessment

Safe(96/100)
Security Score96/100

About pulumi-best-practices

Pulumi Best Practices is a code-guidance skill that helps developers write, review, refactor, and debug Pulumi infrastructure-as-code programs in TypeScript and Python. It targets the subtle correctness issues that arise from Pulumi's asynchronous Output/Input model and resource dependency graph, where mistakes like creating resources inside apply() or manually unwrapping outputs lead to changes that don't appear in preview, race conditions, and incorrect deployment ordering.

The skill is organized as a set of numbered practices, each with a rationale, concrete detection signals to look for, and side-by-side wrong-versus-right code examples with links to official Pulumi documentation. Documented practices include never creating resources inside apply(), passing Outputs directly as Inputs (and using pulumi.interpolate or pulumi.concat for string composition), grouping related resources into reusable ComponentResource classes with a consistent type URN and registerOutputs(), and always setting parent: this on child resources so the component hierarchy is correct in state and the console. It ships with a use_cases.yaml and an agents/openai.yaml alongside SKILL.md, and references a companion pulumi-component skill for deeper component authoring. Its description also indicates coverage of aliases for non-destructive refactoring, secrets and config setup, and pulumi preview/up CI workflows.

It is aimed at infrastructure and platform engineers writing or reviewing Pulumi code, debugging resource dependency issues, or setting up configuration and CI. It is a read-and-advise reference authored by Pulumi; the code it contains is illustrative best-practice guidance and does not itself provision infrastructure or run destructive commands.

FAQ

Which languages and use cases does this skill target?

It targets Pulumi programs in TypeScript and Python, and is meant to load when writing, reviewing, refactoring, or debugging Pulumi code, working with Output/apply usage, creating ComponentResource classes, refactoring with aliases, setting up secrets and config, or configuring preview/up CI workflows.

Why does it warn against creating resources inside apply()?

Resources created inside apply() do not appear in pulumi preview, so changes become unpredictable and Pulumi cannot track dependencies, leading to race conditions and deployment failures. The skill recommends passing outputs directly as inputs instead.

How should I compose strings from Pulumi outputs?

Rather than unwrapping values in apply and concatenating, the skill recommends pulumi.interpolate for template literals and pulumi.concat for simple concatenation, which preserve the dependency chain.

Does the skill provision or modify real infrastructure?

No. It is advisory guidance with wrong-versus-right examples and documentation links. For deeper component authoring it points to a companion pulumi-component skill.

All Files

3 files
SKILL.md15.4 KB
View
use_cases.yaml0.4 KB
View
agents/openai.yaml0.2 KB
View

Install pulumi-best-practices

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill