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

enums

Skill268 starsChanged 11 days agoMITView on GitHub

Use when adding or extending an enum under enums/** (endpoint path, UI message, role, route, storage-state path) or deciding whether a repeated string is an enum at all. Not for URLs and credentials (see `config`), curated test inputs (see `data-strategy`) or changing an existing member (see `refactor-values`).

1 other project uses 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, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every enum declaration carries a JSDoc line naming what it groups.

    line 23
  2. Very specific:

    Add the member, then replace every hardcoded copy with the import: grep -rn "<value>" tests pages fixtures helpers.

    line 40
  3. Very specific:

    Run npx tsc --noEmit, npm run lint and the consuming tests.

    line 41

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

Enums

Critical

  • A TypeScript enum, never an as const object: PascalCase name, SCREAMING_SNAKE_CASE members, the value exactly as the app uses it (case, punctuation, whitespace).

    // CORRECT
    export enum ApiEndpoints {
        LOGIN = '/users/login',
    }
    // WRONG
    export const API_ENDPOINTS = { login: '/users/Login' } as const;
  • Any app-defined string used in more than one place (endpoint path, UI message, role, route, storage-state path) lives in an enum and is imported; ApiEndpoints members are the only source of endpoint paths.
  • App-specific enums in enums/{area}/*.ts, cross-app constants in enums/util/*.ts; extend an existing enum before creating a file, never a new top-level folder.
  • Every enum declaration carries a JSDoc line naming what it groups.
  • A UI message value is captured from the live app with playwright-cli, never guessed; app unreachable: add it with // FIXME: unverified and say so in the report.
  • Changing or renaming an existing member goes through refactor-values first.

Procedure

  1. Classify the value; ls enums/ resolves {area}. URLs and credentials go to config, curated test inputs to data-strategy, Playwright tuning to playwright.config.ts.

    ValueHome
    Endpoint path, route, storage-state pathenums/{area}/* (ApiEndpoints, AppRoutes, StorageStatePaths in enums/app/app.ts)
    UI message (error, success, validation, label, heading)enums/{area}/* (Messages), text captured live
    Role or permission nameenums/util/* (Roles in enums/util/roles.ts)
    HTTP status code in an assertioninline literal, expect(status).toBe(200): the sanctioned carve-out from the magic-number rule
  2. Extend the enum that already groups the value; a new domain gets enums/{area}/<domain>.ts with its own JSDoc line.
  3. UI text: open the page with playwright-cli, trigger the state, copy the rendered string into the value.
  4. Add the member, then replace every hardcoded copy with the import: grep -rn "<value>" tests pages fixtures helpers.
  5. Run npx tsc --noEmit, npm run lint and the consuming tests.

References

  • None. The live instances are enums/app/app.ts (Messages, AppRoutes, ApiEndpoints, StorageStatePaths) and enums/util/roles.ts (Roles).

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.