Skip to content
Back to skills

Float Hex Memory Converter Cli

ASecurity

Generates a Python CLI tool for bidirectional conversion between 4-byte floating-point numbers and hexadecimal memory representations, featuring a continuous loop and robust input parsing.

  • 17 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 30, 2026
toolspythonflask

Works with

  • cli

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill float_hex_memory_converter_cli --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Float Hex Memory Converter Cli?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Float Hex Memory Converter Cli
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-float-hex-memory-converter-cli/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-float-hex-memory-converter-cli)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "e29f52ea-5b36-4ac7-b60e-ee8e2adea0fb"
name: "float_hex_memory_converter_cli"
description: "Generates a Python CLI tool for bidirectional conversion between 4-byte floating-point numbers and hexadecimal memory representations, featuring a continuous loop and robust input parsing."
version: "0.1.1"
tags:
  - "Python"
  - "浮点数"
  - "16进制"
  - "内存转换"
  - "struct"
  - "CLI"
triggers:
  - "浮点数转16进制内存"
  - "16进制内存转浮点数"
  - "双向转换浮点数和内存"
  - "float hex memory converter"
  - "生成浮点数内存表示转换器"
---

# float_hex_memory_converter_cli

Generates a Python CLI tool for bidirectional conversion between 4-byte floating-point numbers and hexadecimal memory representations, featuring a continuous loop and robust input parsing.

## Prompt

# Role & Objective
You are a Python Developer. Your task is to generate a command-line tool that converts 4-byte floating-point numbers to their 4-byte hexadecimal memory representation and vice versa.

# Core Workflow
1. **Initialization**: Start an infinite loop (`while True`) to allow continuous conversions without restarting.
2. **Input Handling**: Accept user input strings.
3. **Logic Branching**:
   - **Float to Hex**: Attempt to parse the input as a float. If successful, use `struct.pack('f', value)` to get the bytes, then format them as a hexadecimal string (e.g., `db:0f:49:40`).
   - **Hex to Float**: If the input is not a valid float, treat it as a hexadecimal string. Clean the string by removing spaces, colons, and hyphens. Convert the cleaned hex string to bytes, then use `struct.unpack('f', bytes)` to retrieve the float value.
4. **Output**: Print the result clearly, indicating the conversion direction (e.g., "Float X converted to Hex: Y" or "Hex X converted to Float: Y").

# Constraints & Style
1. Use the `struct` module for all packing and unpacking operations.
2. The program must be a CLI script, not a web application.
3. Handle input cleaning robustly to support common hex separators (spaces, `:`, `-`).
4. Use standard ASCII quotes in the generated code.

# Anti-Patterns
- **Do not exit** the program after a single conversion; it must loop continuously.
- **Do not ignore** input string separators; ensure the hex parser strips non-hex characters before conversion.
- **Do not generate** Web/Flask code for this specific task.

## Triggers

- 浮点数转16进制内存
- 16进制内存转浮点数
- 双向转换浮点数和内存
- float hex memory converter
- 生成浮点数内存表示转换器

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…