MCP HubMCP Hub
스킬 목록으로 돌아가기

refactor-skill-structure

pjt222
업데이트됨 2 days ago
8 조회
17
2
17
GitHub에서 보기
메타general

정보

이 스킬은 길거나 구조가 나쁜 SKILL.md 파일을 CI 라인 제한에 맞추고 가독성을 개선하도록 리팩터링합니다. 코드 예제를 별도 파일로 추출하고, 복잡한 절차를 분할하며, 점진적 정보 공개를 위해 내용을 재구성합니다. 스킬이 500줄을 초과하거나, 코드 블록이 지나치게 많거나, 관련 없는 여러 작업을 포함한 절차적 단계가 있을 때 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/refactor-skill-structure

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Refactor Skill Structure

Refactor SKILL.md exceeded 500-line limit or w/ structural problems. Extract code examples to references/EXAMPLES.md, split compound procs into focused sub-procs, add cross-refs for progressive disclosure, verify skill complete + valid after restructure.

Use When

  • Skill > 500-line CI limit
  • Single proc step has multi unrelated ops → should be separate
  • Code blocks > 15 lines dominate → could extract
  • Skill accumulated ad-hoc sections breaking standard 6-section
  • After update pushed over limit
  • Review flagged structural issues beyond content

In

  • Required: Path to SKILL.md
  • Optional: Target line count (default 80% of 500 = ~400)
  • Optional: Create references/EXAMPLES.md? (default yes if extractable)
  • Optional: Split into multi skills? (default no, prefer extract first)

Do

Step 1: Measure + ID Bloat

Read skill + create section line budget → ID bloat.

# Total line count
wc -l < skills/<skill-name>/SKILL.md

# Line count per section (approximate)
grep -n "^## \|^### " skills/<skill-name>/SKILL.md

Classify bloat:

  • Extractable: Code blocks > 15 lines, full configs, multi-variant examples
  • Splittable: Compound proc steps doing 2+ unrelated ops
  • Trimable: Redundant explanations, verbose ctx
  • Structural: Ad-hoc sections not in standard 6

→ Line budget showing oversized sections + bloat category. Largest = primary refactor targets.

If err: skill < 500 lines + no structural issues → skill not needed. Verify request justified.

Step 2: Extract Code → references/EXAMPLES.md

Move code blocks > 15 lines to references/EXAMPLES.md, leave brief inline (3-10 lines) in main.

  1. Create dir:

    mkdir -p skills/<skill-name>/references/
    
  2. For each extractable block:

    • Copy full block to references/EXAMPLES.md w/ descriptive heading
    • Replace block in SKILL.md w/ brief 3-5 line snippet
    • Add cross-ref: See [EXAMPLES.md](references/EXAMPLES.md#heading) for the complete configuration.
  3. Structure references/EXAMPLES.md w/ clear headings:

    # 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 ...
    \```
    

→ All blocks > 15 lines extracted. Main SKILL.md keeps brief inline. Cross-refs link to extracted. references/EXAMPLES.md well-organized.

If err: extracting doesn't reduce enough (still > 500) → Step 3 splitting. Few code blocks (natural-lang skill) → focus Steps 3 + 4.

Step 3: Split Compound → Focused Steps

ID proc steps doing multi unrelated ops + split.

Signs compound step:

  • Title contains "and" ("Configure Database and Set Up Caching")
  • Step has multi Expected/On failure blocks (or should)
  • Step > 30 lines
  • Could skip or do diff order from sub-parts

For each compound:

  1. ID distinct ops in step
  2. Create new ### Step N: for each
  3. Renumber subsequent
  4. Each new step → own Expected + On failure
  5. Add transition ctx between new steps

→ Each proc step does one thing. No step > 30 lines. Step count may grow but each indep verifiable.

If err: splitting → too granular (20+ total) → group related micro-steps under single step w/ numbered sub. Sweet spot 5-12 steps.

Step 4: Add Cross-Refs

Ensure main SKILL.md maintains readability + discoverability after extract.

For each extraction:

  1. Inline snippet in SKILL.md self-sufficient for common case
  2. Cross-ref explains additional content available
  3. Use relative paths: [EXAMPLES.md](references/EXAMPLES.md#section-anchor)

Patterns:

  • After brief snippet: See [EXAMPLES.md](references/EXAMPLES.md#full-configuration) for the complete configuration with all options.
  • For multi-variant: See [EXAMPLES.md](references/EXAMPLES.md#variants) for development, staging, and production variants.
  • For extended troubleshooting: See [EXAMPLES.md](references/EXAMPLES.md#troubleshooting) for additional error scenarios.

→ Every extraction has cross-ref. Reader follows main for common case, drills into refs for detail.

If err: cross-refs make text awkward → consolidate multi refs into single note at end of step: For extended examples including [X], [Y], and [Z], see [EXAMPLES.md](references/EXAMPLES.md).

Step 5: Verify Line Count

Re-measure SKILL.md after changes.

# 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. Ideal < 400 → room future growth. references/EXAMPLES.md no limit.

If err: still > 500 after extract + split → skill should decompose into 2 separate skills. Too much ground = scope creep. Use create-skill for second + update Related Skills cross-refs both.

Step 6: Validate All Sections

After refactor, verify skill has all required sections + frontmatter intact.

Run review-skill-format checklist:

  1. YAML frontmatter parses
  2. All 6 required sections (When to Use, Inputs, Procedure, Validation, Common Pitfalls, Related Skills)
  3. Every proc step has Expected + On failure
  4. No orphaned cross-refs (all links resolve)
# 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"

→ All sections present. No content accidentally deleted during extract. Cross-refs in SKILL.md resolve to actual headings in EXAMPLES.md.

If err: section accidentally removed → restore from git: git diff skills/<skill-name>/SKILL.md. Cross-refs broken → verify heading anchors in EXAMPLES.md match links in SKILL.md (GitHub anchor: lowercase, hyphens for spaces, strip punctuation).

Check

  • SKILL.md line count ≤ 500
  • All code blocks in SKILL.md ≤ 15 lines
  • Extracted in references/EXAMPLES.md w/ descriptive headings
  • Every extraction has cross-ref in main SKILL.md
  • No compound proc steps remain (each step one thing)
  • All 6 required sections present after refactor
  • Every proc step has Expected: + On failure:
  • YAML frontmatter intact + parseable
  • Cross-ref links resolve to actual headings in EXAMPLES.md
  • review-skill-format validation passes

Traps

  • Extract too aggressive: All code → refs makes main unreadable. Keep 3-10 line snippets inline for common case. Only extract > 15 lines or multi-variant.
  • Broken anchors: GitHub markdown anchors case-sensitive some renderers. Lowercase headings in EXAMPLES.md, match exact in cross-refs. Test grep -c "heading-text" references/EXAMPLES.md.
  • Lose Expected/On failure during split: Each new step gets own Expected + On failure. Easy to leave one w/o blocks after split.
  • Too many tiny steps: Splitting → 5-12 steps. End up 15+ → split too aggressive. Merge related micro back to logical groups.
  • Forget update EXAMPLES.md headings: Rename section → all cross-ref anchors in SKILL.md must update. Grep old anchor to catch all refs.

  • review-skill-format — run format validation after refactor → confirm compliant
  • update-skill-content — content updates often trigger structural refactor when push over limit
  • create-skill — reference canonical structure when deciding how to organize extracted
  • evolve-skill — split into 2 separate skills → use evolution to create derivative

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-ultra/skills/refactor-skill-structure
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

content-collections

메타

이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.

스킬 보기

polymarket

메타

이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.

스킬 보기

creating-opencode-plugins

메타

이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.

스킬 보기

sglang

메타

SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.

스킬 보기