agentleFS
idavidov13idavidov13/agentic-playwright/.agents/skills/data-strategy/SKILL.md

data-strategy

Skill268 starsChanged 10 days agoMITView on GitHub

Use when creating or extending a data factory, adding a static set of invalid or boundary values, or deciding whether a test value is generated, static, inline or an enum. Not for editing an existing static value (see `refactor-values`) or the loop that consumes a set (see `test-standards`).

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every file under test-data/static/ is .ts exporting as const literal values: never .json, no runtime import, no function, no computed …

    line 10
  2. Very specific:

    Never hardcode test content strings (names, emails, descriptions, product names) in a spec or page object.

    line 19
  3. Very specific:

    Never redefine the universal type-mismatch arrays inline.

    line 28
  4. Very specific:

    Never Faker-generate an app-defined string (error message, label, heading, route).

    line 30
  5. Very specific:

    No magic numbers inline (timeouts, retry counts, limits): suite tuning in playwright.config.ts (config), domain limits in enums/{area}/*, a …

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Data Strategy

Critical

  • Every file under test-data/static/** is .ts exporting as const literal values: never .json, no runtime import, no function, no computed value, no Faker call (the Constitution checks reject anything else).

    // CORRECT
    export const INVALID_EMAILS = ['', 'plaintext', 'missing@domain'] as const;
    // WRONG
    export const INVALID_EMAILS = [faker.internet.email(), buildBadEmail()];
  • Never hardcode test content strings (names, emails, descriptions, product names) in a spec or page object; generate them with a Faker factory from test-data/factories/{area}/.

    // CORRECT
    const product = generateProduct();
    // WRONG
    const product = { name: 'Test Product 1', price: 9.99 };
  • Never redefine the universal type-mismatch arrays inline; import INVALID_STRING_VALUES, INVALID_NUMBER_VALUES, INVALID_BOOLEAN_VALUES, INVALID_UUID_VALUES, INVALID_ENUM_VALUES, INVALID_ARRAY_VALUES and INVALID_OBJECT_VALUES from test-data/static/util/invalid-values.ts.
  • A factory merges overrides over Faker defaults, returns Schema.parse(merged) and carries the Zod-inferred return type; never a cast.
  • Never Faker-generate an app-defined string (error message, label, heading, route); those come from enums/{area}/* (enums).
  • A value used in exactly one assertion stays inline in the test; a static file holds a curated set that a loop iterates.
  • Editing an existing static value or enum member goes through refactor-values first.
  • No magic numbers inline (timeouts, retry counts, limits): suite tuning in playwright.config.ts (config), domain limits in enums/{area}/*, a per-assertion { timeout } only with a comment saying why.

Procedure

  1. Classify the value; ls test-data/static/ and ls test-data/factories/ resolve {area}. App-defined strings go to enums, tuning numbers to config; anything that fits no row: stop and ask.

    ValueHome
    Happy-path dynamic data (names, emails, ids, content)factory in test-data/factories/{area}/<name>.factory.ts
    Universal type-mismatch valuesimport from test-data/static/util/invalid-values.ts
    Curated invalid or boundary set tied to the app's validationtest-data/static/{area}/<name>.ts
    Range violation for one field, used in one specinline array in the spec
  2. Factory: the schema must exist in fixtures/api/schemas/{area}/ (type-safety); write it per references/factories.md.
  3. Static set: pick the tier and the file shape per references/static-data-tiers.md; a set a second spec or field needs moves from inline to test-data/static/{area}/.
  4. Consume: the factory call in the spec, fixture or page-object action; a static export through a for...of loop per test-standards. Run npm run lint and the affected tests.

References

  • references/factories.md: open when creating or extending a factory, pinning fields with overrides, or when Schema.parse throws inside one.
  • references/static-data-tiers.md: open when adding a static set: the three tiers, the two file shapes, promotion from inline, collisions between parallel tests.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.