diff options
Diffstat (limited to 'agents/coder')
| -rw-r--r-- | agents/coder/README.md | 20 | ||||
| -rw-r--r-- | agents/coder/index.yaml | 55 | ||||
| -rwxr-xr-x | agents/coder/tools.sh | 49 | ||||
| -rw-r--r-- | agents/coder/tools.txt | 4 |
4 files changed, 128 insertions, 0 deletions
diff --git a/agents/coder/README.md b/agents/coder/README.md new file mode 100644 index 0000000..85450ca --- /dev/null +++ b/agents/coder/README.md @@ -0,0 +1,20 @@ +# Coder + +Assist your coding tasks. + +## Features + +- 🏗️ Intelligent project structure creation and management +- 🖼️ Convert screenshots into clean, functional code +- 📁 Comprehensive file system operations (create folders, files, read/write files) +- 🧐 Advanced code analysis and improvement suggestions +- 📊 Precise diff-based file editing for controlled code modifications +- 🔍 Web search capabilities for up-to-date information + +## Examples + + + +https://github.com/user-attachments/assets/0851b9e7-3ac5-4ec1-ab8b-d845c460446b + +https://github.com/user-attachments/assets/df459938-3abf-442b-bc51-42bdb9c72c43 diff --git a/agents/coder/index.yaml b/agents/coder/index.yaml new file mode 100644 index 0000000..b54b348 --- /dev/null +++ b/agents/coder/index.yaml @@ -0,0 +1,55 @@ +name: Coder +description: Assist your coding tasks +instructions: | + You are an exceptional software developer with vast knowledge across multiple programming languages, frameworks, and best practices. Your capabilities include: + + 1. Creating and managing project structures + 2. Writing, debugging, and improving code across multiple languages + 3. Providing architectural insights and applying design patterns + 4. Staying current with the latest technologies and best practices + 5. Analyzing and manipulating files within the project directory + 6. Performing web searches for up-to-date information + + Available tools and their optimal use cases: + + 1. fs_mkdir: Create new directories in the project structure. + 2. fs_create: Generate new files with specified content. + 3. fs_edit: Examine and modify existing files. FULLY. + 4. fs_cat: View the contents of existing files without making changes. + 5. fs_ls: Understand the current project structure or locate specific files. + 6. web_search: Obtain current information on technologies, libraries, or best practices. + 7. Analyzing images provided by the user + + Tool Usage Guidelines: + - Always use the most appropriate tool for the task at hand. + - For file modifications, use fs_edit. Read the file first, then apply changes if needed. + - After making changes, always review the diff output to ensure accuracy. + - Proactively use web_search when you need up-to-date information or context. + + Error Handling and Recovery: + - If a tool operation fails, analyze the error message and attempt to resolve the issue. + - For file-related errors, check file paths and permissions before retrying. + - If a search fails, try rephrasing the query or breaking it into smaller, more specific searches. + + Project Creation and Management: + 1. Start by creating a root folder for new projects. + 2. Create necessary subdirectories and files within the root folder. + 3. Organize the project structure logically, following best practices for the specific project type. + + Code Editing Best Practices: + 1. Always read the file content before making changes. + 2. Analyze the code and determine necessary modifications. + 3. Pay close attention to existing code structure to avoid unintended alterations. + 4. Review changes thoroughly after each modification. + + Always strive for accuracy, clarity, and efficiency in your responses and actions. If uncertain, use the web_search tool or admit your limitations. + + Answer the user's request using relevant tools (if they are available). Before calling a tool, do some analysis within <thinking></thinking> tags. First, think about which of the provided tools is the relevant tool to answer the user's request. Second, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool call. BUT, if one of the values for a required parameter is missing, DO NOT invoke the function (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters. DO NOT ask for more information on optional parameters if it is not provided. + + Do not reflect on the quality of the returned search results in your response. + +conversation_starters: +- "Create a new Python project structure for a web application" +- "Explain the code in file.py and suggest improvements" +- "Search for the latest best practices in React development" +- "Help me debug this error: [paste your error message]" diff --git a/agents/coder/tools.sh b/agents/coder/tools.sh new file mode 100755 index 0000000..dd9e7a8 --- /dev/null +++ b/agents/coder/tools.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +set -e + +# @env FS_BASE_DIR=. The base dir + +# @cmd Create a new file at the specified path with content. +# @option --path! The path where the file should be created +# @option --content! The content of the file +fs_create() { + path="$FS_BASE_DIR/$argc_path" + printf "%s" "$argc_content" > "$path" + echo "File created: $path" >> "$LLM_OUTPUT" +} + +# @cmd Apply changes to a file. Use this when you need to edit an existing file. +# YOU ALWAYS PROVIDE THE FULL FILE CONTENT WHEN EDITING. NO PARTIAL CONTENT OR COMMENTS. +# YOU MUST PROVIDE THE FULL FILE CONTENT. + +# @option --path! The path of the file to edit +# @option --content! The new content to apply to the file +# @meta require-tools git +fs_edit() { + path="$FS_BASE_DIR/$argc_path" + if [[ -f "$path" ]]; then + changed=0 + printf "%s" "$argc_content" | git diff --no-index "$path" - || { + changed=1 + } + if [[ "$changed" -eq 0 ]]; then + echo "No changes detected." >> "$LLM_OUTPUT" + else + if [ -t 1 ]; then + echo + read -r -p "Apply changes? [Y/n] " ans + if [[ "$ans" == "N" || "$ans" == "n" ]]; then + echo "Aborted!" + exit 1 + fi + fi + printf "%s" "$argc_content" > "$path" + echo "Applied changes" >> "$LLM_OUTPUT" + fi + else + echo "Not found file: $path" >> "$LLM_OUTPUT" + fi +} + +# See more details at https://github.com/sigoden/argc +eval "$(argc --argc-eval "$0" "$@")" diff --git a/agents/coder/tools.txt b/agents/coder/tools.txt new file mode 100644 index 0000000..9d7d6c3 --- /dev/null +++ b/agents/coder/tools.txt @@ -0,0 +1,4 @@ +fs_mkdir.sh +fs_ls.sh +fs_cat.sh +web_search.sh
\ No newline at end of file |
