agentleFS
idavidov13idavidov13/agentic-playwright/.agents/skills/helpers/SKILL.md

helpers

Skill268 starsChanged 11 days agoMITView on GitHub

Use when adding a reusable plain function under helpers/**, wiring the auth bootstrap in tests/{area}/*.setup.ts, or deciding whether reusable code is a helper or a fixture. Not for fixtures with a setup/use/teardown lifecycle (see `fixtures`) or the helper-fixture promotion threshold (see `api-testing`).

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 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.

  • 3

    Very specific

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

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

    Every exported helper has an explicit return type, typed parameters and a JSDoc block with @param and @returns.

    line 12
  2. Very specific:

    Write the function with its signature and JSDoc, sources per Critical.

    line 31
  3. Very specific:

    Call it from the setup spec, a test, a hook or a fixture.

    line 32

≈ “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

Helpers

Critical

  • A helper is a plain exported function with no Playwright lifecycle: no base.extend, no use(). Code that must run before and after each test is a fixture (fixtures).
  • App-specific helpers live in helpers/{area}/, generic utilities in helpers/util/; extend the existing file of the same domain before creating one, never a new top-level folder.
  • Every exported helper has an explicit return type, typed parameters and a JSDoc block with @param and @returns; names are camelCase verbs (createAppStorageState, formatDate).

    // CORRECT
    export function formatDate(value: number | string): string {
        return new Date(value).toLocaleDateString('en-US');
    }
    // WRONG
    export const formatDate = (value) => new Date(value).toLocaleDateString();
  • URLs, credentials and tokens come from process.env.* (config); endpoint and storage-state paths from enums/{area}/* (enums); never a literal.
  • A helper that calls the API takes apiRequest as a parameter and asserts the body with expect(SchemaName.parse(body)).toBeTruthy(); (api-testing).
  • process.env is written only by the auth bootstrap in helpers/{area}/createStorageState.ts; every other helper returns its result through its signature.

Procedure

  1. Classify: no lifecycle → helper; setup → use() → teardown → fixtures; locators and interactions on a page → page-objects; one API call in one test → apiRequest inline; happy-path data → data-strategy. ls helpers/ resolves {area}.
  2. Pick the file: helpers/{area}/<domain>.ts for app logic, helpers/util/util.ts for a generic utility.
  3. Write the function with its signature and JSDoc, sources per Critical; auth work follows references/auth-bootstrap.md.
  4. Call it from the setup spec, a test, a hook or a fixture; run npx tsc --noEmit, npm run lint and the consuming tests.

References

  • references/auth-bootstrap.md: open when touching tests/{area}/*.setup.ts or the token and storage-state chain, or when process.env.ACCESS_TOKEN is undefined in a test.

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.