mirror of
https://github.com/anthropics/skills
synced 2026-07-05 19:56:54 +00:00
Compare commits
8 Commits
klazuka/ad
...
klazuka/ex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba8e7042a9 | ||
|
|
00756142ab | ||
|
|
ef740771ac | ||
|
|
0f77e501e6 | ||
|
|
e5c60158df | ||
|
|
c74d647e56 | ||
|
|
0877baec7e | ||
|
|
b118d29ea4 |
@@ -15,10 +15,10 @@
|
||||
"source": "./",
|
||||
"strict": false,
|
||||
"skills": [
|
||||
"./document-skills/xlsx",
|
||||
"./document-skills/docx",
|
||||
"./document-skills/pptx",
|
||||
"./document-skills/pdf"
|
||||
"./skills/xlsx",
|
||||
"./skills/docx",
|
||||
"./skills/pptx",
|
||||
"./skills/pdf"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -27,16 +27,18 @@
|
||||
"source": "./",
|
||||
"strict": false,
|
||||
"skills": [
|
||||
"./skill-creator",
|
||||
"./mcp-builder",
|
||||
"./canvas-design",
|
||||
"./algorithmic-art",
|
||||
"./internal-comms",
|
||||
"./webapp-testing",
|
||||
"./artifacts-builder",
|
||||
"./slack-gif-creator",
|
||||
"./theme-factory",
|
||||
"./brand-guidelines"
|
||||
"./skills/algorithmic-art",
|
||||
"./skills/brand-guidelines",
|
||||
"./skills/canvas-design",
|
||||
"./skills/doc-coauthoring",
|
||||
"./skills/frontend-design",
|
||||
"./skills/internal-comms",
|
||||
"./skills/mcp-builder",
|
||||
"./skills/skill-creator",
|
||||
"./skills/slack-gif-creator",
|
||||
"./skills/theme-factory",
|
||||
"./skills/web-artifacts-builder",
|
||||
"./skills/webapp-testing"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
.DS_Store
|
||||
__pycache__/
|
||||
|
||||
|
||||
61
README.md
61
README.md
@@ -9,49 +9,52 @@ For more information, check out:
|
||||
|
||||
# About This Repository
|
||||
|
||||
This repository contains example skills that demonstrate what's possible with Claude's skills system. These examples range from creative applications (art, music, design) to technical tasks (testing web apps, MCP server generation) to enterprise workflows (communications, branding, etc.).
|
||||
This repository contains skills that demonstrate what's possible with Claude's skills system. These skills range from creative applications (art, music, design) to technical tasks (testing web apps, MCP server generation) to enterprise workflows (communications, branding, etc.).
|
||||
|
||||
Each skill is self-contained in its own directory with a `SKILL.md` file containing the instructions and metadata that Claude uses. Browse through these examples to get inspiration for your own skills or to understand different patterns and approaches.
|
||||
Each skill is self-contained in its own folder with a `SKILL.md` file containing the instructions and metadata that Claude uses. Browse through these skills to get inspiration for your own skills or to understand different patterns and approaches.
|
||||
|
||||
**Note:** These are reference examples for inspiration and learning. They showcase general-purpose capabilities rather than organization-specific workflows or sensitive content.
|
||||
Many skills in this repo are open source (Apache 2.0). We've also included the document creation & editing skills that power [Claude's document capabilities](https://www.anthropic.com/news/create-files) under the hood in the [`skills/docx`](./skills/docx), [`skills/pdf`](./skills/pdf), [`skills/pptx`](./skills/pptx), and [`skills/xlsx`](./skills/xlsx) subfolders. These are source-available, not open source, but we wanted to share these with developers as a reference for more complex skills that are actively used in a production AI application.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
**These skills are provided for demonstration and educational purposes only.** While some of these capabilities may be available in Claude, the implementations and behaviors you receive from Claude may differ from what is shown in these examples. These examples are meant to illustrate patterns and possibilities. Always test skills thoroughly in your own environment before relying on them for critical tasks.
|
||||
**These skills are provided for demonstration and educational purposes only.** While some of these capabilities may be available in Claude, the implementations and behaviors you receive from Claude may differ from what is shown in these skills. These skills are meant to illustrate patterns and possibilities. Always test skills thoroughly in your own environment before relying on them for critical tasks.
|
||||
|
||||
# Example Skills
|
||||
# Skill Sets
|
||||
- [./skills](./skills): Skill examples for Creative & Design, Development & Technical, Enterprise & Communication, and Document Skills
|
||||
- [./spec](./spec): The Agent Skills specification
|
||||
- [./template](./template): Skill template
|
||||
|
||||
This repository includes a diverse collection of example skills demonstrating different capabilities:
|
||||
# Try in Claude Code, Claude.ai, and the API
|
||||
|
||||
## Creative & Design
|
||||
- **algorithmic-art** - Create generative art using p5.js with seeded randomness, flow fields, and particle systems
|
||||
- **canvas-design** - Design beautiful visual art in .png and .pdf formats using design philosophies
|
||||
- **slack-gif-creator** - Create animated GIFs optimized for Slack's size constraints
|
||||
## Claude Code
|
||||
You can register this repository as a Claude Code Plugin marketplace by running the following command in Claude Code:
|
||||
```
|
||||
/plugin marketplace add anthropics/skills
|
||||
```
|
||||
|
||||
## Development & Technical
|
||||
- **artifacts-builder** - Build complex claude.ai HTML artifacts using React, Tailwind CSS, and shadcn/ui components
|
||||
- **mcp-server** - Guide for creating high-quality MCP servers to integrate external APIs and services
|
||||
- **webapp-testing** - Test local web applications using Playwright for UI verification and debugging
|
||||
Then, to install a specific set of skills:
|
||||
1. Select `Browse and install plugins`
|
||||
2. Select `anthropic-agent-skills`
|
||||
3. Select `document-skills` or `example-skills`
|
||||
4. Select `Install now`
|
||||
|
||||
## Enterprise & Communication
|
||||
- **brand-guidelines** - Apply Anthropic's official brand colors and typography to artifacts
|
||||
- **internal-comms** - Write internal communications like status reports, newsletters, and FAQs
|
||||
- **theme-factory** - Style artifacts with 10 pre-set professional themes or generate custom themes on-the-fly
|
||||
Alternatively, directly install either Plugin via:
|
||||
```
|
||||
/plugin install document-skills@anthropic-agent-skills
|
||||
/plugin install example-skills@anthropic-agent-skills
|
||||
```
|
||||
|
||||
## Meta Skills
|
||||
- **skill-creator** - Guide for creating effective skills that extend Claude's capabilities
|
||||
- **template-skill** - A basic template to use as a starting point for new skills
|
||||
After installing the plugin, you can use the skill by just mentioning it. For instance, if you install the `document-skills` plugin from the marketplace, you can ask Claude Code to do something like: "Use the PDF skill to extract the form fields from `path/to/some-file.pdf`"
|
||||
|
||||
# Document Skills
|
||||
## Claude.ai
|
||||
|
||||
The `document-skills/` subdirectory contains skills that Anthropic developed to help Claude create various document file formats. These skills demonstrate advanced patterns for working with complex file formats and binary data:
|
||||
These example skills are all already available to paid plans in Claude.ai.
|
||||
|
||||
- **docx** - Create, edit, and analyze Word documents with support for tracked changes, comments, formatting preservation, and text extraction
|
||||
- **pdf** - Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms
|
||||
- **pptx** - Create, edit, and analyze PowerPoint presentations with support for layouts, templates, charts, and automated slide generation
|
||||
- **xlsx** - Create, edit, and analyze Excel spreadsheets with support for formulas, formatting, data analysis, and visualization
|
||||
To use any skill from this repository or upload custom skills, follow the instructions in [Using skills in Claude](https://support.claude.com/en/articles/12512180-using-skills-in-claude#h_a4222fa77b).
|
||||
|
||||
**Important Disclaimer:** These document skills are point-in-time snapshots and are not actively maintained or updated. Versions of these skills ship pre-included with Claude. They are primarily intended as reference examples to illustrate how Anthropic approaches developing more complex skills that work with binary file formats and document structures.
|
||||
## Claude API
|
||||
|
||||
You can use Anthropic's pre-built skills, and upload custom skills, via the Claude API. See the [Skills API Quickstart](https://docs.claude.com/en/api/skills-guide#creating-a-skill) for more.
|
||||
|
||||
# Creating a Basic Skill
|
||||
|
||||
@@ -86,4 +89,4 @@ The markdown content below contains the instructions, examples, and guidelines t
|
||||
|
||||
Skills are a great way to teach Claude how to get better at using specific pieces of software. As we see awesome example skills from partners, we may highlight some of them here:
|
||||
|
||||
- **Notion** - [Notion Skills for Claude](https://www.notion.so/notiondevs/Notion-Skills-for-Claude-28da4445d27180c7af1df7d8615723d0)
|
||||
- **Notion** - [Notion Skills for Claude](https://www.notion.so/notiondevs/Notion-Skills-for-Claude-28da4445d27180c7af1df7d8615723d0)
|
||||
|
||||
@@ -1,328 +0,0 @@
|
||||
---
|
||||
name: mcp-builder
|
||||
description: Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
# MCP Server Development Guide
|
||||
|
||||
## Overview
|
||||
|
||||
To create high-quality MCP (Model Context Protocol) servers that enable LLMs to effectively interact with external services, use this skill. An MCP server provides tools that allow LLMs to access external services and APIs. The quality of an MCP server is measured by how well it enables LLMs to accomplish real-world tasks using the tools provided.
|
||||
|
||||
---
|
||||
|
||||
# Process
|
||||
|
||||
## 🚀 High-Level Workflow
|
||||
|
||||
Creating a high-quality MCP server involves four main phases:
|
||||
|
||||
### Phase 1: Deep Research and Planning
|
||||
|
||||
#### 1.1 Understand Agent-Centric Design Principles
|
||||
|
||||
Before diving into implementation, understand how to design tools for AI agents by reviewing these principles:
|
||||
|
||||
**Build for Workflows, Not Just API Endpoints:**
|
||||
- Don't simply wrap existing API endpoints - build thoughtful, high-impact workflow tools
|
||||
- Consolidate related operations (e.g., `schedule_event` that both checks availability and creates event)
|
||||
- Focus on tools that enable complete tasks, not just individual API calls
|
||||
- Consider what workflows agents actually need to accomplish
|
||||
|
||||
**Optimize for Limited Context:**
|
||||
- Agents have constrained context windows - make every token count
|
||||
- Return high-signal information, not exhaustive data dumps
|
||||
- Provide "concise" vs "detailed" response format options
|
||||
- Default to human-readable identifiers over technical codes (names over IDs)
|
||||
- Consider the agent's context budget as a scarce resource
|
||||
|
||||
**Design Actionable Error Messages:**
|
||||
- Error messages should guide agents toward correct usage patterns
|
||||
- Suggest specific next steps: "Try using filter='active_only' to reduce results"
|
||||
- Make errors educational, not just diagnostic
|
||||
- Help agents learn proper tool usage through clear feedback
|
||||
|
||||
**Follow Natural Task Subdivisions:**
|
||||
- Tool names should reflect how humans think about tasks
|
||||
- Group related tools with consistent prefixes for discoverability
|
||||
- Design tools around natural workflows, not just API structure
|
||||
|
||||
**Use Evaluation-Driven Development:**
|
||||
- Create realistic evaluation scenarios early
|
||||
- Let agent feedback drive tool improvements
|
||||
- Prototype quickly and iterate based on actual agent performance
|
||||
|
||||
#### 1.3 Study MCP Protocol Documentation
|
||||
|
||||
**Fetch the latest MCP protocol documentation:**
|
||||
|
||||
Use WebFetch to load: `https://modelcontextprotocol.io/llms-full.txt`
|
||||
|
||||
This comprehensive document contains the complete MCP specification and guidelines.
|
||||
|
||||
#### 1.4 Study Framework Documentation
|
||||
|
||||
**Load and read the following reference files:**
|
||||
|
||||
- **MCP Best Practices**: [📋 View Best Practices](./reference/mcp_best_practices.md) - Core guidelines for all MCP servers
|
||||
|
||||
**For Python implementations, also load:**
|
||||
- **Python SDK Documentation**: Use WebFetch to load `https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md`
|
||||
- [🐍 Python Implementation Guide](./reference/python_mcp_server.md) - Python-specific best practices and examples
|
||||
|
||||
**For Node/TypeScript implementations, also load:**
|
||||
- **TypeScript SDK Documentation**: Use WebFetch to load `https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md`
|
||||
- [⚡ TypeScript Implementation Guide](./reference/node_mcp_server.md) - Node/TypeScript-specific best practices and examples
|
||||
|
||||
#### 1.5 Exhaustively Study API Documentation
|
||||
|
||||
To integrate a service, read through **ALL** available API documentation:
|
||||
- Official API reference documentation
|
||||
- Authentication and authorization requirements
|
||||
- Rate limiting and pagination patterns
|
||||
- Error responses and status codes
|
||||
- Available endpoints and their parameters
|
||||
- Data models and schemas
|
||||
|
||||
**To gather comprehensive information, use web search and the WebFetch tool as needed.**
|
||||
|
||||
#### 1.6 Create a Comprehensive Implementation Plan
|
||||
|
||||
Based on your research, create a detailed plan that includes:
|
||||
|
||||
**Tool Selection:**
|
||||
- List the most valuable endpoints/operations to implement
|
||||
- Prioritize tools that enable the most common and important use cases
|
||||
- Consider which tools work together to enable complex workflows
|
||||
|
||||
**Shared Utilities and Helpers:**
|
||||
- Identify common API request patterns
|
||||
- Plan pagination helpers
|
||||
- Design filtering and formatting utilities
|
||||
- Plan error handling strategies
|
||||
|
||||
**Input/Output Design:**
|
||||
- Define input validation models (Pydantic for Python, Zod for TypeScript)
|
||||
- Design consistent response formats (e.g., JSON or Markdown), and configurable levels of detail (e.g., Detailed or Concise)
|
||||
- Plan for large-scale usage (thousands of users/resources)
|
||||
- Implement character limits and truncation strategies (e.g., 25,000 tokens)
|
||||
|
||||
**Error Handling Strategy:**
|
||||
- Plan graceful failure modes
|
||||
- Design clear, actionable, LLM-friendly, natural language error messages which prompt further action
|
||||
- Consider rate limiting and timeout scenarios
|
||||
- Handle authentication and authorization errors
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Implementation
|
||||
|
||||
Now that you have a comprehensive plan, begin implementation following language-specific best practices.
|
||||
|
||||
#### 2.1 Set Up Project Structure
|
||||
|
||||
**For Python:**
|
||||
- Create a single `.py` file or organize into modules if complex (see [🐍 Python Guide](./reference/python_mcp_server.md))
|
||||
- Use the MCP Python SDK for tool registration
|
||||
- Define Pydantic models for input validation
|
||||
|
||||
**For Node/TypeScript:**
|
||||
- Create proper project structure (see [⚡ TypeScript Guide](./reference/node_mcp_server.md))
|
||||
- Set up `package.json` and `tsconfig.json`
|
||||
- Use MCP TypeScript SDK
|
||||
- Define Zod schemas for input validation
|
||||
|
||||
#### 2.2 Implement Core Infrastructure First
|
||||
|
||||
**To begin implementation, create shared utilities before implementing tools:**
|
||||
- API request helper functions
|
||||
- Error handling utilities
|
||||
- Response formatting functions (JSON and Markdown)
|
||||
- Pagination helpers
|
||||
- Authentication/token management
|
||||
|
||||
#### 2.3 Implement Tools Systematically
|
||||
|
||||
For each tool in the plan:
|
||||
|
||||
**Define Input Schema:**
|
||||
- Use Pydantic (Python) or Zod (TypeScript) for validation
|
||||
- Include proper constraints (min/max length, regex patterns, min/max values, ranges)
|
||||
- Provide clear, descriptive field descriptions
|
||||
- Include diverse examples in field descriptions
|
||||
|
||||
**Write Comprehensive Docstrings/Descriptions:**
|
||||
- One-line summary of what the tool does
|
||||
- Detailed explanation of purpose and functionality
|
||||
- Explicit parameter types with examples
|
||||
- Complete return type schema
|
||||
- Usage examples (when to use, when not to use)
|
||||
- Error handling documentation, which outlines how to proceed given specific errors
|
||||
|
||||
**Implement Tool Logic:**
|
||||
- Use shared utilities to avoid code duplication
|
||||
- Follow async/await patterns for all I/O
|
||||
- Implement proper error handling
|
||||
- Support multiple response formats (JSON and Markdown)
|
||||
- Respect pagination parameters
|
||||
- Check character limits and truncate appropriately
|
||||
|
||||
**Add Tool Annotations:**
|
||||
- `readOnlyHint`: true (for read-only operations)
|
||||
- `destructiveHint`: false (for non-destructive operations)
|
||||
- `idempotentHint`: true (if repeated calls have same effect)
|
||||
- `openWorldHint`: true (if interacting with external systems)
|
||||
|
||||
#### 2.4 Follow Language-Specific Best Practices
|
||||
|
||||
**At this point, load the appropriate language guide:**
|
||||
|
||||
**For Python: Load [🐍 Python Implementation Guide](./reference/python_mcp_server.md) and ensure the following:**
|
||||
- Using MCP Python SDK with proper tool registration
|
||||
- Pydantic v2 models with `model_config`
|
||||
- Type hints throughout
|
||||
- Async/await for all I/O operations
|
||||
- Proper imports organization
|
||||
- Module-level constants (CHARACTER_LIMIT, API_BASE_URL)
|
||||
|
||||
**For Node/TypeScript: Load [⚡ TypeScript Implementation Guide](./reference/node_mcp_server.md) and ensure the following:**
|
||||
- Using `server.registerTool` properly
|
||||
- Zod schemas with `.strict()`
|
||||
- TypeScript strict mode enabled
|
||||
- No `any` types - use proper types
|
||||
- Explicit Promise<T> return types
|
||||
- Build process configured (`npm run build`)
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: Review and Refine
|
||||
|
||||
After initial implementation:
|
||||
|
||||
#### 3.1 Code Quality Review
|
||||
|
||||
To ensure quality, review the code for:
|
||||
- **DRY Principle**: No duplicated code between tools
|
||||
- **Composability**: Shared logic extracted into functions
|
||||
- **Consistency**: Similar operations return similar formats
|
||||
- **Error Handling**: All external calls have error handling
|
||||
- **Type Safety**: Full type coverage (Python type hints, TypeScript types)
|
||||
- **Documentation**: Every tool has comprehensive docstrings/descriptions
|
||||
|
||||
#### 3.2 Test and Build
|
||||
|
||||
**Important:** MCP servers are long-running processes that wait for requests over stdio/stdin or sse/http. Running them directly in your main process (e.g., `python server.py` or `node dist/index.js`) will cause your process to hang indefinitely.
|
||||
|
||||
**Safe ways to test the server:**
|
||||
- Use the evaluation harness (see Phase 4) - recommended approach
|
||||
- Run the server in tmux to keep it outside your main process
|
||||
- Use a timeout when testing: `timeout 5s python server.py`
|
||||
|
||||
**For Python:**
|
||||
- Verify Python syntax: `python -m py_compile your_server.py`
|
||||
- Check imports work correctly by reviewing the file
|
||||
- To manually test: Run server in tmux, then test with evaluation harness in main process
|
||||
- Or use the evaluation harness directly (it manages the server for stdio transport)
|
||||
|
||||
**For Node/TypeScript:**
|
||||
- Run `npm run build` and ensure it completes without errors
|
||||
- Verify dist/index.js is created
|
||||
- To manually test: Run server in tmux, then test with evaluation harness in main process
|
||||
- Or use the evaluation harness directly (it manages the server for stdio transport)
|
||||
|
||||
#### 3.3 Use Quality Checklist
|
||||
|
||||
To verify implementation quality, load the appropriate checklist from the language-specific guide:
|
||||
- Python: see "Quality Checklist" in [🐍 Python Guide](./reference/python_mcp_server.md)
|
||||
- Node/TypeScript: see "Quality Checklist" in [⚡ TypeScript Guide](./reference/node_mcp_server.md)
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: Create Evaluations
|
||||
|
||||
After implementing your MCP server, create comprehensive evaluations to test its effectiveness.
|
||||
|
||||
**Load [✅ Evaluation Guide](./reference/evaluation.md) for complete evaluation guidelines.**
|
||||
|
||||
#### 4.1 Understand Evaluation Purpose
|
||||
|
||||
Evaluations test whether LLMs can effectively use your MCP server to answer realistic, complex questions.
|
||||
|
||||
#### 4.2 Create 10 Evaluation Questions
|
||||
|
||||
To create effective evaluations, follow the process outlined in the evaluation guide:
|
||||
|
||||
1. **Tool Inspection**: List available tools and understand their capabilities
|
||||
2. **Content Exploration**: Use READ-ONLY operations to explore available data
|
||||
3. **Question Generation**: Create 10 complex, realistic questions
|
||||
4. **Answer Verification**: Solve each question yourself to verify answers
|
||||
|
||||
#### 4.3 Evaluation Requirements
|
||||
|
||||
Each question must be:
|
||||
- **Independent**: Not dependent on other questions
|
||||
- **Read-only**: Only non-destructive operations required
|
||||
- **Complex**: Requiring multiple tool calls and deep exploration
|
||||
- **Realistic**: Based on real use cases humans would care about
|
||||
- **Verifiable**: Single, clear answer that can be verified by string comparison
|
||||
- **Stable**: Answer won't change over time
|
||||
|
||||
#### 4.4 Output Format
|
||||
|
||||
Create an XML file with this structure:
|
||||
|
||||
```xml
|
||||
<evaluation>
|
||||
<qa_pair>
|
||||
<question>Find discussions about AI model launches with animal codenames. One model needed a specific safety designation that uses the format ASL-X. What number X was being determined for the model named after a spotted wild cat?</question>
|
||||
<answer>3</answer>
|
||||
</qa_pair>
|
||||
<!-- More qa_pairs... -->
|
||||
</evaluation>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Reference Files
|
||||
|
||||
## 📚 Documentation Library
|
||||
|
||||
Load these resources as needed during development:
|
||||
|
||||
### Core MCP Documentation (Load First)
|
||||
- **MCP Protocol**: Fetch from `https://modelcontextprotocol.io/llms-full.txt` - Complete MCP specification
|
||||
- [📋 MCP Best Practices](./reference/mcp_best_practices.md) - Universal MCP guidelines including:
|
||||
- Server and tool naming conventions
|
||||
- Response format guidelines (JSON vs Markdown)
|
||||
- Pagination best practices
|
||||
- Character limits and truncation strategies
|
||||
- Tool development guidelines
|
||||
- Security and error handling standards
|
||||
|
||||
### SDK Documentation (Load During Phase 1/2)
|
||||
- **Python SDK**: Fetch from `https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md`
|
||||
- **TypeScript SDK**: Fetch from `https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md`
|
||||
|
||||
### Language-Specific Implementation Guides (Load During Phase 2)
|
||||
- [🐍 Python Implementation Guide](./reference/python_mcp_server.md) - Complete Python/FastMCP guide with:
|
||||
- Server initialization patterns
|
||||
- Pydantic model examples
|
||||
- Tool registration with `@mcp.tool`
|
||||
- Complete working examples
|
||||
- Quality checklist
|
||||
|
||||
- [⚡ TypeScript Implementation Guide](./reference/node_mcp_server.md) - Complete TypeScript guide with:
|
||||
- Project structure
|
||||
- Zod schema patterns
|
||||
- Tool registration with `server.registerTool`
|
||||
- Complete working examples
|
||||
- Quality checklist
|
||||
|
||||
### Evaluation Guide (Load During Phase 4)
|
||||
- [✅ Evaluation Guide](./reference/evaluation.md) - Complete evaluation creation guide with:
|
||||
- Question creation guidelines
|
||||
- Answer verification strategies
|
||||
- XML format specifications
|
||||
- Example questions and answers
|
||||
- Running an evaluation with the provided scripts
|
||||
@@ -1,915 +0,0 @@
|
||||
# MCP Server Development Best Practices and Guidelines
|
||||
|
||||
## Overview
|
||||
|
||||
This document compiles essential best practices and guidelines for building Model Context Protocol (MCP) servers. It covers naming conventions, tool design, response formats, pagination, error handling, security, and compliance requirements.
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Server Naming
|
||||
- **Python**: `{service}_mcp` (e.g., `slack_mcp`)
|
||||
- **Node/TypeScript**: `{service}-mcp-server` (e.g., `slack-mcp-server`)
|
||||
|
||||
### Tool Naming
|
||||
- Use snake_case with service prefix
|
||||
- Format: `{service}_{action}_{resource}`
|
||||
- Example: `slack_send_message`, `github_create_issue`
|
||||
|
||||
### Response Formats
|
||||
- Support both JSON and Markdown formats
|
||||
- JSON for programmatic processing
|
||||
- Markdown for human readability
|
||||
|
||||
### Pagination
|
||||
- Always respect `limit` parameter
|
||||
- Return `has_more`, `next_offset`, `total_count`
|
||||
- Default to 20-50 items
|
||||
|
||||
### Character Limits
|
||||
- Set CHARACTER_LIMIT constant (typically 25,000)
|
||||
- Truncate gracefully with clear messages
|
||||
- Provide guidance on filtering
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
1. Server Naming Conventions
|
||||
2. Tool Naming and Design
|
||||
3. Response Format Guidelines
|
||||
4. Pagination Best Practices
|
||||
5. Character Limits and Truncation
|
||||
6. Tool Development Best Practices
|
||||
7. Transport Best Practices
|
||||
8. Testing Requirements
|
||||
9. OAuth and Security Best Practices
|
||||
10. Resource Management Best Practices
|
||||
11. Prompt Management Best Practices
|
||||
12. Error Handling Standards
|
||||
13. Documentation Requirements
|
||||
14. Compliance and Monitoring
|
||||
|
||||
---
|
||||
|
||||
## 1. Server Naming Conventions
|
||||
|
||||
Follow these standardized naming patterns for MCP servers:
|
||||
|
||||
**Python**: Use format `{service}_mcp` (lowercase with underscores)
|
||||
- Examples: `slack_mcp`, `github_mcp`, `jira_mcp`, `stripe_mcp`
|
||||
|
||||
**Node/TypeScript**: Use format `{service}-mcp-server` (lowercase with hyphens)
|
||||
- Examples: `slack-mcp-server`, `github-mcp-server`, `jira-mcp-server`
|
||||
|
||||
The name should be:
|
||||
- General (not tied to specific features)
|
||||
- Descriptive of the service/API being integrated
|
||||
- Easy to infer from the task description
|
||||
- Without version numbers or dates
|
||||
|
||||
---
|
||||
|
||||
## 2. Tool Naming and Design
|
||||
|
||||
### Tool Naming Best Practices
|
||||
|
||||
1. **Use snake_case**: `search_users`, `create_project`, `get_channel_info`
|
||||
2. **Include service prefix**: Anticipate that your MCP server may be used alongside other MCP servers
|
||||
- Use `slack_send_message` instead of just `send_message`
|
||||
- Use `github_create_issue` instead of just `create_issue`
|
||||
- Use `asana_list_tasks` instead of just `list_tasks`
|
||||
3. **Be action-oriented**: Start with verbs (get, list, search, create, etc.)
|
||||
4. **Be specific**: Avoid generic names that could conflict with other servers
|
||||
5. **Maintain consistency**: Use consistent naming patterns within your server
|
||||
|
||||
### Tool Design Guidelines
|
||||
|
||||
- Tool descriptions must narrowly and unambiguously describe functionality
|
||||
- Descriptions must precisely match actual functionality
|
||||
- Should not create confusion with other MCP servers
|
||||
- Should provide tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint)
|
||||
- Keep tool operations focused and atomic
|
||||
|
||||
---
|
||||
|
||||
## 3. Response Format Guidelines
|
||||
|
||||
All tools that return data should support multiple formats for flexibility:
|
||||
|
||||
### JSON Format (`response_format="json"`)
|
||||
- Machine-readable structured data
|
||||
- Include all available fields and metadata
|
||||
- Consistent field names and types
|
||||
- Suitable for programmatic processing
|
||||
- Use for when LLMs need to process data further
|
||||
|
||||
### Markdown Format (`response_format="markdown"`, typically default)
|
||||
- Human-readable formatted text
|
||||
- Use headers, lists, and formatting for clarity
|
||||
- Convert timestamps to human-readable format (e.g., "2024-01-15 10:30:00 UTC" instead of epoch)
|
||||
- Show display names with IDs in parentheses (e.g., "@john.doe (U123456)")
|
||||
- Omit verbose metadata (e.g., show only one profile image URL, not all sizes)
|
||||
- Group related information logically
|
||||
- Use for when presenting information to users
|
||||
|
||||
---
|
||||
|
||||
## 4. Pagination Best Practices
|
||||
|
||||
For tools that list resources:
|
||||
|
||||
- **Always respect the `limit` parameter**: Never load all results when a limit is specified
|
||||
- **Implement pagination**: Use `offset` or cursor-based pagination
|
||||
- **Return pagination metadata**: Include `has_more`, `next_offset`/`next_cursor`, `total_count`
|
||||
- **Never load all results into memory**: Especially important for large datasets
|
||||
- **Default to reasonable limits**: 20-50 items is typical
|
||||
- **Include clear pagination info in responses**: Make it easy for LLMs to request more data
|
||||
|
||||
Example pagination response structure:
|
||||
```json
|
||||
{
|
||||
"total": 150,
|
||||
"count": 20,
|
||||
"offset": 0,
|
||||
"items": [...],
|
||||
"has_more": true,
|
||||
"next_offset": 20
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Character Limits and Truncation
|
||||
|
||||
To prevent overwhelming responses with too much data:
|
||||
|
||||
- **Define CHARACTER_LIMIT constant**: Typically 25,000 characters at module level
|
||||
- **Check response size before returning**: Measure the final response length
|
||||
- **Truncate gracefully with clear indicators**: Let the LLM know data was truncated
|
||||
- **Provide guidance on filtering**: Suggest how to use parameters to reduce results
|
||||
- **Include truncation metadata**: Show what was truncated and how to get more
|
||||
|
||||
Example truncation handling:
|
||||
```python
|
||||
CHARACTER_LIMIT = 25000
|
||||
|
||||
if len(result) > CHARACTER_LIMIT:
|
||||
truncated_data = data[:max(1, len(data) // 2)]
|
||||
response["truncated"] = True
|
||||
response["truncation_message"] = (
|
||||
f"Response truncated from {len(data)} to {len(truncated_data)} items. "
|
||||
f"Use 'offset' parameter or add filters to see more results."
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Transport Options
|
||||
|
||||
MCP servers support multiple transport mechanisms for different deployment scenarios:
|
||||
|
||||
### Stdio Transport
|
||||
|
||||
**Best for**: Command-line tools, local integrations, subprocess execution
|
||||
|
||||
**Characteristics**:
|
||||
- Standard input/output stream communication
|
||||
- Simple setup, no network configuration needed
|
||||
- Runs as a subprocess of the client
|
||||
- Ideal for desktop applications and CLI tools
|
||||
|
||||
**Use when**:
|
||||
- Building tools for local development environments
|
||||
- Integrating with desktop applications (e.g., Claude Desktop)
|
||||
- Creating command-line utilities
|
||||
- Single-user, single-session scenarios
|
||||
|
||||
### HTTP Transport
|
||||
|
||||
**Best for**: Web services, remote access, multi-client scenarios
|
||||
|
||||
**Characteristics**:
|
||||
- Request-response pattern over HTTP
|
||||
- Supports multiple simultaneous clients
|
||||
- Can be deployed as a web service
|
||||
- Requires network configuration and security considerations
|
||||
|
||||
**Use when**:
|
||||
- Serving multiple clients simultaneously
|
||||
- Deploying as a cloud service
|
||||
- Integration with web applications
|
||||
- Need for load balancing or scaling
|
||||
|
||||
### Server-Sent Events (SSE) Transport
|
||||
|
||||
**Best for**: Real-time updates, push notifications, streaming data
|
||||
|
||||
**Characteristics**:
|
||||
- One-way server-to-client streaming over HTTP
|
||||
- Enables real-time updates without polling
|
||||
- Long-lived connections for continuous data flow
|
||||
- Built on standard HTTP infrastructure
|
||||
|
||||
**Use when**:
|
||||
- Clients need real-time data updates
|
||||
- Implementing push notifications
|
||||
- Streaming logs or monitoring data
|
||||
- Progressive result delivery for long operations
|
||||
|
||||
### Transport Selection Criteria
|
||||
|
||||
| Criterion | Stdio | HTTP | SSE |
|
||||
|-----------|-------|------|-----|
|
||||
| **Deployment** | Local | Remote | Remote |
|
||||
| **Clients** | Single | Multiple | Multiple |
|
||||
| **Communication** | Bidirectional | Request-Response | Server-Push |
|
||||
| **Complexity** | Low | Medium | Medium-High |
|
||||
| **Real-time** | No | No | Yes |
|
||||
|
||||
---
|
||||
|
||||
## 7. Tool Development Best Practices
|
||||
|
||||
### General Guidelines
|
||||
1. Tool names should be descriptive and action-oriented
|
||||
2. Use parameter validation with detailed JSON schemas
|
||||
3. Include examples in tool descriptions
|
||||
4. Implement proper error handling and validation
|
||||
5. Use progress reporting for long operations
|
||||
6. Keep tool operations focused and atomic
|
||||
7. Document expected return value structures
|
||||
8. Implement proper timeouts
|
||||
9. Consider rate limiting for resource-intensive operations
|
||||
10. Log tool usage for debugging and monitoring
|
||||
|
||||
### Security Considerations for Tools
|
||||
|
||||
#### Input Validation
|
||||
- Validate all parameters against schema
|
||||
- Sanitize file paths and system commands
|
||||
- Validate URLs and external identifiers
|
||||
- Check parameter sizes and ranges
|
||||
- Prevent command injection
|
||||
|
||||
#### Access Control
|
||||
- Implement authentication where needed
|
||||
- Use appropriate authorization checks
|
||||
- Audit tool usage
|
||||
- Rate limit requests
|
||||
- Monitor for abuse
|
||||
|
||||
#### Error Handling
|
||||
- Don't expose internal errors to clients
|
||||
- Log security-relevant errors
|
||||
- Handle timeouts appropriately
|
||||
- Clean up resources after errors
|
||||
- Validate return values
|
||||
|
||||
### Tool Annotations
|
||||
- Provide readOnlyHint and destructiveHint annotations
|
||||
- Remember annotations are hints, not security guarantees
|
||||
- Clients should not make security-critical decisions based solely on annotations
|
||||
|
||||
---
|
||||
|
||||
## 8. Transport Best Practices
|
||||
|
||||
### General Transport Guidelines
|
||||
1. Handle connection lifecycle properly
|
||||
2. Implement proper error handling
|
||||
3. Use appropriate timeout values
|
||||
4. Implement connection state management
|
||||
5. Clean up resources on disconnection
|
||||
|
||||
### Security Best Practices for Transport
|
||||
- Follow security considerations for DNS rebinding attacks
|
||||
- Implement proper authentication mechanisms
|
||||
- Validate message formats
|
||||
- Handle malformed messages gracefully
|
||||
|
||||
### Stdio Transport Specific
|
||||
- Local MCP servers should NOT log to stdout (interferes with protocol)
|
||||
- Use stderr for logging messages
|
||||
- Handle standard I/O streams properly
|
||||
|
||||
---
|
||||
|
||||
## 9. Testing Requirements
|
||||
|
||||
A comprehensive testing strategy should cover:
|
||||
|
||||
### Functional Testing
|
||||
- Verify correct execution with valid/invalid inputs
|
||||
|
||||
### Integration Testing
|
||||
- Test interaction with external systems
|
||||
|
||||
### Security Testing
|
||||
- Validate auth, input sanitization, rate limiting
|
||||
|
||||
### Performance Testing
|
||||
- Check behavior under load, timeouts
|
||||
|
||||
### Error Handling
|
||||
- Ensure proper error reporting and cleanup
|
||||
|
||||
---
|
||||
|
||||
## 10. OAuth and Security Best Practices
|
||||
|
||||
### Authentication and Authorization
|
||||
|
||||
MCP servers that connect to external services should implement proper authentication:
|
||||
|
||||
**OAuth 2.1 Implementation:**
|
||||
- Use secure OAuth 2.1 with certificates from recognized authorities
|
||||
- Validate access tokens before processing requests
|
||||
- Only accept tokens specifically intended for your server
|
||||
- Reject tokens without proper audience claims
|
||||
- Never pass through tokens received from MCP clients
|
||||
|
||||
**API Key Management:**
|
||||
- Store API keys in environment variables, never in code
|
||||
- Validate keys on server startup
|
||||
- Provide clear error messages when authentication fails
|
||||
- Use secure transmission for sensitive credentials
|
||||
|
||||
### Input Validation and Security
|
||||
|
||||
**Always validate inputs:**
|
||||
- Sanitize file paths to prevent directory traversal
|
||||
- Validate URLs and external identifiers
|
||||
- Check parameter sizes and ranges
|
||||
- Prevent command injection in system calls
|
||||
- Use schema validation (Pydantic/Zod) for all inputs
|
||||
|
||||
**Error handling security:**
|
||||
- Don't expose internal errors to clients
|
||||
- Log security-relevant errors server-side
|
||||
- Provide helpful but not revealing error messages
|
||||
- Clean up resources after errors
|
||||
|
||||
### Privacy and Data Protection
|
||||
|
||||
**Data collection principles:**
|
||||
- Only collect data strictly necessary for functionality
|
||||
- Don't collect extraneous conversation data
|
||||
- Don't collect PII unless explicitly required for the tool's purpose
|
||||
- Provide clear information about what data is accessed
|
||||
|
||||
**Data transmission:**
|
||||
- Don't send data to servers outside your organization without disclosure
|
||||
- Use secure transmission (HTTPS) for all network communication
|
||||
- Validate certificates for external services
|
||||
|
||||
---
|
||||
|
||||
## 11. Resource Management Best Practices
|
||||
|
||||
1. Only suggest necessary resources
|
||||
2. Use clear, descriptive names for roots
|
||||
3. Handle resource boundaries properly
|
||||
4. Respect client control over resources
|
||||
5. Use model-controlled primitives (tools) for automatic data exposure
|
||||
|
||||
---
|
||||
|
||||
## 12. Prompt Management Best Practices
|
||||
|
||||
- Clients should show users proposed prompts
|
||||
- Users should be able to modify or reject prompts
|
||||
- Clients should show users completions
|
||||
- Users should be able to modify or reject completions
|
||||
- Consider costs when using sampling
|
||||
|
||||
---
|
||||
|
||||
## 13. Error Handling Standards
|
||||
|
||||
- Use standard JSON-RPC error codes
|
||||
- Report tool errors within result objects (not protocol-level)
|
||||
- Provide helpful, specific error messages
|
||||
- Don't expose internal implementation details
|
||||
- Clean up resources properly on errors
|
||||
|
||||
---
|
||||
|
||||
## 14. Documentation Requirements
|
||||
|
||||
- Provide clear documentation of all tools and capabilities
|
||||
- Include working examples (at least 3 per major feature)
|
||||
- Document security considerations
|
||||
- Specify required permissions and access levels
|
||||
- Document rate limits and performance characteristics
|
||||
|
||||
---
|
||||
|
||||
## 15. Compliance and Monitoring
|
||||
|
||||
- Implement logging for debugging and monitoring
|
||||
- Track tool usage patterns
|
||||
- Monitor for potential abuse
|
||||
- Maintain audit trails for security-relevant operations
|
||||
- Be prepared for ongoing compliance reviews
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
These best practices represent the comprehensive guidelines for building secure, efficient, and compliant MCP servers that work well within the ecosystem. Developers should follow these guidelines to ensure their MCP servers meet the standards for inclusion in the MCP directory and provide a safe, reliable experience for users.
|
||||
|
||||
|
||||
----------
|
||||
|
||||
|
||||
# Tools
|
||||
|
||||
> Enable LLMs to perform actions through your server
|
||||
|
||||
Tools are a powerful primitive in the Model Context Protocol (MCP) that enable servers to expose executable functionality to clients. Through tools, LLMs can interact with external systems, perform computations, and take actions in the real world.
|
||||
|
||||
<Note>
|
||||
Tools are designed to be **model-controlled**, meaning that tools are exposed from servers to clients with the intention of the AI model being able to automatically invoke them (with a human in the loop to grant approval).
|
||||
</Note>
|
||||
|
||||
## Overview
|
||||
|
||||
Tools in MCP allow servers to expose executable functions that can be invoked by clients and used by LLMs to perform actions. Key aspects of tools include:
|
||||
|
||||
* **Discovery**: Clients can obtain a list of available tools by sending a `tools/list` request
|
||||
* **Invocation**: Tools are called using the `tools/call` request, where servers perform the requested operation and return results
|
||||
* **Flexibility**: Tools can range from simple calculations to complex API interactions
|
||||
|
||||
Like [resources](/docs/concepts/resources), tools are identified by unique names and can include descriptions to guide their usage. However, unlike resources, tools represent dynamic operations that can modify state or interact with external systems.
|
||||
|
||||
## Tool definition structure
|
||||
|
||||
Each tool is defined with the following structure:
|
||||
|
||||
```typescript
|
||||
{
|
||||
name: string; // Unique identifier for the tool
|
||||
description?: string; // Human-readable description
|
||||
inputSchema: { // JSON Schema for the tool's parameters
|
||||
type: "object",
|
||||
properties: { ... } // Tool-specific parameters
|
||||
},
|
||||
annotations?: { // Optional hints about tool behavior
|
||||
title?: string; // Human-readable title for the tool
|
||||
readOnlyHint?: boolean; // If true, the tool does not modify its environment
|
||||
destructiveHint?: boolean; // If true, the tool may perform destructive updates
|
||||
idempotentHint?: boolean; // If true, repeated calls with same args have no additional effect
|
||||
openWorldHint?: boolean; // If true, tool interacts with external entities
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Implementing tools
|
||||
|
||||
Here's an example of implementing a basic tool in an MCP server:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="TypeScript">
|
||||
```typescript
|
||||
const server = new Server({
|
||||
name: "example-server",
|
||||
version: "1.0.0"
|
||||
}, {
|
||||
capabilities: {
|
||||
tools: {}
|
||||
}
|
||||
});
|
||||
|
||||
// Define available tools
|
||||
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
||||
return {
|
||||
tools: [{
|
||||
name: "calculate_sum",
|
||||
description: "Add two numbers together",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
a: { type: "number" },
|
||||
b: { type: "number" }
|
||||
},
|
||||
required: ["a", "b"]
|
||||
}
|
||||
}]
|
||||
};
|
||||
});
|
||||
|
||||
// Handle tool execution
|
||||
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||
if (request.params.name === "calculate_sum") {
|
||||
const { a, b } = request.params.arguments;
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: String(a + b)
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
throw new Error("Tool not found");
|
||||
});
|
||||
```
|
||||
</Tab>
|
||||
|
||||
<Tab title="Python">
|
||||
```python
|
||||
app = Server("example-server")
|
||||
|
||||
@app.list_tools()
|
||||
async def list_tools() -> list[types.Tool]:
|
||||
return [
|
||||
types.Tool(
|
||||
name="calculate_sum",
|
||||
description="Add two numbers together",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {"type": "number"},
|
||||
"b": {"type": "number"}
|
||||
},
|
||||
"required": ["a", "b"]
|
||||
}
|
||||
)
|
||||
]
|
||||
|
||||
@app.call_tool()
|
||||
async def call_tool(
|
||||
name: str,
|
||||
arguments: dict
|
||||
) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
|
||||
if name == "calculate_sum":
|
||||
a = arguments["a"]
|
||||
b = arguments["b"]
|
||||
result = a + b
|
||||
return [types.TextContent(type="text", text=str(result))]
|
||||
raise ValueError(f"Tool not found: {name}")
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Example tool patterns
|
||||
|
||||
Here are some examples of types of tools that a server could provide:
|
||||
|
||||
### System operations
|
||||
|
||||
Tools that interact with the local system:
|
||||
|
||||
```typescript
|
||||
{
|
||||
name: "execute_command",
|
||||
description: "Run a shell command",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
command: { type: "string" },
|
||||
args: { type: "array", items: { type: "string" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### API integrations
|
||||
|
||||
Tools that wrap external APIs:
|
||||
|
||||
```typescript
|
||||
{
|
||||
name: "github_create_issue",
|
||||
description: "Create a GitHub issue",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
title: { type: "string" },
|
||||
body: { type: "string" },
|
||||
labels: { type: "array", items: { type: "string" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Data processing
|
||||
|
||||
Tools that transform or analyze data:
|
||||
|
||||
```typescript
|
||||
{
|
||||
name: "analyze_csv",
|
||||
description: "Analyze a CSV file",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
filepath: { type: "string" },
|
||||
operations: {
|
||||
type: "array",
|
||||
items: {
|
||||
enum: ["sum", "average", "count"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Best practices
|
||||
|
||||
When implementing tools:
|
||||
|
||||
1. Provide clear, descriptive names and descriptions
|
||||
2. Use detailed JSON Schema definitions for parameters
|
||||
3. Include examples in tool descriptions to demonstrate how the model should use them
|
||||
4. Implement proper error handling and validation
|
||||
5. Use progress reporting for long operations
|
||||
6. Keep tool operations focused and atomic
|
||||
7. Document expected return value structures
|
||||
8. Implement proper timeouts
|
||||
9. Consider rate limiting for resource-intensive operations
|
||||
10. Log tool usage for debugging and monitoring
|
||||
|
||||
### Tool name conflicts
|
||||
|
||||
MCP client applications and MCP server proxies may encounter tool name conflicts when building their own tool lists. For example, two connected MCP servers `web1` and `web2` may both expose a tool named `search_web`.
|
||||
|
||||
Applications may disambiguiate tools with one of the following strategies (among others; not an exhaustive list):
|
||||
|
||||
* Concatenating a unique, user-defined server name with the tool name, e.g. `web1___search_web` and `web2___search_web`. This strategy may be preferable when unique server names are already provided by the user in a configuration file.
|
||||
* Generating a random prefix for the tool name, e.g. `jrwxs___search_web` and `6cq52___search_web`. This strategy may be preferable in server proxies where user-defined unique names are not available.
|
||||
* Using the server URI as a prefix for the tool name, e.g. `web1.example.com:search_web` and `web2.example.com:search_web`. This strategy may be suitable when working with remote MCP servers.
|
||||
|
||||
Note that the server-provided name from the initialization flow is not guaranteed to be unique and is not generally suitable for disambiguation purposes.
|
||||
|
||||
## Security considerations
|
||||
|
||||
When exposing tools:
|
||||
|
||||
### Input validation
|
||||
|
||||
* Validate all parameters against the schema
|
||||
* Sanitize file paths and system commands
|
||||
* Validate URLs and external identifiers
|
||||
* Check parameter sizes and ranges
|
||||
* Prevent command injection
|
||||
|
||||
### Access control
|
||||
|
||||
* Implement authentication where needed
|
||||
* Use appropriate authorization checks
|
||||
* Audit tool usage
|
||||
* Rate limit requests
|
||||
* Monitor for abuse
|
||||
|
||||
### Error handling
|
||||
|
||||
* Don't expose internal errors to clients
|
||||
* Log security-relevant errors
|
||||
* Handle timeouts appropriately
|
||||
* Clean up resources after errors
|
||||
* Validate return values
|
||||
|
||||
## Tool discovery and updates
|
||||
|
||||
MCP supports dynamic tool discovery:
|
||||
|
||||
1. Clients can list available tools at any time
|
||||
2. Servers can notify clients when tools change using `notifications/tools/list_changed`
|
||||
3. Tools can be added or removed during runtime
|
||||
4. Tool definitions can be updated (though this should be done carefully)
|
||||
|
||||
## Error handling
|
||||
|
||||
Tool errors should be reported within the result object, not as MCP protocol-level errors. This allows the LLM to see and potentially handle the error. When a tool encounters an error:
|
||||
|
||||
1. Set `isError` to `true` in the result
|
||||
2. Include error details in the `content` array
|
||||
|
||||
Here's an example of proper error handling for tools:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="TypeScript">
|
||||
```typescript
|
||||
try {
|
||||
// Tool operation
|
||||
const result = performOperation();
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: `Operation successful: ${result}`
|
||||
}
|
||||
]
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
isError: true,
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: `Error: ${error.message}`
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
|
||||
<Tab title="Python">
|
||||
```python
|
||||
try:
|
||||
# Tool operation
|
||||
result = perform_operation()
|
||||
return types.CallToolResult(
|
||||
content=[
|
||||
types.TextContent(
|
||||
type="text",
|
||||
text=f"Operation successful: {result}"
|
||||
)
|
||||
]
|
||||
)
|
||||
except Exception as error:
|
||||
return types.CallToolResult(
|
||||
isError=True,
|
||||
content=[
|
||||
types.TextContent(
|
||||
type="text",
|
||||
text=f"Error: {str(error)}"
|
||||
)
|
||||
]
|
||||
)
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
This approach allows the LLM to see that an error occurred and potentially take corrective action or request human intervention.
|
||||
|
||||
## Tool annotations
|
||||
|
||||
Tool annotations provide additional metadata about a tool's behavior, helping clients understand how to present and manage tools. These annotations are hints that describe the nature and impact of a tool, but should not be relied upon for security decisions.
|
||||
|
||||
### Purpose of tool annotations
|
||||
|
||||
Tool annotations serve several key purposes:
|
||||
|
||||
1. Provide UX-specific information without affecting model context
|
||||
2. Help clients categorize and present tools appropriately
|
||||
3. Convey information about a tool's potential side effects
|
||||
4. Assist in developing intuitive interfaces for tool approval
|
||||
|
||||
### Available tool annotations
|
||||
|
||||
The MCP specification defines the following annotations for tools:
|
||||
|
||||
| Annotation | Type | Default | Description |
|
||||
| ----------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `title` | string | - | A human-readable title for the tool, useful for UI display |
|
||||
| `readOnlyHint` | boolean | false | If true, indicates the tool does not modify its environment |
|
||||
| `destructiveHint` | boolean | true | If true, the tool may perform destructive updates (only meaningful when `readOnlyHint` is false) |
|
||||
| `idempotentHint` | boolean | false | If true, calling the tool repeatedly with the same arguments has no additional effect (only meaningful when `readOnlyHint` is false) |
|
||||
| `openWorldHint` | boolean | true | If true, the tool may interact with an "open world" of external entities |
|
||||
|
||||
### Example usage
|
||||
|
||||
Here's how to define tools with annotations for different scenarios:
|
||||
|
||||
```typescript
|
||||
// A read-only search tool
|
||||
{
|
||||
name: "web_search",
|
||||
description: "Search the web for information",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
query: { type: "string" }
|
||||
},
|
||||
required: ["query"]
|
||||
},
|
||||
annotations: {
|
||||
title: "Web Search",
|
||||
readOnlyHint: true,
|
||||
openWorldHint: true
|
||||
}
|
||||
}
|
||||
|
||||
// A destructive file deletion tool
|
||||
{
|
||||
name: "delete_file",
|
||||
description: "Delete a file from the filesystem",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
path: { type: "string" }
|
||||
},
|
||||
required: ["path"]
|
||||
},
|
||||
annotations: {
|
||||
title: "Delete File",
|
||||
readOnlyHint: false,
|
||||
destructiveHint: true,
|
||||
idempotentHint: true,
|
||||
openWorldHint: false
|
||||
}
|
||||
}
|
||||
|
||||
// A non-destructive database record creation tool
|
||||
{
|
||||
name: "create_record",
|
||||
description: "Create a new record in the database",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
table: { type: "string" },
|
||||
data: { type: "object" }
|
||||
},
|
||||
required: ["table", "data"]
|
||||
},
|
||||
annotations: {
|
||||
title: "Create Database Record",
|
||||
readOnlyHint: false,
|
||||
destructiveHint: false,
|
||||
idempotentHint: false,
|
||||
openWorldHint: false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Integrating annotations in server implementation
|
||||
|
||||
<Tabs>
|
||||
<Tab title="TypeScript">
|
||||
```typescript
|
||||
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
||||
return {
|
||||
tools: [{
|
||||
name: "calculate_sum",
|
||||
description: "Add two numbers together",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
a: { type: "number" },
|
||||
b: { type: "number" }
|
||||
},
|
||||
required: ["a", "b"]
|
||||
},
|
||||
annotations: {
|
||||
title: "Calculate Sum",
|
||||
readOnlyHint: true,
|
||||
openWorldHint: false
|
||||
}
|
||||
}]
|
||||
};
|
||||
});
|
||||
```
|
||||
</Tab>
|
||||
|
||||
<Tab title="Python">
|
||||
```python
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("example-server")
|
||||
|
||||
@mcp.tool(
|
||||
annotations={
|
||||
"title": "Calculate Sum",
|
||||
"readOnlyHint": True,
|
||||
"openWorldHint": False
|
||||
}
|
||||
)
|
||||
async def calculate_sum(a: float, b: float) -> str:
|
||||
"""Add two numbers together.
|
||||
|
||||
Args:
|
||||
a: First number to add
|
||||
b: Second number to add
|
||||
"""
|
||||
result = a + b
|
||||
return str(result)
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Best practices for tool annotations
|
||||
|
||||
1. **Be accurate about side effects**: Clearly indicate whether a tool modifies its environment and whether those modifications are destructive.
|
||||
|
||||
2. **Use descriptive titles**: Provide human-friendly titles that clearly describe the tool's purpose.
|
||||
|
||||
3. **Indicate idempotency properly**: Mark tools as idempotent only if repeated calls with the same arguments truly have no additional effect.
|
||||
|
||||
4. **Set appropriate open/closed world hints**: Indicate whether a tool interacts with a closed system (like a database) or an open system (like the web).
|
||||
|
||||
5. **Remember annotations are hints**: All properties in ToolAnnotations are hints and not guaranteed to provide a faithful description of tool behavior. Clients should never make security-critical decisions based solely on annotations.
|
||||
|
||||
## Testing tools
|
||||
|
||||
A comprehensive testing strategy for MCP tools should cover:
|
||||
|
||||
* **Functional testing**: Verify tools execute correctly with valid inputs and handle invalid inputs appropriately
|
||||
* **Integration testing**: Test tool interaction with external systems using both real and mocked dependencies
|
||||
* **Security testing**: Validate authentication, authorization, input sanitization, and rate limiting
|
||||
* **Performance testing**: Check behavior under load, timeout handling, and resource cleanup
|
||||
* **Error handling**: Ensure tools properly report errors through the MCP protocol and clean up resources
|
||||
375
skills/doc-coauthoring/SKILL.md
Normal file
375
skills/doc-coauthoring/SKILL.md
Normal file
@@ -0,0 +1,375 @@
|
||||
---
|
||||
name: doc-coauthoring
|
||||
description: Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
|
||||
---
|
||||
|
||||
# Doc Co-Authoring Workflow
|
||||
|
||||
This skill provides a structured workflow for guiding users through collaborative document creation. Act as an active guide, walking users through three stages: Context Gathering, Refinement & Structure, and Reader Testing.
|
||||
|
||||
## When to Offer This Workflow
|
||||
|
||||
**Trigger conditions:**
|
||||
- User mentions writing documentation: "write a doc", "draft a proposal", "create a spec", "write up"
|
||||
- User mentions specific doc types: "PRD", "design doc", "decision doc", "RFC"
|
||||
- User seems to be starting a substantial writing task
|
||||
|
||||
**Initial offer:**
|
||||
Offer the user a structured workflow for co-authoring the document. Explain the three stages:
|
||||
|
||||
1. **Context Gathering**: User provides all relevant context while Claude asks clarifying questions
|
||||
2. **Refinement & Structure**: Iteratively build each section through brainstorming and editing
|
||||
3. **Reader Testing**: Test the doc with a fresh Claude (no context) to catch blind spots before others read it
|
||||
|
||||
Explain that this approach helps ensure the doc works well when others read it (including when they paste it into Claude). Ask if they want to try this workflow or prefer to work freeform.
|
||||
|
||||
If user declines, work freeform. If user accepts, proceed to Stage 1.
|
||||
|
||||
## Stage 1: Context Gathering
|
||||
|
||||
**Goal:** Close the gap between what the user knows and what Claude knows, enabling smart guidance later.
|
||||
|
||||
### Initial Questions
|
||||
|
||||
Start by asking the user for meta-context about the document:
|
||||
|
||||
1. What type of document is this? (e.g., technical spec, decision doc, proposal)
|
||||
2. Who's the primary audience?
|
||||
3. What's the desired impact when someone reads this?
|
||||
4. Is there a template or specific format to follow?
|
||||
5. Any other constraints or context to know?
|
||||
|
||||
Inform them they can answer in shorthand or dump information however works best for them.
|
||||
|
||||
**If user provides a template or mentions a doc type:**
|
||||
- Ask if they have a template document to share
|
||||
- If they provide a link to a shared document, use the appropriate integration to fetch it
|
||||
- If they provide a file, read it
|
||||
|
||||
**If user mentions editing an existing shared document:**
|
||||
- Use the appropriate integration to read the current state
|
||||
- Check for images without alt-text
|
||||
- If images exist without alt-text, explain that when others use Claude to understand the doc, Claude won't be able to see them. Ask if they want alt-text generated. If so, request they paste each image into chat for descriptive alt-text generation.
|
||||
|
||||
### Info Dumping
|
||||
|
||||
Once initial questions are answered, encourage the user to dump all the context they have. Request information such as:
|
||||
- Background on the project/problem
|
||||
- Related team discussions or shared documents
|
||||
- Why alternative solutions aren't being used
|
||||
- Organizational context (team dynamics, past incidents, politics)
|
||||
- Timeline pressures or constraints
|
||||
- Technical architecture or dependencies
|
||||
- Stakeholder concerns
|
||||
|
||||
Advise them not to worry about organizing it - just get it all out. Offer multiple ways to provide context:
|
||||
- Info dump stream-of-consciousness
|
||||
- Point to team channels or threads to read
|
||||
- Link to shared documents
|
||||
|
||||
**If integrations are available** (e.g., Slack, Teams, Google Drive, SharePoint, or other MCP servers), mention that these can be used to pull in context directly.
|
||||
|
||||
**If no integrations are detected and in Claude.ai or Claude app:** Suggest they can enable connectors in their Claude settings to allow pulling context from messaging apps and document storage directly.
|
||||
|
||||
Inform them clarifying questions will be asked once they've done their initial dump.
|
||||
|
||||
**During context gathering:**
|
||||
|
||||
- If user mentions team channels or shared documents:
|
||||
- If integrations available: Inform them the content will be read now, then use the appropriate integration
|
||||
- If integrations not available: Explain lack of access. Suggest they enable connectors in Claude settings, or paste the relevant content directly.
|
||||
|
||||
- If user mentions entities/projects that are unknown:
|
||||
- Ask if connected tools should be searched to learn more
|
||||
- Wait for user confirmation before searching
|
||||
|
||||
- As user provides context, track what's being learned and what's still unclear
|
||||
|
||||
**Asking clarifying questions:**
|
||||
|
||||
When user signals they've done their initial dump (or after substantial context provided), ask clarifying questions to ensure understanding:
|
||||
|
||||
Generate 5-10 numbered questions based on gaps in the context.
|
||||
|
||||
Inform them they can use shorthand to answer (e.g., "1: yes, 2: see #channel, 3: no because backwards compat"), link to more docs, point to channels to read, or just keep info-dumping. Whatever's most efficient for them.
|
||||
|
||||
**Exit condition:**
|
||||
Sufficient context has been gathered when questions show understanding - when edge cases and trade-offs can be asked about without needing basics explained.
|
||||
|
||||
**Transition:**
|
||||
Ask if there's any more context they want to provide at this stage, or if it's time to move on to drafting the document.
|
||||
|
||||
If user wants to add more, let them. When ready, proceed to Stage 2.
|
||||
|
||||
## Stage 2: Refinement & Structure
|
||||
|
||||
**Goal:** Build the document section by section through brainstorming, curation, and iterative refinement.
|
||||
|
||||
**Instructions to user:**
|
||||
Explain that the document will be built section by section. For each section:
|
||||
1. Clarifying questions will be asked about what to include
|
||||
2. 5-20 options will be brainstormed
|
||||
3. User will indicate what to keep/remove/combine
|
||||
4. The section will be drafted
|
||||
5. It will be refined through surgical edits
|
||||
|
||||
Start with whichever section has the most unknowns (usually the core decision/proposal), then work through the rest.
|
||||
|
||||
**Section ordering:**
|
||||
|
||||
If the document structure is clear:
|
||||
Ask which section they'd like to start with.
|
||||
|
||||
Suggest starting with whichever section has the most unknowns. For decision docs, that's usually the core proposal. For specs, it's typically the technical approach. Summary sections are best left for last.
|
||||
|
||||
If user doesn't know what sections they need:
|
||||
Based on the type of document and template, suggest 3-5 sections appropriate for the doc type.
|
||||
|
||||
Ask if this structure works, or if they want to adjust it.
|
||||
|
||||
**Once structure is agreed:**
|
||||
|
||||
Create the initial document structure with placeholder text for all sections.
|
||||
|
||||
**If access to artifacts is available:**
|
||||
Use `create_file` to create an artifact. This gives both Claude and the user a scaffold to work from.
|
||||
|
||||
Inform them that the initial structure with placeholders for all sections will be created.
|
||||
|
||||
Create artifact with all section headers and brief placeholder text like "[To be written]" or "[Content here]".
|
||||
|
||||
Provide the scaffold link and indicate it's time to fill in each section.
|
||||
|
||||
**If no access to artifacts:**
|
||||
Create a markdown file in the working directory. Name it appropriately (e.g., `decision-doc.md`, `technical-spec.md`).
|
||||
|
||||
Inform them that the initial structure with placeholders for all sections will be created.
|
||||
|
||||
Create file with all section headers and placeholder text.
|
||||
|
||||
Confirm the filename has been created and indicate it's time to fill in each section.
|
||||
|
||||
**For each section:**
|
||||
|
||||
### Step 1: Clarifying Questions
|
||||
|
||||
Announce work will begin on the [SECTION NAME] section. Ask 5-10 clarifying questions about what should be included:
|
||||
|
||||
Generate 5-10 specific questions based on context and section purpose.
|
||||
|
||||
Inform them they can answer in shorthand or just indicate what's important to cover.
|
||||
|
||||
### Step 2: Brainstorming
|
||||
|
||||
For the [SECTION NAME] section, brainstorm [5-20] things that might be included, depending on the section's complexity. Look for:
|
||||
- Context shared that might have been forgotten
|
||||
- Angles or considerations not yet mentioned
|
||||
|
||||
Generate 5-20 numbered options based on section complexity. At the end, offer to brainstorm more if they want additional options.
|
||||
|
||||
### Step 3: Curation
|
||||
|
||||
Ask which points should be kept, removed, or combined. Request brief justifications to help learn priorities for the next sections.
|
||||
|
||||
Provide examples:
|
||||
- "Keep 1,4,7,9"
|
||||
- "Remove 3 (duplicates 1)"
|
||||
- "Remove 6 (audience already knows this)"
|
||||
- "Combine 11 and 12"
|
||||
|
||||
**If user gives freeform feedback** (e.g., "looks good" or "I like most of it but...") instead of numbered selections, extract their preferences and proceed. Parse what they want kept/removed/changed and apply it.
|
||||
|
||||
### Step 4: Gap Check
|
||||
|
||||
Based on what they've selected, ask if there's anything important missing for the [SECTION NAME] section.
|
||||
|
||||
### Step 5: Drafting
|
||||
|
||||
Use `str_replace` to replace the placeholder text for this section with the actual drafted content.
|
||||
|
||||
Announce the [SECTION NAME] section will be drafted now based on what they've selected.
|
||||
|
||||
**If using artifacts:**
|
||||
After drafting, provide a link to the artifact.
|
||||
|
||||
Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
|
||||
|
||||
**If using a file (no artifacts):**
|
||||
After drafting, confirm completion.
|
||||
|
||||
Inform them the [SECTION NAME] section has been drafted in [filename]. Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
|
||||
|
||||
**Key instruction for user (include when drafting the first section):**
|
||||
Provide a note: Instead of editing the doc directly, ask them to indicate what to change. This helps learning of their style for future sections. For example: "Remove the X bullet - already covered by Y" or "Make the third paragraph more concise".
|
||||
|
||||
### Step 6: Iterative Refinement
|
||||
|
||||
As user provides feedback:
|
||||
- Use `str_replace` to make edits (never reprint the whole doc)
|
||||
- **If using artifacts:** Provide link to artifact after each edit
|
||||
- **If using files:** Just confirm edits are complete
|
||||
- If user edits doc directly and asks to read it: mentally note the changes they made and keep them in mind for future sections (this shows their preferences)
|
||||
|
||||
**Continue iterating** until user is satisfied with the section.
|
||||
|
||||
### Quality Checking
|
||||
|
||||
After 3 consecutive iterations with no substantial changes, ask if anything can be removed without losing important information.
|
||||
|
||||
When section is done, confirm [SECTION NAME] is complete. Ask if ready to move to the next section.
|
||||
|
||||
**Repeat for all sections.**
|
||||
|
||||
### Near Completion
|
||||
|
||||
As approaching completion (80%+ of sections done), announce intention to re-read the entire document and check for:
|
||||
- Flow and consistency across sections
|
||||
- Redundancy or contradictions
|
||||
- Anything that feels like "slop" or generic filler
|
||||
- Whether every sentence carries weight
|
||||
|
||||
Read entire document and provide feedback.
|
||||
|
||||
**When all sections are drafted and refined:**
|
||||
Announce all sections are drafted. Indicate intention to review the complete document one more time.
|
||||
|
||||
Review for overall coherence, flow, completeness.
|
||||
|
||||
Provide any final suggestions.
|
||||
|
||||
Ask if ready to move to Reader Testing, or if they want to refine anything else.
|
||||
|
||||
## Stage 3: Reader Testing
|
||||
|
||||
**Goal:** Test the document with a fresh Claude (no context bleed) to verify it works for readers.
|
||||
|
||||
**Instructions to user:**
|
||||
Explain that testing will now occur to see if the document actually works for readers. This catches blind spots - things that make sense to the authors but might confuse others.
|
||||
|
||||
### Testing Approach
|
||||
|
||||
**If access to sub-agents is available (e.g., in Claude Code):**
|
||||
|
||||
Perform the testing directly without user involvement.
|
||||
|
||||
### Step 1: Predict Reader Questions
|
||||
|
||||
Announce intention to predict what questions readers might ask when trying to discover this document.
|
||||
|
||||
Generate 5-10 questions that readers would realistically ask.
|
||||
|
||||
### Step 2: Test with Sub-Agent
|
||||
|
||||
Announce that these questions will be tested with a fresh Claude instance (no context from this conversation).
|
||||
|
||||
For each question, invoke a sub-agent with just the document content and the question.
|
||||
|
||||
Summarize what Reader Claude got right/wrong for each question.
|
||||
|
||||
### Step 3: Run Additional Checks
|
||||
|
||||
Announce additional checks will be performed.
|
||||
|
||||
Invoke sub-agent to check for ambiguity, false assumptions, contradictions.
|
||||
|
||||
Summarize any issues found.
|
||||
|
||||
### Step 4: Report and Fix
|
||||
|
||||
If issues found:
|
||||
Report that Reader Claude struggled with specific issues.
|
||||
|
||||
List the specific issues.
|
||||
|
||||
Indicate intention to fix these gaps.
|
||||
|
||||
Loop back to refinement for problematic sections.
|
||||
|
||||
---
|
||||
|
||||
**If no access to sub-agents (e.g., claude.ai web interface):**
|
||||
|
||||
The user will need to do the testing manually.
|
||||
|
||||
### Step 1: Predict Reader Questions
|
||||
|
||||
Ask what questions people might ask when trying to discover this document. What would they type into Claude.ai?
|
||||
|
||||
Generate 5-10 questions that readers would realistically ask.
|
||||
|
||||
### Step 2: Setup Testing
|
||||
|
||||
Provide testing instructions:
|
||||
1. Open a fresh Claude conversation: https://claude.ai
|
||||
2. Paste or share the document content (if using a shared doc platform with connectors enabled, provide the link)
|
||||
3. Ask Reader Claude the generated questions
|
||||
|
||||
For each question, instruct Reader Claude to provide:
|
||||
- The answer
|
||||
- Whether anything was ambiguous or unclear
|
||||
- What knowledge/context the doc assumes is already known
|
||||
|
||||
Check if Reader Claude gives correct answers or misinterprets anything.
|
||||
|
||||
### Step 3: Additional Checks
|
||||
|
||||
Also ask Reader Claude:
|
||||
- "What in this doc might be ambiguous or unclear to readers?"
|
||||
- "What knowledge or context does this doc assume readers already have?"
|
||||
- "Are there any internal contradictions or inconsistencies?"
|
||||
|
||||
### Step 4: Iterate Based on Results
|
||||
|
||||
Ask what Reader Claude got wrong or struggled with. Indicate intention to fix those gaps.
|
||||
|
||||
Loop back to refinement for any problematic sections.
|
||||
|
||||
---
|
||||
|
||||
### Exit Condition (Both Approaches)
|
||||
|
||||
When Reader Claude consistently answers questions correctly and doesn't surface new gaps or ambiguities, the doc is ready.
|
||||
|
||||
## Final Review
|
||||
|
||||
When Reader Testing passes:
|
||||
Announce the doc has passed Reader Claude testing. Before completion:
|
||||
|
||||
1. Recommend they do a final read-through themselves - they own this document and are responsible for its quality
|
||||
2. Suggest double-checking any facts, links, or technical details
|
||||
3. Ask them to verify it achieves the impact they wanted
|
||||
|
||||
Ask if they want one more review, or if the work is done.
|
||||
|
||||
**If user wants final review, provide it. Otherwise:**
|
||||
Announce document completion. Provide a few final tips:
|
||||
- Consider linking this conversation in an appendix so readers can see how the doc was developed
|
||||
- Use appendices to provide depth without bloating the main doc
|
||||
- Update the doc as feedback is received from real readers
|
||||
|
||||
## Tips for Effective Guidance
|
||||
|
||||
**Tone:**
|
||||
- Be direct and procedural
|
||||
- Explain rationale briefly when it affects user behavior
|
||||
- Don't try to "sell" the approach - just execute it
|
||||
|
||||
**Handling Deviations:**
|
||||
- If user wants to skip a stage: Ask if they want to skip this and write freeform
|
||||
- If user seems frustrated: Acknowledge this is taking longer than expected. Suggest ways to move faster
|
||||
- Always give user agency to adjust the process
|
||||
|
||||
**Context Management:**
|
||||
- Throughout, if context is missing on something mentioned, proactively ask
|
||||
- Don't let gaps accumulate - address them as they come up
|
||||
|
||||
**Artifact Management:**
|
||||
- Use `create_file` for drafting full sections
|
||||
- Use `str_replace` for all edits
|
||||
- Provide artifact link after every change
|
||||
- Never use artifacts for brainstorming lists - that's just conversation
|
||||
|
||||
**Quality over Speed:**
|
||||
- Don't rush through stages
|
||||
- Each iteration should make meaningful improvements
|
||||
- The goal is a document that actually works for readers
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user