
Pulumi Best Practices
Loads when you're writing or debugging Pulumi TypeScript or Python code and focuses on the patterns that actually prevent infrastructure disasters. The big ones: never create resources inside apply() callbacks because they won't show up in previews, always pass Output types directly as inputs instead of unwrapping them, and set parent: this for every resource in a ComponentResource or your hierarchy breaks. Also covers when to use pulumi.interpolate versus concat, how to refactor resources without destroying them using aliases, and secrets management. Honestly wish this existed when I was learning Pulumi because these mistakes are silent until your deployment goes sideways.
- skills.sh installs
- 2.6K
- GitHub stars
- 79
- last updated
- Aug 21, 2026
Install
$ npx -y skills add pulumi/agent-skills --skill pulumi-best-practices --agent claude-codeInstalls into .claude/skills of the current project.
Files
Pulumi Best Practices
When to Use This Skill
Invoke this skill when:
- Writing new Pulumi programs or components
- Reviewing Pulumi code for correctness
- Refactoring existing Pulumi infrastructure
- Debugging resource dependency issues
- Setting up configuration and secrets
Practices
1. Never Create Resources Inside apply()
Why: Resources created inside apply() don't appear in pulumi preview, making changes unpredictable. Pulumi cannot properly track dependencies, leading to race conditions and deployment failures.
Detection signals:
new aws.or other resource constructors inside.apply()callbacks- Resource creation inside
pulumi.all([...]).apply() - Dynamic resource counts determined at runtime inside apply
Wrong:
const bucket = new aws.s3.Bucket("bucket");
bucket.id.apply(bucketId => {
// WRONG: This resource won't appear in preview
new aws.s3.BucketObject("object", {
bucket: bucketId,
content: "hello",
});
});
Right:
const bucket = new aws.s3.Bucket("bucket");
Sponsors