Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

resource-naming资源命名

Agent Skill

resource-naming 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

870

周安装

37

GitHub Stars

公开资料未说明

下载量

305
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:resource-naming(资源命名)
来源仓库:https://github.com/loxosceles/ai-dev
仓库路径:skills/resource-naming
安装命令:
npx skills add https://github.com/loxosceles/ai-dev --skill resource-naming
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/loxosceles/ai-dev --skill resource-naming

简介

关键规则:

  • 每个 AWS 资源名称必须包含项目前缀
  • 每个 AWS 资源名称必须包含环境标识符
  • 使用模式:{项目}-{资源名称}-{环境}
  • 为什么:
  • 防止资源冲突和数据损坏
  • 实现清晰的项目所有权
  • 允许安全的多环境部署到同一帐户
  • 促进轻松的资源识别和管理
  • 如何:使用 ${projectPrefix}
  • 和${环境}
  • 所有资源名称中的变量保持一致。
  • 验证:将 dev 和 prod 部署到同一帐户并验证没有冲突。
  • 请记住:这不是可选的。这是一种关键模式,可以防止生产事故并实现清晰的资源管理。
  • 渐进式改进
  • 如果开发人员纠正了该技能本应阻止的行为,请建议对此技能进行具体修改,以防止将来出现相同的纠正。
  • 每周安装量
  • 37
  • 存储库
  • loxosceles/ai-dev
  • 第一次看到
  • 3天前
  • 安全审计
  • Gen Agent Trust Hub 通行证
  • 套接字通行证
  • 斯尼克通行证

SKILL.md

AWS Resource Naming Conventions

This is a reference pattern. Learn from the approach, adapt to your context — don't copy verbatim.

Status: 🔴 CRITICAL PATTERN Category: Infrastructure Applies To: All AWS resources across all projects


Overview

This document defines the standard naming conventions for AWS resources. Following these patterns ensures:

  • Clear project ownership
  • Environment separation and safety
  • Consistent resource identification
  • Easy filtering and management in AWS Console
  • Prevention of resource conflicts and data corruption

Standard Naming Pattern

Core Format

{project}-{resource-name}-{environment}

Components

  1. Project Prefix (required)

- Short identifier for the project (2-4 characters) - Lowercase letters only - Examples: cme, aip, app - Identifies which project owns the resource

  1. Resource Name (required)

- Describes the resource's purpose - Lowercase with hyphens - Examples: job-extractor, opportunities, website

  1. Environment Suffix (required)

- dev - Development environment - prod - Production environment - staging - Staging environment (optional) - local - Local development (for configuration only, never deployed) - Always in last position for consistency

Why This Pattern?

  • Project ownership clear: Prefix identifies the owning project
  • Consistent environment position: Always at the end
  • Short names: No account/region unless required for uniqueness
  • AWS best practice: Lowercase with hyphens
  • Easy filtering: Can filter by prefix in AWS Console
  • Multi-project support: Clear separation when multiple projects share an account
  • Prevents conflicts: Environment suffix prevents dev/prod overwrites

Account Strategy: Single vs. Multi-Account

Two Deployment Approaches

Option 1: Single Account (dev and prod in same AWS account)

  • Lower cost (no cross-account complexity)
  • Simpler IAM and networking
  • Requires environment suffix to prevent conflicts

Option 2: Multi-Account (separate AWS accounts for dev and prod)

  • Better isolation and security
  • Separate billing and cost tracking
  • Still requires environment suffix for safety

Why Environment Suffix is Always Required

Even with separate AWS accounts, the environment suffix provides critical safety:

  1. Human Error Prevention: Immediately see which environment you're working in # Without environment suffix aws lambda list-functions → job-extractor # Which environment is this? # With environment suffix aws lambda list-functions → job-extractor-prod # Clear: this is production!
  2. Account Confusion Protection: Prevents mistakes when switching between accounts # You think you're in dev account, but you're actually in prod # Without suffix: You might delete "job-extractor" thinking it's dev # With suffix: You see "job-extractor-prod" and stop immediately
  3. Future-Proofing: Account strategy might change

- Start with single account, later split to multi-account - Merge accounts for cost optimization - Add staging environment to existing account

  1. Consistency: Same naming pattern works everywhere

- Local development - CI/CD pipelines - AWS Console - CloudFormation/CDK code

Real-World Scenario

# You're debugging an issue and need to check Lambda logs
# You have AWS CLI configured with multiple profiles

# Scenario 1: Without environment suffix
aws lambda get-function --function-name job-extractor --profile prod-account
# ⚠️  Is this the right function? Hard to tell from name alone

# Scenario 2: With environment suffix
aws lambda get-function --function-name job-extractor-prod --profile prod-account
# ✅ Name confirms you're looking at production resource
# ✅ Immediate visual confirmation prevents mistakes

Rule: Always include environment suffix, regardless of account strategy. It's a safety layer that costs nothing but prevents costly mistakes.


Critical: Why Environment Suffix Matters

The Problem

Without environment identifiers in resource names, dev and prod resources conflict when deployed to the same AWS account, causing overwrites and data corruption.

Real-World Impact

Lambda Functions (no environment in name):

// ❌ WRONG
functionName: 'job-data-extractor'

// GitHub Actions deploys dev
ENVIRONMENT=dev → Lambda: job-data-extractor

// GitHub Actions deploys prod
ENVIRONMENT=prod → Lambda: job-data-extractor  // OVERWRITES dev!

DynamoDB Tables (no environment in name):

// ❌ WRONG
tableName: `opportunities-${account}-${region}`

// Both environments use SAME table
// Result: Dev and prod data MIXED!

The Solution

Always include environment in resource names:

// ✅ CORRECT
functionName: `job-data-extractor-${environment}`
tableName: `opportunities-${environment}`

// Results:
// dev:  job-data-extractor-dev, opportunities-dev
// prod: job-data-extractor-prod, opportunities-prod

Resource-Specific Patterns

Lambda Functions

Pattern: {project}-{function-name}-{environment}

Examples:

// ✅ CORRECT
functionName: `cme-job-extractor-${environment}`
functionName: `aip-data-sync-${environment}`

// Results:
// cme-job-extractor-dev
// cme-job-extractor-prod
// aip-data-sync-dev

Rationale: Lambda names must be unique per account. Environment suffix prevents dev/prod conflicts.


DynamoDB Tables

Pattern: {project}-{table-name}-{environment}

Examples:

// ✅ CORRECT
tableName: `cme-opportunities-${environment}`
tableName: `aip-user-sessions-${environment}`

// Results:
// cme-opportunities-dev
// cme-opportunities-prod

Optional Extended Pattern (when uniqueness needed):

tableName: `{project}-{table-name}-${environment}-${account}-${region}`

// Example:
// cme-opportunities-dev-123456-us-east-1

Rationale: Table names must be unique per account. Environment suffix is critical to prevent data mixing.


S3 Buckets

Pattern: {project}-{bucket-purpose}-{environment} (add random suffix if collision)

Examples:

// ✅ CORRECT
bucketName: `cme-website-${environment}`
bucketName: `aip-assets-${environment}`

// Results:
// cme-website-dev
// cme-website-prod

If collision occurs (bucket name already taken globally):

bucketName: `cme-website-${environment}-x7k2m`

// Results:
// cme-website-dev-x7k2m
// cme-website-prod-p9n4q

Important Notes:

  • Bucket names must be globally unique across ALL AWS accounts
  • Use lowercase letters, numbers, and hyphens only (no underscores)
  • If deployment fails with "BucketAlreadyExists", add random suffix
  • Suffix format: 5 random lowercase alphanumeric characters

Rationale: Bucket names must be globally unique. Start with clean pattern, add suffix only if needed.


API Gateway

Pattern: {PROJECT} API - {environment} (display name, uppercase project)

Examples:

// ✅ CORRECT
restApiName: `CME API - ${environment}`
restApiName: `AIP API - ${environment}`

// Results:
// CME API - dev
// CME API - prod

Rationale: Display name for humans. Uppercase for readability in AWS Console.


CloudFront Distributions

Pattern: Comment field: {Project Name} - {environment}

Examples:

Career Match Engine - dev
AI Portfolio - prod

Tag: Environment: dev or Environment: prod

Rationale: CloudFront IDs are auto-generated. Use comment and tags for identification.


Lambda Layers

Pattern: {project}-{layer-name} or {project}-{layer-name}-{environment}

Examples:

// Shared across environments
layerName: 'cme-common-layer'
layerName: 'aip-utils-layer'

// Environment-specific
layerName: `cme-config-layer-${environment}`

Note: Layers are often shared across environments. Environment suffix optional.

Rationale: Layers are versioned. Sharing across environments reduces duplication.

Lambda Layer Code Organization

Goal: Provide each Lambda with only what it needs while avoiding code duplication. This is a trade-off between deployment size and code reuse - evaluate on a case-by-case basis.

Layer Structure: Organize by scope and reusability

layers/
  common/                # Truly shared utilities (3+ consumers)
    nodejs/
      logger.mjs
      response-builder.mjs
      config-loader.mjs
      validation.mjs

  feature-utils/         # Feature-specific utilities
    nodejs/
      feature-operations.mjs
      feature-schemas.mjs

  external-sdks/         # Third-party integrations
    nodejs/
      package.json       # npm dependencies
      sdk-wrapper.mjs

Organizing Shared Code:

Common Layer - For widely-used utilities:

  • Generic helpers (logging, validation, response formatting)
  • Used by 3+ different features
  • No feature-specific logic

Feature Layer - For feature-specific shared code:

  • Operations and schemas for a specific domain
  • Used by 2+ functions within that feature
  • Contains feature-specific logic

Integration Layer - For external dependencies:

  • Third-party SDK packages
  • Wrappers around external services
  • Isolates version management

Using Multiple Layers:

// Function can reference multiple layers
const myFunction = new Function({
  layers: [
    commonLayer,        // Generic utilities
    featureALayer,      // Feature A utilities
    featureBLayer       // Feature B utilities (if needed)
  ]
});

Decision Guide:

  • Generic utilitiescommon layer
  • Feature-specific code → feature layer
  • External packages → integration layer
  • Cross-feature needs → Reference multiple layers

Trade-offs:

  • More layers = lighter individual Lambdas but more complexity
  • Fewer layers = simpler setup but larger deployments
  • Balance based on your project's needs

Example Scenario: API schemas used by multiple features

  • If generic: Move to common layer
  • If feature-specific: Keep in feature layer, other features reference it
  • Don't duplicate: Use layer composition

SQS Queues

Pattern: {project}-{queue-name}-{environment}

Examples:

queueName: `cme-job-processing-${environment}`
queueName: `aip-notifications-${environment}`

SNS Topics

Pattern: {project}-{topic-name}-{environment}

Examples:

topicName: `cme-alerts-${environment}`
topicName: `aip-events-${environment}`

EventBridge Rules

Pattern: {project}-{rule-name}-{environment}

Examples:

ruleName: `cme-daily-sync-${environment}`
ruleName: `aip-cleanup-${environment}`

Step Functions

Pattern: {project}-{state-machine-name}-{environment}

Examples:

stateMachineName: `cme-workflow-${environment}`
stateMachineName: `aip-pipeline-${environment}`

Secrets Manager

Pattern: {project}/{environment}/{secret-name}

Examples:

secretName: `cme/${environment}/api-key`
secretName: `aip/${environment}/db-password`

SSM Parameters

Pattern: /{project}/{environment}/{namespace}/{key}

Examples:

/cme/dev/lambda/job-extractor/LLM_API_KEY
/cme/prod/api/corsAllowedOrigins
/aip/dev/frontend/api-endpoint

Note: Use camelCase for project name in SSM for historical compatibility.


CloudWatch Log Groups

Pattern: /aws/lambda/{project}-{function-name}-{environment}

Examples:

/aws/lambda/cme-job-extractor-dev
/aws/lambda/cme-recruiter-chat-prod
/aws/lambda/aip-data-sync-dev

Note: Auto-generated by Lambda. Follows Lambda naming automatically.


CDK Implementation Pattern

Construct Props

export interface ResourceConstructProps {
  projectPrefix: string;    // 'cme', 'aip', etc.
  environment: string;      // 'dev', 'prod', 'staging'
  account: string;
  region: string;
}

Lambda Function

const myFunction = new lambda.Function(this, 'MyFunction', {
  functionName: `${props.projectPrefix}-my-function-${props.environment}`,
  runtime: lambda.Runtime.NODEJS_22_X,
  handler: 'index.handler',
  code: lambda.Code.fromAsset('lambda'),
  environment: {
    ENVIRONMENT: props.environment,
    PROJECT: props.projectPrefix
  }
});

DynamoDB Table

const myTable = new dynamodb.Table(this, 'MyTable', {
  tableName: `${props.projectPrefix}-my-table-${props.environment}`,
  partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING },
  billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
  removalPolicy: props.environment === 'prod'
    ? cdk.RemovalPolicy.RETAIN
    : cdk.RemovalPolicy.DESTROY
});

S3 Bucket

const myBucket = new s3.Bucket(this, 'MyBucket', {
  bucketName: `${props.projectPrefix}-my-bucket-${props.environment}`,
  removalPolicy: props.environment === 'prod'
    ? cdk.RemovalPolicy.RETAIN
    : cdk.RemovalPolicy.DESTROY,
  autoDeleteObjects: props.environment !== 'prod'
});

Environment Variable Setup

Required Environment Variable

# Must be set before deployment
export ENVIRONMENT=dev  # or 'prod', 'staging', etc.
export PROJECT_PREFIX=myapp  # Short project identifier

Deployment Script

#!/bin/bash
set -e

if [ -z "$ENVIRONMENT" ]; then
  echo "Error: ENVIRONMENT is not set"
  echo "Usage: ENVIRONMENT=dev ./deploy.sh"
  exit 1
fi

if [ -z "$PROJECT_PREFIX" ]; then
  echo "Error: PROJECT_PREFIX is not set"
  echo "Usage: PROJECT_PREFIX=myapp ENVIRONMENT=dev ./deploy.sh"
  exit 1
fi

echo "Deploying $PROJECT_PREFIX to environment: $ENVIRONMENT"
cdk deploy --all

GitHub Actions

name: Deploy

on:
  push:
    branches:
      - main      # Deploys to prod
      - develop   # Deploys to dev

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set environment
        run: |
          if [ "${{ github.ref }}" == "refs/heads/main" ]; then
            echo "ENVIRONMENT=prod" >> $GITHUB_ENV
          else
            echo "ENVIRONMENT=dev" >> $GITHUB_ENV
          fi
          echo "PROJECT_PREFIX=myapp" >> $GITHUB_ENV

      - name: Deploy
        run: |
          echo "Deploying $PROJECT_PREFIX to $ENVIRONMENT"
          ./deploy.sh

Validation Checklist

Before deploying any resource, verify:

  • Starts with project prefix (cme-, aip-, etc.)
  • Ends with environment (-dev, -prod, -staging)
  • Uses lowercase with hyphens (except API Gateway display names)
  • No hardcoded environment values (use variables)
  • Name clearly describes resource purpose
  • Follows pattern: {project}-{resource-name}-{environment}
  • Environment variable is set before deployment

Common Pitfalls

❌ Pitfall 1: Hardcoded Environment

// ❌ WRONG - Hardcoded 'dev'
bucketName: `my-app-dev`

// ✅ CORRECT - Use variable
bucketName: `my-app-${environment}`

❌ Pitfall 2: Missing Environment Variable

// ❌ WRONG - No environment
functionName: 'my-function'

// ✅ CORRECT - Include environment
functionName: `my-function-${environment}`

❌ Pitfall 3: Inconsistent Pattern

// ❌ WRONG - Inconsistent
functionName: `my-function-${environment}`  // Has environment
tableName: `my-table`  // Missing environment

// ✅ CORRECT - Consistent
functionName: `my-function-${environment}`
tableName: `my-table-${environment}`

❌ Pitfall 4: Missing Project Prefix

// ❌ WRONG - No project identification
functionName: `job-extractor-${environment}`

// ✅ CORRECT - Include project prefix
functionName: `cme-job-extractor-${environment}`

❌ Pitfall 5: Assuming Different Accounts Mean No Environment Suffix Needed

// ❌ WRONG ASSUMPTION
// "We use different AWS accounts for dev/prod, so we don't need environment in names"
functionName: 'job-extractor'  // No environment suffix

// ✅ CORRECT - Always include environment
functionName: `job-extractor-${environment}`

// REALITY:
// - Human error: You might be in wrong account without realizing
// - Visual confirmation: Name tells you it's prod even if you're confused about account
// - Account strategy might change (single → multi or multi → single)
// - Consistency: Same pattern works for single and multi-account setups
// - Safety layer: Costs nothing, prevents costly mistakes

Migration from Old Names

Audit Phase

  1. List all AWS resources in the account
  2. Identify resources without environment in name
  3. Identify resources without project prefix
  4. Document which environments are affected
  5. Plan migration strategy

Migration Phase

  1. Deploy new resources with correct names
  2. Migrate data from old to new resources
  3. Update application to use new resources
  4. Verify new resources working
  5. Delete old resources after validation

Validation

How to Verify Separation

AWS Console Check:

# List all Lambda functions
aws lambda list-functions --query 'Functions[*].FunctionName'

# Should see:
# - cme-my-function-dev
# - cme-my-function-prod
# ✅ Clear project and environment separation

# NOT:
# - my-function
# ❌ No project or environment identifier

DynamoDB Check:

# List all tables
aws dynamodb list-tables

# Should see:
# - cme-my-table-dev
# - cme-my-table-prod
# ✅ Clear separation

Deployment Test:

# Deploy dev
ENVIRONMENT=dev ./deploy.sh

# Deploy prod
ENVIRONMENT=prod ./deploy.sh

# Verify:
# - No resource overwrites
# - Both environments coexist
# - No conflicts or errors

Quick Reference

✅ DO

  • Include project prefix in ALL resource names
  • Include ${environment} in ALL resource names
  • Use consistent naming pattern across all resources
  • Validate environment variable is set before deployment
  • Test both dev and prod deployments to same account
  • Document naming convention in project README

❌ DON'T

  • Hardcode environment values ('dev', 'prod')
  • Skip project prefix in resource names
  • Assume different AWS accounts mean no naming needed
  • Skip environment in "temporary" or "test" resources
  • Use different naming patterns for different resource types
  • Deploy without verifying environment variable

Related Patterns


Summary

Critical Rules:

  1. Every AWS resource name MUST include the project prefix
  2. Every AWS resource name MUST include the environment identifier
  3. Use the pattern: {project}-{resource-name}-{environment}

Why:

  • Prevents resource conflicts and data corruption
  • Enables clear project ownership
  • Allows safe multi-environment deployments to same account
  • Facilitates easy resource identification and management

How: Use ${projectPrefix} and ${environment} variables in all resource names consistently.

Validation: Deploy both dev and prod to same account and verify no conflicts.

Remember: This is not optional. It's a critical pattern that prevents production incidents and enables clear resource management.


Progressive Improvement

If the developer corrects a behavior that this skill should have prevented, suggest a specific amendment to this skill to prevent the same correction in the future.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.16%
按下载量换算101

Claude

31.8%
按下载量换算97

Cursor

18.01%
按下载量换算55

Gemini CLI

8.36%
按下载量换算25

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills