authoring-patterns
/authoring-patterns
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/.
- Author
- nvidia ↗
- Repository
- elements ↗
- Licence
- Apache-2.0
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 2
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
- SKILL.md zawiera komentarze HTML (2). Nie widać ich w podglądzie Markdown, a model je czyta.
What it does and when to use it
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/.
Triggers from the description
Original author description
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/.
How it works
- When to Use This Skill
- Must Read Files
- Workflow
- References
SKILL.md preview
---
name: authoring-patterns
description: 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/.
---
# 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](projects/site/src/docs/internal/guidelines/examples.md) -- 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:
| Category | File | Description |
| ------------------ | ---------------------------------------------------------------------------------------- | ---------------------------------------- |
| Authentication | `authentication.examples.ts` | Login forms, access states |
| Dashboard | `dashboard.examples.ts` | Monitoring dashboards, KPI views |
| Examples | `browse.examples.ts`, `panel.examples.ts`, `subheader.examples.ts`, `editor.examples.ts` | General compositions and layout patterns |
| Feedback | `empty-states.examples.ts` | Empty states, error states, offline |
| Heatmap | `heatmap.examples.ts` | Data visualization grids |
| Keyboard Shortcuts | `keyboard-shortcuts.examples.ts` | Keyboard shortcut displays |
| Logging | `logging.examples.ts` | Log viewers and log-related UI |
| Media | `media.examples.ts` | Media players, image galleries |
| Responsive | `responsive.examples.ts` | Responsive layout patterns |
| Search | `search.examples.ts` | Search interfaces |
| Trend | `trend.examples.ts` | Trend 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:**
```typescript
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):**
```typescript
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](projects/site/src/docs/internal/guidelines/examples.md) -- naming, summary, structure rules
- [Authoring Guidelines](projects/internals/tools/src/context/authoring.md) -- HTML authoring rules for `nve-*` components
- Existing patterns: `projects/internals/patterns/src/*.examples.ts`
Versions
The database has no other skills named authoring-patterns.
Database snapshot: 13.11.2026 · package version 9870f2e4e34c (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100write-design-pattern
Write a design pattern catalog entry. Use when the user asks to document a design pattern, add a pattern to the catalog, or after a refactoring session identifies a reusable pattern. - 100code-pattern-extractor
Analyze codebases to identify reusable code patterns, duplications, and implementation patterns for future development. Use when refactoring code, identifying technical debt, finding opportunities for abstraction, or documenting common patterns in a directory or module. Outputs… - 100extract-pattern
Use when the user wants to create templates, extract reusable patterns, document solutions, or build a pattern library from working workflows. - 90playground
Create, implement, or review playground work with format, accessibility, performance, and visual-verification controls. Use when the requested deliverable depends on playground. - 100wp-playground-development
WordPress Playground review and development guidance. Use when reviewing Blueprints, Playground JSON setup flows, `@wp-playground/cli` usage, embedded Playground demos, reproducible bug repros, docs examples, or when user mentions "WordPress Playground", "Blueprint",… - 100playground-examples
This skill should be used when adding, editing, or fixing an example in apps/playground — when a task says "add a playground example", "example fails check:examples", "playgroundExamples.test.ts is failing", "regenerate ambient types", "generate-types", "example thumbnail is…