new-event-source
Skill1.7k starsChanged 7 months agoApache-2.0View on GitHub
Add a new AWS event source attribute (e.g., Kinesis, Kafka, MQ) to the Lambda .NET Annotations framework, including the attribute class, source generator integration, CloudFormation writer, unit tests, writer tests, source generator tests, and integration tests
Trending
Quiet since July.about the whole repository
Who's talking about aws/aws-lambda-dotnet
- aws/integrations-on-dotnet-aspire-for-aws“.NET Aspire Lambda Local Development Feature Tracker”GitHub · Jan 28, 2025 · 8 reactions
- aws-powertools/powertools-lambda-dotnet“Feature request: Support using with Amazon.Lambda.AspNetCoreServer.Hosting”GitHub · Jul 24, 2023 · 6 reactions
- getsentry/sentry-dotnet“Events are not sent in AWS Lambda ”GitHub · Oct 26, 2018 · 5 reactions
- aws/aws-extensions-for-dotnet-cli“Template Substitions are not supported for YAML”GitHub · Feb 2, 2018 · 4 reactions
- aws/aws-extensions-for-dotnet-cli“Re-enable JSON comment support in the config file”GitHub · Dec 16, 2025 · 3 reactions
The biggest 5 of 18 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 18
Talked about on GitHub (18 times).
On GitHub · 18
- Jan 28, 2025.NET Aspire Lambda Local Development Feature Tracker — aws/integrations-on-dotnet-aspire-for-aws8 reactions · 7 comments
- Jul 24, 2023Feature request: Support using with Amazon.Lambda.AspNetCoreServer.Hosting — aws-powertools/powertools-lambda-dotnet6 reactions · 7 comments
- Oct 26, 2018Events are not sent in AWS Lambda — getsentry/sentry-dotnet5 reactions · 28 comments
- Feb 2, 2018Template Substitions are not supported for YAML — aws/aws-extensions-for-dotnet-cli4 reactions · 4 comments
- Dec 16, 2025Re-enable JSON comment support in the config file — aws/aws-extensions-for-dotnet-cli3 reactions
13 more on GitHub
- Jul 17, 2025Static Assets are now included when packing a Blazor Web App — dotnet/sdk3 reactions · 6 comments
- Jan 19, 2023[release/7.0] Target lower glibc for Linux arm64 — dotnet/runtime3 reactions · 5 comments
- Nov 21, 2020Parallel build fails for .Net Core project — aws/aws-lambda-builders3 reactions · 4 comments
- Oct 31, 2019dotnet global tools failing to uninstall or update on 2.1-sdk-alpine — dotnet/sdk3 reactions · 8 comments
- Mar 20, 2018Razor pages and webapi — Azure/azure-functions-host3 reactions · 8 comments
- Sep 8, 2022dotnet tools use wrong architecture of libhostfxr.dylib on Mac M1 — dotnet/sdk2 reactions · 9 comments
- Jul 18, 2026Aspire: support AWS Lambda — GustavEikaas/easy-dotnet.nvim1 reaction · 1 comment
- May 20, 2024Certain lambda layers result in manifest error — aws/aws-extensions-for-dotnet-cli1 reaction · 4 comments
- Feb 2, 2024Improve cold starts on AL2023 — maxday/lambda-perf1 reaction · 1 comment
- May 10, 2023[CSharp] AWS Lambda Modelling — github/codeql1 reaction · 12 comments
- Apr 14, 2023Rider 2023 / aws.toolkit ver1.65-231 - Timeout while waiting for debugger to connect — aws/aws-toolkit-jetbrains1 reaction · 1 comment
- Apr 11, 2022'dotnet lambda publish-layer' fails in .NET 6 with ‘--enable-package-optimization true’ — aws/aws-extensions-for-dotnet-cli1 reaction · 5 comments
- Sep 30, 2020sam build dotnet core sends normal output to STDERR — aws/aws-lambda-builders1 reaction · 4 comments
In this repositoryOne other file it gives its agents.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 3 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Before starting, gather from the user:
- Distinctive: line 22
Read these files to understand existing patterns before creating new ones:
- Very specific: line 35
Add copyright header: // Copyright Amazon.com, Inc.
- Very specific: line 38
All optional properties use nullable backing fields with Is<PropertyName>Set internal properties
- Very specific: line 41
Use Regex("^[a-zA-Z0-9]+$") for ResourceName validation
- Very specific: line 65
Add else if block for the new attribute type after the existing event attribute blocks.
- Very specific: line 71
Add else if block mapping the attribute to the EventType enum value.
- Very specific: line 77
Add descriptor with the next available AWSLambda0XXX ID for invalid attribute validation errors.
- Very specific: line 85
Add Validate{ServiceName}Events() call in ValidateFunction method
- Very specific: line 86
Create private Validate{ServiceName}Events() method that validates:
- Distinctive: line 101
Add the new attribute name if the SyntaxReceiver filters by attribute name strings.
- Very specific: line 107
Add case AttributeModel<{ServiceName}EventAttribute> in the event processing switch
- Very specific: line 108
Create Process{ServiceName}Attribute() method that writes CF template properties
- Very specific: line 192
Invalid event test spans: must reference exact line numbers in the .cs.error file
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Adding a New Event Source to Lambda Annotations
This skill guides you through adding a complete new event source attribute to the AWS Lambda .NET Annotations framework. Use this when a user asks to add support for a new AWS event source like Kinesis, Kafka, MQ, etc.
Prerequisites
Before starting, gather from the user:
- Service name (e.g., "Kinesis", "Kafka", "MQ")
- Primary resource identifier (e.g., stream ARN, topic ARN, broker ARN)
- CloudFormation event type string (e.g., "Kinesis", "MSK", "MQ")
- Event class name from the corresponding
Amazon.Lambda.*EventsNuGet package (e.g.,KinesisEvent) - Optional properties the attribute should support (e.g., BatchSize, StartingPosition, Filters)
- Whether
@references useFn::GetAttorRef— event source mappings useFn::GetAtt, subscriptions useRef
Reference Examples
Read these files to understand existing patterns before creating new ones:
- SNS (simplest, subscription-based):
Libraries/src/Amazon.Lambda.Annotations/SNS/SNSEventAttribute.cs - SQS (event source mapping with batching):
Libraries/src/Amazon.Lambda.Annotations/SQS/SQSEventAttribute.cs - DynamoDB (stream-based):
Libraries/src/Amazon.Lambda.Annotations/DynamoDB/DynamoDBEventAttribute.cs - S3 (notification-based):
Libraries/src/Amazon.Lambda.Annotations/S3/S3EventAttribute.cs
Steps
Step 1: Create the Event Attribute Class
Create: Libraries/src/Amazon.Lambda.Annotations/{ServiceName}/{ServiceName}EventAttribute.cs
Key patterns:
- Add copyright header:
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.+// SPDX-License-Identifier: Apache-2.0 - Inherit from
Attributewith[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)](useAllowMultiple = falsefor event types where multiple triggers on the same function don't make sense, e.g., Schedule events) - Constructor takes the primary resource identifier as a required
stringparameter - All optional properties use nullable backing fields with
Is<PropertyName>Setinternal properties - Include auto-derived
ResourceNameproperty (strips@prefix or extracts name from ARN) - Include
internal List<string> Validate()method with all validation rules - Use
Regex("^[a-zA-Z0-9]+$")for ResourceName validation
Step 2: Register Type Full Names
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/TypeFullNames.cs
Add constants:
public const string {ServiceName}EventAttribute = "Amazon.Lambda.Annotations.{ServiceName}.{ServiceName}EventAttribute";
public const string {ServiceName}Event = "Amazon.Lambda.{ServiceName}Events.{ServiceName}Event";Also add to EventType enum if needed in Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Models/EventType.cs.
Step 3: Create the Attribute Builder
Create: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Models/Attributes/{ServiceName}EventAttributeBuilder.cs
Extracts attribute data from Roslyn AttributeData. Use consistent else if chaining. Reference: SNSEventAttributeBuilder.cs.
Step 4: Register in AttributeModelBuilder
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Models/Attributes/AttributeModelBuilder.cs
Add else if block for the new attribute type after the existing event attribute blocks.
Step 5: Register in EventTypeBuilder
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Models/EventTypeBuilder.cs
Add else if block mapping the attribute to the EventType enum value.
Step 6: Add DiagnosticDescriptor
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs
Add descriptor with the next available AWSLambda0XXX ID for invalid attribute validation errors.
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/AnalyzerReleases.Unshipped.md — add the new diagnostic ID.
Step 7: Add Validation in LambdaFunctionValidator
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Validation/LambdaFunctionValidator.cs
- Add
Validate{ServiceName}Events()call inValidateFunctionmethod - Create private
Validate{ServiceName}Events()method that validates:- Attribute properties via
Validate()method - Method parameters (first must be event type, optional second is
ILambdaContext) - Return type (usually
voidorTask)
- Attribute properties via
Step 8: Add Dependency Check
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Validation/LambdaFunctionValidator.cs
In ValidateDependencies, add check for Amazon.Lambda.{ServiceName}Events NuGet package.
Step 9: Check SyntaxReceiver
Check: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/SyntaxReceiver.cs
Add the new attribute name if the SyntaxReceiver filters by attribute name strings.
Step 10: Add CloudFormation Writer Logic
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Writers/CloudFormationWriter.cs
- Add
case AttributeModel<{ServiceName}EventAttribute>in the event processing switch - Create
Process{ServiceName}Attribute()method that writes CF template properties- Event source mappings (SQS, DynamoDB, Kinesis): use
Fn::GetAttfor@references - Subscription events (SNS): use
Reffor@references - Track synced properties in metadata
- Event source mappings (SQS, DynamoDB, Kinesis): use
Step 11: Create Attribute Unit Tests
Create: Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/{ServiceName}EventAttributeTests.cs
Cover: constructor, defaults, property tracking, ResourceName derivation, all validation paths. Reference: SQSEventAttributeTests.cs, DynamoDBEventAttributeTests.cs, SNSEventAttributeTests.cs.
Step 12: Create CloudFormation Writer Tests
Create: Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/WriterTests/{ServiceName}EventsTests.cs
This is a partial class CloudFormationWriterTests. Include tests for:
Verify{ServiceName}EventAttributes_AreCorrectlyApplied— Theory with JSON/YAML and property combinationsVerify{ServiceName}EventProperties_AreSyncedCorrectly— Synced properties update when attributes changeSwitchBetweenArnAndRef_For{Resource}— ARN to@reference switchingVerify{Resource}CanBeSet_FromCloudFormationParameter— CF Parameters handlingVerifyManuallySet{ServiceName}EventProperties_ArePreserved— Hand-edited template preservation
Reference: SQSEventsTests.cs, DynamoDBEventsTests.cs, SNSEventsTests.cs.
Step 13: Create Valid Event Examples + Source Generator Test
Create: Libraries/test/TestServerlessApp/{ServiceName}EventExamples/Valid{ServiceName}Events.cs.txt
Create: Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/{ServiceName}/ (generated handler snapshots)
Create: Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ServerlessTemplates/{serviceName}Events.template
Modify: Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/SourceGeneratorTests.cs — add VerifyValid{ServiceName}Events() test
Step 14: Create Invalid Event Examples + Source Generator Test
Create: Libraries/test/TestServerlessApp/{ServiceName}EventExamples/Invalid{ServiceName}Events.cs.error
Cover: invalid property values, invalid params, invalid return type, multiple events, invalid ARN, invalid resource name.
Modify: Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/SourceGeneratorTests.cs — add VerifyInvalid{ServiceName}Events_ThrowsCompilationErrors() test with diagnostic assertions including line spans.
Step 15: Create Generated Code Snapshots
Create: Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/{ServiceName}/
Tip: Run the source generator once to get actual output, then use as snapshot.
Step 16: Create Integration Test
Create: Libraries/test/TestServerlessApp.IntegrationTests/{ServiceName}EventSourceMapping.cs
Modify: Libraries/test/TestServerlessApp.IntegrationTests/IntegrationTestContextFixture.cs — resource lookup
Modify: Libraries/test/TestServerlessApp.IntegrationTests/DeploymentScript.ps1 — if needed
Step 17: Update AnalyzerReleases.Unshipped.md
Modify: Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/AnalyzerReleases.Unshipped.md
File Map Summary
| Action | File Path |
| Create | src/Amazon.Lambda.Annotations/{ServiceName}/{ServiceName}EventAttribute.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/TypeFullNames.cs |
| Create | src/Amazon.Lambda.Annotations.SourceGenerator/Models/Attributes/{ServiceName}EventAttributeBuilder.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/Models/Attributes/AttributeModelBuilder.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/Models/EventTypeBuilder.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/Validation/LambdaFunctionValidator.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/SyntaxReceiver.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/Writers/CloudFormationWriter.cs |
| Modify | src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/AnalyzerReleases.Unshipped.md |
| Create | test/Amazon.Lambda.Annotations.SourceGenerators.Tests/{ServiceName}EventAttributeTests.cs |
| Create | test/Amazon.Lambda.Annotations.SourceGenerators.Tests/WriterTests/{ServiceName}EventsTests.cs |
| Create | test/TestServerlessApp/{ServiceName}EventExamples/Valid{ServiceName}Events.cs.txt |
| Create | test/TestServerlessApp/{ServiceName}EventExamples/Invalid{ServiceName}Events.cs.error |
| Create | test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/{ServiceName}/ |
| Create | test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ServerlessTemplates/{serviceName}Events.template |
| Modify | test/Amazon.Lambda.Annotations.SourceGenerators.Tests/SourceGeneratorTests.cs |
| Create | test/TestServerlessApp.IntegrationTests/{ServiceName}EventSourceMapping.cs |
| Modify | test/TestServerlessApp.IntegrationTests/IntegrationTestContextFixture.cs |
Important Conventions
- Copyright header on every new
.csfile - Consistent
else ifchaining in attribute builders (neveriftheniffor the same loop) - Both JSON and YAML template formats must be tested in writer tests
- Invalid event test spans must reference exact line numbers in the
.cs.errorfile .cs.txtextension for valid test files (prevents deployment).cs.errorextension for invalid test files (prevents compilation)- Use enums instead of strings when you need to represent a fixed, known set of constants that do not change frequently (e.g.,
StartingPosition,AuthType,HttpApiVersion). Enums provide compile-time type safety, eliminate the need for manual string validation in theValidate()method, and prevent invalid values from being set. In attribute builders, enum values come through Roslyn'sAttributeDataas their underlyingintvalue and must be cast accordingly (e.g.,(MyEnum)(int)pair.Value.Value). When writing enum values to CloudFormation templates, use.ToString()to convert back to the string representation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

