Skip to content

Commit 7fb1352

Browse files
committed
feat: Add Bogus skill and usage patterns documentation for generating realistic test data in .NET projects
1 parent 49faf8f commit 7fb1352

7 files changed

Lines changed: 146 additions & 27 deletions

File tree

.github/skills/bogus/SKILL.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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.**
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Bogus API Quick Reference
2+
3+
## Installation
4+
- NuGet: `Install-Package Bogus`
5+
- Add to .csproj:
6+
```xml
7+
<ItemGroup>
8+
<PackageReference Include="Bogus" Version="*" />
9+
</ItemGroup>
10+
```
11+
12+
## Basic Usage
13+
```csharp
14+
using Bogus;
15+
16+
var faker = new Faker<Person>()
17+
.RuleFor(p => p.Name, f => f.Name.FullName())
18+
.RuleFor(p => p.Email, f => f.Internet.Email());
19+
20+
var person = faker.Generate();
21+
```
22+
23+
## Faker Facade
24+
```csharp
25+
var faker = new Bogus.Faker("en");
26+
var order = new Order {
27+
OrderId = faker.Random.Number(1, 100),
28+
Item = faker.Lorem.Sentence(),
29+
Quantity = faker.Random.Number(1, 10)
30+
};
31+
```
32+
33+
## DataSets Directly
34+
```csharp
35+
var random = new Randomizer();
36+
var lorem = new Lorem("en");
37+
var order = new Order {
38+
OrderId = random.Number(1, 100),
39+
Item = lorem.Sentence(),
40+
Quantity = random.Number(1, 10)
41+
};
42+
```
43+
44+
## Locales
45+
```csharp
46+
var lorem = new Lorem(locale: "ko");
47+
Console.WriteLine(lorem.Sentence(5));
48+
```
49+
50+
## Analyzer Setup
51+
```xml
52+
<ItemGroup>
53+
<PackageReference Include="Bogus.Tools.Analyzer" Version="*" PrivateAssets="All"/>
54+
</ItemGroup>
55+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Bogus Usage Patterns in BookStore
2+
3+
## Project Patterns
4+
- **Always use Bogus for test data generation in tests** (see tests/AGENTS.md, integration-testing-guide.md)
5+
- **No hand-rolled random data**: All random/fake data in tests must use Bogus
6+
- **Centralize generators**: Use shared helpers (e.g., FakeDataGenerators.cs) to avoid duplication
7+
- **Unique data per test**: Use Bogus to ensure no test data conflicts
8+
- **Locale support**: Use appropriate locale for multilingual data
9+
- **No hardcoded test data**: All test data should be generated
10+
11+
## Example: Centralized Generator
12+
```csharp
13+
public static CreateBookRequest GenerateFakeBookRequest() => new()
14+
{
15+
Id = Guid.CreateVersion7(),
16+
Title = _faker.Commerce.ProductName(),
17+
Isbn = _faker.Commerce.Ean13(),
18+
Language = "en",
19+
Translations = new Dictionary<string, BookTranslationDto>
20+
{
21+
["en"] = new(_faker.Lorem.Paragraph()),
22+
["es"] = new(_faker.Lorem.Paragraph())
23+
},
24+
PublicationDate = new PartialDate(
25+
_faker.Date.Past(10).Year,
26+
_faker.Random.Int(1, 12),
27+
_faker.Random.Int(1, 28)),
28+
Prices = new Dictionary<string, decimal> { ["USD"] = decimal.Parse(_faker.Commerce.Price(10, 100)) }
29+
};
30+
```
31+
32+
## See also
33+
- tests/BookStore.AppHost.Tests/Helpers/FakeDataGenerators.cs
34+
- docs/guides/integration-testing-guide.md

.github/skills/copilot-skill-creator/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Check available MCPs - if useful for research (searching docs, finding similar s
6464
Based on the user interview, fill in these components:
6565

6666
- **name**: Skill identifier
67-
- **description**: When to trigger, what it does. This is the primary triggering mechanism - include both what the skill does AND specific contexts for when to use it. All "when to use" info goes here, not in the body. Note: AI assistants have a tendency to "undertrigger" skills -- to not use them when they'd be useful. To combat this, please make the skill descriptions a little bit "pushy". So for instance, instead of "How to build a simple fast dashboard to display internal company data.", you might write "How to build a simple fast dashboard to display internal company data. Make sure to use this skill whenever the user mentions dashboards, data visualization, internal metrics, or wants to display any kind of company data, even if they don't explicitly ask for a 'dashboard.'"
67+
- **description**: When to trigger, what it does. This is the primary triggering mechanism - include both what the skill does AND specific contexts for when to use it. All "when to use" info goes here, not in the body. Note: AI assistants have a tendency to "undertrigger" skills -- to not use them when they'd be useful. To combat this, please make the skill descriptions a little bit "pushy". So for instance, instead of "How to build a simple fast dashboard to display internal company data.", you might write "How to build a simple fast dashboard to display internal company data. Make sure to use this skill whenever the user mentions dashboards, data visualization, internal metrics, or wants to display any kind of company data, even if they don't explicitly ask for a 'dashboard.'" All skill descriptions are included in the context and should be written as a single line to minimize token usage.
6868
- **compatibility**: Required tools, dependencies (optional, rarely needed)
6969
- **the rest of the skill :)**
7070

.github/skills/etag/SKILL.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
---
22
name: etag
3-
description: |
4-
Use this skill for any request involving HTTP ETags, conditional requests, or optimistic concurrency in REST APIs. Trigger for:
5-
- Implementing or explaining ETag headers
6-
- Preventing lost updates ("mid-air collisions")
7-
- Designing cache validation or conditional GET/PUT/DELETE
8-
- Explaining If-Match, If-None-Match, 304 Not Modified, or 412 Precondition Failed
9-
- Any .NET, web, or REST API project where resource versioning or concurrency is needed
10-
Always use this skill when the user mentions ETag, If-Match, If-None-Match, conditional requests, or optimistic concurrency—even if not named explicitly.
3+
description: Use this skill for any request involving HTTP ETags, conditional requests, or optimistic concurrency in REST APIs: implementing/explaining ETag headers, preventing lost updates, designing cache validation or conditional GET/PUT/DELETE, explaining If-Match, If-None-Match, 304 Not Modified, or 412 Precondition Failed, or any .NET/web/REST API project where resource versioning or concurrency is needed; always use when ETag, If-Match, If-None-Match, conditional requests, or optimistic concurrency are mentioned.
114
---
125

136
# ETag Skill

.github/skills/tunit/SKILL.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
---
22
name: tunit
3-
description: >
4-
Write, review, and fix TUnit tests in .NET projects. Use this skill whenever
5-
you're writing a new test class, adding assertions, creating data-driven tests,
6-
setting up test lifecycle hooks, or debugging why a test compiles but behaves
7-
unexpectedly. Also triggers for: migrating from xUnit/NUnit to TUnit, choosing
8-
the right assertion, using Bogus for test data, wiring up NSubstitute mocks,
9-
writing integration tests, or any question about parallelism and test ordering.
10-
Prefer this skill over guessing — TUnit's async-first API has several
11-
non-obvious patterns that differ from xUnit/NUnit.
3+
description: Use this skill to write, review, and fix TUnit tests in .NET projects: for new test classes, assertions, data-driven tests, lifecycle hooks, debugging, migrating from xUnit/NUnit, choosing assertions, using Bogus, NSubstitute mocks, integration tests, or questions about parallelism and test ordering; prefer this skill over guessing, as TUnit's async-first API has non-obvious patterns differing from xUnit/NUnit.
124
---
135

146
# TUnit Testing Skill

.github/skills/wolverine/SKILL.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
---
22
name: wolverine
33
description: |
4-
Use this skill for any request involving Wolverine — the .NET command/handler and messaging framework. Trigger for:
5-
- Implementing, updating, or testing command/handler patterns
6-
- Message bus, async messaging, or background jobs
7-
- Transaction management, optimistic concurrency (e.g., ETags), or handler conventions
8-
- Migrating endpoints to Wolverine, troubleshooting handler discovery, or integrating with Marten
9-
- Any .NET project using WolverineFx libraries (project-agnostic)
10-
Always use this skill when the user mentions Wolverine, mediator, message bus, async jobs, or handler patterns — even if not named explicitly.
11-
12-
Note: ETags and optimistic concurrency are recommended best practices for update/delete operations, but are not required by Wolverine itself.
4+
Use for any request involving Wolverine (.NET command/handler, messaging, async jobs, handler patterns, Marten integration, or optimistic concurrency); always trigger for Wolverine, mediator, message bus, or handler patterns.
135
---
146

157
# Wolverine Skill

0 commit comments

Comments
 (0)