[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JF3DHMJJN8K48A5143P15P":3,"skill-same:01M6JF3DHMJJN8K48A5143P15P":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M6JF3DHMJJN8K48A5143P15P","pulumi-best-practices",null,"Best practices for writing reliable Pulumi programs. Covers Output handling, resource dependencies, component structure, secrets management, safe refactoring with aliases, and deployment workflows.","jdiegosierra\u002Fenterprise-agent-plugins","jdiegosierra","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F27728978?v=4","01M6JF1FEEGH0TEKZ1X8C4DC89","Diego","01M6JF1FJR2H5YYKPRJ0HTJ9RJ",1,"MIT","https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Fpulumi-best-practices\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"pulumi best practices","pulumi","best practices","management","for","aliases","with","output","structure","dependencies","agent-skills","writing","refactoring","secrets","secrets management","deployment","component","workflows","safe","2026-11-10 10:12:30",false,"---\nname: pulumi-best-practices\ndescription: Best practices for writing reliable Pulumi programs. Covers Output handling, resource dependencies, component structure, secrets management, safe refactoring with aliases, and deployment workflows.\nmetadata:\n  based_on: pulumi\u002Fagent-skills\n---\n\n# Pulumi Best Practices\n\n## When to Use This Skill\n\nInvoke this skill when:\n\n- Writing new Pulumi programs or components\n- Reviewing Pulumi code for correctness\n- Refactoring existing Pulumi infrastructure\n- Debugging resource dependency issues\n- Setting up configuration and secrets\n\n## Practices\n\n### 1. Never Create Resources Inside `apply()`\n\n**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.\n\n**Detection signals**:\n\n- `new aws.` or other resource constructors inside `.apply()` callbacks\n- Resource creation inside `pulumi.all([...]).apply()`\n- Dynamic resource counts determined at runtime inside apply\n\n**Wrong**:\n\n```typescript\nconst bucket = new aws.s3.Bucket(\"bucket\");\n\nbucket.id.apply(bucketId => {\n    \u002F\u002F WRONG: This resource won't appear in preview\n    new aws.s3.BucketObject(\"object\", {\n        bucket: bucketId,\n        content: \"hello\",\n    });\n});\n```\n\n**Right**:\n\n```typescript\nconst bucket = new aws.s3.Bucket(\"bucket\");\n\n\u002F\u002F Pass the output directly - Pulumi handles the dependency\nconst object = new aws.s3.BucketObject(\"object\", {\n    bucket: bucket.id,  \u002F\u002F Output\u003Cstring> works here\n    content: \"hello\",\n});\n```\n\n**When apply is appropriate**:\n\n- Transforming output values for use in tags, names, or computed strings\n- Logging or debugging (not resource creation)\n- Conditional logic that affects resource properties, not resource existence\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Finputs-outputs\u002F\n\n---\n\n### 2. Pass Outputs Directly as Inputs\n\n**Why**: Pulumi builds a directed acyclic graph (DAG) based on input\u002Foutput relationships. Passing outputs directly ensures correct creation order. Unwrapping values manually breaks the dependency chain, causing resources to deploy in wrong order or reference values that don't exist yet.\n\n**Detection signals**:\n\n- Variables extracted from `.apply()` used later as resource inputs\n- `await` on output values outside of apply\n- String concatenation with outputs instead of `pulumi.interpolate`\n\n**Wrong**:\n\n```typescript\nconst vpc = new aws.ec2.Vpc(\"vpc\", { cidrBlock: \"10.0.0.0\u002F16\" });\n\n\u002F\u002F WRONG: Extracting the value breaks the dependency chain\nlet vpcId: string;\nvpc.id.apply(id => { vpcId = id; });\n\nconst subnet = new aws.ec2.Subnet(\"subnet\", {\n    vpcId: vpcId,  \u002F\u002F May be undefined, no tracked dependency\n    cidrBlock: \"10.0.1.0\u002F24\",\n});\n```\n\n**Right**:\n\n```typescript\nconst vpc = new aws.ec2.Vpc(\"vpc\", { cidrBlock: \"10.0.0.0\u002F16\" });\n\nconst subnet = new aws.ec2.Subnet(\"subnet\", {\n    vpcId: vpc.id,  \u002F\u002F Pass the Output directly\n    cidrBlock: \"10.0.1.0\u002F24\",\n});\n```\n\n**For string interpolation**:\n\n```typescript\n\u002F\u002F WRONG\nconst name = bucket.id.apply(id => `prefix-${id}-suffix`);\n\n\u002F\u002F RIGHT - use pulumi.interpolate for template literals\nconst name = pulumi.interpolate`prefix-${bucket.id}-suffix`;\n\n\u002F\u002F RIGHT - use pulumi.concat for simple concatenation\nconst name = pulumi.concat(\"prefix-\", bucket.id, \"-suffix\");\n```\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Finputs-outputs\u002F\n\n---\n\n### 3. Use Components for Related Resources\n\n**Why**: ComponentResource classes group related resources into reusable, logical units. Without components, your resource graph is flat, making it hard to understand which resources belong together, reuse patterns across stacks, or reason about your infrastructure at a higher level.\n\n**Detection signals**:\n\n- Multiple related resources created at top level without grouping\n- Repeated resource patterns across stacks that should be abstracted\n- Hard to understand resource relationships from the Pulumi console\n\n**Wrong**:\n\n```typescript\n\u002F\u002F Flat structure - no logical grouping, hard to reuse\nconst bucket = new aws.s3.Bucket(\"app-bucket\");\nconst bucketPolicy = new aws.s3.BucketPolicy(\"app-bucket-policy\", {\n    bucket: bucket.id,\n    policy: policyDoc,\n});\nconst originAccessIdentity = new aws.cloudfront.OriginAccessIdentity(\"app-oai\");\nconst distribution = new aws.cloudfront.Distribution(\"app-cdn\", { \u002F* ... *\u002F });\n```\n\n**Right**:\n\n```typescript\ninterface StaticSiteArgs {\n    domain: string;\n    content: pulumi.asset.AssetArchive;\n}\n\nclass StaticSite extends pulumi.ComponentResource {\n    public readonly url: pulumi.Output\u003Cstring>;\n\n    constructor(name: string, args: StaticSiteArgs, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:StaticSite\", name, args, opts);\n\n        \u002F\u002F Resources created here - see practice 4 for parent setup\n        const bucket = new aws.s3.Bucket(`${name}-bucket`, {}, { parent: this });\n        \u002F\u002F ...\n\n        this.url = distribution.domainName;\n        this.registerOutputs({ url: this.url });\n    }\n}\n\n\u002F\u002F Reusable across stacks\nconst site = new StaticSite(\"marketing\", {\n    domain: \"marketing.example.com\",\n    content: new pulumi.asset.FileArchive(\".\u002Fdist\"),\n});\n```\n\n**Component best practices**:\n\n- Use a consistent type URN pattern: `organization:module:ComponentName`\n- Call `registerOutputs()` at the end of the constructor\n- Expose outputs as class properties for consumers\n- Accept `ComponentResourceOptions` to allow callers to set providers, aliases, etc.\n\nFor in-depth component authoring guidance (args design, multi-language support, testing, distribution), use skill `pulumi-component`.\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Fresources\u002Fcomponents\u002F\n\n---\n\n### 4. Always Set `parent: this` in Components\n\n**Why**: When you create resources inside a ComponentResource without setting `parent: this`, those resources appear at the root level of your stack's state. This breaks the logical hierarchy, makes the Pulumi console hard to navigate, and can cause issues with aliases and refactoring. The parent relationship is what makes the component actually group its children.\n\n**Detection signals**:\n\n- ComponentResource classes that don't pass `{ parent: this }` to child resources\n- Resources inside a component appearing at root level in the console\n- Unexpected behavior when adding aliases to components\n\n**Wrong**:\n\n```typescript\nclass MyComponent extends pulumi.ComponentResource {\n    constructor(name: string, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:MyComponent\", name, {}, opts);\n\n        \u002F\u002F WRONG: No parent set - this bucket appears at root level\n        const bucket = new aws.s3.Bucket(`${name}-bucket`);\n    }\n}\n```\n\n**Right**:\n\n```typescript\nclass MyComponent extends pulumi.ComponentResource {\n    constructor(name: string, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:MyComponent\", name, {}, opts);\n\n        \u002F\u002F RIGHT: Parent establishes hierarchy\n        const bucket = new aws.s3.Bucket(`${name}-bucket`, {}, {\n            parent: this\n        });\n\n        const policy = new aws.s3.BucketPolicy(`${name}-policy`, {\n            bucket: bucket.id,\n            policy: policyDoc,\n        }, {\n            parent: this\n        });\n    }\n}\n```\n\n**What parent: this provides**:\n\n- Resources appear nested under the component in Pulumi console\n- Deleting the component deletes all children\n- Aliases on the component automatically apply to children\n- Clear ownership in state files\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Fresources\u002Fcomponents\u002F\n\n---\n\n### 5. Encrypt Secrets from Day One\n\n**Why**: Secrets marked with `--secret` are encrypted in state files, masked in CLI output, and tracked through transformations. Starting with plaintext config and converting later requires credential rotation, reference updates, and audit of leaked values in logs and state history.\n\n**Detection signals**:\n\n- Passwords, API keys, tokens stored as plain config\n- Connection strings with embedded credentials\n- Private keys or certificates in plaintext\n\n**Wrong**:\n\n```bash\n# Plaintext - will be visible in state and logs\npulumi config set databasePassword hunter2\npulumi config set apiKey sk-1234567890\n```\n\n**Right**:\n\n```bash\n# Encrypted from the start\npulumi config set --secret databasePassword hunter2\npulumi config set --secret apiKey sk-1234567890\n```\n\n**In code**:\n\n```typescript\nconst config = new pulumi.Config();\n\n\u002F\u002F This retrieves a secret - the value stays encrypted\nconst dbPassword = config.requireSecret(\"databasePassword\");\n\n\u002F\u002F Creating outputs from secrets preserves secrecy\nconst connectionString = pulumi.interpolate`postgres:\u002F\u002Fuser:${dbPassword}@host\u002Fdb`;\n\u002F\u002F connectionString is also a secret Output\n\n\u002F\u002F Explicitly mark values as secret\nconst computed = pulumi.secret(someValue);\n```\n\n**Use Pulumi ESC for centralized secrets**:\n\n```yaml\n# Pulumi.yaml\nenvironment:\n  - production-secrets  # Pull from ESC environment\n```\n\n```bash\n# ESC manages secrets centrally across stacks\nesc env set production-secrets db.password --secret \"hunter2\"\n```\n\n**What qualifies as a secret**:\n\n- Passwords and passphrases\n- API keys and tokens\n- Private keys and certificates\n- Connection strings with credentials\n- OAuth client secrets\n- Encryption keys\n\n**References**:\n\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Fsecrets\u002F\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fesc\u002F\n\n---\n\n### 6. Use Aliases When Refactoring\n\n**Why**: Renaming resources, moving them into components, or changing parents causes Pulumi to see them as new resources. Without aliases, refactoring destroys and recreates resources, potentially causing downtime or data loss. Aliases preserve resource identity through refactors.\n\n**Detection signals**:\n\n- Resource rename without alias\n- Moving resource into or out of a ComponentResource\n- Changing the parent of a resource\n- Preview shows delete+create when update was intended\n\n**Wrong**:\n\n```typescript\n\u002F\u002F Before: resource named \"my-bucket\"\nconst bucket = new aws.s3.Bucket(\"my-bucket\");\n\n\u002F\u002F After: renamed without alias - DESTROYS THE BUCKET\nconst bucket = new aws.s3.Bucket(\"application-bucket\");\n```\n\n**Right**:\n\n```typescript\n\u002F\u002F After: renamed with alias - preserves the existing bucket\nconst bucket = new aws.s3.Bucket(\"application-bucket\", {}, {\n    aliases: [{ name: \"my-bucket\" }],\n});\n```\n\n**Moving into a component**:\n\n```typescript\n\u002F\u002F Before: top-level resource\nconst bucket = new aws.s3.Bucket(\"my-bucket\");\n\n\u002F\u002F After: inside a component - needs alias with old parent\nclass MyComponent extends pulumi.ComponentResource {\n    constructor(name: string, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:MyComponent\", name, {}, opts);\n\n        const bucket = new aws.s3.Bucket(\"bucket\", {}, {\n            parent: this,\n            aliases: [{\n                name: \"my-bucket\",\n                parent: pulumi.rootStackResource,  \u002F\u002F Was at root\n            }],\n        });\n    }\n}\n```\n\n**Alias types**:\n\n```typescript\n\u002F\u002F Simple name change\naliases: [{ name: \"old-name\" }]\n\n\u002F\u002F Parent change\naliases: [{ name: \"resource-name\", parent: oldParent }]\n\n\u002F\u002F Full URN (when you know the exact previous URN)\naliases: [\"urn:pulumi:stack::project::aws:s3\u002Fbucket:Bucket::old-name\"]\n```\n\n**Lifecycle**:\n\n1. Add alias during refactor\n2. Run `pulumi up` on all stacks\n3. Remove alias after all stacks updated (optional, but keeps code clean)\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fiac\u002Fconcepts\u002Fresources\u002Foptions\u002Faliases\u002F\n\n---\n\n### 7. Preview Before Every Deployment\n\n**Why**: `pulumi preview` shows exactly what will be created, updated, or destroyed. Surprises in production come from skipping preview. A resource showing \"replace\" when you expected \"update\" means imminent destruction and recreation.\n\n**Detection signals**:\n\n- Running `pulumi up --yes` interactively without reviewing changes\n- No preview step anywhere in the CI\u002FCD workflow for a given change\n- Preview output not reviewed before merge or deployment approval\n\n**Wrong**:\n\n```bash\n# Deploying blind\npulumi up --yes\n```\n\n**Right**:\n\n```bash\n# Always preview first\npulumi preview\n\n# Review the output, then deploy\npulumi up\n```\n\n**What to look for in preview**:\n\n- `+ create` - New resource will be created\n- `~ update` - Existing resource will be modified in place\n- `- delete` - Resource will be destroyed\n- `+-replace` - Resource will be destroyed and recreated (potential downtime)\n- `~+-replace` - Resource will be updated, then replaced\n\n**Warning signs**:\n\n- Unexpected `replace` operations (check for immutable property changes)\n- Resources being deleted that shouldn't be\n- More changes than expected from your code diff\n\n**CI\u002FCD integration**:\n\n```yaml\n# GitHub Actions example\njobs:\n  preview:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - name: Pulumi Preview\n        uses: pulumi\u002Factions@v5\n        with:\n          command: preview\n          stack-name: production\n        env:\n          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}\n\n  deploy:\n    needs: preview\n    runs-on: ubuntu-latest\n    if: github.ref == 'refs\u002Fheads\u002Fmain'\n    steps:\n      - name: Pulumi Up\n        uses: pulumi\u002Factions@v5\n        with:\n          command: up\n          stack-name: production\n```\n\n**PR workflow**:\n\n- Run preview on every PR\n- Post preview output as PR comment\n- Require preview review before merge\n- Deploy only on merge to main\n\n**References**:\n\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fcli\u002Fcommands\u002Fpulumi_preview\u002F\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fiac\u002Fpackages-and-automation\u002Fcontinuous-delivery\u002Fgithub-actions\u002F\n\n---\n\n## Quick Reference\n\n| Practice | Key Signal | Fix |\n|----------|-----------|-----|\n| No resources in apply | `new Resource()` inside `.apply()` | Move resource outside, pass Output directly |\n| Pass outputs directly | Extracted values used as inputs | Use Output objects, `pulumi.interpolate` |\n| Use components | Flat structure, repeated patterns | Create ComponentResource classes |\n| Set parent: this | Component children at root level | Pass `{ parent: this }` to all child resources |\n| Secrets from day one | Plaintext passwords\u002Fkeys in config | Use `--secret` flag, ESC |\n| Aliases when refactoring | Delete+create in preview | Add alias with old name\u002Fparent |\n| Preview before deploy | `pulumi up --yes` | Always run `pulumi preview` first |\n\n## Validation Checklist\n\nWhen reviewing Pulumi code, verify:\n\n- [ ] No resource constructors inside `apply()` callbacks\n- [ ] Outputs passed directly to dependent resources\n- [ ] Related resources grouped in ComponentResource classes\n- [ ] Child resources have `{ parent: this }`\n- [ ] Sensitive values use `config.requireSecret()` or `--secret`\n- [ ] Refactored resources have aliases preserving identity\n- [ ] Deployment process includes preview step\n\n## Related Skills\n\n- **pulumi-component**: Deep guide to authoring ComponentResource classes, designing args interfaces, multi-language support, testing, and distribution. Use skill `pulumi-component`.\n- **pulumi-automation-api**: Programmatic orchestration of multiple stacks. Use skill `pulumi-automation-api`.\n- **pulumi-esc**: Centralized secrets and configuration management. Use skill `pulumi-esc`.\n\n## Attribution\n\nBased on [pulumi\u002Fagent-skills](https:\u002F\u002Fgithub.com\u002Fpulumi\u002Fagent-skills).\n","# Pulumi Best Practices\n\n## When to Use This Skill\n\nInvoke this skill when:\n\n- Writing new Pulumi programs or components\n- Reviewing Pulumi code for correctness\n- Refactoring existing Pulumi infrastructure\n- Debugging resource dependency issues\n- Setting up configuration and secrets\n\n## Practices\n\n### 1. Never Create Resources Inside `apply()`\n\n**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.\n\n**Detection signals**:\n\n- `new aws.` or other resource constructors inside `.apply()` callbacks\n- Resource creation inside `pulumi.all([...]).apply()`\n- Dynamic resource counts determined at runtime inside apply\n\n**Wrong**:\n\n```typescript\nconst bucket = new aws.s3.Bucket(\"bucket\");\n\nbucket.id.apply(bucketId => {\n    \u002F\u002F WRONG: This resource won't appear in preview\n    new aws.s3.BucketObject(\"object\", {\n        bucket: bucketId,\n        content: \"hello\",\n    });\n});\n```\n\n**Right**:\n\n```typescript\nconst bucket = new aws.s3.Bucket(\"bucket\");\n\n\u002F\u002F Pass the output directly - Pulumi handles the dependency\nconst object = new aws.s3.BucketObject(\"object\", {\n    bucket: bucket.id,  \u002F\u002F Output\u003Cstring> works here\n    content: \"hello\",\n});\n```\n\n**When apply is appropriate**:\n\n- Transforming output values for use in tags, names, or computed strings\n- Logging or debugging (not resource creation)\n- Conditional logic that affects resource properties, not resource existence\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Finputs-outputs\u002F\n\n---\n\n### 2. Pass Outputs Directly as Inputs\n\n**Why**: Pulumi builds a directed acyclic graph (DAG) based on input\u002Foutput relationships. Passing outputs directly ensures correct creation order. Unwrapping values manually breaks the dependency chain, causing resources to deploy in wrong order or reference values that don't exist yet.\n\n**Detection signals**:\n\n- Variables extracted from `.apply()` used later as resource inputs\n- `await` on output values outside of apply\n- String concatenation with outputs instead of `pulumi.interpolate`\n\n**Wrong**:\n\n```typescript\nconst vpc = new aws.ec2.Vpc(\"vpc\", { cidrBlock: \"10.0.0.0\u002F16\" });\n\n\u002F\u002F WRONG: Extracting the value breaks the dependency chain\nlet vpcId: string;\nvpc.id.apply(id => { vpcId = id; });\n\nconst subnet = new aws.ec2.Subnet(\"subnet\", {\n    vpcId: vpcId,  \u002F\u002F May be undefined, no tracked dependency\n    cidrBlock: \"10.0.1.0\u002F24\",\n});\n```\n\n**Right**:\n\n```typescript\nconst vpc = new aws.ec2.Vpc(\"vpc\", { cidrBlock: \"10.0.0.0\u002F16\" });\n\nconst subnet = new aws.ec2.Subnet(\"subnet\", {\n    vpcId: vpc.id,  \u002F\u002F Pass the Output directly\n    cidrBlock: \"10.0.1.0\u002F24\",\n});\n```\n\n**For string interpolation**:\n\n```typescript\n\u002F\u002F WRONG\nconst name = bucket.id.apply(id => `prefix-${id}-suffix`);\n\n\u002F\u002F RIGHT - use pulumi.interpolate for template literals\nconst name = pulumi.interpolate`prefix-${bucket.id}-suffix`;\n\n\u002F\u002F RIGHT - use pulumi.concat for simple concatenation\nconst name = pulumi.concat(\"prefix-\", bucket.id, \"-suffix\");\n```\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Finputs-outputs\u002F\n\n---\n\n### 3. Use Components for Related Resources\n\n**Why**: ComponentResource classes group related resources into reusable, logical units. Without components, your resource graph is flat, making it hard to understand which resources belong together, reuse patterns across stacks, or reason about your infrastructure at a higher level.\n\n**Detection signals**:\n\n- Multiple related resources created at top level without grouping\n- Repeated resource patterns across stacks that should be abstracted\n- Hard to understand resource relationships from the Pulumi console\n\n**Wrong**:\n\n```typescript\n\u002F\u002F Flat structure - no logical grouping, hard to reuse\nconst bucket = new aws.s3.Bucket(\"app-bucket\");\nconst bucketPolicy = new aws.s3.BucketPolicy(\"app-bucket-policy\", {\n    bucket: bucket.id,\n    policy: policyDoc,\n});\nconst originAccessIdentity = new aws.cloudfront.OriginAccessIdentity(\"app-oai\");\nconst distribution = new aws.cloudfront.Distribution(\"app-cdn\", { \u002F* ... *\u002F });\n```\n\n**Right**:\n\n```typescript\ninterface StaticSiteArgs {\n    domain: string;\n    content: pulumi.asset.AssetArchive;\n}\n\nclass StaticSite extends pulumi.ComponentResource {\n    public readonly url: pulumi.Output\u003Cstring>;\n\n    constructor(name: string, args: StaticSiteArgs, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:StaticSite\", name, args, opts);\n\n        \u002F\u002F Resources created here - see practice 4 for parent setup\n        const bucket = new aws.s3.Bucket(`${name}-bucket`, {}, { parent: this });\n        \u002F\u002F ...\n\n        this.url = distribution.domainName;\n        this.registerOutputs({ url: this.url });\n    }\n}\n\n\u002F\u002F Reusable across stacks\nconst site = new StaticSite(\"marketing\", {\n    domain: \"marketing.example.com\",\n    content: new pulumi.asset.FileArchive(\".\u002Fdist\"),\n});\n```\n\n**Component best practices**:\n\n- Use a consistent type URN pattern: `organization:module:ComponentName`\n- Call `registerOutputs()` at the end of the constructor\n- Expose outputs as class properties for consumers\n- Accept `ComponentResourceOptions` to allow callers to set providers, aliases, etc.\n\nFor in-depth component authoring guidance (args design, multi-language support, testing, distribution), use skill `pulumi-component`.\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Fresources\u002Fcomponents\u002F\n\n---\n\n### 4. Always Set `parent: this` in Components\n\n**Why**: When you create resources inside a ComponentResource without setting `parent: this`, those resources appear at the root level of your stack's state. This breaks the logical hierarchy, makes the Pulumi console hard to navigate, and can cause issues with aliases and refactoring. The parent relationship is what makes the component actually group its children.\n\n**Detection signals**:\n\n- ComponentResource classes that don't pass `{ parent: this }` to child resources\n- Resources inside a component appearing at root level in the console\n- Unexpected behavior when adding aliases to components\n\n**Wrong**:\n\n```typescript\nclass MyComponent extends pulumi.ComponentResource {\n    constructor(name: string, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:MyComponent\", name, {}, opts);\n\n        \u002F\u002F WRONG: No parent set - this bucket appears at root level\n        const bucket = new aws.s3.Bucket(`${name}-bucket`);\n    }\n}\n```\n\n**Right**:\n\n```typescript\nclass MyComponent extends pulumi.ComponentResource {\n    constructor(name: string, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:MyComponent\", name, {}, opts);\n\n        \u002F\u002F RIGHT: Parent establishes hierarchy\n        const bucket = new aws.s3.Bucket(`${name}-bucket`, {}, {\n            parent: this\n        });\n\n        const policy = new aws.s3.BucketPolicy(`${name}-policy`, {\n            bucket: bucket.id,\n            policy: policyDoc,\n        }, {\n            parent: this\n        });\n    }\n}\n```\n\n**What parent: this provides**:\n\n- Resources appear nested under the component in Pulumi console\n- Deleting the component deletes all children\n- Aliases on the component automatically apply to children\n- Clear ownership in state files\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Fresources\u002Fcomponents\u002F\n\n---\n\n### 5. Encrypt Secrets from Day One\n\n**Why**: Secrets marked with `--secret` are encrypted in state files, masked in CLI output, and tracked through transformations. Starting with plaintext config and converting later requires credential rotation, reference updates, and audit of leaked values in logs and state history.\n\n**Detection signals**:\n\n- Passwords, API keys, tokens stored as plain config\n- Connection strings with embedded credentials\n- Private keys or certificates in plaintext\n\n**Wrong**:\n\n```bash\n# Plaintext - will be visible in state and logs\npulumi config set databasePassword hunter2\npulumi config set apiKey sk-1234567890\n```\n\n**Right**:\n\n```bash\n# Encrypted from the start\npulumi config set --secret databasePassword hunter2\npulumi config set --secret apiKey sk-1234567890\n```\n\n**In code**:\n\n```typescript\nconst config = new pulumi.Config();\n\n\u002F\u002F This retrieves a secret - the value stays encrypted\nconst dbPassword = config.requireSecret(\"databasePassword\");\n\n\u002F\u002F Creating outputs from secrets preserves secrecy\nconst connectionString = pulumi.interpolate`postgres:\u002F\u002Fuser:${dbPassword}@host\u002Fdb`;\n\u002F\u002F connectionString is also a secret Output\n\n\u002F\u002F Explicitly mark values as secret\nconst computed = pulumi.secret(someValue);\n```\n\n**Use Pulumi ESC for centralized secrets**:\n\n```yaml\n# Pulumi.yaml\nenvironment:\n  - production-secrets  # Pull from ESC environment\n```\n\n```bash\n# ESC manages secrets centrally across stacks\nesc env set production-secrets db.password --secret \"hunter2\"\n```\n\n**What qualifies as a secret**:\n\n- Passwords and passphrases\n- API keys and tokens\n- Private keys and certificates\n- Connection strings with credentials\n- OAuth client secrets\n- Encryption keys\n\n**References**:\n\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fconcepts\u002Fsecrets\u002F\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fesc\u002F\n\n---\n\n### 6. Use Aliases When Refactoring\n\n**Why**: Renaming resources, moving them into components, or changing parents causes Pulumi to see them as new resources. Without aliases, refactoring destroys and recreates resources, potentially causing downtime or data loss. Aliases preserve resource identity through refactors.\n\n**Detection signals**:\n\n- Resource rename without alias\n- Moving resource into or out of a ComponentResource\n- Changing the parent of a resource\n- Preview shows delete+create when update was intended\n\n**Wrong**:\n\n```typescript\n\u002F\u002F Before: resource named \"my-bucket\"\nconst bucket = new aws.s3.Bucket(\"my-bucket\");\n\n\u002F\u002F After: renamed without alias - DESTROYS THE BUCKET\nconst bucket = new aws.s3.Bucket(\"application-bucket\");\n```\n\n**Right**:\n\n```typescript\n\u002F\u002F After: renamed with alias - preserves the existing bucket\nconst bucket = new aws.s3.Bucket(\"application-bucket\", {}, {\n    aliases: [{ name: \"my-bucket\" }],\n});\n```\n\n**Moving into a component**:\n\n```typescript\n\u002F\u002F Before: top-level resource\nconst bucket = new aws.s3.Bucket(\"my-bucket\");\n\n\u002F\u002F After: inside a component - needs alias with old parent\nclass MyComponent extends pulumi.ComponentResource {\n    constructor(name: string, opts?: pulumi.ComponentResourceOptions) {\n        super(\"myorg:components:MyComponent\", name, {}, opts);\n\n        const bucket = new aws.s3.Bucket(\"bucket\", {}, {\n            parent: this,\n            aliases: [{\n                name: \"my-bucket\",\n                parent: pulumi.rootStackResource,  \u002F\u002F Was at root\n            }],\n        });\n    }\n}\n```\n\n**Alias types**:\n\n```typescript\n\u002F\u002F Simple name change\naliases: [{ name: \"old-name\" }]\n\n\u002F\u002F Parent change\naliases: [{ name: \"resource-name\", parent: oldParent }]\n\n\u002F\u002F Full URN (when you know the exact previous URN)\naliases: [\"urn:pulumi:stack::project::aws:s3\u002Fbucket:Bucket::old-name\"]\n```\n\n**Lifecycle**:\n\n1. Add alias during refactor\n2. Run `pulumi up` on all stacks\n3. Remove alias after all stacks updated (optional, but keeps code clean)\n\n**Reference**: https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fiac\u002Fconcepts\u002Fresources\u002Foptions\u002Faliases\u002F\n\n---\n\n### 7. Preview Before Every Deployment\n\n**Why**: `pulumi preview` shows exactly what will be created, updated, or destroyed. Surprises in production come from skipping preview. A resource showing \"replace\" when you expected \"update\" means imminent destruction and recreation.\n\n**Detection signals**:\n\n- Running `pulumi up --yes` interactively without reviewing changes\n- No preview step anywhere in the CI\u002FCD workflow for a given change\n- Preview output not reviewed before merge or deployment approval\n\n**Wrong**:\n\n```bash\n# Deploying blind\npulumi up --yes\n```\n\n**Right**:\n\n```bash\n# Always preview first\npulumi preview\n\n# Review the output, then deploy\npulumi up\n```\n\n**What to look for in preview**:\n\n- `+ create` - New resource will be created\n- `~ update` - Existing resource will be modified in place\n- `- delete` - Resource will be destroyed\n- `+-replace` - Resource will be destroyed and recreated (potential downtime)\n- `~+-replace` - Resource will be updated, then replaced\n\n**Warning signs**:\n\n- Unexpected `replace` operations (check for immutable property changes)\n- Resources being deleted that shouldn't be\n- More changes than expected from your code diff\n\n**CI\u002FCD integration**:\n\n```yaml\n# GitHub Actions example\njobs:\n  preview:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - name: Pulumi Preview\n        uses: pulumi\u002Factions@v5\n        with:\n          command: preview\n          stack-name: production\n        env:\n          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}\n\n  deploy:\n    needs: preview\n    runs-on: ubuntu-latest\n    if: github.ref == 'refs\u002Fheads\u002Fmain'\n    steps:\n      - name: Pulumi Up\n        uses: pulumi\u002Factions@v5\n        with:\n          command: up\n          stack-name: production\n```\n\n**PR workflow**:\n\n- Run preview on every PR\n- Post preview output as PR comment\n- Require preview review before merge\n- Deploy only on merge to main\n\n**References**:\n\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fcli\u002Fcommands\u002Fpulumi_preview\u002F\n- https:\u002F\u002Fwww.pulumi.com\u002Fdocs\u002Fiac\u002Fpackages-and-automation\u002Fcontinuous-delivery\u002Fgithub-actions\u002F\n\n---\n\n## Quick Reference\n\n| Practice | Key Signal | Fix |\n|----------|-----------|-----|\n| No resources in apply | `new Resource()` inside `.apply()` | Move resource outside, pass Output directly |\n| Pass outputs directly | Extracted values used as inputs | Use Output objects, `pulumi.interpolate` |\n| Use components | Flat structure, repeated patterns | Create ComponentResource classes |\n| Set parent: this | Component children at root level | Pass `{ parent: this }` to all child resources |\n| Secrets from day one | Plaintext passwords\u002Fkeys in config | Use `--secret` flag, ESC |\n| Aliases when refactoring | Delete+create in preview | Add alias with old name\u002Fparent |\n| Preview before deploy | `pulumi up --yes` | Always run `pulumi preview` first |\n\n## Validation Checklist\n\nWhen reviewing Pulumi code, verify:\n\n- [ ] No resource constructors inside `apply()` callbacks\n- [ ] Outputs passed directly to dependent resources\n- [ ] Related resources grouped in ComponentResource classes\n- [ ] Child resources have `{ parent: this }`\n- [ ] Sensitive values use `config.requireSecret()` or `--secret`\n- [ ] Refactored resources have aliases preserving identity\n- [ ] Deployment process includes preview step\n\n## Related Skills\n\n- **pulumi-component**: Deep guide to authoring ComponentResource classes, designing args interfaces, multi-language support, testing, and distribution. Use skill `pulumi-component`.\n- **pulumi-automation-api**: Programmatic orchestration of multiple stacks. Use skill `pulumi-automation-api`.\n- **pulumi-esc**: Centralized secrets and configuration management. Use skill `pulumi-esc`.\n\n## Attribution\n\nBased on [pulumi\u002Fagent-skills](https:\u002F\u002Fgithub.com\u002Fpulumi\u002Fagent-skills).\n",{"name":5,"metadata":43,"description":7},{"based_on":44},"pulumi\u002Fagent-skills","main","558f37431dd6df3458f8bd5e229edb6c1c254ca7","plugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Fpulumi-best-practices",0,"https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins","https:\u002F\u002Fgithub.com\u002Fjdiegosierra","https:\u002F\u002Fjdiegosierra.github.io","Site Reliability Engineer | DevOps | MLOps | Software Craftsmanship | Blockchain Expert | Embedded Software Developer","2026-04-08 06:00:05",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add jdiegosierra\u002Fenterprise-agent-plugins --skill pulumi-best-practices",{"tool":60,"command":61},"bunx","bunx skills add jdiegosierra\u002Fenterprise-agent-plugins --skill pulumi-best-practices",{"tool":63,"command":64},"pnpm","pnpm dlx skills add jdiegosierra\u002Fenterprise-agent-plugins --skill pulumi-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Fpulumi-best-practices\u002FSKILL.md",true,[],[69,90,96,102,123,145],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":38},"01M6JF56YA4GJ2G91M4655E2VF","vue","Use when building Vue 3 applications with Composition API, Nuxt 3, or Quasar. Invoke for Pinia, TypeScript, PWA, Capacitor mobile apps, Vite configuration.","https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Fvue\u002FSKILL.md",[],[71,23,76,77,78,79,80,81,82,83,84,85,86,87,88,25,89],"Composition","configuration","mobile","vite","use","capacitor","pwa","pinia","nuxt","apps","api","applications","typescript","claude-skills",{"skillNo":91,"name":92,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":38},"01M6JF55WHCX01YN0EDC1ENBP1","update","https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Fupdate\u002FSKILL.md",[],[92],{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":38},"01M6JF52TKMMW8CSBWWK0D60Z7","uninstall","https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Funinstall\u002FSKILL.md",[],[98],{"skillNo":103,"name":88,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":38},"01M6JF4ZA6KVK7K37FYCGKZR3V","Use when working with TypeScript's advanced type system — generics, conditional types, mapped types, or full-stack type safety. Assumes ES2023+ JavaScript knowledge (see javascript for fundamentals). Invoke for type guards, utility types, tRPC integration, monorepo setup.","https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Ftypescript\u002FSKILL.md",[],[88,80,89,108,25,109,110,111,112,113,23,114,115,116,117,118,119,120,121,122],"advanced","types","trpc","utility","type","type system","monorepo","system","stack","knowledge","Safety","Type Safety","integration","conditional","javascript",{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":38},"01M6JF4VJD26K2THYRJGM1BK6M","testing","Use when writing tests, creating test strategies, or building automation frameworks. Invoke for unit tests, integration tests, E2E, coverage analysis, performance testing, security testing.","https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Ftesting\u002FSKILL.md",[],[125,23,30,130,89,131,132,133,134,135,136,80,137,138,139,140,141,142,143,144],"coverage","test strategies","unit","tests","Security Testing","strategies","frameworks","analysis","e2e","writing tests","unit tests","integration tests","test","automation","performance",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":38},"01M6JF4PEBCHAS2VP7EEW634B7","terraform","Use when working with Terraform or OpenTofu — creating modules, writing tests, setting up CI\u002FCD pipelines, reviewing configurations, debugging state issues, implementing security scanning, or making IaC architecture decisions. For Pulumi see pulumi-best-practices, for general CI\u002FCD see devops.","https:\u002F\u002Fgithub.com\u002Fjdiegosierra\u002Fenterprise-agent-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Facme-engineering\u002Fsrc\u002Fskills\u002Fterraform\u002FSKILL.md",[],[147,152,23,153,20,89,154,133,155,156,157,158,159,80,160,161,162,163,164,30],"up","implementing","CI\u002FCD","best-practices","general","modules","iac","scanning","ci","issues","debugging","architecture","security"]