multi-environment

multi-environment is a cursor rule for Cursor from GoranErhartic/cursor-development-rules. It costs 20 tokens per session (986 once invoked), scanned A, original, MIT.

AWS CDK rules for deploying the same application to separate environments such as development, staging, and production, using different settings and resource names for each.

In plain words
What is it for?
Use it to configure stage-specific logging, concurrency, stack names, and conditional resources through CDK context and application settings.
Why use it?
It prevents environment-specific settings from being mixed together and allows resources or performance options to vary safely by stage.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { DataStack } from "../lib/stacks/data-stack";.

Good fit Use it to configure stage-specific logging, concurrency, stack names, and conditional resources through CDK context and application settings.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/GoranErhartic/cursor-development-rules
agentmods
npx agentmods add rules/goranerhartic/cursor-development-rules/multi-environment

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for multi-environment

README.md
[![agentmods](https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/multi-environment/github.svg)](https://agentmods.dev/rules/goranerhartic/cursor-development-rules/multi-environment)
Your own site
<a href="https://agentmods.dev/rules/goranerhartic/cursor-development-rules/multi-environment"><img src="https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/multi-environment/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for multi-environment

Your own site · 80×15
<a href="https://agentmods.dev/rules/goranerhartic/cursor-development-rules/multi-environment"><img src="https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/multi-environment.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 986 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00986
Opus 5.5 $0.00008 $0.00394
Sonnet 5.5 $0.00004 $0.00197
Haiku 4.5 $0.00002 $0.00099

Measured 1mo ago against content hash 7e165203936f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

multi-environment scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/languages/aws-lambda/multi-environment.mdc · 153 lines

How it starts

The opening of the file, as written. The whole thing — 153 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Multi-Environment CDK

Overview

Use CDK context and environment parameters to deploy the same app to dev, staging, and prod with stage-specific configuration. Use conditional resources (e.g. provisioned concurrency only in prod) and stage-aware stack names.

Context and cdk.json

// cdk.json
{
  "app": "npx ts-node bin/app.ts",
  "context": {
    "dev": {
      "stage": "dev",
      "logLevel": "DEBUG",
      "provisionedConcurrency": 0
    },
    "staging": {
      "stage": "staging",
      "logLevel": "INFO",
      "provisionedConcurrency": 1
    },
    "prod": {
      "stage": "prod",
      "logLevel": "WARN",
      "provisionedConcurrency": 5
    }
  }
}

Stage-Aware App Entry

// cdk/bin/app.ts

import "source-map-support/register";
import { App, Environment } from "aws-cdk-lib";
import { DataStack } from "../lib/stacks/data-stack";
import { ApiStack } from "../lib/stacks/api-stack";

const app = new App();

const stage = app.node.tryGetContext("stage") ?? "dev";
const context = app.node.tryGetContext(stage) ?? {};
const env: Environment = {
  account: process.env.CDK_DEFAULT_ACCOUNT,
  region: process.env.CDK_DEFAULT_REGION ?? "us-east-1",
};

const dataStack = new DataStack(app, `RealEstateData-${stage}`, {
  env,
  stage,
  ...context,
});

new ApiStack(app, `RealEstateApi-${stage}`, {
  env,
  stage,
  dataTable: dataStack.dataTable,
  idempotencyTable: dataStack.idempotencyTable,
  opensearchEndpoint: dataStack.opensearchEndpoint,
  ...context,
});

app.synth();

Conditional Resources

// cdk/lib/stacks/api-stack.ts

import { Stack, StackProps } from "aws-cdk-lib";
import { Construct } from "constructs";
import { Alias } from "aws-cdk-lib/aws-lambda";
import { StandardLambda } from "../constructs/lambda-function";

interface ApiStackProps extends StackProps {
  stage: string;
  provisionedConcurrency?: number;
  dataTable: Table;
}

export class ApiStack extends Stack {
  constructor(scope: Construct, id: string, props: ApiStackProps) {
    super(scope, id, props);

    const criticalHandler = new StandardLambda(this, "CriticalHandler", {
      entry: "src/functions/critical/handler.ts",
      handler: "handler",
      memorySize: 512,
      timeoutSeconds: 30,
      environment: {
        STAGE: props.stage,
        LOG_LEVEL: props.logLevel ?? "INFO",
      },
    });

    if ((props.provisionedConcurrency ?? 0) > 0) {
      const version = criticalHandler.currentVersion;
      new Alias(this, "CriticalAlias", {
        aliasName: "live",
        version,
        provisionedConcurrentExecutions: props.provisionedConcurrency,
      });
    }
  }
}

Read the full file on GitHub · 153 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 153 lines · 20 tokens per session scan A 7e165203936f

Subscribe to this mod's changes

multi-environment is a cursor rule published in the GitHub repository GoranErhartic/cursor-development-rules (19 stars, last pushed 7mo ago), licensed MIT. It adds 20 tokens to every session and 986 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.