em-dash

Detects and replaces em dashes and en dashes with hyphens in code and comments.

38.5k|4.9k|Updated Jun 11, 2025
One-click install
npx skills add https://github.com/github/awesome-copilot --skill em-dash
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: em-dash
Source: https://github.com/github/awesome-copilot/tree/main/skills/em-dash
Command: npx skills add https://github.com/github/awesome-copilot --skill em-dash

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Em dashes (U+2014) and en dashes (U+2013) frequently appear in AI-generated text and pasted content, but they do not belong in source code, code comments, or machine-readable files. This Skill enforces a consistent punctuation policy by replacing these Unicode dashes with the standard hyphen-minus character.

Core Features & Use Cases

  • Dash Detection and Replacement: Identifies em dashes and en dashes in code files and comments and replaces them with the hyphen (-) character.
  • Punctuation Reference: Provides a detailed guide to punctuation characters, marking which are keyboard characters and which appear in programming language syntax.
  • Shell Replacement Commands: Includes ready-to-use sed and perl one-liners for stripping Unicode dashes and replacement characters (U+FFFD) from text.
  • Use Case: When an AI agent writes or edits code comments, use this Skill to ensure no em dashes slip into the codebase, keeping files ASCII-safe and consistent.

Quick Start

Review my code comments and replace any em dashes or en dashes with hyphens.

Frequently Asked Questions about em-dash

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove em dashes from code comments?

Replace em dashes (U+2014) and en dashes (U+2013) with the hyphen-minus character (-). You can use the perl command 'perl -CS -pe "s/\x{2013}|\x{2014}/-/g"' to strip them from files in bulk.

Should em dashes ever be used in code files?

No. Em dashes and en dashes are not keyboard characters and never appear in programming language syntax, so they should never be used in code or code comments. Use the hyphen (-) character instead.

When is it acceptable to use an em dash in text files?

Default to never. The only exception is when explicitly instructed and the text is clearly literature or news content. If an em dash already exists in raw data files, leave it unchanged.

How do I fix the Unicode replacement character in pasted text?

The replacement character (U+FFFD, shown as �) can appear when text is pasted with encoding issues. Remove it with 'perl -CS -pe "s/\x{FFFD}/ /g"' to substitute a space.

Which punctuation characters are safe to use in code comments?

Use characters that are both on a standard keyboard and part of programming syntax, such as periods, commas, colons, semicolons, parentheses, brackets, hyphens, and slashes. Avoid any character that fails either test.