Extract version

From maslennikov-ig/claude-code-orchestrator-kit · View interactive version

Extract version is an AI agent skill from the GitHub repository maslennikov-ig/claude-code-orchestrator-kit. Parse and validate semantic version strings from various formats. Use for extracting versions from text, validating semver compliance, or comparing version numbers.

How to use this skill

Skill file

Extract Version

Parse semantic version strings and validate semver compliance.

When to Use

Instructions

Step 1: Receive Version Input

Accept version string in various formats.

Expected Input:

Step 2: Extract Version Pattern

Use regex to extract semver pattern.

Patterns to Match:

Regex:

(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9.-]+))?(?:\+([a-zA-Z0-9.-]+))?

Step 3: Parse Components

Extract major, minor, patch, and optional components.

Components:

Step 4: Validate Semver

Check if version follows semantic versioning 2.0.0 spec.

Validation Rules:

Step 5: Return Parsed Data

Return structured version object.

Expected Output:

{
  "major": 0,
  "minor": 7,
  "patch": 0,
  "prerelease": null,
  "build": null,
  "original": "v0.7.0",
  "normalized": "0.7.0",
  "valid": true,
  "semver": "0.7.0"
}

Error Handling

Examples

Example 1: Basic Version

Input:

versionString: "0.7.0"

Output:

{
  "major": 0,
  "minor": 7,
  "patch": 0,
  "prerelease": null,
  "build": null,
  "original": "0.7.0",
  "normalized": "0.7.0",
  "valid": true,
  "semver": "0.7.0"
}

Example 2: Version with Prefix

Input:

versionString: "v1.2.3"

Output:

{
  "major": 1,
  "minor": 2,
  "patch": 3,
  "prerelease": null,
  "build": null,
  "original": "v1.2.3",
  "normalized": "1.2.3",
  "valid": true,
  "semver": "1.2.3"
}

Example 3: Prerelease Version

Input:

versionString: "2.0.0-beta.1"

Output:

{
  "major": 2,
  "minor": 0,
  "patch": 0,
  "prerelease": "beta.1",
  "build": null,
  "original": "2.0.0-beta.1",
  "normalized": "2.0.0-beta.1",
  "valid": true,
  "semver": "2.0.0-beta.1"
}

Example 4: Full Semver with Build

Input:

versionString: "1.0.0-alpha.1+001"

Output:

{
  "major": 1,
  "minor": 0,
  "patch": 0,
  "prerelease": "alpha.1",
  "build": "001",
  "original": "1.0.0-alpha.1+001",
  "normalized": "1.0.0-alpha.1+001",
  "valid": true,
  "semver": "1.0.0-alpha.1+001"
}

Example 5: Extract from Text

Input:

versionString: "Version: 0.8.0 released on 2025-10-17"

Output:

{
  "major": 0,
  "minor": 8,
  "patch": 0,
  "prerelease": null,
  "build": null,
  "original": "Version: 0.8.0 released on 2025-10-17",
  "normalized": "0.8.0",
  "valid": true,
  "semver": "0.8.0"
}

Example 6: Invalid Version

Input:

versionString: "1.2.a"

Output:

{
  "valid": false,
  "error": "Invalid version format: patch must be numeric",
  "original": "1.2.a"
}

Validation

Supporting Files

None required - pure parsing logic with regex.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.