{"slug":"sample-data-2","title":"sample-data","summary":"How the sample data is seeded with Bogus behind the Database:SeedSampleData setting, and how tests get their own fixed data. Use when changing seed data, adding a column that needs sample values, or writing tests that depend on known data.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-27T19:09:12.128274Z","repo":{"url":"https://github.com/LeanMeanCleanApps/CleanGraphQLApi","stars":13,"forks":7,"license":"MIT","updatedAt":"2026-11-25T23:23:22Z"},"bodyHtml":"<hr>\n<h2>name: sample-data\ndescription: How the sample data is seeded with Bogus behind the Database:SeedSampleData setting, and how tests get their own fixed data. Use when changing seed data, adding a column that needs sample values, or writing tests that depend on known data.\nmetadata:\nscope: shared</h2>\n<h1>Sample data</h1>\n<h2>The rule</h2>\n<p>There are two kinds of data, and they never mix.</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Where</th>\n<th>Used by</th>\n<th>Shape</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Sample data</td>\n<td><code>src/Infrastructure/Databases/MovieReviews/Extensions/MovieReviewsDbContextExtensions.cs</code> (<code>AddData</code>)</td>\n<td>Local runs, Docker and the presentation integration tests</td>\n<td>15 authors, 50 movies, 150 reviews from Bogus with a fixed seed</td>\n</tr>\n<tr>\n<td>Test data</td>\n<td><code>tests/Infrastructure.Tests.Integration/Databases/MovieReviews/Extensions/MovieReviewsCollectionData.cs</code> (<code>AddTestData</code>)</td>\n<td>Repository tests</td>\n<td>A handful of hand-written rows named \"One\", \"Two\", \"Three\" so assertions can find them</td>\n</tr>\n</tbody>\n</table>\n<p>Sample data is only added when <code>Database:SeedSampleData</code> is <code>true</code> (on in <code>appsettings.local.json</code> and <code>appsettings.docker.json</code>, off in <code>appsettings.json</code>; Lambda turns it on only in <code>docker-compose.yml</code>) and the database is empty. A deployed copy never starts with fake data.</p>\n<h2>Steps</h2>\n<ol>\n<li>New column on a model? Add a <code>RuleFor</code> to the matching <code>Faker&lt;T&gt;</code> in <code>AddData</code>, and a value to the rows in <code>AddTestData</code> if tests need it.</li>\n<li>Movie titles and review text come from the <code>Titles</code> and <code>ReviewTexts</code> lists in <code>AddData</code>. Keep them made up, with no real films, characters or brands, and keep a few titles for common searches such as \"space\" or \"love\".</li>\n<li>Keep the fixed <code>Seed</code> and <code>ReferenceDate</code>. Dates come from <code>f.Date.Past(refDate: ReferenceDate)</code>, never from the clock, so every run gives the same data.</li>\n<li>Tests that need a specific row look it up by its known value (<code>Authors.First(a =&gt; a.FirstName == \"One\")</code>), not by position.</li>\n<li>Presentation integration tests that need a row with children pick one that has them. Bogus spreads reviews at random, so a few movies and authors have none.</li>\n</ol>\n<h2>Don't</h2>\n<ul>\n<li>Seed in a repository constructor or on every request. Seeding happens once, in <code>InitialiseInfrastructure()</code>.</li>\n<li>Turn <code>SeedSampleData</code> on in <code>appsettings.json</code>.</li>\n<li>Use <code>DateTime.Now</code>, <code>Guid.NewGuid()</code> or an unseeded <code>Faker</code> in sample data.</li>\n<li>Assert exact counts of sample data in presentation tests. They depend on the random spread; repository tests use the test data for exact counts.</li>\n</ul>\n<h2>Check</h2>\n<pre><code>dotnet test\n</code></pre>\n","files":[{"path":"SKILL.md","sizeBytes":2463,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-27T19:10:25.043737Z","sha256":"3971EDA3C9355FC7B178F42B83A9AD3E220E72891EA6AE1E88B6D81466CCFACE","sizeBytes":1306},"review":null,"source":{"repositoryUrl":"https://github.com/LeanMeanCleanApps/CleanGraphQLApi","path":".agents/skills/sample-data","license":"MIT","commit":"1168fead2e0c8143a44bdce3344e0ab5fe1db90a","subtreeSha":"70B42CCCC3E7D174113D00D4317EBFB3536D655636CDBB21A4A0454956B20BFF","lastSyncedAt":"2026-11-27T19:09:06.789278Z"},"reviewedAt":"2026-11-27T19:12:56.133541Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/LeanMeanCleanApps/CleanGraphQLApi/tree/main/.agents/skills/sample-data"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install leanmeancleanapps-cleangraphqlapi@llmmart"},{"target":"git","command":"git clone https://github.com/LeanMeanCleanApps/CleanGraphQLApi.git"}]}