brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
refactor-skill-structureRefactor an over-long or poorly structured SKILL.md by extracting examples to references/EXAMPLES.md, splitting compound procedures, and reorganizing sections for progressive disclosure. Use when a skill exceeds the 500-line CI limit, when code blocks dominate the skill body, when a procedure step contains multiple unrelated operations, or after a content u…
Independent GitHub snapshot · Automated classification · Original documentation governs
重構已逾 500 行限或結構有疾之 SKILL.md。本技能將延伸之代碼例抽出至 references/EXAMPLES.md,將複合程序拆分為聚焦之子程序,加交互引用以漸進揭示,並驗證重組後技能仍完整有效。
references/EXAMPLES.md(預設:有可抽內容則是)讀取技能並按段建立行預算,以識別膨脹所在。
# Total line count
wc -l < skills/<skill-name>/SKILL.md
# Line count per section (approximate)
grep -n "^## \|^### " skills/<skill-name>/SKILL.md
膨脹之源分類:
預期: 行預算顯示哪些段過大及何種膨脹類別適用。最大段乃首要重構標的。
失敗時: 若技能未逾 500 行且無顯結構問題,本技能恐不需。先驗重構之請求是否合理。
將逾 15 行之代碼塊移至 references/EXAMPLES.md,於主 SKILL.md 留簡短行內片段(3-10 行)。
建 references 目錄:
mkdir -p skills/<skill-name>/references/
對每可抽之代碼塊:
references/EXAMPLES.md,置於描述性標題之下See [EXAMPLES.md](references/EXAMPLES.md#heading) for the complete configuration.以清晰標題組織 references/EXAMPLES.md:
# Examples
## Example 1: Full Configuration
Complete configuration file for [context]:
\```yaml
# ... full config here ...
\```
## Example 2: Multi-Variant Setup
### Variant A: Development
\```yaml
# ... dev config ...
\```
### Variant B: Production
\```yaml
# ... prod config ...
\```
預期: 所有逾 15 行之代碼塊已抽出。主 SKILL.md 留簡短行內片段以資易讀。交互引用連至所抽之內容。references/EXAMPLES.md 組織良好,標題具描述性。
失敗時: 若抽代碼塊不足以充分減行(仍逾 500),續至步驟三作程序拆分。若技能代碼塊極少(如自然語言類技能),則改聚焦於步驟三、四。
識別作多種不相關操作之程序步並拆之。
複合步之徵兆:
對每複合步:
### Step N:預期: 每程序步只作一事。無步逾 30 行。步數可增但每步可獨立驗證。
失敗時: 若拆步過細(如總計逾 20 步),考慮將相關微步歸於單一步下之編號子步。佳之區間為 5-12 程序步。
確保抽出後主 SKILL.md 仍易讀且可發現。
對每抽出:
[EXAMPLES.md](references/EXAMPLES.md#section-anchor)交互引用模式:
See [EXAMPLES.md](references/EXAMPLES.md#full-configuration) for the complete configuration with all options.See [EXAMPLES.md](references/EXAMPLES.md#variants) for development, staging, and production variants.See [EXAMPLES.md](references/EXAMPLES.md#troubleshooting) for additional error scenarios.預期: 每抽出皆有對應之交互引用。讀者可循主 SKILL.md 處理常見情形,而鑽入 references 看細節。
失敗時: 若交互引用使行文不順,將多引用合併為程序步末之單一注:For extended examples including [X], [Y], and [Z], see [EXAMPLES.md](references/EXAMPLES.md).
對 SKILL.md 重新度量行數。
# Check main SKILL.md
lines=$(wc -l < skills/<skill-name>/SKILL.md)
[ "$lines" -le 500 ] && echo "SKILL.md: OK ($lines lines)" || echo "SKILL.md: STILL OVER ($lines lines)"
# Check references file if created
if [ -f skills/<skill-name>/references/EXAMPLES.md ]; then
ref_lines=$(wc -l < skills/<skill-name>/references/EXAMPLES.md)
echo "EXAMPLES.md: $ref_lines lines"
fi
# Total content
echo "Total content: $((lines + ${ref_lines:-0})) lines"
預期: SKILL.md 已逾 500 行下。理想於 400 行下,留將來增長空間。references/EXAMPLES.md 無行限。
失敗時: 若抽出與拆分後仍逾 500 行,考慮是否應將該技能分解為兩個獨立技能。涵蓋過廣乃範圍蠕之徵。用 create-skill 寫第二技能並更新二者之相關技能交互引用。
重構之後,驗該技能仍具所有必需段且 frontmatter 完整。
跑 review-skill-format 清單:
# Quick section check
for section in "## When to Use" "## Inputs" "## Procedure" "## Common Pitfalls" "## Related Skills"; do
grep -q "$section" skills/<skill-name>/SKILL.md && echo "$section: OK" || echo "$section: MISSING"
done
grep -qE "## Validation( Checklist)?" skills/<skill-name>/SKILL.md && echo "Validation: OK" || echo "Validation: MISSING"
預期: 所有段皆存。抽出時無內容意外被刪。SKILL.md 中之交互引用解析至 EXAMPLES.md 中之實際標題。
失敗時: 若有段意外被移除,自 git 歷史復之:git diff skills/<skill-name>/SKILL.md 以見何變。若交互引用斷,驗 EXAMPLES.md 之標題錨點與 SKILL.md 之連結相符(GitHub 風格 markdown 錨點規則:小寫、空格化連字符、剝點符)。
references/EXAMPLES.md 中,附描述性標題review-skill-format 之驗證於重構後技能上通過grep -c "heading-text" references/EXAMPLES.md 測之review-skill-format — 重構之後跑格式驗證,確認技能仍合規update-skill-content — 內容更新每每為結構重構之觸發,當其推技能逾行限時create-skill — 決定如何組織抽出內容時,參照標準結構evolve-skill — 須將一技能拆為二時,用 evolve 建衍生