AI Agent Support
Structus is AI-agent-friendly! We provide comprehensive resources to help AI coding assistants understand and properly use this library.
π― Purpose
These resources help AI agents:
- Understand Architecture - Learn Clean Architecture, DDD, and CQRS principles
- Generate Correct Code - Follow library conventions and best practices
- Avoid Common Mistakes - Prevent anti-patterns and architectural violations
- Accelerate Development - Provide templates for common tasks
- Maintain Consistency - Ensure generated code follows project standards
π Available Resources
Library Overview
High-level architecture and design principles of Structus. Start here to understand the core concepts.
Usage Patterns
Common patterns and anti-patterns. Learn what to do and what to avoid.
Code Templates
Ready-to-use code templates for common tasks like creating aggregates, commands, queries, and repositories.
AI Prompts
Pre-written prompt templates for specific tasks:
- Creating aggregates
- Adding commands
- Adding queries
- Implementing repositories
π€ For AI Agents
When a developer asks you to work with Structus:
- Start Here: Read the Library Overview to understand the architecture
- Check Patterns: Review Usage Patterns for correct implementation patterns
- Use Templates: Refer to Code Templates for boilerplate code
- Follow Prompts: Use the AI Prompts as guides for specific tasks
π¨βπ» For Developers
To help your AI assistant work better with Structus:
Quick Start Prompt
Copy and paste this prompt to your AI assistant:
I'm working with the Structus library (com.melsardes.libraries.structuskotlin).
Please read these files to understand the architecture:
1. Library Overview - Core concepts and architecture
2. Usage Patterns - Implementation patterns and anti-patterns
3. Code Templates - Ready-to-use code templates
Then help me [describe your task here].
Best Practices
- Share Context: Point your AI to this documentation when starting a new feature
- Use Prompts: Copy prompt templates and customize them for your needs
- Reference Patterns: Mention specific patterns when asking for help
- Provide Examples: Show AI the templates that match your use case
π Example Interactions
Creating a New Aggregate
Using Structus library, create an Order aggregate with:
- OrderId as the identifier
- Customer ID, order items, and total amount as properties
- Methods to add items and calculate total
- Domain events for order creation and item addition
Follow the patterns from the Code Templates section.
Implementing a Command Handler
Using Structus library, implement a CreateOrderCommandHandler that:
- Validates the customer exists
- Creates an Order aggregate
- Saves it to the repository
- Publishes events using the Transactional Outbox Pattern
Follow the Usage Patterns for command handlers.
Adding a Query
Using Structus library, create a GetOrderByIdQuery and handler that:
- Retrieves order details from the database
- Returns a DTO optimized for reading
- Bypasses the domain model for performance
Follow the CQRS patterns from Usage Patterns.
π Integration with AI Tools
GitHub Copilot
Add this to your workspace settings:
{
"github.copilot.advanced": {
"contextFiles": [
".ai/library-overview.md",
".ai/usage-patterns.md",
".ai/code-templates.md"
]
}
}
Cursor
Reference these files in your .cursorrules:
When working with Structus library:
- Follow patterns from .ai/usage-patterns.md
- Use templates from .ai/code-templates.md
- Maintain clean architecture principles
Claude / ChatGPT
Include this in your conversation:
I'm using Structus library. Here's the architecture overview:
[paste content from Library Overview]
Please help me implement [your feature].
π Additional Resources
- Main Documentation - Complete library documentation
- Quick Start Tutorial - Build your first app
- Architecture Overview - Deep dive into architecture
- Best Practices - Guidelines and conventions
π€ Contributing
Help us improve AI agent support:
- Report issues with AI-generated code
- Suggest new prompt templates
- Share successful AI interactions
- Contribute new code templates
Visit our GitHub repository to contribute.
Making Structus easier to use with AI assistance! π€