Skip to content

Commit 6d3b5e4

Browse files
committed
Add Kiro steering and MCP placeholder; stop ignoring AI tool configs
Introduce product.md, tech.md, and structure.md steering following the canonical cross-runtime skeleton shared by all four workshop language variants, plus an empty MCP server configuration placeholder. Remove the AI Tools ignore block so agent configuration ships with the repo.
1 parent bc5f6e8 commit 6d3b5e4

5 files changed

Lines changed: 219 additions & 48 deletions

File tree

.gitignore

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,51 +37,3 @@ terraform.rc
3737
# But keep the non-sensitive common and environment-specific configs
3838
!**/terraform.tfvars
3939
!**/envs/*.tfvars
40-
41-
### AI Tools ###
42-
# Kiro
43-
.kiro/
44-
45-
# Claude
46-
.claude/
47-
48-
# Cursor
49-
.cursor/
50-
.cursorignore
51-
.cursorindexingignore
52-
.cursorrules
53-
54-
# GitHub Copilot
55-
.copilot/
56-
.github/copilot-instructions.md
57-
58-
# Windsurf / Codeium
59-
.windsurf/
60-
.codeium/
61-
62-
# Aider
63-
.aider*
64-
.aider.tags.cache.v3/
65-
66-
# Amazon Q Developer
67-
.amazonq/
68-
.qdeveloper/
69-
70-
# Cline
71-
.cline/
72-
.clinerules
73-
74-
# Roo Code
75-
.roo/
76-
.rooignore
77-
78-
# Augment
79-
.augment/
80-
.augmentignore
81-
82-
# Tabnine
83-
.tabnine_root
84-
85-
# Continue
86-
.continue/
87-
.continuerc.json

.kiro/settings/mcp.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"mcpServers": {}
3+
}

.kiro/steering/product.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Unicorn Properties - Product Overview
2+
3+
## What is Unicorn Properties?
4+
5+
Unicorn Properties is a serverless, event-driven real estate management platform that handles property listings, contracts, and approvals. It is built as a reference architecture for the AWS Serverless Developer Experience workshop.
6+
7+
## Business Domain
8+
9+
The platform manages three core domains, each implemented as an independent microservice:
10+
11+
- **Contracts** (`Unicorn.Contracts`) - Manages contractual relationships between property sellers and Unicorn Properties, including property definitions, terms, and engagement costs
12+
- **Approvals** (`Unicorn.Approvals`) - Implements the approval workflow that validates contract existence, content safety, image safety, and contract approval status before a listing can be published
13+
- **Web** (`Unicorn.Web`) - Manages property listing details (address, price, description, photos) for the public website, displaying only approved listings
14+
15+
## Key Features
16+
17+
- Event-driven architecture using Amazon EventBridge
18+
- Serverless compute with AWS Lambda
19+
- Property listing management and search
20+
- Automated approval workflows using AWS Step Functions
21+
- Content and image validation using AWS AI services
22+
- Real-time contract status tracking
23+
24+
## Architecture Pattern
25+
26+
The system follows a microservices architecture where each service:
27+
28+
- Owns its domain: a dedicated EventBridge event bus, schema registry, and event subscriptions
29+
- Uses DynamoDB for data persistence
30+
- Communicates with other services asynchronously through events, never direct API calls
31+
- Maintains clear service boundaries with well-defined APIs and published event contracts

.kiro/steering/structure.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Project Structure & Conventions
2+
3+
## Repository Layout
4+
5+
Multi-service monorepo with three services plus shared infrastructure:
6+
7+
```text
8+
├── unicorn_contracts/ # Contracts Service - property contracts
9+
├── unicorn_approvals/ # Approvals Service - approval workflow
10+
├── unicorn_web/ # Web Service - property listings and search
11+
├── unicorn_shared/ # Global namespaces and shared images stacks
12+
├── docs/ # Documentation and architecture diagrams
13+
└── pyproject.toml # Repository root project metadata
14+
```
15+
16+
## Service Structure Pattern
17+
18+
Each service follows this structure. Maintain it when adding or modifying services:
19+
20+
```text
21+
unicorn_<service>/
22+
├── Makefile # Canonical build/deploy/test interface
23+
├── pyproject.toml # Dependencies, pytest and coverage config
24+
├── uv.lock # Locked dependency versions (committed)
25+
├── ruff.toml # Lint/format configuration
26+
├── src/
27+
│ ├── <service>_service/ # Lambda handlers and domain code (snake_case dir)
28+
│ └── requirements.txt # Generated by make build for SAM - do not edit
29+
├── tests/
30+
│ ├── unit/ # Unit tests (+ events/ payloads, conftest.py)
31+
│ ├── integration/ # Integration tests against deployed stacks
32+
│ └── pipes/ # Stream/pipe payload fixtures (contracts)
33+
└── infrastructure/ # All IaC for the service (see below)
34+
```
35+
36+
Step Functions ASL definitions live next to the service template (e.g., `unicorn_approvals/infrastructure/approvals-service/property_approval.asl.yaml`).
37+
38+
## Infrastructure Layout
39+
40+
Every service owns its infrastructure under `infrastructure/`:
41+
42+
```text
43+
infrastructure/
44+
├── domain.yaml # Event bus, bus policies, schema registry,
45+
│ # catch-all rule, SSM exports
46+
├── <service>-service/
47+
│ ├── template.yaml # Lambda, API Gateway, DynamoDB, queues
48+
│ ├── samconfig.toml # SAM build/deploy configuration
49+
│ └── api.yaml # OpenAPI specification (REST services)
50+
├── schema-registry/
51+
│ └── <EventName>-schema.yaml # One stack per published event schema
52+
└── subscriptions/
53+
└── <producer>-subscriptions.yaml # Rules on producer buses feeding this service
54+
```
55+
56+
Deploy order: shared namespaces first, then per service `domain -> schema -> service`; subscriptions reference both participating domains. `make deploy` and `make delete` encode the correct (reverse) order.
57+
58+
## Code Conventions
59+
60+
- Source directories are snake_case (`contracts_service`, `approvals_service`, `publication_manager_service`, `search_service`)
61+
- Lambda handler modules are snake_case and describe the trigger (`contract_event_handler.py`)
62+
- Domain enums and exceptions live beside handlers (`enums.py`, `exceptions.py`)
63+
- Event schema models live in `src/schema/`
64+
- Format and lint with ruff before committing (`make format`, `make lint`)
65+
66+
## Resource Naming & Events
67+
68+
- Stack names: `uni-prop-{stage}-{service}` (e.g., `uni-prop-local-contracts`); schema stacks append `-schema-<EventName>`
69+
- Event buses: `unicorn-{service}-eventbus-${Stage}` (e.g., `unicorn-contracts-eventbus-local`), exported via SSM
70+
- Event sources use the service namespace value (e.g., `unicorn-contracts`), resolved from the SSM namespace parameters — never hardcode it
71+
- Canonical event detail types: `ContractStatusChanged` (Contracts), `PublicationApprovalRequested` (Web), `PublicationEvaluationCompleted` (Approvals)
72+
- SSM parameter contracts:
73+
- Global namespaces: `/uni-prop/Unicorn{Service}Namespace`
74+
- Stage-scoped: `/uni-prop/${Stage}/{Service}EventBus`, `...EventBusArn`, `...SchemaRegistryName`
75+
- Each domain template includes a catch-all rule logging all bus events to CloudWatch for debugging
76+
77+
## Testing Conventions
78+
79+
```text
80+
tests/
81+
├── unit/ # Fast tests, AWS mocked with moto; conftest.py fixtures
82+
│ └── events/ # Sample event payloads (e.g., create_contract_valid_1.json)
83+
├── integration/ # Run against a deployed stack
84+
└── pipes/ # EventBridge/stream/pipe payload fixtures
85+
```
86+
87+
- Test event naming: `[action]_[entity]_[condition]_[n].json` (e.g., `create_contract_valid_1.json`)
88+
- pytest config lives in `pyproject.toml`: coverage over `src/` with an 80% fail-under gate
89+
- Integration tests require a deployed `local` stage stack
90+
91+
## Development Workflow
92+
93+
When adding a feature:
94+
95+
1. Implement the handler in `src/<service>_service/` following existing patterns
96+
2. Add or update SAM resources in `infrastructure/<service>-service/template.yaml` using the naming conventions above
97+
3. Add unit test payloads under `tests/unit/events/` and tests beside existing ones
98+
4. If the change publishes or consumes a new event: update `infrastructure/schema-registry/` and the consumer's `infrastructure/subscriptions/`
99+
5. Run `make lint` and `make test` before deploying with `make deploy STAGE=local`
100+
101+
When modifying services, preserve the existing structure — do not reorganize directories without a documented reason.

.kiro/steering/tech.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Technology Stack & Build System
2+
3+
## Runtime & Language
4+
5+
- **Python >= 3.13** (pinned in each service's `pyproject.toml`) - all Lambda functions
6+
- **uv** - package and environment manager; each service has its own `pyproject.toml` and `uv.lock`
7+
- **AWS SAM** - infrastructure as code, build, and deployment
8+
9+
## AWS Services
10+
11+
- **AWS Lambda** - serverless compute
12+
- **Amazon DynamoDB** - NoSQL persistence with streams
13+
- **Amazon EventBridge** - event bus, schema registry, and cross-service messaging
14+
- **AWS Step Functions** - approval workflow orchestration
15+
- **Amazon API Gateway** - REST API endpoints
16+
- **Amazon SQS** - ingest queues and dead-letter queues
17+
- **AWS X-Ray** - distributed tracing
18+
- **Amazon CloudWatch** - logging, metrics, and monitoring
19+
20+
## Key Libraries & Frameworks
21+
22+
- **AWS Lambda Powertools for Python** (`aws-lambda-powertools[tracer]`) - structured logging, metrics, and tracing
23+
- **boto3** and **aws-xray-sdk** - AWS service clients and tracing
24+
- **pytest** with `pytest-cov` (80% coverage gate) and **moto** for AWS mocking
25+
- **ruff** - linting and formatting (per-service `ruff.toml`)
26+
27+
## Build & Development Commands
28+
29+
### Make Targets (canonical interface)
30+
31+
Run from a service directory (e.g., `unicorn_contracts/`). Stages: `local` (default), `dev`, `prod`; default region `ap-southeast-2`.
32+
33+
```bash
34+
make build STAGE=local # uv sync, export requirements.txt, sam build
35+
make deploy STAGE=local # deploy-domain + deploy-schema + deploy-service
36+
make deploy-domain # Event bus, schema registry (infrastructure/domain.yaml)
37+
make deploy-schema # Event schema stack(s)
38+
make deploy-service # Lambda, API Gateway, DynamoDB (service template)
39+
make test # Run all tests (pytest)
40+
make unit-test # Unit tests only
41+
make format # ruff format + ruff check --fix
42+
make lint # ruff check/format + cfn-lint on templates
43+
make clean # Remove .aws-sam/, caches
44+
make delete # Delete stacks in reverse dependency order
45+
```
46+
47+
`unicorn_shared/` has its own targets: `deploy-namespaces`, `deploy-images` (per-stage variants), `deploy`, `list-parameters`, and reverse-order `delete` targets. Deploy shared namespaces before any service.
48+
49+
### Runtime Commands
50+
51+
Inside a service directory, the make targets invoke uv commands you can also run directly:
52+
53+
```bash
54+
uv sync --dev # Install dependencies (incl. dev extras)
55+
uv run pytest # All tests (config in pyproject.toml)
56+
uv run pytest tests/unit -v # Unit tests only
57+
uv run ruff check . # Lint
58+
uv run ruff format . # Format
59+
```
60+
61+
`make build` exports the locked dependencies to `src/requirements.txt` for SAM packaging — do not edit that file by hand.
62+
63+
### SAM Commands
64+
65+
```bash
66+
sam build --cached --parallel # Build (config in samconfig.toml)
67+
sam deploy --no-confirm-changeset # Deploy current service
68+
sam validate --lint # Validate templates
69+
sam sync --watch # Rapid dev iteration
70+
sam local start-api --warm-containers EAGER # Local API
71+
sam local start-lambda --warm-containers EAGER # Local Lambda endpoint
72+
```
73+
74+
`samconfig.toml` in each `infrastructure/<service>-service/` directory sets stack name, cached/parallel builds, `disable_rollback` for dev iteration, and `Stage` parameter overrides.
75+
76+
## Environment Variables
77+
78+
Standard Lambda environment variables set in the SAM templates:
79+
80+
- `DYNAMODB_TABLE` - DynamoDB table name
81+
- `SERVICE_NAMESPACE` - service identifier for event sources (from SSM namespace parameters)
82+
- `POWERTOOLS_SERVICE_NAME`, `POWERTOOLS_METRICS_NAMESPACE` - Powertools identifiers
83+
- `POWERTOOLS_LOG_LEVEL`, `POWERTOOLS_LOGGER_LOG_EVENT`, `POWERTOOLS_LOGGER_SAMPLE_RATE`, `POWERTOOLS_TRACE_DISABLED` - observability tuning (stage-mapped)
84+
- `LOG_LEVEL` - application log level

0 commit comments

Comments
 (0)