Skip to main content

agentic-ai-prompt-research

Research collection of reconstructed prompt patterns and architectures for agentic AI coding assistants

الانتقال إلى التثبيت

معلومات المصدر

المستودع
reason-machines/ai-agent-skills
آخر نشاط في المصدر
١٧ مايو ٢٠٢٦ في ١٣:٣٦
لغة SKILL.md المكتشفة
الإنجليزية
النجوم
١
التفرعات
١

خيارات التثبيت

يُحدَّد Prompt الذي يراجع المصدر أولًا بشكل افتراضي. يمكنك التبديل إلى أمر مباشر أو تنزيل نسخة محلية.

مراجعة ملفات المصدر

اقرأ SKILL.md وأي ملفات مرافقة يعرضها SkillsMP قبل أن تقرر التثبيت.

عرض SKILL.md

SKILL.md
تعليمات المصدر · معاينة للقراءة فقط
name
agentic-ai-prompt-research
description
Research collection of reconstructed prompt patterns and architectures for agentic AI coding assistants
triggers
["show me agentic AI prompt patterns","how do AI coding assistants work internally","explain prompt architecture for autonomous agents","what are the system prompts for Claude Code","help me design a multi-agent coding system","show me security patterns for AI tool approval","how to build context window management","explain agent coordination patterns"]
# Agentic AI Prompt Research > Skill by [ara.so](https://ara.so) — AI Agent Skills collection. This project documents reconstructed prompt patterns and architectural designs from modern agentic AI coding assistants. It provides educational insights into how systems like Claude Code assemble dynamic prompts, coordinate multiple agents, manage security, and handle context windows. ## What This Project Provides A collection of 30+ documented patterns covering: - **Core Identity**: Main system prompts, simple mode, default agent instructions, security boundaries - **Orchestration**: Coordinator prompts, multi-agent communication protocols - **Specialized Agents**: Verification, exploration, agent creation, configuration agents - **Security**: Permission explainers, auto-approval classifiers, risk assessment - **Context Management**: Conversation compaction, memory selection, session search - **Skills**: Reusable multi-agent workflows (simplify, skillify, stuck, remember) All patterns are based on behavioral observation and reverse engineering, not leaked proprietary code. ## Installation ```bash # Clone the repository git clone https://github.com/Leonxlnx/agentic-ai-prompt-research.git cd agentic-ai-prompt-research # Browse the prompts directory ls prompts/ ``` No build or installation required — this is a documentation and research repository. ## Repository Structure ``` prompts/ ├── 01_main_system_prompt.md # Dynamic prompt assembly ├── 02_simple_mode.md # Minimal operation mode ├── 03_default_agent_prompt.md # Base agent instructions ├── 04_cyber_risk_instruction.md # Security boundaries ├── 05_coordinator_system_prompt.md # Multi-agent orchestration ├── 06_teammate_prompt_addendum.md # Agent communication ├── 07_verification_agent.md # Adversarial testing ├── 08_explore_agent.md # Read-only exploration ├── 09_agent_creation_architect.md # Dynamic agent generation ├── 10_statusline_setup_agent.md # Terminal configuration ├── 11_permission_explainer.md # Risk assessment ├── 12_yolo_auto_mode_classifier.md # Security classification ├── 13_tool_prompts.md # Tool-specific instructions ├── 14_tool_use_summary.md # Action summarization ├── 15_session_search.md # Semantic search ├── 16_memory_selection.md # Context selection ├── 17_auto_mode_critique.md # Classifier review ├── 18_proactive_mode.md # Autonomous operation ├── 19_simplify_skill.md # Code review pattern ├── 20_session_title.md # Title generation ├── 21_compact_service.md # Context compression ├── 22_away_summary.md # Session recaps ├── 23_chrome_browser_automation.md # Browser integration ├── 24_memory_instruction.md # Memory hierarchy ├── 25_skillify.md # Skill creation workflow ├── 26_stuck_skill.md # Diagnostic patterns ├── 27_remember_skill.md # Memory management ├── 28_update_config_skill.md # Configuration updates ├── 29_agent_summary.md # Progress updates └── 30_prompt_suggestion.md # Follow-up prediction ``` ## Key Architectural Patterns ### 1. Dynamic Prompt Assembly The system assembles prompts from modular components: ``` ┌─────────────────────────────────────┐ │ Cacheable Prefix (stable) │ │ - Identity & safety rules │ │ - Permission configuration │ │ - Code style preferences │ │ - Tool usage patterns │ ├─────────────────────────────────────┤ ← Cache boundary │ Dynamic Suffix (per-session) │ │ - Available agents/skills │ │ - Memory file contents │ │ - Environment context │ │ - Active MCP servers │ └─────────────────────────────────────┘ ``` **Example pattern from `01_main_system_prompt.md`:** ```markdown # Core identity established first You are Claude Code, an agentic AI coding assistant... # Tool preferences defined When editing files, prefer multi_file_edit for batching... # Security boundaries set Never execute commands that could compromise user data... # Dynamic sections injected [AVAILABLE_AGENTS: verification, explore, statusline_setup] [MEMORY_FILES: .claude/project_rules.md, .claude/preferences.md] [ENVIRONMENT: OS=linux, SHELL=bash, CWD=/home/user/project] ``` ### 2. Multi-Agent Coordination **Coordinator Pattern** (`05_coordinator_system_prompt.md`): ```markdown ## Phased Workflow 1. **Planning Phase**: Break task into subtasks 2. **Delegation Phase**: Assign workers with specific contexts 3. **Synthesis Phase**: Merge results and resolve conflicts ## Worker Communication - Workers receive: task description, relevant files, constraints - Workers return: results, confidence score, blockers - Coordinator decides: accept, retry, escalate ``` **Implementation approach:** ```python # Conceptual multi-agent orchestration class AgentCoordinator: def execute_task(self, user_request: str): # Phase 1: Planning subtasks = self.plan(user_request) # Phase 2: Delegation workers = [ self.spawn_agent("worker", task=t, context=self.get_context(t)) for t in subtasks ] results = [w.execute() for w in workers] # Phase 3: Synthesis return self.merge_results(results) def spawn_agent(self, agent_type: str, task: str, context: dict): # Load base prompt + agent-specific addendum base_prompt = self.load_prompt("03_default_agent_prompt.md") agent_prompt = self.load_prompt(f"{agent_type}_prompt.md") return Agent( system_prompt=f"{base_prompt}\n\n{agent_prompt}", task=task, context=context ) ``` ### 3. Security Classification **Multi-stage auto-approval** (`12_yolo_auto_mode_classifier.md`): ```python class SecurityClassifier: def classify_tool_call(self, tool: str, args: dict) -> str: """Returns: 'safe', 'unsafe', or 'uncertain'""" # Stage 1: Fast predefined rules if tool == "bash" and "rm -rf" in args.get("command", ""): return "unsafe" if tool == "read_file" and not self.accesses_sensitive_path(args["path"]): return "safe" # Stage 2: User-defined overrides for rule in self.user_classifier_rules: result = rule.evaluate(tool, args) if result != "uncertain": return result # Stage 3: Extended reasoning (slower) return self.llm_classify_with_reasoning(tool, args) def accesses_sensitive_path(self, path: str) -> bool: sensitive = ["/etc/passwd", "~/.ssh", ".env"] return any(s in path for s in sensitive) ``` **User-configurable rules** (`.claude/auto_mode_rules.md`): ```yaml rules: - pattern: "read_file:docs/**" verdict: safe reason: "Documentation is always safe to read" - pattern: "bash:git push *" verdict: unsafe reason: "Always confirm before pushing code" - pattern: "edit_file:**/test_*.py" verdict: safe reason: "Test file edits are low-risk" ``` ### 4. Memory Hierarchy **Loading order** (`24_memory_instruction.md`): ```python class MemoryLoader: def load_context(self, project_path: str) -> str: """Load memory files in priority order (earliest = lowest priority)""" layers = [ # 1. Enterprise/managed configuration self.load_if_exists("/etc/claude/enterprise_policy.md"), # 2. User global preferences self.load_if_exists("~/.claude/global_preferences.md"), # 3. Project-level shared instructions self.load_if_exists(f"{project_path}/.claude/project_rules.md"), # 4. Project rules directory (supports includes) *self.load_directory(f"{project_path}/.claude/rules/"), # 5. Local overrides (private, gitignored) self.load_if_exists(f"{project_path}/.claude/local_overrides.md"), ] # Later layers override earlier ones return self.merge_with_precedence(layers) def merge_with_precedence(self, layers: list[str]) -> str: """Handle conflicting instructions by priority""" merged = {} for layer in layers: directives = self.parse_directives(layer) merged.update(directives) # Later overwrites earlier return self.serialize(merged) ``` **Transitive includes:** ```markdown <!-- project_rules.md --> # Project Rules @include ./rules/code_style.md @include ./rules/testing_requirements.md <!-- Conditional inclusion --> @include ./rules/python_specific.md if file_extension == ".py" ``` ### 5. Context Window Management **Compaction strategy** (`21_compact_service.md`): ```python class ContextCompactor: def compact_conversation(self, messages: list[dict]) -> list[dict]: """Summarize old messages to fit within context window""" # Keep recent messages verbatim recent_cutoff = len(messages) - 10 recent = messages[recent_cutoff:] old = messages[:recent_cutoff] # Identify which old messages to keep fully important = self.filter_important(old) # Tool uses, errors, decisions # Summarize the rest summaries = self.batch_summarize( [m for m in old if m not in important], max_tokens_per_summary=150 ) return summaries + important + recent def filter_important(self, messages: list[dict]) -> list[dict]: """Keep tool uses, errors, and key decisions""" important = [] for msg in messages: if msg.get("tool_use"): important.append(msg) elif "error" in msg.get("content", "").lower(): important.append(msg) elif msg.get("flagged_as_important"): important.append(msg) return important ``` ### 6. Specialized Agent Patterns **Verification Agent** (`07_verification_agent.md`): ```markdown ## Your Role You are an adversarial testing agent. After another agent implements a feature, your job is to break it. ## Testing Strategy 1. **Read the implementation** - Understand what was built 2. **Generate test cases** - Focus on edge cases and error conditions 3. **Execute tests** - Run them and document failures 4. **Report findings** - Clear reproduction steps ## Test Categories - Boundary conditions (empty input, max values) - Error handling (invalid input, network failures) - Race conditions (concurrent access) - Security (injection, unauthorized access) ## Constraints - Read-only access to implementation - Create test files in `tests/` directory - Use project's testing framework - No modifications to implementation code ``` **Explore Agent** (`08_explore_agent.md`): ```markdown ## Your Role You explore codebases to answer questions. You have read-only access. ## Available Tools - `read_file`: Read any file - `list_directory`: Browse directory structure - `search_code`: Semantic code search - `grep`: Pattern matching across files ## Constraints - NEVER use edit_file or write_file - NEVER use bash to modify files - Focus on understanding, not changing ## Exploration Strategy 1. Start broad (directory structure, README) 2. Identify entry points (main files, key modules) 3. Follow dependencies 4. Document findings concisely ``` ### 7. Skill Patterns **Simplify Skill** (`19_simplify_skill.md`) - Multi-agent parallel review: ```python class SimplifySkill: """Spawn multiple agents to review code in parallel""" def execute(self, target_files: list[str]): # Spawn review agents in parallel agents = [ self.spawn_agent("reviewer", { "file": f, "focus": "complexity", "constraints": "suggest simplifications, not rewrites" }) for f in target_files ] # Collect suggestions suggestions = [a.execute() for a in agents] # Coordinator merges and deduplicates return self.merge_suggestions(suggestions) ``` **Skillify Skill** (`25_skillify.md`) - Interview-based skill creation: ```markdown ## Process 1. **Interview user** about the skill they want to create - What problem does it solve? - What tools/agents are needed? - What are success criteria? 2. **Generate skill specification** ```yaml name: custom-skill-name description: One-line description triggers: [list of natural language triggers] agents: [required agent types] tools: [required tool access] workflow: [step-by-step process] ``` 3. **Write skill implementation** as markdown file 4. **Test skill** with sample scenarios 5. **Save to** `.claude/skills/custom-skill-name.md` ``` ## Usage Examples ### Building a Custom Agent System ```python # Using patterns from this research to build your own agent import anthropic class CustomAgentSystem: def __init__(self, api_key: str): self.client = anthropic.Anthropic(api_key=api_key) self.prompts = self.load_prompt_library() def load_prompt_library(self) -> dict: """Load reconstructed prompts from this repository""" return { "coordinator": open("prompts/05_coordinator_system_prompt.md").read(), "default_agent": open("prompts/03_default_agent_prompt.md").read(), "security": open("prompts/04_cyber_risk_instruction.md").read(), } def create_coordinator(self, task: str) -> str: """Create a coordinator agent for a complex task""" system_prompt = f""" {self.prompts['default_agent']} {self.prompts['coordinator']} {self.prompts['security']} Available sub-agents: explore, verification, implementation Current task: {task} """ response = self.client.messages.create(
عرض على GitHub
ملف SKILL.md هذا كبير جدا، لذلك يعرض SkillsMP القسم الاول فقط هنا. عرض على GitHub