Skillpedia
التوثيق7.8k · #13043

create-skill-from-source-code

ما الذي تفعله

توجّه هذه المهارة وكيل الذكاء الاصطناعي إلى قراءة ملف كود مصدري وكتابة مادة تعليمية منه، على هيئة ملف مهارة. وهي مناسبة لمن يريد تعليم تطبيق مرجعي أو توثيقه.

متى تستخدمها

  • ✓عندما يكون لديك تطبيق مرجعي وتريد مادة تعليمية مستخرجة منه.
  • ✓عندما تحتاج إلى توثيق قابل لإعادة الاستخدام يشرح طريقة عمل الكود.
  • ✓عندما تريد تدوين البنية والتقنيات الأساسية وأمثلة الاستخدام.

رابط المهارة

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/create-skill-from-source-code/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/create-skill-from-source-code/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“اقرأ ملف الكود المصدري هذا، واكتب دليلًا واضحًا يشرح أنماطه الرئيسية ويعرض كيفية استخدامها.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يقرأ الوكيل ملف الكود كاملًا، ويحدد الأنماط المعمارية وهياكل البيانات والخوارزميات ونقاط التكامل. ثم يكتب المادة برأس مناسب وتحليل وقوالب كود وأمثلة.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Create Skill from Source Code

This skill guides you through the process of analyzing an existing source code implementation and transforming it into comprehensive educational documentation in the form of a skill file.

Overview

When you have a reference implementation and need to create teaching materials or reusable documentation from it, follow this systematic workflow to extract patterns, analyze architecture, and generate well-structured educational content.

Prerequisites

  • Access to the source code file(s) you want to document
  • Understanding of the target audience for the skill
  • Knowledge of the programming language/framework used

Workflow Steps

1. Read and Parse the Source Code

First, read the complete source file to understand its full scope:

# Read the source file
cat /path/to/source/file.ext

Or use file reading tools to access the content programmatically.

2. Identify Key Architectural Patterns

Analyze the code to identify:

  • Core architectural patterns: What design patterns are used? (e.g., Observer, Factory, MVC)
  • Key implementation techniques: How are specific challenges solved?
  • Important data structures: What structures enable the functionality?
  • Critical algorithms: What are the main algorithmic approaches?
  • Integration points: How does the code interact with external systems?

Take notes on 3-5 major patterns that define the implementation.

3. Create the Skill Directory Structure

# Create skill directory
mkdir -p skills/skill-name

# If you need auxiliary files (examples, scripts, etc.)
mkdir -p skills/skill-name/examples
mkdir -p skills/skill-name/templates

4. Generate Comprehensive SKILL.md

Create a SKILL.md file with the following structure:

Required YAML Frontmatter

---
name: descriptive-skill-name
description: Brief one-sentence description of what the skill teaches
---

Frontmatter rules:

  • Must be enclosed in --- fences
  • name: lowercase, use hyphens for spaces
  • description: concise but informative (1-2 sentences max)

Document Body Structure

Organize the content into clear sections:

# [Skill Title]

## Overview
Brief introduction to what pattern/technique is being taught.

## Key Patterns Identified

### Pattern 1: [Name]
**Purpose**: What problem does it solve?
**Implementation**: How is it implemented in the reference code?
**Key Code Elements**: 
- Relevant classes/functions
- Important variables/structures

### Pattern 2: [Name]
[Same structure as Pattern 1]

[Continue for 3-5 main patterns]

## Complete Code Template

Provide a minimal but complete implementation:

\`\`\`[language]
// Simplified, well-commented version of the key code
// Include only essential elements
// Add explanatory comments
\`\`\`

## Usage Examples

### Example 1: Basic Usage
\`\`\`[language]
// Practical example showing how to use the pattern
\`\`\`

### Example 2: Advanced Usage
\`\`\`[language]
// More complex scenario
\`\`\`

## Best Practices

- List key recommendations
- Common pitfalls to avoid
- Performance considerations
- Testing strategies

## When to Use This Pattern

Explain scenarios where this pattern is appropriate and where it might not be the best choice.

## Related Patterns

Reference related techniques or alternative approaches.

## References

- Link to original source (if applicable)
- Related documentation
- Further reading

5. Verify File Creation and Frontmatter

After creating the skill file, verify:

# Check file exists
ls -la skills/skill-name/SKILL.md

# Verify frontmatter format
head -n 5 skills/skill-name/SKILL.md

# Should show:
# ---
# name: skill-name
# description: Description here
# ---

Ensure:

  • File starts with --- on line 1
  • YAML contains at least name and description fields
  • Frontmatter closes with ---
  • Content follows immediately after

6. Add Auxiliary Files (Optional)

If the pattern benefits from additional resources:

Example script (examples/demo.sh):

#!/bin/bash
# Demonstration script showing the pattern in action

Template file (templates/starter.template):

# Ready-to-use template that users can copy

Configuration example (examples/config.example):

# Sample configuration demonstrating best practices

Tips for Creating Effective Skills

Make It Generalizable

  • Abstract away specific variable names, file paths, or domain-specific detail
الأسئلة الشائعة

ماذا يحدد الوكيل في الكود؟

يبحث عن أنماط التصميم والتقنيات الأساسية وهياكل البيانات المهمة والخوارزميات ونقاط التكامل.

لمن الدليل؟

تطلب المهارة من الوكيل مراعاة الجمهور المقصود قبل الكتابة.

هل يتضمن أمثلة كود؟

نعم، تتضمن المهارة قوالب كود وأمثلة استخدام في المخرجات.

التفاصيل

الوصف الأصلي من المؤلف

Analyze existing source code to identify key patterns and generate comprehensive educational skill documentation with proper YAML frontmatter, architectural analysis, code templates, and usage examples.

repo: HKUDS/AgentPilot

الشعبية

نجوم GitHub
7.8k
الترتيب
#13043
الترخيص
MIT
آخر تحديث
1‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة