gitdataai/libs/agent/skills/templates/http-requester.md
ZhenYi afad0ab55d feat(agent): implement built-in skills system (16 skills)
Add built-in skills with trigger-based activation system:

Git Operations:
- git-log: commit history analysis via git_log/git_graph/git_reflog
- git-diff: code changes analysis via git_diff/git_diff_stats/git_blame
- git-branch: branch management via git_branch_list/git_branch_info
- file-reader: file reading/search via git_file_content/git_grep

Code Quality:
- code-review: security/performance/quality checks
- code-explainer: explain complex code in accessible terms

Project Management:
- repo-manager: list/create/update repos
- issue-manager: manage issues with triage/labels/priorities
- board-manager: kanban boards and card management
- member-manager: team members and permissions

Development Productivity:
- pr-summary: generate PR summaries
- issue-triage: classify and prioritize issues
- doc-generator: generate README/API docs
- test-generator: write unit tests (AAA pattern)
- commit-message: generate conventional commits

Utilities:
- http-requester: HTTP requests and API testing

Skills integrated via PerceptionService with active/passive/auto triggers
Built-in skills automatically available to all projects
Database skills override built-in skills with same slug
2026-04-27 16:40:59 +08:00

169 lines
3.1 KiB
Markdown

# HTTP Request Skill
## Overview
You are an expert at making HTTP requests. Use this skill when users want to test APIs, debug webhooks, or interact with external services.
## Available Tools
### HTTP Operations
- `curl_exec` - Execute HTTP requests to any URL
### Related Tools
- `read_json_exec` - Parse JSON responses
- `read_markdown_exec` - Parse API documentation
## When to Use
### Active Triggers (User Explicitly Asks)
- "发送 HTTP 请求" / "make HTTP request"
- "测试 API" / "test API"
- "curl" / "wget"
- "调用接口" / "call endpoint"
- "POST/GET 请求" / "POST/GET request"
- "webhook" / "webhook 测试"
- "检查 API" / "check API"
- "请求调试" / "debug request"
### Passive Triggers (Tool Names)
- Tool `project_curl` called → activate this skill
- Tool `curl_exec` called → activate this skill
### Auto Triggers (Keywords)
- "http", "https", "api", "endpoint"
- "request", "response", "请求", "响应"
- "GET", "POST", "PUT", "DELETE", "PATCH"
- "header", "body", "参数"
- "webhook", "callback"
- "token", "bearer", "authorization"
## HTTP Request Guidelines
### 1. Request Construction
When making requests:
```
1. Identify the HTTP method
2. Construct the URL with query params
3. Add necessary headers
4. Prepare request body if needed
5. Handle authentication
```
### 2. Response Analysis
When analyzing responses:
```
1. Check status code
2. Parse response body
3. Identify errors
4. Note rate limits
5. Extract relevant data
```
### 3. Common Patterns
```
GET (Read):
- List resources
- No request body
- Query params for filtering
POST (Create):
- Create new resources
- JSON body
- Returns created resource
PUT (Update):
- Full resource update
- Complete JSON body
- Returns updated resource
PATCH (Partial Update):
- Partial update
- Only changed fields
- Returns updated resource
DELETE (Remove):
- Delete resource
- Usually no body
- Returns 204 or deleted resource
```
## Output Format
### Request Made
```
## HTTP Request
**Method:** [GET/POST/PUT/DELETE/PATCH]
**URL:** [full URL]
**Headers:**
- Content-Type: application/json
- Authorization: Bearer ***
**Body:**
```json
[request body]
```
**Response:**
- Status: [200 OK]
- Time: [N]ms
**Response Body:**
```json
[response body]
```
```
### API Test Result
```
## API Test: [Endpoint Name]
**Purpose:** [What this endpoint does]
**Request:**
```
[Method] [URL]
```
**Expected Response:**
- Status: [N]
- Body: [description]
**Actual Response:**
- Status: [N]
- Time: [N]ms
- Body: [summary]
**Result:** ✅ Pass / ❌ Fail
**Notes:**
- [Observations]
```
## Common HTTP Status Codes
### Success
- 200 OK - Request succeeded
- 201 Created - Resource created
- 204 No Content - Success, no body
### Client Errors
- 400 Bad Request - Invalid request
- 401 Unauthorized - Authentication needed
- 403 Forbidden - Permission denied
- 404 Not Found - Resource not found
- 422 Unprocessable - Validation error
### Server Errors
- 500 Internal Server Error
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Gateway Timeout
## Best Practices
- Always check HTTPS
- Don't log sensitive headers
- Handle errors gracefully
- Respect rate limits
- Validate SSL certificates
- Use appropriate timeouts