Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

clang-format Configuration

БесплатноБез исполняемых скриптовНе проверен

The model must invoke this skill when any trigger occurs - (1) user mentions "clang-format" or ".clang-format", (2) user requests analyzing code…

BbgnsurfTechот BbgnsurfTech★ 30 звёзд на GitHub11 установок в других каталогах

Об этом скилле

clang-format Configuration

Configure the clang-format code formatting tool using ready-to-use templates, integration scripts, and comprehensive reference documentation.

Purpose

This skill provides procedural workflows for clang-format configuration tasks:

  • Create new .clang-format files from proven templates
  • Analyze existing code style and generate matching configurations
  • Set up editor and git integration with bundled scripts
  • Troubleshoot formatting behavior using reference documentation

Workflow Routing by Trigger Type

Once invoked, route to appropriate workflow based on which trigger fired:

Trigger 1: Explicit clang-format mention → If user asks about specific options: Consult references/01-09.md for relevant category → If user needs complete reference: Direct to references/complete/clang-format-style-options.md → If user asks about CLI usage: Reference references/cli-usage.md

Trigger 2: Code style analysis request → Follow "Analyzing Existing Code Style" workflow below → Examine code samples systematically (braces→indentation→spacing→breaking→alignment) → Map patterns to closest template in assets/configs/ → Generate initial configuration hypothesis as a temporary configuration file "/tmp/<reponame>/hypothesis.clang-format" → VERIFY IMPACT: Run clang-format --style="/tmp/<repo_name>/hypothesis_<number>.clang-format" file.cpp | diff - file.cpp on 3-5 representative samples → MEASURE IMPACT using weighted scoring: • Metric 1: Line count changes (lines added/removed) - weight 10 • Metric 2: In-line whitespace changes (spacing within existing lines) - weight 1 • Impact Score = (line_count_changes × 10) + (whitespace_changes × 1) • Lower score = lower impact to rebasing conflicts, future git-diff analysis, and merge request change reviews = better configuration → ITERATE: Adjust config options targeting highest-impact settings, re-test, compare scores → REPEAT until reaching minimal achievable score while maintaining consistent style enforcement → REPORT TO USER: Present winning configuration with: • Final impact score and breakdown (line changes vs whitespace changes) • Comparison table showing all tested hypotheses and their scores • Example diff snippets showing what will change, with commands for the user to test it themselves against files of their choice. • Rationale for selected configuration → AWAIT USER APPROVAL before finalizing configuration → Only after approval: provide final configuration file

Trigger 3: Configuration file operations → If creating new: Follow "Creating New Configuration from Template" workflow → If modifying existing: Read current config, identify changes needed, consult relevant category guide → If generating from code: Use Trigger 2 workflow (code style analysis)

Trigger 4: Formatting behavior investigation → Follow "Troubleshooting Formatting Issues" workflow below → Verify config detection with --dump-config → Identify affected category, consult relevant references/0X.md guide → Test isolated options with minimal config

Trigger 5: Style option inquiries → Map question to category: braces→03, indentation→04, spacing→05, alignment→01, breaking→02 → Reference specific category guide in references/ → Provide examples from quick-reference.md if applicable

Trigger 6: Minimal-disruption requests → Use "Analyzing Existing Code Style" workflow to match current patterns → Emphasize starting from closest template to minimize changes → Test on representative samples before project-wide application → Document which patterns were preserved vs normalized

Bundled Resources

Configuration Templates (assets/configs/)

Seven ready-to-use .clang-format templates optimized for common scenarios:

  • google-cpp-modified.clang-format - Google C++ style with 4-space indent, 120 column limit
  • linux-kernel.clang-format - Linux kernel coding standards (tabs, K&R braces)
  • microsoft-visual-studio.clang-format - Microsoft/Visual Studio conventions
  • modern-cpp17-20.clang-format - Modern C++17/20 style with contemporary idioms
  • compact-dense.clang-format - Compact style for space-constrained environments
  • readable-spacious.clang-format - Spacious style prioritizing readability
  • multi-language.clang-format - Multi-language configuration (C++, JavaScript, Java)

When to use templates: Start new projects, establish team standards, or quickly test formatting approaches.

Integration Scripts (assets/integrations/)

Three editor and git integration scripts:

  • pre-commit - Git hook script for automatic formatting of staged files (works with pre-commit or prek framework)
  • vimrc-clang-format.vim - Vim configuration for format-on-save
  • emacs-clang-format.el - Emacs configuration for clang-format integration

When to use integrations: Set up automatic formatting in development workflow.

Note: The pre-commit hook script works with both the pre-commit framework (Python) and prek (Rust alternative). Both

Полный SKILL.md на GitHub

Установить clang-format Configuration в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

assets/configs/compact-dense.clang-formatassets/configs/google-cpp-modified.clang-formatassets/configs/linux-kernel.clang-formatassets/configs/microsoft-visual-studio.clang-formatassets/configs/modern-cpp17-20.clang-formatassets/configs/multi-language.clang-formatassets/configs/readable-spacious.clang-formatassets/integrations/emacs-clang-format.elassets/integrations/pre-commitassets/integrations/vimrc-clang-format.vimreferences/01-alignment.mdreferences/02-breaking.mdreferences/03-braces.mdreferences/04-indentation.mdreferences/05-spacing.mdreferences/06-includes.mdreferences/07-languages.mdreferences/08-comments.mdreferences/09-advanced.mdreferences/cli-usage.mdreferences/complete/clang-format-cli.mdreferences/complete/clang-format-style-options.mdreferences/index.mdreferences/quick-reference.md

FAQ

Что делает скилл clang-format Configuration?

The model must invoke this skill when any trigger occurs - (1) user mentions "clang-format" or ".clang-format", (2) user requests analyzing code style/formatting patterns/conventions, (3) user requests creating/modifying/generating formatting configuration, (4) user troubleshoots formatting behavior or unexpected results, (5) user asks about brace styles/indentation/spacing/alignment/line breaking/pointer alignment, (6) user wants to preserve existing style/minimize whitespace changes/reduce formatting diffs/codify dominant conventions.

Как установить скилл clang-format Configuration?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл clang-format Configuration запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить clang-format Configuration с