- name
- lib-skill-creator-skill
- description
- Guides users through the process of creating library skills, including structure design, content organization, and validation workflows
Source Code Into Skill
Overview
This skill transforms specified source code into AI-coding-friendly guiding skills through natural collaborative conversations.
Why generate skills for libraries?
When AI coding tools work on projects that depend on a library, they often need to understand the library's APIs and classes to complete user requests effectively. By generating a skill from the library's source code:
- AI tools can understand the purpose and logic of each API without reading the original source code
- Developers can share library knowledge with AI tools in a standardized format
- The generated skill serves as comprehensive, searchable documentation optimized for AI consumption
This approach ensures that the generated skills accurately reflect the codebase structure and provide clear, actionable guidance for AI coding tools.
The Process
Understand the Repository
Analyze the source code to identify all publicly exposed APIs, objects, classes, interfaces, enums, services, and other constructs. Summarize your findings and present them to the user for confirmation.
Ask the user these questions:
Is this summary correct?
- [ ] Confirm - The summary is accurate, proceed to next step
- [ ] Revise - Need to add/remove/modify APIs
- [ ] Add context - Provide additional notes
If "Revise" or "Add context" selected, ask:
- Which APIs need to be added, removed, or modified?
- Any additional context or notes to include?
Once confirmed, proceed to determine the partitioning strategy.
Determine the Partitioning Strategy
Ask the user to choose how to organize the generated documentation files based on the project structure. Present the following options:
- By namespace - Group APIs by their namespace/package structure
- By folder - Group APIs by their folder location in the source tree
- By file - Create one documentation file per source file
Confirm with the user:
- Which partitioning strategy works best for this project?
- Any specific folder/naming conventions to follow?
This ensures the generated documentation structure matches the logical organization of the codebase.
Document and Generate API Files
Based on the confirmed list of APIs, document each API through collaborative dialogue and write the content to a file immediately after confirmation.
For each API, confirm and document the following:
- API Declaration - The exact function/class/interface signature as it appears in the source code
- Description - A clear explanation of what the API does and its purpose
- Usage Scenarios - When and why a user would use this API, including common use cases
- Example Code - Practical code snippets demonstrating how to use the API correctly
Workflow for each API:
- Present the current documentation draft to the user
- Ask for confirmation on each element (declaration, description, scenarios, examples)
- Incorporate user feedback iteratively and present the revised content
- Repeat the feedback loop until the user confirms the documentation is correct
- Once confirmed, write the validated content to:
/<skill-name>/references/<folder>/<api>.md- Proceed to the next API and repeat
File path structure:
<skill-name>- The name of the skill being created<folder>- The folder determined by the partitioning strategy<api>- The name of the API being documented
Each .md file should contain the confirmed documentation for a single API, formatted clearly for AI coding tools to reference.
Update Main Skill Documentation
After all public API documentation files have been generated, update the main skill documentation (<skill-name>/SKILL.md) to include references to all documented APIs.
Generate Or Update the SKILL.md to:
- Include required metadata at the top of the file:
---
name: <skill-name>
description: "<brief description of the library and its purpose>"
---- Add a section listing all available APIs organized by the chosen partitioning strategy
- Provide brief descriptions or links to each API's detailed documentation
- Ensure the table of contents (if present) reflects all newly added API documentation
This step ensures users can easily discover and navigate all available API documentation from the main skill file.
Key Constraints
- Prefer multiple choice - Structure questions as single-select options whenever possible
- Recommend with rationale - When presenting options, lead with the recommended approach followed by brief explanations