Markdown Organizer Skill (LLM-Enhanced)
This skill helps in managing a collection of Markdown articles by leveraging Large Language Models (LLM) for semantic understanding, categorization, and summarization.
Prerequisites
- Python Package: Ensure
markdown-it-py is installed in your environment (pip install markdown-it-py).
How to Use
When invoked with a task related to organizing or summarizing Markdown content, this skill will prepare prompts for an LLM (such as myself) to process the content.
Input Source:
- A
dir_path pointing to a directory containing Markdown files (.md).
- A
file_path pointing to a specific Markdown file.
Task Specification: The prompt should clearly indicate the desired action:
categorize:
- Action: Calls
scripts/categorizer.py which will return a dictionary containing an llm_prompt for categorization.
- User/Agent Role: You (the agent) will read this
llm_prompt and provide the categories as a comma-separated list.
- (Optional)
categories_list: You can pass a list of suggested categories to the script, which will be included in the prompt. If not provided, a default list from resources/category_keywords.json will be used.
summarize:
- Action: Calls
scripts/summarizer.py which will return a dictionary containing an llm_prompt for summarization.
- User/Agent Role: You (the agent) will read this
llm_prompt and provide the summary text.
organize:
- Action: Requires prior categorization. Once categories are determined (e.g., by the LLM), this action calls
scripts/organizer.py to move files into category-specific subdirectories.
- Input: Requires the
file_path and the determined category.
generate_summary_file:
- Action: Creates a summary Markdown file based on a list of article data (titles, paths, and their LLM-generated summaries).
- Input: Requires
articles_data (list of dicts: {'title': '...', 'path': '...', 'summary': '...'}), category_name, and optionally output_dir.
search:
- Action: Calls
scripts/search_engine.py to search for content within the managed Markdown articles (currently keyword-based).
generate_code:
- Action: Calls
scripts/code_generator.py which will return a dictionary containing an llm_prompt for code generation.
- User/Agent Role: You (the agent) will read this
llm_prompt and provide the generated code.
- Input: Requires
file_path and optionally language (defaults to "Python").
Resources
resources/category_keywords.json: Contains a list of suggested_categories for the LLM to consider during categorization. This list can be customized.
resources/summary_template.md: A Jinja2 template used by summarizer.py to format the final summary Markdown file.
Scripts
scripts/markdown_parser.py: Parses Markdown files, extracting plain text content and headings for LLM processing.
scripts/categorizer.py: Prepares an LLM prompt for categorizing an article based on its content.
scripts/organizer.py: Handles file system operations to move categorized articles into designated directories.
scripts/summarizer.py: Prepares an LLM prompt for summarizing an article and formats category summary files.
scripts/search_engine.py: Provides keyword-based search functionality across Markdown articles.
scripts/code_generator.py: Sets up LLM prompts for generating code snippets from article content.
Example Invocation (Conceptual)
Let's say you want to categorize and summarize a file /path/to/my_article.md:
Get Categorization Prompt:
# This would be an internal call by the agent
from scripts.categorizer import categorize_content_llm_prompt
result = categorize_content_llm_prompt(file_path="/path/to/my_article.md")
# result will contain {'llm_prompt': "Please categorize...", 'file_path': '...', 'title': '...'}
print(result['llm_prompt'])
Agent's Response (example): "Machine Learning, Neural Networks"
Get Summarization Prompt:
# This would be an internal call by the agent
from scripts.summarizer import summarize_content_llm_prompt
result = summarize_content_llm_prompt(file_path="/path/to/my_article.md")
# result will contain {'llm_prompt': "Please provide a concise...", 'file_path': '...', 'title': '...'}
print(result['llm_prompt'])
Agent's Response (example): "This article introduces..."
Organize File (after categorization):
# This would be an internal call by the agent based on the categorization
from scripts.organizer import organize_files
new_path = organize_files(file_path="/path/to/my_article.md", category="Machine Learning", base_dir="/path/to/organized_articles")
# new_path might be "/path/to/organized_articles/Machine Learning/my_article.md"
Generate Code:
# This would be an internal call by the agent based on the article content
from scripts.code_generator import generate_code_llm_prompt
result = generate_code_llm_prompt(file_path="/path/to/my_algorithm_article.md", language="Python")
# result will contain {'llm_prompt': "Based on the following...", 'file_path': '...', 'title': '...', 'language': 'Python'}
print(result['llm_prompt'])
Agent's Response (example):
# Generated Python code for the algorithm described in the article
def my_algorithm(...):
# ... implementation ...
1---2name: markdown-organizer3description: A skill to read, organize, categorize, and summarize Markdown articles using LLM for semantic understanding, facilitating knowledge management.4---56# Markdown Organizer Skill (LLM-Enhanced)78This skill helps in managing a collection of Markdown articles by leveraging Large Language Models (LLM) for semantic understanding, categorization, and summarization.910## Prerequisites1112* **Python Package**: Ensure `markdown-it-py` is installed in your environment (`pip install markdown-it-py`).1314## How to Use1516When invoked with a task related to organizing or summarizing Markdown content, this skill will prepare prompts for an LLM (such as myself) to process the content.17181. **Input Source**:19 * A `dir_path` pointing to a directory containing Markdown files (`.md`).20 * A `file_path` pointing to a specific Markdown file.21222. **Task Specification**: The prompt should clearly indicate the desired action:2324 * **`categorize`**:25 * **Action**: Calls `scripts/categorizer.py` which will return a dictionary containing an `llm_prompt` for categorization.26 * **User/Agent Role**: You (the agent) will read this `llm_prompt` and provide the categories as a comma-separated list.27 * **(Optional) `categories_list`**: You can pass a list of suggested categories to the script, which will be included in the prompt. If not provided, a default list from `resources/category_keywords.json` will be used.2829 * **`summarize`**:30 * **Action**: Calls `scripts/summarizer.py` which will return a dictionary containing an `llm_prompt` for summarization.31 * **User/Agent Role**: You (the agent) will read this `llm_prompt` and provide the summary text.3233 * **`organize`**:34 * **Action**: Requires prior categorization. Once categories are determined (e.g., by the LLM), this action calls `scripts/organizer.py` to move files into category-specific subdirectories.35 * **Input**: Requires the `file_path` and the determined `category`.3637 * **`generate_summary_file`**:38 * **Action**: Creates a summary Markdown file based on a list of article data (titles, paths, and their LLM-generated summaries).39 * **Input**: Requires `articles_data` (list of dicts: `{'title': '...', 'path': '...', 'summary': '...'}`), `category_name`, and optionally `output_dir`.4041 * **`search`**:42 * **Action**: Calls `scripts/search_engine.py` to search for content within the managed Markdown articles (currently keyword-based).4344 * **`generate_code`**:45 * **Action**: Calls `scripts/code_generator.py` which will return a dictionary containing an `llm_prompt` for code generation.46 * **User/Agent Role**: You (the agent) will read this `llm_prompt` and provide the generated code.47 * **Input**: Requires `file_path` and optionally `language` (defaults to "Python").4849## Resources5051* `resources/category_keywords.json`: Contains a list of `suggested_categories` for the LLM to consider during categorization. This list can be customized.52* `resources/summary_template.md`: A Jinja2 template used by `summarizer.py` to format the final summary Markdown file.5354## Scripts5556* `scripts/markdown_parser.py`: Parses Markdown files, extracting plain text content and headings for LLM processing.57* `scripts/categorizer.py`: Prepares an LLM prompt for categorizing an article based on its content.58* `scripts/organizer.py`: Handles file system operations to move categorized articles into designated directories.59* `scripts/summarizer.py`: Prepares an LLM prompt for summarizing an article and formats category summary files.60* `scripts/search_engine.py`: Provides keyword-based search functionality across Markdown articles.61* `scripts/code_generator.py`: Sets up LLM prompts for generating code snippets from article content.6263## Example Invocation (Conceptual)6465Let's say you want to categorize and summarize a file `/path/to/my_article.md`:66671. **Get Categorization Prompt**:68 ```python69 # This would be an internal call by the agent70 from scripts.categorizer import categorize_content_llm_prompt71 result = categorize_content_llm_prompt(file_path="/path/to/my_article.md")72 # result will contain {'llm_prompt': "Please categorize...", 'file_path': '...', 'title': '...'}73 print(result['llm_prompt'])74 ```75 **Agent's Response (example)**: "Machine Learning, Neural Networks"76772. **Get Summarization Prompt**:78 ```python79 # This would be an internal call by the agent80 from scripts.summarizer import summarize_content_llm_prompt81 result = summarize_content_llm_prompt(file_path="/path/to/my_article.md")82 # result will contain {'llm_prompt': "Please provide a concise...", 'file_path': '...', 'title': '...'}83 print(result['llm_prompt'])84 ```85 **Agent's Response (example)**: "This article introduces..."86873. **Organize File (after categorization)**:88 ```python89 # This would be an internal call by the agent based on the categorization90 from scripts.organizer import organize_files91 new_path = organize_files(file_path="/path/to/my_article.md", category="Machine Learning", base_dir="/path/to/organized_articles")92 # new_path might be "/path/to/organized_articles/Machine Learning/my_article.md"93 ```94954. **Generate Code**:96 ```python97 # This would be an internal call by the agent based on the article content98 from scripts.code_generator import generate_code_llm_prompt99 result = generate_code_llm_prompt(file_path="/path/to/my_algorithm_article.md", language="Python")100 # result will contain {'llm_prompt': "Based on the following...", 'file_path': '...', 'title': '...', 'language': 'Python'}101 print(result['llm_prompt'])102 ```103 **Agent's Response (example)**:104 ```python105 # Generated Python code for the algorithm described in the article106 def my_algorithm(...):107 # ... implementation ...108 ```