-
Notifications
You must be signed in to change notification settings - Fork 0
AI Documentation Maintenance
This document provides guidance for maintainers on keeping the AI-focused documentation up-to-date as new features are added to FunctionalStateMachine.
-
.copilot-instructions.md- Comprehensive guide for AI assistants in the repository -
AI-USAGE-GUIDE.md- Condensed quick-start guide included in NuGet packages
Update the AI documentation files when:
- ✅ Adding a new feature or capability
- ✅ Changing existing API behavior
- ✅ Adding new builder methods or patterns
- ✅ Deprecating features
- ✅ Adding new packages
- ✅ Changing recommended patterns or best practices
- ✅ Fixing common pitfalls or issues
When adding a new feature:
-
Update Feature Documentation First
- Create or update the relevant file in
/docs - Add entry to
/docs/index.md - Update examples in
/samplesif applicable
- Create or update the relevant file in
-
Update
.copilot-instructions.md- Add new pattern to "Common Patterns" section if it's a major feature
- Update "Key Builder Methods" table if adding new builder methods
- Add to "Execute Function Signatures" or "ModifyData Function Signatures" if adding new overloads
- Update "Quick Reference: File Structure" if it affects project structure
- Add to "Common Mistakes to Avoid" if there are common pitfalls
- Update "Version Information" section to list the new feature
-
Update
AI-USAGE-GUIDE.md- Add to "Key Patterns" section if it's a commonly-used feature
- Update "Complete Example" if it demonstrates a fundamental pattern
- Add to "Common Pitfalls" table if applicable
- Update "When Updating for New Features" section if there are migration considerations
-
Update
README.md- Add feature to appropriate section with example
- Link to detailed documentation
- Update feature list if it's a major addition
When modifying existing APIs:
- Update all examples that use the changed API
- Update pattern descriptions in both AI documentation files
- Add deprecation notes if deprecating old patterns
- Update "Common Mistakes" if the change prevents a common error
When making breaking changes:
- Update CHANGELOG.md with clear migration instructions
- Add migration notes to both AI documentation files
- Update all examples to use new patterns
- Consider adding a "Migration Guide" section if the change is significant
This file should maintain these sections in order:
- Overview - Brief description of the library
- Package Installation - How to install
- Core Type Pattern - The fundamental type system
- Fluent Builder Pattern - How to build state machines
- Common Patterns - Numbered patterns for frequent use cases
- Command Dispatching - Optional package usage
- Testing State Machines - How to test
- Common Mistakes to Avoid - Anti-patterns
- Data Access Patterns - Function signatures
- Validation and Analysis - Build-time checks
- Diagram Generation - Optional tooling
- When to Use This Library - Use cases
- Quick Reference: File Structure - Project organization
- Version Information - Feature list
- Further Documentation - Links
- Quick Troubleshooting - Common issues
- Summary Checklist - Implementation steps
This file should maintain these sections in order:
- Package - Quick install command
- Essential Type Pattern - Core type definitions
- Builder Pattern - Basic building example
- Execution - How to fire and execute
- Key Patterns - Most common patterns only
- Critical Rules - Do's and don'ts
- Command Dispatching - Optional package
- Execute Function Signatures - Available overloads
- ModifyData Function Signatures - Available overloads
- Common Pitfalls - Table format
- Complete Example - End-to-end example
- Documentation - Links to more info
- Version Detection - How to check versions
- When Updating for New Features - Change process
- ✅ Use imperative mood: "Add trigger type" not "You should add trigger type"
- ✅ Provide concrete examples for every pattern
- ✅ Include type signatures and parameter names
- ✅ Show both simple and complex variants
- ✅ Use consistent naming in examples (MyState, MyTrigger, MyData, MyCommand)
- ✅ Explain why a pattern exists, not just how to use it
- ✅ Include anti-patterns with ❌ markers
- ✅ Include best practices with ✅ markers
- ✅ Use code blocks with
csharplanguage identifier - ✅ Keep examples self-contained and copyable
When documenting a pattern:
- Title - Clear, descriptive name
- Example - Working code snippet
- Explanation - Key behaviors or notes in bold
- Use case - When to apply this pattern
Example:
### Pattern N: Pattern Name
[code example]
**Key behavior description.** Additional context.Before committing AI documentation updates:
- Build solution successfully:
dotnet build - All code examples are syntactically correct
- All internal links work (e.g., to /docs files)
- Examples use consistent naming conventions
- New features are mentioned in both AI documentation files
- CHANGELOG.md is updated with the feature
- Feature documentation exists in
/docs - Version Information section lists the new feature
To validate that AI documentation is effective:
-
Use with an AI Assistant
- Share the documentation with an AI coding assistant
- Ask it to create a state machine using a new feature
- Verify it follows the documented patterns correctly
-
Check Examples
- Copy examples into a test project
- Verify they compile without errors
- Run examples to ensure they work as described
-
Review Coverage
- Compare feature list in documentation with actual features in code
- Ensure all public APIs are documented
- Verify all patterns in
/docsare reflected in AI docs
Let's say you're adding a new feature called "Parallel Transitions" that allows multiple state changes at once:
Create /docs/Parallel-Transitions.md:
# Parallel Transitions
Parallel transitions allow a state to transition to multiple target states simultaneously...
[Full documentation with examples]Update /docs/index.md:
- [Parallel transitions](Parallel-Transitions)Add to "Key Builder Methods" table:
| `.ParallelTransitionTo(states)` | Multiple target states | Inside `.On<>()` |Add to "Common Patterns":
### Pattern N: Parallel Transitions
[code example with explanation]Add to "Version Information":
- Parallel transitionsAdd to "Key Patterns":
### Parallel Transitions
[brief example]Add section with example and link to docs.
Add entry under unreleased or current version.
dotnet build
dotnet pack
# Test with AI assistantEnsure AI assistants can find the documentation:
- Reference in README.md - Main entry point should link to AI docs
- Include in Packages - AI-USAGE-GUIDE.md in NuGet package via Directory.Build.props
-
Repository Root - Keep
.copilot-instructions.mdat root for IDE integration - Link from docs/index.md - Make discoverable from main docs
For questions about AI documentation maintenance, open an issue or discussion on GitHub.