Skip to content
Skills Library
Programming · Building & coding

components-version-badge

/components-version-badge

Version badge with build-info tooltip (version, commit, changelog). Use when adding version display to app header/footer for Next.js, Nuxt, SvelteKit, Vite, React, Vue, or Svelte.

Licence
MIT
Last repository change
24.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Version badge with build-info tooltip (version, commit, changelog). Use when adding version display to app header/footer for Next.js, Nuxt, SvelteKit, Vite, React, Vue, or Svelte.

Arguments

/components-version-badge [--check-only] [--location <header|footer|custom>]
Original author description

Version badge with build-info tooltip (version, commit, changelog). Use when adding version display to app header/footer for Next.js, Nuxt, SvelteKit, Vite, React, Vue, or Svelte.

How it works

  1. When to Use This Skill
  2. Context
  3. Parameters
  4. Overview
  5. Tech Stack Detection
  6. Execution
  7. Component Variants
  8. Build Script Template
  9. Flags
  10. Examples
Original SKILL.md headings · 271 lines, 1,077 words
SKILL.md preview
---
created: 2025-02-03
modified: 2026-06-18
reviewed: 2026-04-25
description: Version badge with build-info tooltip (version, commit, changelog). Use when adding version display to app header/footer for Next.js, Nuxt, SvelteKit, Vite, React, Vue, or Svelte.
allowed-tools: Glob, Grep, Read, Write, Edit, Bash, AskUserQuestion, TodoWrite
args: "[--check-only] [--location <header|footer|custom>]"
argument-hint: "[--check-only] [--location <header|footer|custom>]"
name: components-version-badge
---

# /components:version-badge

Implement a version badge component that displays version number, git commit, and recent changelog in a tooltip.

## When to Use This Skill

| Use this skill when... | Use version-badge-pattern instead when... |
|---|---|
| Adding a version badge end-to-end to an existing app via slash command | Studying the pattern, data flow, and accessibility checklist before adapting it manually |
| You want auto-detection of framework, styling, and UI library with file edits applied | You need full reference implementations for React, Vue 3, Svelte, or plain CSS variants |
| Implementing the default header placement with `--check-only` / `--location` flags | Composing the changelog-parser script and build-pipeline wiring into a custom workflow |

## Context

- Framework config: !`find . -maxdepth 1 \( -name "next.config.*" -o -name "nuxt.config.*" -o -name "svelte.config.*" -o -name "vite.config.*" \)`
- Package manager: !`find . -maxdepth 1 \( -name "package.json" -o -name "bun.lockb" -o -name "pnpm-lock.yaml" \)`
- Styling: !`find . -maxdepth 1 \( -name "tailwind.config.*" -o -name "postcss.config.*" \)`
- UI library: !`find . -maxdepth 1 -name "components.json"`
- Changelog: !`find . -maxdepth 1 -name \'CHANGELOG.md\'`
- Version: !`find . -path '*/package.json' -maxdepth 2 -exec jq -r '.version // "unknown"' {} +`

## Parameters

- `--check-only`: Analyze project and show what would be implemented without making changes
- `--location <header|footer|custom>`: Specify component placement (default: header)

## Overview

This command adds a version display to your application with:

- **Trigger element**: `v1.43.0 | 004ddd9` (version + abbreviated commit)
- **Tooltip**: Full build info (version, commit, timestamp, branch) + recent changelog entries
- **Build-time processing**: Zero runtime overhead

## Tech Stack Detection

Detect the project's tech stack from the values in [Context](#context):

1. **Framework**:
   - Next.js: `next.config.js` or `next.config.mjs` or `next.config.ts`
   - Nuxt: `nuxt.config.ts` or `nuxt.config.js`
   - SvelteKit: `svelte.config.js`
   - Vite + React: `vite.config.*` + React in dependencies
   - Vite + Vue: `vite.config.*` + Vue in dependencies
   - Create React App: `react-scripts` in dependencies
   - Plain React: React in dependencies without specific framework

2. **Styling**:
   - Tailwind CSS: `tailwind.config.*` or `@tailwind` in CSS
   - CSS Modules: `.module.css` files
   - styled-components: In dependencies
   - Emotion: `@emotion/*` in dependencies
   - Plain CSS: Fallback

3. **UI Library**:
   - shadcn/ui: `components.json` with shadcn config
   - Radix UI: `@radix-ui/*` in dependencies
   - Headless UI: `@headlessui/*` in dependencies
   - None: Use native implementation

## Execution

Execute this version badge implementation workflow:

### Step 1: Analyze project

Read `package.json` to identify dependencies. Check for framework config files, styling configuration, and existing component patterns.

### Step 2: Create changelog parser script

Create a build-time script that parses `CHANGELOG.md`:

**Location**: `scripts/parse-changelog.mjs` (or appropriate location)

```javascript
// Script should:
// 1. Read CHANGELOG.md
// 2. Extract last 2 versions with their changes
// 3. Categorize changes (feat, fix, perf, breaking)
// 4. Output as JSON for NEXT_PUBLIC_CHANGELOG (or equivalent)
```

**Change type icons**:
| Type | Icon | Description |
|------|------|-------------|
| feat | sparkles | New feature |
| fix | bug | Bug fix |
| perf | zap | Performance improvement |
| breaking | warning | Breaking change |

**Limits**:
- Max 3 features per version
- Max 2 other changes per version
- Last 2 versions only

### Step 3: Configure build pipeline

Based on framework, add build-time environment variables:

**Next.js** (`next.config.mjs`):
```javascript
const buildInfo = {
  version: process.env.npm_package_version || 'dev',
  commit: process.env.VERCEL_GIT_COMMIT_SHA || process.env.GITHUB_SHA || 'local',
  branch: process.env.VERCEL_GIT_COMMIT_REF || process.env.GITHUB_REF_NAME || 'local',
  buildTime: new Date().toISOString(),
};

export default {
  env: {
    NEXT_PUBLIC_BUILD_INFO: JSON.stringify(buildInfo),
    // NEXT_PUBLIC_CHANGELOG set by parse-changelog.mjs
  },
};
```

**Vite** (`vite.config.ts`):
```typescript
export default defineConfig({
  define: {
    'import.meta.env.VITE_BUILD_INFO': JSON.stringify(buildInfo),
  },
});
```

### Step 4: Create component

Create the version badge component appropriate for the detected framework:

**Component structure**:
```
src/components/
  version-badge/
    version-badge.tsx     # Main component
    version-badge.css     # Styles (if not using Tailwind)
    index.ts              # Export
```

**Features to implement**:

1. **Trigger display**:
   - Version number from build info
   - Abbreviated commit SHA (7 chars)
   - Subtle styling: `text-[10px] text-muted-foreground/60`
   - Hover brightening for affordance
   - Hidden when no build info (local dev)

2. **Tooltip content**:
   - Build Information section with table layout
   - Recent Changes section with categorized items
   - Proper keyboard accessibility

3. **Accessibility**:
   - Focusable button trigger
   - `aria-label` with version info
   - Focus ring styling
   - Both hover and focus trigger tooltip
   - Screen reader friendly content

### Step 5: Integrate component

Add the component to the appropriate location:

**Common locations**:
- Header/navbar (most common)
- Footer
- Settings page
- About modal

**Default**: Place below the main title in header, for both desktop and mobile nav.

## Component Variants

### React + Tailwind + shadcn/ui

Uses Tooltip from shadcn/ui, cn utility for class merging.

### React + Tailwind (no UI library)

Native implementation with Radix Tooltip or custom tooltip.

### Vue 3 + Tailwind

Vue component with Teleport for tooltip positioning.

### Svelte + Tailwind

Svelte component with actions for tooltip behavior.

### Plain CSS

Generates CSS with custom properties for theming.

## Build Script Template

```javascript
#!/usr/bin/env node
/**
 * parse-changelog.mjs
 * Parses CHANGELOG.md and outputs JSON for the version badge tooltip
 */

import { readFileSync, existsSync } from 'fs';

const CHANGELOG_PATH = './CHANGELOG.md';
const MAX_VERSIONS = 2;
const MAX_FEATURES_PER_VERSION = 3;
const MAX_OTHER_PER_VERSION = 2;

function parseChangelog() {
  if (!existsSync(CHANGELOG_PATH)) {
    return JSON.stringify([]);
  }

  const content = readFileSync(CHANGELOG_PATH, 'utf-8');
  const versions = [];

  // Parse version headers and their changes
  const versionRegex = /^## \[?(\d+\.\d+\.\d+)\]?/gm;
  const changeRegex = /^\* \*\*(\w+):\*\* (.+)$/gm;

  // ... parsing logic ...

  return JSON.stringify(versions.slice(0, MAX_VERSIONS));
}

// Output for environment variable
console.log(parseChangelog());
```

## Flags

| Flag | Description |
|------|-------------|
| `--check-only` | Analyze project and show what would be implemented |
| `--location <loc>` | Specify component placement (header, footer, custom) |

## Examples

```bash
# Implement version badge with auto-detection
/components:version-badge

# Check what would be implemented without changes
/components:version-badge --check-only

# Place in footer instead of header
/components:version-badge --location footer
```

## Post-Implementation

After implementing:

1. **Verify build**: Run build command to ensure env vars are set
2. **Test tooltip**: Check hover and keyboard accessibility
3. **Update CI**: Ensure changelog is available during build
4. **Document**: Add note to README about version display feature

## Error Handling

- **No package.json**: Warn and ask for framework specification
- **Unknown framework**: Offer generic implementation or ask user
- **No CHANGELOG.md**: Component works without changelog, shows only build info
- **Existing component**: Ask before overwriting, offer merge strategy

## See Also

- `version-badge-pattern` skill - Detailed pattern documentation

Versions

The database has no other skills named components-version-badge.

Database snapshot: 13.11.2026 · package version 0ac9829cad10 (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

  • 100version-badge-pattern
    Version badge UI showing build version, git commit, and changelog in a tooltip. Use when adding version visibility for support or debugging. Works with React, Vue, Svelte, and JS.
  • 100framework-to-capacitor
    Configures a web framework build so Capacitor can ship it as an iOS/Android app. Use for Next.js static export (output 'export', out/), Nuxt 4 (ssr false, nuxt generate, .output/public), Angular (dist/<project>/browser), SvelteKit adapter-static (SvelteKit 2 svelte.config.js or…
  • 100framework-to-capacitor
    Configures a web framework build so Capacitor can ship it as an iOS/Android app. Use for Next.js static export (output 'export', out/), Nuxt 4 (ssr false, nuxt generate, .output/public), Angular (dist/<project>/browser), SvelteKit adapter-static (SvelteKit 2 svelte.config.js or…
  • 90svelte
    Svelte 5 and SvelteKit development standards and best practices for component-based user interfaces and full-stack applications Triggers on: **/*.svelte, **/*.ts, **/*.js, **/*.css, **/*.scss, **/*.json
  • 100sveltekit
    SvelteKit full-stack Svelte framework. Covers routing, load functions, form actions, and server-side rendering. Use when building SvelteKit applications. USE WHEN: user mentions "SvelteKit", "Svelte Kit", asks about "+page.svelte", "load functions", "form actions in SvelteKit",…
  • 90vue-nuxt
    Build and upgrade Vue or Nuxt applications with reactive state, server rendering and typed data boundaries. Use when implementing Vue components, composables or Nuxt routes; distinguish client-only Vue from Nuxt server/runtime features.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.