|
| 1 | +--- |
| 2 | +name: bogus |
| 3 | +description: Generate realistic fake data for .NET projects using the Bogus library. Use for test data, database seeding, randomized object creation, and prototyping. Always prefer Bogus over hand-rolled random data or hardcoded test values. Trigger for any .NET test, data seeding, or sample data scenario. Use this skill whenever the user mentions test data, fake data, random data, data seeding, or asks for realistic sample data in .NET, even if they don't mention Bogus by name. Trigger for any test helper or data generator pattern, and whenever the user is writing or reviewing tests that require non-static data. Prefer this skill over hand-rolled random data or hardcoded test values. |
| 4 | +--- |
| 5 | + |
| 6 | +# Bogus Skill |
| 7 | + |
| 8 | +This skill enables the AI to generate realistic fake data for .NET projects using the [Bogus](https://github.com/bchavez/Bogus) library. It is project-agnostic and supports C#, F#, and VB.NET. |
| 9 | + |
| 10 | +## Key Patterns |
| 11 | +- **Always use Bogus for test data in tests** (see [usage-patterns.md](references/usage-patterns.md)) |
| 12 | +- **No hand-rolled random data**: All random/fake data in tests must use Bogus |
| 13 | +- **Centralize generators**: Use shared helpers to avoid duplication |
| 14 | +- **Unique data per test**: Use Bogus to ensure no test data conflicts |
| 15 | +- **Locale support**: Use appropriate locale for multilingual data |
| 16 | +- **No hardcoded test data**: All test data should be generated |
| 17 | + |
| 18 | +## Quick Start |
| 19 | +See [bogus-api.md](references/bogus-api.md) for installation and usage. |
| 20 | + |
| 21 | +## Example: Centralized Generator |
| 22 | +```csharp |
| 23 | +public static CreateBookRequest GenerateFakeBookRequest() => new() |
| 24 | +{ |
| 25 | + Id = Guid.CreateVersion7(), |
| 26 | + Title = _faker.Commerce.ProductName(), |
| 27 | + Isbn = _faker.Commerce.Ean13(), |
| 28 | + Language = "en", |
| 29 | + Translations = new Dictionary<string, BookTranslationDto> |
| 30 | + { |
| 31 | + ["en"] = new(_faker.Lorem.Paragraph()), |
| 32 | + ["es"] = new(_faker.Lorem.Paragraph()) |
| 33 | + }, |
| 34 | + PublicationDate = new PartialDate( |
| 35 | + _faker.Date.Past(10).Year, |
| 36 | + _faker.Random.Int(1, 12), |
| 37 | + _faker.Random.Int(1, 28)), |
| 38 | + Prices = new Dictionary<string, decimal> { ["USD"] = decimal.Parse(_faker.Commerce.Price(10, 100)) } |
| 39 | +}; |
| 40 | +``` |
| 41 | + |
| 42 | +## References |
| 43 | +- [usage-patterns.md](references/usage-patterns.md): Project usage patterns and best practices |
| 44 | +- [bogus-api.md](references/bogus-api.md): API quick reference and installation |
| 45 | +- [Bogus GitHub](https://github.com/bchavez/Bogus): Official documentation |
| 46 | + |
| 47 | +## Advanced |
| 48 | +- For extending Bogus, seeding EF Core, or analyzer setup, see [bogus-api.md](references/bogus-api.md) |
| 49 | +- For project-specific conventions, see your project's AGENTS.md or test guides |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +**Keep this skill project-agnostic. Add new reference files for advanced scenarios as needed.** |
0 commit comments