tool-design-pattern
Automatically applies when creating AI tool functions. Ensures proper schema design, input validation, error handling, context access, and comprehensive testing.
npx skills add majiayu000/claude-skill-registry --skill tool-design-pattern --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# AI Tool Design Pattern Enforcer When creating tools for AI agents (LangChain, function calling, etc.), follow these design patterns. ## ✅ Standard Tool Pattern ```python from langchain.tools import tool from pydantic import BaseModel, Field from typing import Optional import logging logger = logging.getLogger(__name__) # 1. Define input schema class SearchInput(BaseModel): """Input schema for search tool.""" query: str = Field(..., description="Search query string") max_results: int = Field( default=10, ge=1, le=100, description="Maximum number of results to return" ) filter_type: Optional[str] = Field( None, description="Optional filter type (e.g., 'recent', 'popular')" ) # 2. Implement tool function @tool(args_schema=SearchInput) def search_database(query: str, max_results: int = 10, filter_type: Optional[str] = None) -> str: """ Search database for relevant information. Use this tool when user asks to find, search, or look up information. Returns JSON string with search results. Args: query: Search query string max_results: Maximum number of results (1-100) filter_type: Optional filter (recent, popular) Returns: JSON string with results or error message """ request_id = str(uu
- ✅ Standard Tool Pattern
- Tool Schema Design
- Error Handling Pattern
- Context Access Pattern
- Async Tool Pattern
- Testing Tools
- ❌ Anti-Patterns
- Best Practices Checklist
- Auto-Apply
- Related Skills
What does the tool-design-pattern skill do?
Automatically applies when creating AI tool functions. Ensures proper schema design, input validation, error handling, context access, and comprehensive testing.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill tool-design-pattern --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
