소스 정보
- 저장소
- cxcscmu/SkillLearnBench
- 최근 소스 활동
- 2026년 4월 24일 05:14
- 감지된 SKILL.md 언어
- 영어
- 스타
- 77
- 포크
- 4
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill template-processing명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | template-processing |
| description | Process templates with placeholder substitution and conditional sections |
When filling document templates, you often need to:
{{PLACEHOLDER}} with actual dataThis skill covers patterns for template processing in both text and document contexts.
{{CANDIDATE_FULL_NAME}}
{{POSITION}}
{{START_DATE}}
{{BASE_SALARY}}
import json
with open('employee_data.json', 'r') as f:
data = json.load(f)
# Access placeholder values
name = data['CANDIDATE_FULL_NAME']
position = data['POSITION']
{{IF_CONDITION_NAME}}
Content to show if CONDITION_NAME is "Yes"
{{END_IF_CONDITION_NAME}}
def process_conditional_section(text, condition_key, condition_value):
"""Remove conditional markers based on condition value"""
start_marker = f'{{{{IF_{condition_key}}}}}'
end_marker = f'{{{{END_IF_{condition_key}}}}}'
# Find section
start_idx = text.find(start_marker)
end_idx = text.find(end_marker)
if start_idx == -1 or end_idx == -1:
return text # No conditional section found
# Extract the content between markers
before = text[:start_idx]
content = text[start_idx + len(start_marker):end_idx]
after = text[end_idx + len(end_marker):]
if condition_value.lower() == 'yes':
# Keep content, remove markers
return before + content + after
else:
# Remove entire section
return before + after
import json
from docx import Document
with open('employee_data.json', 'r') as f:
data = json.load(f)
doc = Document('template.docx')
def replace_placeholders(doc, data):
"""Replace all {{PLACEHOLDER}} with data values"""
# Replace in paragraphs
for para in doc.paragraphs:
para_text = para.text
for key, value in data.items():
placeholder = f'{{{{{key}}}}}'
para_text = para_text.replace(placeholder, str(value))
# Update paragraph (handle text fragmentation)
if para_text != para.text:
for run in para.runs:
run.text = ''
para.text = para_text
# Replace in tables
for table in doc.tables:
for row in table.rows:
for cell in row.cells:
cell_text = cell.text
for key, value in data.items():
placeholder = f'{{{{{key}}}}}'
cell_text = cell_text.replace(placeholder, str(value))
if cell_text != cell.text:
for para in cell.paragraphs:
for run in para.runs:
run.text = ''
para.text = cell_text
cell_text = cell.text # Reset after first cell
def process_conditionals(doc, data):
"""Process {{IF_*}}...{{END_IF_*}} sections"""
for para in doc.paragraphs:
para_text = para.text
# Find all conditional markers
import re
pattern = r'{{\s*IF_(\w+)\s*}}(.*?){{\s*END_IF_\1\s*}}'
def replace_conditional(match):
condition_key = match.group(1)
content = match.group(2)
condition_value = data.get(condition_key, 'No')
if condition_value == 'Yes':
return content.strip()
else:
return ''
new_text = re.sub(pattern, replace_conditional, para_text, flags=re.DOTALL)
if new_text != para_text:
for run in para.runs:
run.text = ''
para.text = new_text
Text Fragmentation in Word: Placeholders might be split across multiple runs. Always work at the paragraph level (para.text) not individual run level.
Order of Operations:
Multiline Content: When using regex for conditionals, use re.DOTALL flag to match across newlines
Data Type Conversion: Convert all data values to strings when replacing:
placeholder_value = str(data[key])
Preserve Formatting: The simple approach loses formatting. For preserving formatting:
import json
import re
from docx import Document
def fill_offer_letter(template_path, data_path, output_path):
# Load data
with open(data_path) as f:
data = json.load(f)
doc = Document(template_path)
# Process all paragraphs
for para in doc.paragraphs:
text = para.text
# Handle conditionals first
pattern = r'{{\s*IF_(\w+)\s*}}(.*?){{\s*END_IF_\1\s*}}'
def replace_cond(m):
key = m.group(1)
content = m.group(2)
return content.strip() if data.get(key) == 'Yes' else ''
text = re.sub(pattern, replace_cond, text, flags=re.DOTALL)
# Replace placeholders
for key, value in data.items():
text = text.replace(f'{{{{{key}}}}}', str(value))
# Update paragraph
if text != para.text:
for run in para.runs:
run.text = ''
para.text = text
# Similarly for tables
for table in doc.tables:
for row in table.rows:
for cell in row.cells:
para cell.paragraphs:
text = para.text
pattern =
text = re.sub(pattern, replace_cond, text, flags=re.DOTALL)
key, value data.items():
text = text.replace(, (value))
text != para.text:
run para.runs:
run.text =
para.text = text
doc.save(output_path)