スキル一覧に戻る
iamyojimbo

python-case-conversion

by iamyojimbo

0🍴 0📅 2026年1月20日
GitHubで見るManusで実行

SKILL.md


name: python-case-conversion description: Provides guidance on converting strings between different cases in Python (camelCase, snake_case, kebab-case, PascalCase, etc.) using the pydash library. Use this skill when asked to convert string formats, rename variables to follow naming conventions, transform API responses, or work with different programming language conventions.

Python Case Conversion

Overview

This skill provides comprehensive guidance on converting strings between different case formats in Python using the pydash library. Convert between camelCase, snake_case, kebab-case, PascalCase, and many other formats commonly used in programming.

When to Use This Skill

Use this skill when:

  • Converting variable names between different naming conventions (e.g., Python's snake_case to JavaScript's camelCase)
  • Transforming API response field names to match local code conventions
  • Creating URL-friendly slugs from titles or descriptions
  • Formatting strings for display purposes (title case, start case, human case)
  • Adapting code between different programming languages with different naming conventions
  • Bulk renaming variables or fields to follow a style guide
  • Working with database column names and converting them to/from code variable names

Quick Start

To convert between string cases in Python, use the pydash library:

import pydash as _

# Convert to camelCase
_.camel_case("foo bar baz")  # "fooBarBaz"

# Convert to snake_case
_.snake_case("FooBarBaz")  # "foo_bar_baz"

# Convert to kebab-case
_.kebab_case("Foo Bar Baz")  # "foo-bar-baz"

# Convert to PascalCase
_.pascal_case("foo bar baz")  # "FooBarBaz"

# Create URL slug
_.slugify("Hello World!")  # "hello-world"

Common Conversion Tasks

Converting Variable Names Between Languages

When working with APIs or multi-language codebases:

import pydash as _

# Python to JavaScript
python_var = "user_email_address"
js_var = _.camel_case(python_var)  # "userEmailAddress"

# JavaScript to Python
js_field = "firstName"
python_field = _.snake_case(js_field)  # "first_name"

# Python to CSS
python_class = "primary_button"
css_class = _.kebab_case(python_class)  # "primary-button"

Creating URL Slugs

For blog posts, articles, or any URL-friendly strings:

import pydash as _

title = "My Amazing Blog Post!"
slug = _.slugify(title)  # "my-amazing-blog-post"

# With custom separator
slug = _.slugify(title, separator="_")  # "my_amazing_blog_post"

Display-Friendly Labels

Convert code variable names to user-friendly labels:

import pydash as _

# Database column to label
_.start_case("created_at")  # "Created At"
_.title_case("user_email")  # "User Email"

# Special handling for _id suffix
_.human_case("user_id")  # "User" (removes _id)

Bulk Transformations

When converting multiple fields at once:

import pydash as _

# Convert API response keys
api_response = {
    "firstName": "John",
    "lastName": "Doe",
    "emailAddress": "john@example.com"
}

python_response = {
    _.snake_case(key): value
    for key, value in api_response.items()
}
# Result: {"first_name": "John", "last_name": "Doe", "email_address": "john@example.com"}

Available Case Conversion Functions

For a complete reference of all available functions, see references/case_conversion_functions.md.

Key functions include:

  • camel_case() - Convert to camelCase (first letter lowercase)
  • pascal_case() - Convert to PascalCase (first letter uppercase)
  • snake_case() - Convert to snake_case (underscores)
  • kebab_case() - Convert to kebab-case (hyphens)
  • slugify() - Convert to URL-safe slug
  • title_case() - Convert to Title Case
  • start_case() - Convert to Start Case
  • human_case() - Convert to human-friendly format
  • upper_case() - Convert to UPPER CASE (with spaces)
  • lower_case() - Convert to lower case (with spaces)
  • separator_case(separator) - Convert using custom separator

Programming Convention Reference

Different contexts require different naming conventions:

ContextConventionFunction
Python variables/functionssnake_casesnake_case()
Python classesPascalCasepascal_case()
JavaScript variables/functionscamelCasecamel_case()
JavaScript classesPascalCasepascal_case()
CSS classeskebab-casekebab_case()
URLslowercase-with-hyphensslugify()
Database columnssnake_casesnake_case()
ConstantsSCREAMING_SNAKE_CASEsnake_case() + to_upper()
Display textTitle Casetitle_case() or start_case()

Installation

If pydash is not installed, install it with:

pip install pydash

Detailed Reference

For comprehensive documentation including:

  • Complete function reference table with examples
  • Detailed usage patterns for each function
  • Unicode and special character handling
  • Advanced use cases and edge cases

See: references/case_conversion_functions.md

スコア

総合スコア

40/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です