SuperAPI AI Directory

code-feeder

Coding & development

View repository

Updated 10-16 00:04

About this skill

Code Feeder Skill

Goal: Generate a high-quality Markdown document containing theuser's intentandkey code. Script path:~/.claude/skills/code-feeder/scripts/ (if it does not exist, search code_collector.py)

🧠 Core Principles

  1. Intent first: You must ask for the collection purpose (e.g. "refactor login") and write it into the document.
  2. Precise collection: Select code according to the intent. Import small files in batches, and extract snippets from large files.
  3. Closed-loop completion: For files the tool reports as "skipped",you mustuse --append mode to extract key snippets for completion.

⚙️ Mode Decision

Mode Flag Applicable scenario Key parameters
Batch --mode batch Small files/configuration files --files f1 f2
Snippets --mode snippets Large files (>500KB)/specific functions --target f1 --ranges [...]
Append --append Complete missed files/incremental updates (use with Snippets)

📋 Execution Workflow

1. Confirm intent

If not provided, ask: "What is the specific purpose of collecting the code? Which modules should be focused on?"

2. Detection and planning

python {script_dir}/detect_project.py "{project_path}"

According to the output, ignore irrelevant directories and focus on core files.

3. Execute collection

A. Batch mode (preferred)

python {script_dir}/code_collector.py "{project_path}" \
  --mode batch --files src/main.py config.json ... \
  --intent "{user_intent}" --output "ctx.md"

B. Snippet mode (for large files/specific logic) Supported types: function, class, method, lines

python {script_dir}/code_collector.py "{project_path}" \
  --mode snippets --target "src/heavy.js" \
  --ranges '[{{"type":"function","name":"login"}}, {{"type":"lines","start":1,"end":50}}]' \
  --intent "{user_intent}" --output "ctx.md"

4. Completion (Critical)

Check the output for "⚠️ Skipped files". If a file is important,immediatelyuse append mode to extract:

python {script_dir}/code_collector.py "{project_path}" \
  --mode snippets --target "skipped_file.py" \
  --ranges '[{{"type":"function","name":"core_logic"}}]' \
  --output "ctx.md" --append

5. Review and manual patching

Read generated document, check completeness and correctness:

  • Critical omissions: If the tool cannot extract it (e.g. complex regex fails) but the code is crucial,you must manually Read the file contents, and manually append it in the same format as in the file to the corresponding section, and update the relevant directory tree and statistics.
  • Structure check: Confirm that the directory tree and statistics are normal.

6. Delivery

Tell the user the document path, and confirm that it already contains the intent and core logic.

⚠️ Exception Guide

  • Binary files: Only note their existence in the document; do not read them.
  • Extraction failure: If function extraction fails, fall back to using lines line-number range extraction.