{"id":"6b9116c9-b439-4a49-9055-bb45b821690f","shortId":"jjPfZM","kind":"skill","title":"tencentcloud-cos","tagline":"Manage Tencent Cloud COS (Cloud Object Storage) buckets and objects.\nUse whenever the user asks about COS / 对象存储 / Tencent Cloud bucket\noperations: list buckets, list objects, upload, download, delete,\npre-signed URLs, calculate bucket size (du), batch delete with prefix,\ncopy ob","description":"# Tencent Cloud COS (Object Storage)\n\nManage Tencent Cloud COS buckets and objects via the official `cos-python-sdk-v5` client.\n\n> **Setup:** See [tencentcloud authentication](../_shared/tencentcloud.md) for SecretId / SecretKey / region setup. The SDK reads `TENCENTCLOUD_SECRET_ID` / `TENCENTCLOUD_SECRET_KEY` / `TENCENTCLOUD_REGION` from the environment.\n\n## CLI (preferred)\n\nThe skill ships [`scripts/cos.py`](scripts/cos.py) — a self-contained CLI that wraps every COS operation below. **Prefer this over hand-rolled SDK calls** when the user's request maps cleanly onto one of its subcommands; it's what the maintained code paths exercise.\n\n```bash\nCOS=$SKILL_DIR/scripts/cos.py\n\npython3 $COS buckets                                  # list all buckets\npython3 $COS ls mydata-1250000000 --prefix images/    # list objects\npython3 $COS upload mydata-1250000000 ./report.pdf --key docs/report-2026.pdf\npython3 $COS download mydata-1250000000 docs/report-2026.pdf --output ./out.pdf\npython3 $COS url mydata-1250000000 docs/report-2026.pdf --expires 3600\npython3 $COS du mydata-1250000000 --prefix logs/\npython3 $COS cp mydata-1250000000 old/path.txt new/path.txt\npython3 $COS batch-delete mydata-1250000000 --prefix temp/old/ --dry-run\npython3 $COS batch-delete mydata-1250000000 --prefix temp/old/   # actually delete\npython3 $COS info mydata-1250000000 docs/report-2026.pdf\n```\n\nRun `python3 $COS --help` (or `python3 $COS <cmd> --help`) for full flags. Pass `--region <region>` to override per-call.\n\n## When to Use\n\n- List COS buckets across the account\n- List objects in a bucket (with prefix / delimiter filtering)\n- Upload / download files\n- Delete a single object or batch-delete by prefix\n- Generate pre-signed download URLs (private bucket sharing)\n- Calculate bucket / prefix storage usage\n- Copy objects within a bucket\n\n## Dependencies\n\n```bash\npip install cos-python-sdk-v5\n```\n\n## Bucket naming\n\nTencent Cloud bucket names always end in `-<APPID>`, e.g. `mydata-1250000000`. The APPID is the numeric account identifier. The SDK requires the full `name-APPID` form everywhere a bucket is named.\n\n## Quick start\n\n```python\nimport os\nfrom qcloud_cos import CosConfig, CosS3Client\n\nconfig = CosConfig(\n    Region=os.environ[\"TENCENTCLOUD_REGION\"],\n    SecretId=os.environ[\"TENCENTCLOUD_SECRET_ID\"],\n    SecretKey=os.environ[\"TENCENTCLOUD_SECRET_KEY\"],\n    Scheme=\"https\",\n)\nclient = CosS3Client(config)\n```\n\n## Workflows\n\n### List all buckets\n\n```python\nresp = client.list_buckets()\nfor b in resp[\"Buckets\"][\"Bucket\"]:\n    print(b[\"Name\"], b[\"Location\"], b[\"CreationDate\"])\n```\n\n### List objects in a bucket\n\n```python\n# Single page (max 1000 objects)\nresp = client.list_objects(Bucket=\"mydata-1250000000\", Prefix=\"images/\", Delimiter=\"/\")\nfor obj in resp.get(\"Contents\", []):\n    print(obj[\"Key\"], int(obj[\"Size\"]), obj[\"LastModified\"])\n\n# Paginate through everything\nmarker = \"\"\nwhile True:\n    resp = client.list_objects(Bucket=\"mydata-1250000000\", Prefix=\"logs/\", Marker=marker, MaxKeys=1000)\n    for obj in resp.get(\"Contents\", []):\n        print(obj[\"Key\"])\n    if resp.get(\"IsTruncated\") != \"true\":\n        break\n    marker = resp[\"NextMarker\"]\n```\n\n### Upload a file\n\n```python\n# Streaming upload — handles multipart / resumes / 5GB+ files transparently\nclient.upload_file(\n    Bucket=\"mydata-1250000000\",\n    Key=\"uploads/2026/report.pdf\",\n    LocalFilePath=\"./report.pdf\",\n)\n```\n\n### Download a file\n\n```python\nclient.download_file(\n    Bucket=\"mydata-1250000000\",\n    Key=\"uploads/2026/report.pdf\",\n    DestFilePath=\"./report.pdf\",\n)\n```\n\n### Generate a pre-signed download URL\n\n```python\n# Default expiry 1 hour; pass Expired=86400 for 24h, etc.\nurl = client.get_presigned_url(\n    Method=\"GET\",\n    Bucket=\"mydata-1250000000\",\n    Key=\"uploads/2026/report.pdf\",\n    Expired=3600,\n)\nprint(url)\n```\n\n### Delete a single object\n\n```python\nclient.delete_object(Bucket=\"mydata-1250000000\", Key=\"uploads/old-file.txt\")\n```\n\n### Batch delete by prefix (with dry-run safety)\n\n```python\n# 1) Always preview first\nto_delete = []\nmarker = \"\"\nwhile True:\n    resp = client.list_objects(Bucket=\"mydata-1250000000\", Prefix=\"temp/old/\", Marker=marker, MaxKeys=1000)\n    for obj in resp.get(\"Contents\", []):\n        to_delete.append({\"Key\": obj[\"Key\"]})\n    if resp.get(\"IsTruncated\") != \"true\":\n        break\n    marker = resp[\"NextMarker\"]\n\nprint(f\"Would delete {len(to_delete)} objects\")\nfor o in to_delete[:10]:\n    print(\"  -\", o[\"Key\"])\n\n# 2) Confirm with the user before running this:\n# resp = client.delete_objects(Bucket=\"mydata-1250000000\", Delete={\"Object\": to_delete, \"Quiet\": \"false\"})\n# print(\"Deleted:\", len(resp.get(\"Deleted\", [])))\n```\n\n### Calculate bucket / prefix size (du)\n\n```python\ntotal_bytes = 0\ntotal_count = 0\nmarker = \"\"\nwhile True:\n    resp = client.list_objects(Bucket=\"mydata-1250000000\", Prefix=\"logs/\", Marker=marker, MaxKeys=1000)\n    for obj in resp.get(\"Contents\", []):\n        total_bytes += int(obj[\"Size\"])\n        total_count += 1\n    if resp.get(\"IsTruncated\") != \"true\":\n        break\n    marker = resp[\"NextMarker\"]\n\nprint(f\"{total_count} objects, {total_bytes / 1024 / 1024:.1f} MiB\")\n```\n\n### Copy objects within a bucket\n\n```python\nclient.copy_object(\n    Bucket=\"mydata-1250000000\",\n    Key=\"new/path.txt\",\n    CopySource={\n        \"Bucket\": \"mydata-1250000000\",\n        \"Key\": \"old/path.txt\",\n        \"Region\": os.environ[\"TENCENTCLOUD_REGION\"],\n    },\n)\n```\n\n## Safety reminders\n\n- **Confirm batch deletes with the user** before running. The `delete_objects` call is irreversible — there's no recycle bin in COS by default.\n- **Pre-signed URLs are bearer tokens** — anyone with the URL gets the object until it expires. Default to short expiries (1 hour) unless the user explicitly asks for longer.\n- **Cross-region operations** require the source / destination Region in `CopySource`. Mismatched region triggers `NoSuchBucket`.\n- **`download_file` overwrites the destination** without asking. Pick `DestFilePath` carefully when scripting in a loop.\n\n## Error patterns\n\n| Symptom | Likely cause |\n|---|---|\n| `NoSuchBucket` | Wrong region, wrong APPID suffix on the bucket name |\n| `AccessDenied` | Sub-account missing `QcloudCOSReadOnlyAccess` / `QcloudCOSDataReadOnly` etc. |\n| `SignatureDoesNotMatch` | SecretKey was pasted with leading / trailing whitespace, or the system clock is off by more than 5 minutes |\n| `RequestTimeTooSkewed` | Same — clock skew |\n\n## Console links\n\n- COS console: <https://console.cloud.tencent.com/cos/bucket>\n- API reference: <https://www.tencentcloud.com/document/product/436/41330>","tags":["tencentcloud","cos","skills","acedatacloud","acedata-cloud","agent-skills","agentskills","ai-image","ai-music","ai-tools","ai-video","claude-code"],"capabilities":["skill","source-acedatacloud","skill-tencentcloud-cos","topic-acedata-cloud","topic-agent-skills","topic-agentskills","topic-ai-image","topic-ai-music","topic-ai-tools","topic-ai-video","topic-claude-code","topic-cursor","topic-gemini-cli","topic-github-copilot","topic-mcp"],"categories":["Skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/AceDataCloud/Skills/tencentcloud-cos","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add AceDataCloud/Skills","source_repo":"https://github.com/AceDataCloud/Skills","install_from":"skills.sh"}},"qualityScore":"0.453","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (6,577 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:14:04.312Z","embedding":null,"createdAt":"2026-05-18T13:21:35.466Z","updatedAt":"2026-05-18T19:14:04.312Z","lastSeenAt":"2026-05-18T19:14:04.312Z","tsv":"'-1250000000':152,161,169,177,185,192,201,213,222,312,403,431,470,483,514,530,557,611,643,692,698 '/_shared/tencentcloud.md':72 '/cos/bucket':842 '/document/product/436/41330':847 '/out.pdf':172 '/report.pdf':162,474,487 '0':631,634 '1':498,543,662,751 '10':594 '1000':396,437,563,649 '1024':678,679 '1f':680 '2':598 '24h':504 '3600':180,518 '5':830 '5gb':463 '86400':502 'accessdeni':805 'account':250,318,808 'across':248 'actual':216 'alway':307,544 'anyon':737 'api':843 'appid':314,327,799 'ask':18,757,781 'authent':71 'b':375,381,383,385 'bash':138,293 'batch':41,198,210,269,533,708 'batch-delet':197,209,268 'bearer':735 'bin':725 'break':450,577,667 'bucket':11,24,27,38,56,144,147,247,255,280,283,291,301,305,331,369,373,378,379,391,401,429,468,481,512,528,555,609,624,641,686,690,696,803 'byte':630,656,677 'calcul':37,282,623 'call':117,241,718 'care':784 'caus':794 'clean':124 'cli':92,103 'client':67,363 'client.copy':688 'client.delete':526,607 'client.download':479 'client.get':507 'client.list':372,399,427,553,639 'client.upload':466 'clock':824,834 'cloud':6,8,23,48,54,304 'code':135 'config':345,365 'confirm':599,707 'consol':836,839 'console.cloud.tencent.com':841 'console.cloud.tencent.com/cos/bucket':840 'contain':102 'content':411,442,568,654 'copi':45,287,682 'copysourc':695,770 'cos':3,7,20,49,55,63,107,139,143,149,158,166,174,182,189,196,208,219,226,230,246,297,341,727,838 'cos-python-sdk-v5':62,296 'cosconfig':343,346 'coss3client':344,364 'count':633,661,674 'cp':190 'creationd':386 'cross':761 'cross-region':760 'default':496,729,747 'delet':32,42,199,211,217,263,270,521,534,548,584,587,593,612,615,619,622,709,716 'delimit':258,406 'depend':292 'destfilepath':486,783 'destin':767,779 'dir/scripts/cos.py':141 'docs/report-2026.pdf':164,170,178,223 'download':31,167,261,277,475,493,775 'dri':205,539 'dry-run':204,538 'du':40,183,627 'e.g':310 'end':308 'environ':91 'error':790 'etc':505,812 'everi':106 'everyth':422 'everywher':329 'exercis':137 'expir':179,501,517,746 'expiri':497,750 'explicit':756 'f':582,672 'fals':617 'file':262,456,464,467,477,480,776 'filter':259 'first':546 'flag':234 'form':328 'full':233,324 'generat':273,488 'get':511,741 'hand':114 'hand-rol':113 'handl':460 'help':227,231 'hour':499,752 'https':362 'id':83,355 'identifi':319 'imag':154,405 'import':337,342 'info':220 'instal':295 'int':415,657 'irrevers':720 'istrunc':448,575,665 'key':86,163,360,414,445,471,484,515,531,570,572,597,693,699 'lastmodifi':419 'lead':818 'len':585,620 'like':793 'link':837 'list':26,28,145,155,245,251,367,387 'localfilepath':473 'locat':384 'log':187,433,645 'longer':759 'loop':789 'ls':150 'maintain':134 'manag':4,52 'map':123 'marker':423,434,435,451,549,560,561,578,635,646,647,668 'max':395 'maxkey':436,562,648 'method':510 'mib':681 'minut':831 'mismatch':771 'miss':809 'multipart':461 'mydata':151,160,168,176,184,191,200,212,221,311,402,430,469,482,513,529,556,610,642,691,697 'name':302,306,326,333,382,804 'name-appid':325 'new/path.txt':194,694 'nextmark':453,580,670 'nosuchbucket':774,795 'numer':317 'o':590,596 'ob':46 'obj':408,413,416,418,439,444,565,571,651,658 'object':9,13,29,50,58,156,252,266,288,388,397,400,428,524,527,554,588,608,613,640,675,683,689,717,743 'offici':61 'old/path.txt':193,700 'one':126 'onto':125 'oper':25,108,763 'os':338 'os.environ':348,352,357,702 'output':171 'overrid':238 'overwrit':777 'page':394 'pagin':420 'pass':235,500 'past':816 'path':136 'pattern':791 'per':240 'per-cal':239 'pick':782 'pip':294 'pre':34,275,491,731 'pre-sign':33,274,490,730 'prefer':93,110 'prefix':44,153,186,202,214,257,272,284,404,432,536,558,625,644 'presign':508 'preview':545 'print':380,412,443,519,581,595,618,671 'privat':279 'python':64,298,336,370,392,457,478,495,525,542,628,687 'python3':142,148,157,165,173,181,188,195,207,218,225,229 'qcloud':340 'qcloudcosdatareadon':811 'qcloudcosreadonlyaccess':810 'quick':334 'quiet':616 'read':80 'recycl':724 'refer':844 'region':76,88,236,347,350,701,704,762,768,772,797 'remind':706 'request':122 'requesttimetooskew':832 'requir':322,764 'resp':371,377,398,426,452,552,579,606,638,669 'resp.get':410,441,447,567,574,621,653,664 'resum':462 'roll':115 'run':206,224,540,604,714 'safeti':541,705 'scheme':361 'script':786 'scripts/cos.py':97,98 'sdk':65,79,116,299,321 'secret':82,85,354,359 'secretid':74,351 'secretkey':75,356,814 'see':69 'self':101 'self-contain':100 'setup':68,77 'share':281 'ship':96 'short':749 'sign':35,276,492,732 'signaturedoesnotmatch':813 'singl':265,393,523 'size':39,417,626,659 'skew':835 'skill':95,140 'skill-tencentcloud-cos' 'sourc':766 'source-acedatacloud' 'start':335 'storag':10,51,285 'stream':458 'sub':807 'sub-account':806 'subcommand':129 'suffix':800 'symptom':792 'system':823 'temp/old':203,215,559 'tencent':5,22,47,53,303 'tencentcloud':2,70,81,84,87,349,353,358,703 'tencentcloud-co':1 'to_delete.append':569 'token':736 'topic-acedata-cloud' 'topic-agent-skills' 'topic-agentskills' 'topic-ai-image' 'topic-ai-music' 'topic-ai-tools' 'topic-ai-video' 'topic-claude-code' 'topic-cursor' 'topic-gemini-cli' 'topic-github-copilot' 'topic-mcp' 'total':629,632,655,660,673,676 'trail':819 'transpar':465 'trigger':773 'true':425,449,551,576,637,666 'unless':753 'upload':30,159,260,454,459 'uploads/2026/report.pdf':472,485,516 'uploads/old-file.txt':532 'url':36,175,278,494,506,509,520,733,740 'usag':286 'use':14,244 'user':17,120,602,712,755 'v5':66,300 'via':59 'whenev':15 'whitespac':820 'within':289,684 'without':780 'workflow':366 'would':583 'wrap':105 'wrong':796,798 'www.tencentcloud.com':846 'www.tencentcloud.com/document/product/436/41330':845 '对象存储':21","prices":[{"id":"a769020a-8c6b-475c-89e2-736301a0a20e","listingId":"6b9116c9-b439-4a49-9055-bb45b821690f","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"AceDataCloud","category":"Skills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:21:35.466Z"}],"sources":[{"listingId":"6b9116c9-b439-4a49-9055-bb45b821690f","source":"github","sourceId":"AceDataCloud/Skills/tencentcloud-cos","sourceUrl":"https://github.com/AceDataCloud/Skills/tree/main/skills/tencentcloud-cos","isPrimary":false,"firstSeenAt":"2026-05-18T13:21:35.466Z","lastSeenAt":"2026-05-18T19:14:04.312Z"}],"details":{"listingId":"6b9116c9-b439-4a49-9055-bb45b821690f","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"AceDataCloud","slug":"tencentcloud-cos","github":{"repo":"AceDataCloud/Skills","stars":7,"topics":["acedata-cloud","agent-skills","agentskills","ai-image","ai-music","ai-tools","ai-video","claude-code","cursor","gemini-cli","github-copilot","mcp","npm","openai-codex","roo-code"],"license":"other","html_url":"https://github.com/AceDataCloud/Skills","pushed_at":"2026-05-18T07:35:03Z","description":"Agent Skills for AceDataCloud AI services — music, image, video generation, web search, and more. Compatible with Claude Code, GitHub Copilot, Gemini CLI, and all agentskills.io-compatible agents.","skill_md_sha":"bbec1601a8328d2b6b60e548705641e75736f0d5","skill_md_path":"skills/tencentcloud-cos/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/AceDataCloud/Skills/tree/main/skills/tencentcloud-cos"},"layout":"multi","source":"github","category":"Skills","frontmatter":{"name":"tencentcloud-cos","license":"Apache-2.0","description":"Manage Tencent Cloud COS (Cloud Object Storage) buckets and objects.\nUse whenever the user asks about COS / 对象存储 / Tencent Cloud bucket\noperations: list buckets, list objects, upload, download, delete,\npre-signed URLs, calculate bucket size (du), batch delete with prefix,\ncopy objects between keys. Backed by the official cos-python-sdk-v5."},"skills_sh_url":"https://skills.sh/AceDataCloud/Skills/tencentcloud-cos"},"updatedAt":"2026-05-18T19:14:04.312Z"}}