pulumi avatar

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-code

Installs 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

Details

Repository
github.com/pulumi/agent-skills
Categories
Documentation, Code Review & Quality, AI & Agent Building, Debugging, Automation & Workflows, Python, Cloud & Infrastructure

More from pulumi/agent-skills

All 12
1shubhamsaboo avataremail-draftershubhamsaboo/awesome-llm-appsProfessional email composition for business communication across various contexts. Use when: writing emails, drafting professional messages, composing replies, 2.6Kskills.sh installs
2deanpeters avatardirector-readiness-advisordeanpeters/product-manager-skillsGuide the PM-to-Director transition across preparing, interviewing, landing, and recalibrating. Use when leadership scope is changing and you need practical coa2.6Kskills.sh installs
3eronred avatarlocalizationeronred/aso-skillsWhen the user wants to localize their App Store listing for international markets. Also use when the user mentions "localization", "translate my app", "internat2.6Kskills.sh installs
4github avatargithub-actions-hardeninggithub/awesome-copilotSecurity hardening reviewer for GitHub Actions workflow files (.github/workflows/*.yml). Reasons about the Actions threat model that pattern matchers and genera2.6Kskills.sh installs
5nicholasspisak avatarsecond-brain-querynicholasspisak/second-brainAnswer questions against the knowledge base wiki. Use when the user asks a question about their collected knowledge, wants to explore connections between topics2.6Kskills.sh installs
6nicholasspisak avatarsecond-brain-lintnicholasspisak/second-brainHealth-check the wiki for contradictions, orphan pages, stale claims, and missing cross-references. Use when the user says "audit", "health check", "lint", "fin2.5Kskills.sh installs