Guidance for creating polyglot files that are valid in both Python and C. This skill applies when tasked with writing code that must be parseable and executable by both the Python interpreter and C compiler. Covers polyglot syntax techniques, testing strategies, and critical cleanup requirements.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
polyglot-c-py
description
Guidance for creating polyglot files that are valid in both Python and C. This skill applies when tasked with writing code that must be parseable and executable by both the Python interpreter and C compiler. Covers polyglot syntax techniques, testing strategies, and critical cleanup requirements.
Polyglot C-Python File Creation
This skill provides guidance for creating single source files that function correctly as both Python and C programs.
When to Use
This skill applies when:
Creating a file that must be valid syntax for both Python and C
The file needs to execute correctly under both python filename and gcc filename && ./output
Building polyglot programs that produce equivalent output in both languages
Polyglot Structure Approach
Core Technique
Use preprocessor directives and string literals to hide language-specific code:
Hide C code from Python: Wrap C-specific code in triple-quoted strings that Python ignores
Hide Python code from C: Use #if 0...#endif preprocessor blocks that C ignores but Python sees as comments