autonomous-agent-patterns
构建自主AI智能体
学习经过验证的设计模式,用于创建具有正确工具集成、权限系统和安全控制的自主编码智能体。这对于构建AI驱动开发工具的开发者来说是必不可少的。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“autonomous-agent-patterns”。 Show me how to build an agent that can read and edit files with proper permission controls.
预期结果:
A Python implementation showing: 1) FileTool base class with JSON schema, 2) ReadFileTool and EditFileTool implementations, 3) PermissionLevel enum with AUTO/ASK_ONCE/ASK_EACH/NEVER levels, 4) ApprovalManager that checks permission config before executing tools, 5) Example config mapping read_file to AUTO and write_file to ASK_ONCE.
正在使用“autonomous-agent-patterns”。 How do I create a visual agent that can click buttons on web pages by describing them?
预期结果:
A VisualAgent pattern using: 1) BrowserTool with Playwright for screenshot capture, 2) Vision model integration to analyze screenshots, 3) find_and_click method that asks LLM to locate elements by description and return coordinates, 4) Mouse click at detected coordinates. Includes error handling for elements not found.
正在使用“autonomous-agent-patterns”。 Design a checkpoint system for long-running agent tasks.
预期结果:
CheckpointManager class with: 1) save_checkpoint method capturing history, context, workspace state (git status), and metadata, 2) restore_checkpoint to reload state, 3) Uses JSON storage with session IDs, 4) Includes workspace capture via git commands for state tracking.
安全审计
安全This skill is a reference documentation resource containing code examples for building autonomous agents. All detected patterns (external_commands, network, filesystem, env_access) are documentation examples demonstrating legitimate agent patterns, not actual executable malicious code. The skill does not contain prompt injection attempts or malicious intent. All findings are false positives - the skill is educational content about agent architecture.
质量评分
你能构建什么
构建Claude Code扩展
创建使用Claude进行自主代码编辑的VS Code扩展或CLI工具,并配备正确的权限控制。
设计安全的智能体API
为AI智能体框架实现具有权限级别、审批对话框和沙盒化的工具调用API。
为智能体添加浏览器自动化
通过视觉元素检测和自动化,使您的AI智能体能够与Web应用程序交互。
试试这些提示
展示如何在Python中实现一个基础的智能体循环,使用LLM来决定何时使用工具以及何时返回最终答案。
为AI智能体创建一个权限系统,包含不同级别:安全操作自动批准、中等风险一次性询问、危险命令每次询问、以及禁止操作永不允许。
编写一个Python类,在沙盒环境中安全地执行shell命令,限制可运行的命令并将文件系统访问限制在工作目录内。
展示如何实现动态MCP服务器连接,发现可用工具并允许根据用户描述在运行时创建新工具。
最佳实践
- 始终实施权限级别 - 自动批准安全的读取操作,但需要对文件写入和命令执行进行审批
- 使用沙盒化执行环境来限制可访问的命令和文件系统路径
- 使用清晰的JSON模式定义工具,以便LLM理解每个工具的功能及其参数
避免
- 允许无限制的命令执行而没有权限检查或沙盒化
- 为智能体提供无限上下文而没有适当的上下文管理和大小限制
- 实现描述模糊的工具,使得工具的功能不明确