@devxiyang/agent-skill 0.0.8 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,139 +0,0 @@
1
- ---
2
- name: web
3
- description: Fetch web pages, call REST APIs, download files, and extract content from URLs using curl.
4
- requires: bin:curl
5
- tags: web,http
6
- ---
7
-
8
- # Web Skill
9
-
10
- ## Preflight
11
-
12
- Verify curl is available before proceeding:
13
-
14
- ```bash
15
- curl --version
16
- ```
17
-
18
- If missing, load `references/install.md` for installation instructions.
19
-
20
- ## Fetch a web page
21
-
22
- ```bash
23
- curl -sL "https://example.com"
24
- ```
25
-
26
- ## REST API calls
27
-
28
- ```bash
29
- # GET with JSON response
30
- curl -s "https://api.example.com/users" | jq .
31
-
32
- # POST JSON
33
- curl -s -X POST "https://api.example.com/items" \
34
- -H "Content-Type: application/json" \
35
- -d '{"name": "foo"}'
36
-
37
- # PUT
38
- curl -s -X PUT "https://api.example.com/items/1" \
39
- -H "Content-Type: application/json" \
40
- -d '{"name": "bar"}'
41
-
42
- # DELETE
43
- curl -s -X DELETE "https://api.example.com/items/1"
44
-
45
- # With auth header
46
- curl -s "https://api.example.com/data" \
47
- -H "Authorization: Bearer $TOKEN"
48
- ```
49
-
50
- ## Form data & file upload
51
-
52
- ```bash
53
- # Submit a form (application/x-www-form-urlencoded)
54
- curl -s -X POST "https://example.com/login" \
55
- -d "username=alice&password=secret"
56
-
57
- # Multipart file upload
58
- curl -s -X POST "https://example.com/upload" \
59
- -F "file=@/path/to/file.pdf" \
60
- -F "description=My file"
61
- ```
62
-
63
- ## Cookies & sessions
64
-
65
- ```bash
66
- # Save cookies to a file
67
- curl -s -c cookies.txt "https://example.com/login" \
68
- -d "user=alice&pass=secret"
69
-
70
- # Reuse saved cookies
71
- curl -s -b cookies.txt "https://example.com/dashboard"
72
- ```
73
-
74
- ## Download a file
75
-
76
- ```bash
77
- curl -sL "https://example.com/file.zip" -o /tmp/file.zip
78
-
79
- # Resume interrupted download
80
- curl -C - -L "https://example.com/large.zip" -o /tmp/large.zip
81
- ```
82
-
83
- ## Extract content from a page
84
-
85
- Prefer Python for reliable HTML parsing over fragile sed/grep:
86
-
87
- ```bash
88
- curl -sL "https://example.com" | python3 -c "
89
- import sys, html.parser
90
-
91
- class TextExtractor(html.parser.HTMLParser):
92
- skip = {'script', 'style'}
93
- def __init__(self):
94
- super().__init__()
95
- self._tag = None
96
- self.parts = []
97
- def handle_starttag(self, tag, attrs):
98
- self._tag = tag
99
- def handle_data(self, data):
100
- if self._tag not in self.skip and data.strip():
101
- self.parts.append(data.strip())
102
-
103
- p = TextExtractor()
104
- p.feed(sys.stdin.read())
105
- print('\n'.join(p.parts))
106
- "
107
- ```
108
-
109
- ## Inspect response
110
-
111
- ```bash
112
- # Headers only
113
- curl -sI "https://example.com"
114
-
115
- # Show both headers and body
116
- curl -sD - "https://example.com"
117
-
118
- # Show HTTP status code only
119
- curl -s -o /dev/null -w "%{http_code}" "https://example.com"
120
- ```
121
-
122
- ## HTTPS & certificates
123
-
124
- ```bash
125
- # Skip certificate verification (use only for testing)
126
- curl -sk "https://self-signed.example.com"
127
-
128
- # Use a specific CA certificate
129
- curl -s --cacert /path/to/ca.crt "https://example.com"
130
- ```
131
-
132
- ## Tips
133
-
134
- - `-s` silences progress output
135
- - `-L` follows redirects
136
- - `-I` fetches headers only
137
- - `--max-time 10` sets a timeout in seconds
138
- - `--compressed` requests gzip encoding automatically
139
- - `-v` shows full request/response for debugging
@@ -1,51 +0,0 @@
1
- # Installing curl
2
-
3
- curl is pre-installed on macOS and Windows 10 (version 1803+). Check first:
4
-
5
- ```bash
6
- curl --version
7
- ```
8
-
9
- Install only if the command is not found.
10
-
11
- ## macOS
12
-
13
- curl ships with every macOS installation. If the command is somehow missing, it likely indicates a system issue rather than a missing package. Try reinstalling Xcode Command Line Tools:
14
-
15
- ```bash
16
- xcode-select --install
17
- ```
18
-
19
- If you need a newer version and have Homebrew:
20
-
21
- ```bash
22
- brew install curl
23
- ```
24
-
25
- ## Windows
26
-
27
- curl is bundled with Windows 10 version 1803+ as `curl.exe`. If missing:
28
-
29
- Download from https://curl.se/windows/ and add the binary to your PATH.
30
-
31
- If winget is available:
32
-
33
- ```powershell
34
- winget install cURL.cURL
35
- ```
36
-
37
- ## Linux
38
-
39
- ```bash
40
- # Debian/Ubuntu
41
- sudo apt update && sudo apt install curl
42
-
43
- # Fedora
44
- sudo dnf install curl
45
-
46
- # Arch
47
- sudo pacman -S curl
48
-
49
- # openSUSE
50
- sudo zypper install curl
51
- ```