본문으로 건너뛰기
cccskills
무료GitHub에 공개

fallback-doc-with-delegation

Create documents when several research or execution tools fail. Delegate PDFs and complex layouts to shell_agent, a separate agent, or save Markdown directly, while distinguishing verified facts from general guidance and checking the output.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Generate professional documents after tool failures using shell_agent for complex formats or write_file for simple text/markdown

설치 방법 보기

이럴 때 유용합니다

  • Drafting reports when several data retrieval tools fail
  • Delegating PDF templates and complex document layouts
  • Saving Markdown drafts with clear information limitations

포함된 파일(2)

  • SKILL.md8.7 KB
  • .skill_id49 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Fallback Document Generation with Delegation

When to Use This Skill

Use this workflow when attempting to generate a document or report, but multiple primary data source tools fail simultaneously:

  • read_file returns binary/image data instead of text (common with PDFs)
  • search_web returns errors or no results
  • execute_code_sandbox fails unexpectedly
  • Other data retrieval tools are unavailable

Key insight: Rather than getting stuck on failed data retrieval, pivot immediately to generating the document using the most appropriate available method—either shell_agent for complex formats or write_file for simple text.

Step-by-Step Instructions

Step 1: Detect Tool Failure Pattern

Recognize when you're in a fallback scenario:

TOOL_FAILURE_INDICATORS = [
    "read_file returns binary or image data",
    "search_web returns unknown error or empty results",
    "execute_code_sandbox fails repeatedly",
    "Multiple consecutive tool failures on data retrieval"
]

Decision point: If 2+ indicators are present, proceed to Step 2.

Step 2: Choose the Appropriate Fallback Method

Critical Decision: Select between shell_agent and write_file based on document complexity:

Use shell_agent when...Use write_file when...
Generating PDFs or formatted documentsCreating simple markdown/text files
Complex layout or styling neededPlain structured content is sufficient
External libraries required (reportlab, pandoc)No special formatting libraries needed
Multi-step generation processSingle-pass content generation
Verification/validation neededDirect file creation is adequate

Decision Tree:

Is the output a PDF or complex formatted document?
├── YES → Use shell_agent (delegates to skilled agent)
└── NO → Is it markdown or plain text?
    ├── YES → Use write_file (direct content generation)
    └── NO → Use shell_agent (handles uncertainty)

Step 3A: Execute with shell_agent (Complex Documents)

For PDFs and complex formatting:

# Delegate to shell_agent with clear task description
shell_agent(
    task="Generate a professional [document type] about [topic]. "
         "Use appropriate libraries (e.g., reportlab for PDFs). "
         "Include: [list key sections/requirements]. "
         "Save to working directory as [filename]."
)

Advantages of shell_agent:

  • Agent autonomously handles library selection and usage
  • Automatically retries and fixes errors
  • Can use multiple tools internally (run_shell, execute_code_sandbox)
  • Validates output before completion

Example:

shell_agent(
    task="Create a 1-page SBAR (Situation-Background-Assessment-Recommendation) "
         "template PDF with 4 sections. Each section should have guiding points "
         "and blank lined spaces for user input. Use reportlab library. "
         "Save as SBAR_template.pdf in current directory."
)

Step 3B: Execute with write_file (Simple Documents)

For markdown and plain text:

# Generate content with embedded domain knowledge
report_content = f"""# [Document Title]

## Executive Summary
[Brief overview of key findings/content]

## Background
[Context and scope - use embedded knowledge]

## Main Content
[Organized sections with headers, lists, tables as appropriate]

## Limitations & Notes
[Transparent about data source limitations if relevant]

## Recommendations/Next Steps
[Actionable guidance based on available information]
"""

write_file(path="output/report.md", content=report_content)

Step 4: Structure Content Professionally

Regardless of method, ensure professional organization:

# [Document Title]

## Executive Summary
[Brief overview of key findings/content]

## Background
[Context and scope - use embedded knowledge]

## Main Content
[Organized sections with headers, lists, tables as appropriate]

## Limitations & Notes
[Transparent about data source limitations if relevant]

## Recommendations/Next Steps
[Actionable guidance based on available information]

Step 5: Leverage Embedded Domain Knowledge

When external data is unavailable:

  • Use general domain knowledge appropriately
  • Clearly distinguish between verified facts and general guidance
  • Include actionable frameworks rather than specific unverified data
  • Add placeholder notes where specific data would enhance the document

Example:

> **Note**: Specific [metric/data point] would typically be sourced from 
> [expected source]. The guidance below reflects established best practices 
> in this domain.

Step 6: Validate Output

# For shell_agent: verify the output exists and is valid
list_dir(path=".")  # Confirm file was created

# For PDFs, optionally verify with pdfinfo via run_shell
# For markdown, optionally read to confirm content

# For write_file: confirm file exists
list_dir(path=".")  # Confirm file exists

Code Example

# Complete detection and pivot pattern
def generate_fallback_document(task_goal, output_format="markdown"):
    # After detecting tool failures:
    
    # Step 1: Choose method based on format
    if output_format == "pdf" or "complex" in task_goal:
        # Use shell_agent for complex formats
        shell_agent(
            task=f"Generate a professional {output_format} document about "
                 f"{task_goal}. Use appropriate libraries. Include executive "
                 f"summary, main content, limitations, and recommendations. "
                 f"Save to working directory."
        )
        return "Document generated via shell_agent delegation"
    
    else:
        # Use write_file for simple formats
        report_content = f"""# {task_goal} Report

## Executive Summary
This report was generated using established domain knowledge due to 
temporary unavailability of primary data sources.

## Key Frameworks and Guidance
[Structured content with headers, bullets, tables]

## Limitations
- Specific data points from [expected sources] were unavailable
- Recommendations based on general best practices

## Action Items
1. [Concrete step 1]
2. [Concrete step 2]
"""
        write_file(path="generated_report.md", content=report_content)
        return "Report generated with write_file"

Best Practices

DoDon't
Choose method based on document complexityDefault to write_file for PDFs without consideration
Delegate complex formatting to shell_agentKeep retrying failing tools 5+ times
Be transparent about limitationsClaim unverified specifics as facts
Provide actionable frameworksLeave the task incomplete
Use professional document structureOutput unstructured text walls
Validate the generated outputAssume success without verification

Common Pitfalls

  1. Wrong tool selection: Using write_file for PDF generation instead of delegating to shell_agent
  2. Over-apologizing: Acknowledge limitations once, then deliver value
  3. Under-delivering: A well-structured partial report beats no report
  4. Misrepresenting certainty: Use appropriate hedging language
  5. Skipping validation: Always confirm the file was created successfully

Success Criteria

The skill is successfully applied when:

  • Document is generated despite tool failures
  • Appropriate method chosen (shell_agent for complex, write_file for simple)
  • Content is professionally structured (headers, sections, lists)
  • Limitations are transparently noted
  • Actionable guidance is provided
  • File is successfully created and verified

Method Comparison

Aspectshell_agentwrite_file
Best forPDFs, complex layouts, multi-step generationMarkdown, plain text, single-pass content
Error handlingAutonomous retry and fixManual error handling required
Library accessFull library ecosystemContent-only (no external libs)
Processing timeLonger (agent reasoning)Faster (direct write)
VerificationBuilt-in validationManual verification needed
CostHigher (agent execution)Lower (simple operation)

Decision Checklist

Before selecting method, ask:

  1. Is the output format PDF or other binary format? → shell_agent
  2. Does it require external libraries (reportlab, pandoc, etc.)? → shell_agent
  3. Is it markdown or plain text only? → write_file
  4. Does it need multi-step processing or validation? → shell_agent
  5. Is quick, simple content generation sufficient? → write_file

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Incremental audio production with duration mismatch handling, adaptive stem extension, and pre-mix alignment verification

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Incremental audio production with duration alignment handling, per-stem verification, and adaptive extension strategies

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

End-to-end audio production workflow with stems, effects, archiving, and verification

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Fallback pattern for executing Python code when execute_code_sandbox fails

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

HKUDS의 스킬 모두 보기

이 스킬의 문제 신고