This project is specifically designed for efficient AI-assisted development. Whether you're using Antigravity, Cursor, Windsurf, Claude, GPT-4, or GitHub Copilot, this guide will help you contribute effectively.
- Open the project root directory
- The
.ai/project-context.mdfile should auto-load - Start coding - the AI knows all project conventions!
- First Message: Upload or paste
.ai/project-context.md - Second Message: Describe your task
- The AI will follow all project conventions automatically
- The inline XML documentation guides suggestions
- Check
.github/copilot-instructions.mdfor project rules - Use comments to guide Copilot:
// Implement IDiceRoller following project conventions
We maintain comprehensive context files so AI assistants can generate perfect code on the first try. No more back-and-forth fixing style issues!
Write tests first, let AI implement. The tests ARE the specification.
Define interfaces, multiple people (or AIs) can implement different parts simultaneously.
.ai/
├── project-context.md # PRIMARY - All coding standards (READ FIRST)
├── current-tasks.md # What we're working on now
├── architecture-decisions.md # Why things are built this way
├── code-examples.md # Canonical implementation patterns
└── testing-patterns.md # How to write tests
-
project-context.md (MANDATORY READING)
- Coding conventions (MUST follow exactly)
- Enum patterns with Unspecified/LastValue
- XML documentation requirements
- Interface-first design rules
- Legal constraints (SRD only)
-
current-tasks.md (Check for work items)
## In Progress - [ ] Implement advantage/disadvantage system (#23) - Interface: `IAdvantageProvider` - Tests: `Tests/Mechanics/AdvantageTests.cs` - Status: Tests written, needs implementation
-
architecture-decisions.md (Understand the "why")
- Why Result pattern instead of exceptions
- Why interface-heavy architecture
- Why separate Core/Implementation projects
Following project-context.md conventions, implement the IConcentrationManager interface.
Write comprehensive tests first (TDD), including edge cases for damage thresholds.
Use the standard enum pattern and Result<T> for returns.
Task: Implement concentration mechanics
Context: See IConcentrationManager in Core/Interfaces/Magic/
Requirements:
1. Follow TDD - write tests first
2. DC = max(10, damage/2)
3. Return Result<bool> not raw bool
4. Include XML docs on ALL members
5. Test edge cases: 0 damage, negative damage, massive damage
Bug: Advantage rolls returning lower of two dice
Location: StandardDiceRoller.RollWithAdvantage()
Current test: DiceRollerTests.RollWithAdvantage_ShouldReturnHigher
The test is correct but failing. Fix the implementation.
Add support for importing from Roll20 format.
1. Create Roll20Importer.cs in Content/Importers/
2. Map Roll20's spell structure to our SpellData
3. Strip all description/flavor text
4. Add to ContentImporterFactory
5. Include test with sample Roll20 JSON in TestData/
/// <summary>
/// Manages creature hit points and damage calculation
/// </summary>
public interface IHitPointManager
{
/// <summary>
/// Applies damage to creature accounting for all modifiers
/// </summary>
/// <param name="amount">Base damage before modifiers</param>
/// <param name="type">Damage type for resistance/immunity check</param>
/// <returns>Actual damage dealt after all modifiers</returns>
Result<int> ApplyDamage(int amount, DamageType type);
}[Theory]
[InlineData(10, DamageType.Fire, 5)] // Resistance
[InlineData(10, DamageType.Poison, 0)] // Immunity
[InlineData(10, DamageType.Cold, 20)] // Vulnerability
public void ApplyDamage_WithModifiers_CalculatesCorrectly(
int baseDamage, DamageType type, int expected)
{
// This test defines the behavior before implementation exists
}public enum ActionType
{
Unspecified = 0, // AI: ALWAYS start with this
Action,
BonusAction,
Reaction,
FreeAction,
LastValue // AI: ALWAYS end with this
}
// AI should generate this validation method
public static bool IsValid(ActionType type)
=> type > ActionType.Unspecified && type < ActionType.LastValue;- AI reads the interface definition
- AI checks for existing tests
- AI writes missing tests if needed
- AI implements following all patterns
- AI ensures all tests pass
Human: Add support for undead creatures
AI Actions:
1. Create IUndead interface in Core/Interfaces/Creatures/
2. Add UndeadType enum with Unspecified/LastValue
3. Write tests for undead-specific mechanics
4. Implement in Implementation/Creatures/
5. Add import support for undead from content files
Human: The attack roll isn't applying proficiency bonus
AI Needs:
- The failing test
- The current implementation
- Related interfaces (IAttackRoll, IProficiencyProvider)
AI Should:
- Fix only the specific issue
- Not refactor unrelated code
- Maintain all existing tests passing
- Every public method needs at least 3 tests: happy path, edge case, error case
- Use
TheorywithInlineDatafor parametric tests - Test method naming:
MethodName_Condition_ExpectedResult - Always test enum bounds with Unspecified and LastValue
Generate comprehensive tests for IDiceRoller.Roll method:
- Valid notation: "3d6+2", "1d20", "4d4-1"
- Invalid notation: "", "abc", "1d0", "0d6"
- Edge cases: "1d1", "100d100", negative modifiers
- Use Theory/InlineData for all cases
We support multiple formats but convert everything to our clean internal representation:
graph LR
A[5e.tools JSON] --> D[Internal Format]
B[Open5e JSON] --> D
C[Foundry VTT] --> D
E[FC5 XML] --> D
D --> F[Game Engine]
- Never import description/flavor text
- Only extract mechanical effects
- Map to our clean internal format
- Mark the source format for tracking
- Don't validate legality (user's responsibility)
Create importer for D&D Beyond JSON format:
1. Class: DndBeyondImporter : IContentImporter
2. Parse their spell structure
3. Extract: name, level, school, range, components
4. Ignore: description, flavor_text, source_book
5. Map components: "V,S,M" -> Components(Verbal=true, Somatic=true, Material=true)
6. Test with sample JSON from TestData/
- ✅ Always include XML documentation
- ✅ Follow the exact enum pattern (Unspecified/LastValue)
- ✅ Use Result for public APIs
- ✅ Write tests before implementation
- ✅ Use underscore prefix for private fields
- ✅ Validate inputs with guard clauses
- ✅ Keep interfaces in Core project only
- ❌ Skip XML docs ("it's obvious")
- ❌ Use proprietary D&D terms
- ❌ Include spell/monster descriptions
- ❌ Throw exceptions from public methods
- ❌ Put implementation in Core project
- ❌ Create enums without sentinels
- ❌ Use 'var' except for obvious types
Implement combat initiative system:
1. First, I need to understand the requirements
2. Check existing interfaces: ICombatManager, IInitiativeTracker
3. Write tests for: roll initiative, sort order, ties, advantages
4. Implement following Result<T> pattern
5. Integrate with existing TurnManager
Human: Implement spell slots system
AI: I'll implement this incrementally:
1. First PR: ISpellSlotManager interface
2. Second PR: Basic implementation with tests
3. Third PR: Multiclass support
4. Fourth PR: Warlock pact slots
This allows for review and feedback at each stage.
Human: How should I implement conditions?
AI: Check the existing implementation pattern:
- BuffManager uses IEffect with duration
- StatusEffect class shows the pattern
- Follow the same approach for conditions
- See Tests/Effects/BuffTests.cs for test patterns
Solution: Always start conversation with:
I'm working on OpenCombatEngine.
CRITICAL: Follow all conventions in project-context.md exactly.
[Then describe your task]
Solution: Be explicit about file locations:
Create the interface in: src/OpenCombatEngine.Core/Interfaces/Combat/IInitiative.cs
Create the tests in: tests/OpenCombatEngine.Core.Tests/Combat/InitiativeTests.cs
Create the implementation in: src/OpenCombatEngine.Implementation/Combat/StandardInitiative.cs
Solution: Prompt for specific test categories:
Generate tests for these categories:
1. Happy path (normal usage)
2. Boundary conditions (min/max values)
3. Invalid inputs (null, negative, out of range)
4. Edge cases specific to D&D rules
- Test it thoroughly
- Document it in
.ai/code-examples.md - Submit PR with rationale
Share it! Add to .ai/effective-prompts.md
Place in .ai/ directory and document its purpose
- Best For: Full implementation of entire features
- Tip: Let it read all context files at project open
- Strength: Maintains context across entire session
- Best For: Rapid iteration on specific files
- Tip: Use comments to guide generation
- Strength: Excellent at following patterns in current file
- Best For: Architecture discussions and design
- Tip: Attach project-context.md to every conversation
- Strength: Understands complex requirements
- Best For: Line-by-line code completion
- Tip: Write descriptive comments first
- Strength: Follows existing patterns in file
- Best For: Explaining complex algorithms
- Tip: Provide explicit context about project standards
- Strength: Good at generating comprehensive tests
Instead of: "Add a method to ICreature" Do: "Add these related methods to ICreature: Attack(), Defend(), TakeDamage()"
Instead of: "Follow project patterns" Do: "Follow the pattern used in BuffManager.ApplyBuff()"
Instead of: "Implement like other managers" Do: "Implement like SpellManager.cs lines 45-67"
When generating content-related code:
- ✅ Use SRD terms only
- ✅ Generic names (not "Beholder", use "ManyEyedCreature")
- ✅ Mechanical effects only (no flavor text)
- ✅ Let users import their own content
- ❌ Never generate copyrighted descriptions
- ❌ Never use "D&D" or "Dungeons & Dragons"
- Check Context Files: Answer might be in
.ai/directory - Read Tests: Tests often explain intended behavior
- Look at Examples:
examples/directory has working code - Ask in Issues: Tag with
ai-developmentlabel
- Trust the AI but Verify: AI can make mistakes, always review
- Tests Don't Lie: If tests pass, the code is probably correct
- Context Prevents Bugs: Good context = fewer iterations
- Share Your Learnings: Help others with your discoveries
Remember: The goal is to make AI-assisted development so smooth that it feels like the AI is a team member who's been on the project since day one!