agentleFS
NVIDIAKnown publisherNVIDIA/elements/.agents/skills/authoring-patterns/SKILL.md

authoring-patterns

Skill115 starsChanged 55 days agoApache-2.0View on GitHub

Convert validated playground templates or HTML compositions into reusable pattern files (*.examples.ts) in the pattern library. Use this skill whenever the user wants to save, persist, store, or catalog a template, prototype, composition, or playground result as a reusable pattern. Trigger on phrases like "save as pattern," "create pattern," "add to pattern library," "persist this template," "convert to examples.ts," or when the user has validated HTML and wants it stored in projects/internals/patterns/src/.

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. About 0 are common, 14 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check for a recently validated HTML template from a playground workflow

    line 31
  2. Distinctive:

    Check for HTML the user has pasted or referenced

    line 32
  3. Distinctive:

    If no template exists, ask the user to provide the HTML they want to save

    line 33
  4. Distinctive:

    Ensure the template is valid before proceeding.

    line 37
  5. Very specific:

    Call api_validate with { template, lang: 'html', format: 'json' }

    line 39
  6. Distinctive:

    If validation returns errors, report them to the user and fix each issue

    line 40
  7. Distinctive:

    Do NOT proceed to Phase 3 until validation passes

    line 42
  8. Distinctive:

    Use the MCP tool to derive correct ESM import statements.

    line 46
  9. Very specific:

    Call api_imports_get with the template HTML

    line 48
  10. Very specific:

    Always prepend import { html } from 'lit'.

    line 50
  11. Very specific:

    Avoid component names in the title (use LoginForm not InputPasswordLoginForm)

    line 60
  12. Distinctive:

    Should reflect the pattern's theme or category

    line 65
  13. Very specific:

    Must use format 'Patterns/<Category>'

    line 69
  14. Distinctive:

    Check existing categories before creating new ones:

    line 70
  15. Distinctive:

    If an existing file matches the template's theme, add the new export to that file

    line 88
  16. Distinctive:

    Only create a new file when no existing category fits

    line 89
  17. Distinctive:

    When appropriate, reference NVIDIA or NVIDIA Autonomous Vehicle program for UX use cases

    line 103
  18. Very specific:

    If the template contains <script> tags: use the render() method form

    line 124
  19. Very specific:

    If the template uses only declarative HTML: use the render arrow-function form

    line 125
  20. Distinctive:

    Read the existing file

    line 175
  21. Distinctive:

    Do NOT change existing exports or the default export

    line 178
  22. Very specific:

    Write the file to projects/internals/patterns/src/<file-name>.examples.ts

    line 182

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

Authoring Patterns

Persist a validated HTML template as a reusable pattern file in the Elements pattern library at projects/internals/patterns/src/.

When to Use This Skill

  • User wants to save a playground template as a reusable pattern
  • User asks to persist, save, or store a composition in the codebase
  • User wants to create a new pattern file from HTML
  • User says "save as pattern," "create pattern," or "add to pattern library"
  • User has a validated playground prototype and wants it cataloged

Must Read Files

You MUST review these files before proceeding:

  • Examples Guidelines -- authoritative rules for naming, @summary, and structure
  • Scan projects/internals/patterns/src/*.examples.ts to understand existing patterns and categories

Workflow

Phase 1: Locate Template

Find the validated HTML template to persist. Look for it in the conversation context:

  1. Check for a recently validated HTML template from a playground workflow
  2. Check for HTML the user has pasted or referenced
  3. If no template exists, ask the user to provide the HTML they want to save

Phase 2: Check Validity

Ensure the template is valid before proceeding.

  1. Call api_validate with { template, lang: 'html', format: 'json' }
  2. If validation returns errors, report them to the user and fix each issue
  3. Re-validate until ok is true and summary.errors is 0
  4. Do NOT proceed to Phase 3 until validation passes

Phase 3: Generate Imports

Use the MCP tool to derive correct ESM import statements.

  1. Call api_imports_get with the template HTML
  2. The tool returns the required @nvidia-elements/core/*/define.js imports
  3. Always prepend import { html } from 'lit'; as the first import -- the tool does not include it

Phase 4: Determine Metadata

Analyze the template and determine where and how to file it.

Export name:

  • PascalCase, 1-3 words (per examples.md guidelines)
  • Describes WHAT the pattern shows, not HOW it works
  • Avoid component names in the title (use LoginForm not InputPasswordLoginForm)

Filename:

  • kebab-case with .examples.ts suffix
  • Should reflect the pattern's theme or category

Category (default export title):

  • Must use format 'Patterns/<Category>'
  • Check existing categories before creating new ones:
CategoryFileDescription
Authenticationauthentication.examples.tsLogin forms, access states
Dashboarddashboard.examples.tsMonitoring dashboards, KPI views
Examplesbrowse.examples.ts, panel.examples.ts, subheader.examples.ts, editor.examples.tsGeneral compositions and layout patterns
Feedbackempty-states.examples.tsEmpty states, error states, offline
Heatmapheatmap.examples.tsData visualization grids
Keyboard Shortcutskeyboard-shortcuts.examples.tsKeyboard shortcut displays
Logginglogging.examples.tsLog viewers and log-related UI
Mediamedia.examples.tsMedia players, image galleries
Responsiveresponsive.examples.tsResponsive layout patterns
Searchsearch.examples.tsSearch interfaces
Trendtrend.examples.tsTrend charts and metrics

Add-to-existing vs. create-new:

  • If an existing file matches the template's theme, add the new export to that file
  • Only create a new file when no existing category fits
  • Present the decision to the user for confirmation

Phase 5: Write @summary

Compose a UX-focused JSDoc @summary for the pattern.

Rules:

  • Max 400 characters
  • One or two concise sentences
  • Explain WHAT the pattern demonstrates, WHY the pattern helps, WHEN to use it, and HOW it improves UX
  • Always include @tags pattern
  • Derive design intent from template analysis: layout type, interaction pattern, use case, domain context
  • When appropriate, reference NVIDIA or NVIDIA Autonomous Vehicle program for UX use cases

Good examples:

@summary Login form with email and password fields with credential validation. Use for authentication entry points where real-time feedback guides users through sign-in requirements.
@summary Data grid empty state with retry action. Use when requested data is not found and a retry action is available.
@summary Horizontal list item card with thumbnail, title, description, and icon button actions for browsable content lists.

Avoid:

  • Restating what is obvious from the code (@summary A card with a button)
  • Vague descriptions (@summary Example pattern)

Phase 6: Assemble

Build the TypeScript file content.

Determine render style:

  • If the template contains <script> tags: use the render() method form
  • If the template uses only declarative HTML: use the render arrow-function form

New file template:

import { html } from 'lit';
// ... generated imports from Phase 3

export default {
  title: 'Patterns/<Category>',
  component: 'nve-patterns'
};

/**
 * @summary <UX-focused description from Phase 5>
 * @tags pattern
 */
export const ExportName = {
  render: () => html`
    <!-- template HTML -->
  `
};

New file template (with <script> tags):

import { html } from 'lit';
// ... generated imports from Phase 3

export default {
  title: 'Patterns/<Category>',
  component: 'nve-patterns'
};

/**
 * @summary <UX-focused description from Phase 5>
 * @tags pattern
 */
export const ExportName = {
  render() {
    return html`
    <!-- template HTML with <script> tags -->
    `
  }
};

Adding to an existing file:

  1. Read the existing file
  2. Merge imports -- add any new @nvidia-elements/core/*/define.js imports that are not already present, maintaining alphabetical order
  3. Append the new named export at the end of the file
  4. Do NOT change existing exports or the default export

Phase 7: Write and Verify

  1. Write the file to projects/internals/patterns/src/<file-name>.examples.ts
  2. Confirm to the user with:
    • Path
    • Export name
    • Category
    • Components used (list of nve-* tags)
    • The @summary content

References

  • Examples Guidelines -- naming, summary, structure rules
  • Authoring Guidelines -- HTML authoring rules for nve-* components
  • Existing patterns: projects/internals/patterns/src/*.examples.ts

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.