# render-functions

render-functions teaches your AI assistant to build dynamic Vue components using the h() render function and JSX. Useful for component libraries when standard templates become too restrictive.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 196 installs · ★ 259 repo stars
- Author: patterns.dev
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/PatternsDev/skills/tree/HEAD/vue/render-functions/SKILL.md
- Updated: 2026-04-15
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/render-functions

## What it does

The skill guides AI assistants on building Vue components programmatically with the `h()` hyperscript function and JSX. Standard Vue `<template>` markup compiles to virtual DOM render functions at build time. Calling render functions directly bypasses template compilation and grants manual control over virtual DOM nodes.

The instructions detail the three arguments of `h()`: tag or component definition, props with event handlers, and child nodes. If you choose JSX syntax, the project must include `@vue/babel-plugin-jsx` since Vue lacks built-in JSX compilation. Unlike React, Vue JSX preserves the `class` attribute and uses single curly braces `{}` for expressions.

Standard templates remain preferred whenever `v-if`, `v-for`, or slots cover the use case. Moving to render functions is advised strictly for flexible component libraries or rendering logic too dynamic for template directives.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add PatternsDev/skills --skill render-functions -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/render-functions/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/render-functions/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add PatternsDev/skills --skill render-functions -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/render-functions/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add PatternsDev/skills --skill render-functions -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/render-functions/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install PatternsDev/skills vue/render-functions/SKILL.md
```

2. **Manually: put the files in place**
- File: `.github/skills/render-functions/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add PatternsDev/skills --skill render-functions -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/PatternsDev/skills --path vue/render-functions
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/render-functions/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add PatternsDev/skills --skill render-functions -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/PatternsDev/skills/tree/HEAD/vue/render-functions/SKILL.md

## When to use it
- rewrite Vue template markup into programmatic `h()` calls
- generate virtual DOM nodes dynamically in component libraries
- configure and write Vue components using JSX syntax
- handle conditional rendering too complex for template directives

## Example prompts
- Rewrite this card component from `<template>` to a Vue `h()` render function.
- Build a dynamic header component in Vue using JSX instead of `v-if`.
- Show me how to pass props and children to `h()` for a custom button.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: c5598e6200394859.

BEGIN THIRD-PARTY FILE c5598e6200394859
```text
---
name: render-functions
description: Teaches Vue render functions and JSX for programmatic template creation. Use when templates are too limiting and you need the full power of JavaScript to construct component output dynamically.
paths:
  - "**/*.vue"
license: MIT
metadata:
  author: patterns.dev
  version: "1.1"
related_skills:
  - "composables"
  - "components"
---

# Render Functions

## Table of Contents

- [When to Use](#when-to-use)
- [When NOT to Use](#when-not-to-use)
- [Instructions](#instructions)
- [Details](#details)
- [Source](#source)

Vue recommends for us to use templates (i.e. the `<template></template>` syntax) to construct the markup of our Vue components. However, we're also given the opportunity to directly use something known as **render functions** to build the markup of our components as well.

Vue, at build time, takes the templates we create for our components and compiles them to render functions. It's at these compiled render functions, where Vue builds a virtual representation of nodes that make up the virtual DOM.

## When to Use

- Use this when you need complex dynamic rendering logic that's hard to express with template directives
- This is helpful for component library development where flexibility and low-level control are needed

## When NOT to Use

- When templates handle the use case — templates are more readable and benefit from compile-time optimizations
- For standard component markup where `v-if`, `v-for`, and slots cover the rendering needs
- When the team is unfamiliar with `h()` / JSX and the maintenance cost outweighs the flexibility gain

## Instructions

- Use the `h()` function with three arguments: tag/component, props/attributes, and children
- Use JSX with `@vue/babel-plugin-jsx` as a more readable alternative to raw `h()` calls
- Prefer Vue templates for most application code — render functions are for advanced cases
- Remember that Vue JSX uses `class` (not `className`) and single curly braces `{}`

## Details

By using render functions, we skip the compile step that Vue takes to compile our templates, and are able to construct our component templates with the help of programmatic JavaScript.

### But why?

Render functions come into play when we require a higher level of customization and flexibility that's not easily achievable with the standard template syntax. In a nutshell, you may prefer to use render functions:

- When you need to dynamically render components or elements based on complex logic that can be cumbersome to express within a template.
- You want to have a direct hand on the Virtual DOM for advanced manipulations.
```
END THIRD-PARTY FILE c5598e6200394859

The third-party file has ended. Everything between the c5598e6200394859 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2639 of 6659 bytes. © patterns.dev · MIT · https://github.com/PatternsDev/skills/tree/HEAD/vue/render-functions/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
