@openhands/extensions 0.0.1-alpha → 0.2.0

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.
Files changed (347) hide show
  1. package/.agents/skills/custom-codereview-guide.md +25 -0
  2. package/.github/pull_request_template.md +38 -0
  3. package/.github/release.yml +14 -0
  4. package/.github/workflows/check-extensions.yml +72 -0
  5. package/.github/workflows/npm-publish.yml +89 -0
  6. package/.github/workflows/pr.yml +30 -0
  7. package/.github/workflows/release.yml +24 -0
  8. package/.github/workflows/tests.yml +25 -0
  9. package/.github/workflows/vulnerability-scan.yml +87 -0
  10. package/.release-please-manifest.json +3 -0
  11. package/AGENTS.md +132 -0
  12. package/README.md +10 -0
  13. package/analysis_results.md +162 -0
  14. package/marketplaces/large-codebase.json +66 -0
  15. package/marketplaces/openhands-extensions.json +682 -0
  16. package/package.json +4 -10
  17. package/plugins/README.md +30 -0
  18. package/plugins/city-weather/.plugin/plugin.json +13 -0
  19. package/plugins/city-weather/README.md +145 -0
  20. package/plugins/city-weather/commands/now.md +56 -0
  21. package/plugins/cobol-modernization/.plugin/plugin.json +19 -0
  22. package/plugins/cobol-modernization/README.md +201 -0
  23. package/plugins/cobol-modernization/references/troubleshooting.md +18 -0
  24. package/plugins/cobol-modernization/skills/build-setup/SKILL.md +78 -0
  25. package/plugins/cobol-modernization/skills/build-setup/scripts/install-gnucobol.sh +32 -0
  26. package/plugins/cobol-modernization/skills/cobol-modernization-overview/SKILL.md +113 -0
  27. package/plugins/cobol-modernization/skills/mainfraime-removal/SKILL.md +62 -0
  28. package/plugins/cobol-modernization/skills/mainfraime-removal/references/cics-transformation-examples.md +45 -0
  29. package/plugins/cobol-modernization/skills/mainframe-planning/SKILL.md +78 -0
  30. package/plugins/cobol-modernization/skills/to-java-migration/SKILL.md +59 -0
  31. package/plugins/cobol-modernization/skills/to-java-migration/references/cobol-to-java-example.md +58 -0
  32. package/plugins/cobol-modernization/skills/to-java-migration/references/datatype-mappings.md +19 -0
  33. package/plugins/issue-duplicate-checker/.plugin/plugin.json +13 -0
  34. package/plugins/issue-duplicate-checker/README.md +51 -0
  35. package/plugins/issue-duplicate-checker/action.yml +349 -0
  36. package/plugins/issue-duplicate-checker/scripts/auto_close_duplicate_issues.py +569 -0
  37. package/plugins/issue-duplicate-checker/scripts/issue_duplicate_check_openhands.py +681 -0
  38. package/plugins/issue-duplicate-checker/scripts/post_duplicate_notice.js +220 -0
  39. package/plugins/issue-duplicate-checker/scripts/remove_duplicate_candidate_label.js +27 -0
  40. package/plugins/magic-test/.plugin/plugin.json +13 -0
  41. package/plugins/magic-test/skills/magic-word/SKILL.md +33 -0
  42. package/plugins/migration-scoring/.plugin/plugin.json +19 -0
  43. package/plugins/migration-scoring/README.md +244 -0
  44. package/plugins/migration-scoring/skills/migration-mapping/SKILL.md +72 -0
  45. package/plugins/migration-scoring/skills/migration-report/SKILL.md +118 -0
  46. package/plugins/migration-scoring/skills/migration-scoring-overview/SKILL.md +126 -0
  47. package/plugins/migration-scoring/skills/score-quality/SKILL.md +54 -0
  48. package/plugins/migration-scoring/skills/score-quality/references/scoring-criteria.md +30 -0
  49. package/plugins/migration-scoring/skills/score-style/SKILL.md +106 -0
  50. package/plugins/onboarding/.plugin/plugin.json +20 -0
  51. package/plugins/onboarding/README.md +30 -0
  52. package/plugins/onboarding/references/criteria.md +144 -0
  53. package/plugins/onboarding/skills/agent-readiness-report/README.md +23 -0
  54. package/plugins/onboarding/skills/agent-readiness-report/SKILL.md +122 -0
  55. package/plugins/onboarding/skills/agent-readiness-report/scripts/scan_agent_instructions.sh +88 -0
  56. package/plugins/onboarding/skills/agent-readiness-report/scripts/scan_build_env.sh +114 -0
  57. package/plugins/onboarding/skills/agent-readiness-report/scripts/scan_feedback_loops.sh +133 -0
  58. package/plugins/onboarding/skills/agent-readiness-report/scripts/scan_policy.sh +113 -0
  59. package/plugins/onboarding/skills/agent-readiness-report/scripts/scan_workflows.sh +127 -0
  60. package/plugins/onboarding/skills/improve-agent-readiness/README.md +19 -0
  61. package/plugins/onboarding/skills/improve-agent-readiness/SKILL.md +167 -0
  62. package/plugins/onboarding/skills/setup-agents-md/README.md +15 -0
  63. package/plugins/onboarding/skills/setup-agents-md/SKILL.md +150 -0
  64. package/plugins/onboarding/skills/setup-openhands/README.md +20 -0
  65. package/plugins/onboarding/skills/setup-openhands/SKILL.md +56 -0
  66. package/plugins/onboarding/skills/setup-pr-review/README.md +23 -0
  67. package/plugins/onboarding/skills/setup-pr-review/SKILL.md +72 -0
  68. package/plugins/openhands/.plugin/plugin.json +13 -0
  69. package/plugins/openhands/README.md +52 -0
  70. package/plugins/openhands/SKILL.md +61 -0
  71. package/plugins/openhands/commands/create.md +55 -0
  72. package/plugins/openhands/commands/openhands-cloud.md +8 -0
  73. package/plugins/openhands/scripts/run.sh +69 -0
  74. package/plugins/pr-review/.plugin/plugin.json +13 -0
  75. package/plugins/pr-review/README.md +393 -0
  76. package/plugins/pr-review/action.yml +298 -0
  77. package/plugins/pr-review/scripts/agent_script.py +1282 -0
  78. package/plugins/pr-review/scripts/evaluate_review.py +655 -0
  79. package/plugins/pr-review/scripts/prompt.py +260 -0
  80. package/plugins/pr-review/workflows/pr-review-by-openhands.yml +51 -0
  81. package/plugins/pr-review/workflows/pr-review-evaluation.yml +85 -0
  82. package/plugins/qa-changes/.plugin/plugin.json +11 -0
  83. package/plugins/qa-changes/README.md +185 -0
  84. package/plugins/qa-changes/action.yml +181 -0
  85. package/plugins/qa-changes/scripts/agent_script.py +406 -0
  86. package/plugins/qa-changes/scripts/evaluate_qa_changes.py +385 -0
  87. package/plugins/qa-changes/scripts/prompt.py +174 -0
  88. package/plugins/qa-changes/workflows/qa-changes-by-openhands.yml +50 -0
  89. package/plugins/qa-changes/workflows/qa-changes-evaluation.yml +85 -0
  90. package/plugins/release-notes/.plugin/plugin.json +19 -0
  91. package/plugins/release-notes/README.md +283 -0
  92. package/plugins/release-notes/SKILL.md +83 -0
  93. package/plugins/release-notes/action.yml +117 -0
  94. package/plugins/release-notes/commands/release-notes.md +8 -0
  95. package/plugins/release-notes/scripts/agent_script.py +292 -0
  96. package/plugins/release-notes/scripts/generate_release_notes.py +733 -0
  97. package/plugins/release-notes/scripts/prompt.py +90 -0
  98. package/plugins/release-notes/scripts/validate_release_notes.py +328 -0
  99. package/plugins/release-notes/workflows/release-notes.yml +76 -0
  100. package/plugins/vulnerability-remediation/.plugin/plugin.json +19 -0
  101. package/plugins/vulnerability-remediation/README.md +217 -0
  102. package/plugins/vulnerability-remediation/action.yml +187 -0
  103. package/plugins/vulnerability-remediation/scripts/scan_and_remediate.py +561 -0
  104. package/plugins/vulnerability-remediation/workflows/vulnerability-scan.yml +87 -0
  105. package/pyproject.toml +12 -0
  106. package/release-please-config.json +16 -0
  107. package/scripts/sync_extensions.py +494 -0
  108. package/scripts/sync_openhands_sdk_skill.py +264 -0
  109. package/skills/README.md +159 -0
  110. package/skills/add-javadoc/.plugin/plugin.json +18 -0
  111. package/skills/add-javadoc/README.md +40 -0
  112. package/skills/add-javadoc/SKILL.md +35 -0
  113. package/skills/add-javadoc/references/example.md +32 -0
  114. package/skills/add-skill/.plugin/plugin.json +18 -0
  115. package/skills/add-skill/README.md +67 -0
  116. package/skills/add-skill/SKILL.md +47 -0
  117. package/skills/add-skill/scripts/fetch_skill.py +259 -0
  118. package/skills/agent-creator/.plugin/plugin.json +20 -0
  119. package/skills/agent-creator/README.md +104 -0
  120. package/skills/agent-creator/SKILL.md +190 -0
  121. package/skills/agent-creator/commands/agent-creator.md +8 -0
  122. package/skills/agent-creator/references/fallback.md +117 -0
  123. package/skills/agent-memory/.plugin/plugin.json +18 -0
  124. package/skills/agent-memory/README.md +35 -0
  125. package/skills/agent-memory/SKILL.md +30 -0
  126. package/skills/agent-memory/commands/remember.md +8 -0
  127. package/skills/agent-sdk-builder/.plugin/plugin.json +18 -0
  128. package/skills/agent-sdk-builder/README.md +40 -0
  129. package/skills/agent-sdk-builder/SKILL.md +37 -0
  130. package/skills/agent-sdk-builder/commands/agent-builder.md +8 -0
  131. package/skills/azure-devops/.plugin/plugin.json +18 -0
  132. package/skills/azure-devops/README.md +55 -0
  133. package/skills/azure-devops/SKILL.md +50 -0
  134. package/skills/bitbucket/.plugin/plugin.json +17 -0
  135. package/skills/bitbucket/README.md +50 -0
  136. package/skills/bitbucket/SKILL.md +45 -0
  137. package/skills/code-review/.plugin/plugin.json +19 -0
  138. package/skills/code-review/README.md +18 -0
  139. package/skills/code-review/SKILL.md +208 -0
  140. package/skills/code-review/commands/codereview-roasted.md +8 -0
  141. package/skills/code-review/commands/codereview.md +8 -0
  142. package/skills/code-review/references/risk-evaluation.md +41 -0
  143. package/skills/code-review/references/supply-chain-security.md +31 -0
  144. package/skills/code-simplifier/.plugin/plugin.json +21 -0
  145. package/skills/code-simplifier/README.md +30 -0
  146. package/skills/code-simplifier/SKILL.md +91 -0
  147. package/skills/code-simplifier/commands/simplify.md +8 -0
  148. package/skills/code-simplifier/references/code-quality-review.md +86 -0
  149. package/skills/code-simplifier/references/code-reuse-review.md +63 -0
  150. package/skills/code-simplifier/references/efficiency-review.md +81 -0
  151. package/skills/datadog/.plugin/plugin.json +19 -0
  152. package/skills/datadog/README.md +100 -0
  153. package/skills/datadog/SKILL.md +95 -0
  154. package/skills/deno/.plugin/plugin.json +18 -0
  155. package/skills/deno/README.md +5 -0
  156. package/skills/deno/SKILL.md +99 -0
  157. package/skills/deno/references/README.md +6 -0
  158. package/skills/discord/.plugin/plugin.json +18 -0
  159. package/skills/discord/README.md +31 -0
  160. package/skills/discord/SKILL.md +109 -0
  161. package/skills/discord/__init__.py +0 -0
  162. package/skills/discord/references/REFERENCE.md +78 -0
  163. package/skills/discord/scripts/__init__.py +0 -0
  164. package/skills/discord/scripts/_http.py +127 -0
  165. package/skills/discord/scripts/post_webhook.py +106 -0
  166. package/skills/discord/scripts/send_message.py +102 -0
  167. package/skills/docker/.plugin/plugin.json +17 -0
  168. package/skills/docker/README.md +34 -0
  169. package/skills/docker/SKILL.md +29 -0
  170. package/skills/evidence-based-citations/.plugin/plugin.json +20 -0
  171. package/skills/evidence-based-citations/README.md +31 -0
  172. package/skills/evidence-based-citations/SKILL.md +59 -0
  173. package/skills/flarglebargle/.plugin/plugin.json +16 -0
  174. package/skills/flarglebargle/README.md +14 -0
  175. package/skills/flarglebargle/SKILL.md +9 -0
  176. package/skills/frontend-design/.plugin/plugin.json +21 -0
  177. package/skills/frontend-design/LICENSE.txt +177 -0
  178. package/skills/frontend-design/README.md +42 -0
  179. package/skills/frontend-design/SKILL.md +42 -0
  180. package/skills/github/.plugin/plugin.json +19 -0
  181. package/skills/github/README.md +42 -0
  182. package/skills/github/SKILL.md +106 -0
  183. package/skills/github-pr-review/.plugin/plugin.json +18 -0
  184. package/skills/github-pr-review/README.md +145 -0
  185. package/skills/github-pr-review/SKILL.md +148 -0
  186. package/skills/github-pr-review/commands/github-pr-review.md +8 -0
  187. package/skills/github-pr-reviewer/.plugin/plugin.json +20 -0
  188. package/skills/github-pr-reviewer/README.md +34 -0
  189. package/skills/github-pr-reviewer/SKILL.md +89 -0
  190. package/skills/github-pr-reviewer/commands/pr-reviewer:setup.md +8 -0
  191. package/skills/github-repo-monitor/.plugin/plugin.json +22 -0
  192. package/skills/github-repo-monitor/README.md +70 -0
  193. package/skills/github-repo-monitor/SKILL.md +316 -0
  194. package/skills/github-repo-monitor/commands/github-monitor:poll.md +8 -0
  195. package/skills/github-repo-monitor/references/github-api.md +241 -0
  196. package/skills/github-repo-monitor/references/state-schema.md +160 -0
  197. package/skills/github-repo-monitor/scripts/main.py +915 -0
  198. package/skills/github-repo-monitor/tests/test_main.py +400 -0
  199. package/skills/gitlab/.plugin/plugin.json +17 -0
  200. package/skills/gitlab/README.md +37 -0
  201. package/skills/gitlab/SKILL.md +32 -0
  202. package/skills/incident-retrospective/.plugin/plugin.json +21 -0
  203. package/skills/incident-retrospective/README.md +34 -0
  204. package/skills/incident-retrospective/SKILL.md +98 -0
  205. package/skills/incident-retrospective/commands/incident-retro:setup.md +8 -0
  206. package/skills/iterate/.plugin/plugin.json +13 -0
  207. package/skills/iterate/README.md +25 -0
  208. package/skills/iterate/SKILL.md +399 -0
  209. package/skills/iterate/commands/babysit.md +8 -0
  210. package/skills/iterate/commands/iterate.md +8 -0
  211. package/skills/iterate/commands/verify.md +8 -0
  212. package/skills/iterate/references/heuristics.md +58 -0
  213. package/skills/iterate/references/verification.md +96 -0
  214. package/skills/jupyter/.plugin/plugin.json +18 -0
  215. package/skills/jupyter/README.md +55 -0
  216. package/skills/jupyter/SKILL.md +50 -0
  217. package/skills/kubernetes/.plugin/plugin.json +18 -0
  218. package/skills/kubernetes/README.md +53 -0
  219. package/skills/kubernetes/SKILL.md +48 -0
  220. package/skills/learn-from-code-review/.plugin/plugin.json +19 -0
  221. package/skills/learn-from-code-review/README.md +64 -0
  222. package/skills/learn-from-code-review/SKILL.md +186 -0
  223. package/skills/learn-from-code-review/commands/learn-from-reviews.md +8 -0
  224. package/skills/linear/.plugin/plugin.json +19 -0
  225. package/skills/linear/README.md +58 -0
  226. package/skills/linear/SKILL.md +213 -0
  227. package/skills/linear-triage/.plugin/plugin.json +21 -0
  228. package/skills/linear-triage/README.md +34 -0
  229. package/skills/linear-triage/SKILL.md +91 -0
  230. package/skills/linear-triage/commands/linear-triage:setup.md +8 -0
  231. package/skills/notion/.plugin/plugin.json +17 -0
  232. package/skills/notion/README.md +114 -0
  233. package/skills/notion/SKILL.md +109 -0
  234. package/skills/npm/.plugin/plugin.json +17 -0
  235. package/skills/npm/README.md +14 -0
  236. package/skills/npm/SKILL.md +9 -0
  237. package/skills/openhands-api/.plugin/plugin.json +22 -0
  238. package/skills/openhands-api/README.md +48 -0
  239. package/skills/openhands-api/SKILL.md +399 -0
  240. package/skills/openhands-api/references/README.md +33 -0
  241. package/skills/openhands-api/references/TROUBLESHOOTING.md +81 -0
  242. package/skills/openhands-api/references/example_prompt.md +12 -0
  243. package/skills/openhands-api/scripts/openhands_api.py +606 -0
  244. package/skills/openhands-api/scripts/openhands_api.ts +252 -0
  245. package/skills/openhands-automation/.plugin/plugin.json +19 -0
  246. package/skills/openhands-automation/README.md +89 -0
  247. package/skills/openhands-automation/SKILL.md +875 -0
  248. package/skills/openhands-automation/commands/automation:create.md +8 -0
  249. package/skills/openhands-automation/references/ab-testing.md +185 -0
  250. package/skills/openhands-automation/references/custom-automation.md +644 -0
  251. package/skills/openhands-sdk/.plugin/plugin.json +20 -0
  252. package/skills/openhands-sdk/README.md +22 -0
  253. package/skills/openhands-sdk/SKILL.md +229 -0
  254. package/skills/openhands-sdk/commands/sdk.md +8 -0
  255. package/skills/pdflatex/.plugin/plugin.json +18 -0
  256. package/skills/pdflatex/README.md +39 -0
  257. package/skills/pdflatex/SKILL.md +34 -0
  258. package/skills/prd/.plugin/plugin.json +19 -0
  259. package/skills/prd/README.md +28 -0
  260. package/skills/prd/SKILL.md +237 -0
  261. package/skills/prd/commands/prd.md +8 -0
  262. package/skills/qa-changes/README.md +18 -0
  263. package/skills/qa-changes/SKILL.md +229 -0
  264. package/skills/qa-changes/commands/qa-changes.md +8 -0
  265. package/skills/release-notes/README.md +24 -0
  266. package/skills/release-notes/SKILL.md +19 -0
  267. package/skills/release-notes/commands/release-notes.md +8 -0
  268. package/skills/research-brief/.plugin/plugin.json +20 -0
  269. package/skills/research-brief/README.md +34 -0
  270. package/skills/research-brief/SKILL.md +99 -0
  271. package/skills/research-brief/commands/research-brief:setup.md +8 -0
  272. package/skills/security/.plugin/plugin.json +18 -0
  273. package/skills/security/README.md +38 -0
  274. package/skills/security/SKILL.md +33 -0
  275. package/skills/skill-creator/.plugin/plugin.json +17 -0
  276. package/skills/skill-creator/LICENSE.txt +202 -0
  277. package/skills/skill-creator/README.md +182 -0
  278. package/skills/skill-creator/SKILL.md +545 -0
  279. package/skills/skill-creator/references/output-patterns.md +82 -0
  280. package/skills/skill-creator/references/workflows.md +28 -0
  281. package/skills/skill-creator/scripts/init_skill.py +303 -0
  282. package/skills/skill-creator/scripts/quick_validate.py +95 -0
  283. package/skills/slack-channel-monitor/.plugin/plugin.json +21 -0
  284. package/skills/slack-channel-monitor/README.md +91 -0
  285. package/skills/slack-channel-monitor/SKILL.md +276 -0
  286. package/skills/slack-channel-monitor/commands/slack-monitor:poll.md +8 -0
  287. package/skills/slack-channel-monitor/references/slack-api.md +207 -0
  288. package/skills/slack-channel-monitor/references/state-schema.md +180 -0
  289. package/skills/slack-channel-monitor/scripts/main.py +962 -0
  290. package/skills/slack-standup-digest/.plugin/plugin.json +21 -0
  291. package/skills/slack-standup-digest/README.md +34 -0
  292. package/skills/slack-standup-digest/SKILL.md +92 -0
  293. package/skills/slack-standup-digest/commands/standup-digest:setup.md +8 -0
  294. package/skills/spark-version-upgrade/.plugin/plugin.json +20 -0
  295. package/skills/spark-version-upgrade/README.md +54 -0
  296. package/skills/spark-version-upgrade/SKILL.md +233 -0
  297. package/skills/ssh/.plugin/plugin.json +18 -0
  298. package/skills/ssh/README.md +140 -0
  299. package/skills/ssh/SKILL.md +135 -0
  300. package/skills/swift-linux/.plugin/plugin.json +17 -0
  301. package/skills/swift-linux/README.md +86 -0
  302. package/skills/swift-linux/SKILL.md +81 -0
  303. package/skills/theme-factory/.plugin/plugin.json +19 -0
  304. package/skills/theme-factory/LICENSE.txt +202 -0
  305. package/skills/theme-factory/README.md +58 -0
  306. package/skills/theme-factory/SKILL.md +59 -0
  307. package/skills/theme-factory/theme-showcase.pdf +0 -0
  308. package/skills/theme-factory/themes/arctic-frost.md +19 -0
  309. package/skills/theme-factory/themes/botanical-garden.md +19 -0
  310. package/skills/theme-factory/themes/desert-rose.md +19 -0
  311. package/skills/theme-factory/themes/forest-canopy.md +19 -0
  312. package/skills/theme-factory/themes/golden-hour.md +19 -0
  313. package/skills/theme-factory/themes/midnight-galaxy.md +19 -0
  314. package/skills/theme-factory/themes/modern-minimalist.md +19 -0
  315. package/skills/theme-factory/themes/ocean-depths.md +19 -0
  316. package/skills/theme-factory/themes/sunset-boulevard.md +19 -0
  317. package/skills/theme-factory/themes/tech-innovation.md +19 -0
  318. package/skills/uv/.plugin/plugin.json +18 -0
  319. package/skills/uv/README.md +5 -0
  320. package/skills/uv/SKILL.md +95 -0
  321. package/skills/uv/references/README.md +5 -0
  322. package/skills/vercel/.plugin/plugin.json +18 -0
  323. package/skills/vercel/README.md +108 -0
  324. package/skills/vercel/SKILL.md +103 -0
  325. package/tests/test_add_skill_installs_to_agents_dir.py +42 -0
  326. package/tests/test_catalogs.py +109 -0
  327. package/tests/test_code_review_risk_evaluation.py +94 -0
  328. package/tests/test_issue_duplicate_checker.py +240 -0
  329. package/tests/test_openhands_api_python.py +152 -0
  330. package/tests/test_plugin_manifest.py +83 -0
  331. package/tests/test_pr_review_diff_payload.py +202 -0
  332. package/tests/test_pr_review_feedback.py +263 -0
  333. package/tests/test_pr_review_prompt.py +152 -0
  334. package/tests/test_pr_review_review_context.py +253 -0
  335. package/tests/test_qa_changes.py +232 -0
  336. package/tests/test_qa_changes_evaluation.py +259 -0
  337. package/tests/test_release_notes_generator.py +990 -0
  338. package/tests/test_sdk_loading.py +150 -0
  339. package/tests/test_skill_plugin_loading.py +149 -0
  340. package/tests/test_skills_have_readme.py +66 -0
  341. package/tests/test_sync_extensions.py +292 -0
  342. package/tests/test_workflow_sync.py +46 -0
  343. package/utils/analysis/README.md +7 -0
  344. package/utils/analysis/laminar_signals/README.md +211 -0
  345. package/utils/analysis/laminar_signals/analyze.py +780 -0
  346. package/utils/analysis/laminar_signals/templates/default.j2 +49 -0
  347. package/utils/analysis/laminar_signals/templates/pr_review.j2 +61 -0
@@ -0,0 +1,81 @@
1
+ # Efficiency Review
2
+
3
+ A detailed reference for evaluating performance, resource usage, and algorithmic efficiency in recently modified code. Focus on real, measurable inefficiencies - not premature optimization or micro-benchmarks that do not matter at the project's scale.
4
+
5
+ ## Core Principles
6
+
7
+ 1. **Pragmatic Optimization**: Fix inefficiencies that affect real users or real workloads. Do not optimize code paths that execute once at startup or handle trivial data volumes.
8
+ 2. **Algorithmic Awareness**: Prefer better algorithms and data structures over micro-optimizations. An O(n²) loop over a growing dataset is a real problem; shaving nanoseconds off an O(n) loop is not.
9
+ 3. **Measure Before Prescribing**: When recommending a change, explain *why* it matters at the expected scale. Cite the data size, call frequency, or latency target that makes the optimization worthwhile.
10
+ 4. **Preserve Functionality**: Efficiency improvements must not change behavior. All outputs and side effects remain identical.
11
+
12
+ ## What to Look For
13
+
14
+ ### Algorithmic Complexity
15
+
16
+ - Nested loops over collections that grow with input size (O(n²) or worse)
17
+ - Linear search where a hash/set lookup would suffice
18
+ - Repeated sorting or filtering of the same data
19
+ - Recursive algorithms without memoization on overlapping subproblems
20
+ - Using arrays for membership checks instead of sets or maps
21
+
22
+ ### Unnecessary Work
23
+
24
+ - Recomputing values inside loops that could be computed once outside
25
+ - Performing I/O (file reads, network calls, DB queries) inside tight loops
26
+ - Loading entire datasets into memory when streaming or pagination is available
27
+ - Eagerly computing expensive results that may never be used (missing lazy evaluation)
28
+ - Serializing/deserializing data multiple times in the same pipeline
29
+
30
+ ### Resource Usage
31
+
32
+ - Unbounded memory growth (appending to lists without limits, caching without eviction)
33
+ - File handles, connections, or streams opened but not closed (missing `finally`/`with`/`using`/`defer`)
34
+ - Large object allocations in hot paths that could reuse buffers
35
+ - Spawning threads or processes without pooling or concurrency limits
36
+
37
+ ### Data Structure Choices
38
+
39
+ - Using a list where a set or map provides O(1) lookups
40
+ - Storing data in formats that require repeated parsing (e.g., stringified JSON accessed multiple times)
41
+ - Using mutable shared state where an immutable snapshot or copy-on-write pattern is safer and no slower
42
+ - Choosing a general-purpose collection when a specialized one (deque, priority queue, sorted set) better fits the access pattern
43
+
44
+ ### Database and I/O Patterns
45
+
46
+ - N+1 query patterns (fetching related records one-by-one inside a loop)
47
+ - Missing indices on frequently queried columns (when schema is visible)
48
+ - Fetching columns or rows not needed by the caller
49
+ - Synchronous blocking calls in async contexts
50
+
51
+ ## Review Checklist
52
+
53
+ - [ ] Identify any loops with O(n²) or worse complexity on non-trivial input sizes
54
+ - [ ] Check for repeated computation that could be hoisted or cached
55
+ - [ ] Verify I/O operations are batched and not performed in tight loops
56
+ - [ ] Confirm resources (connections, handles, streams) are properly closed
57
+ - [ ] Review data structure choices for appropriate access-pattern fit
58
+ - [ ] Look for N+1 query patterns or unnecessary full-table scans
59
+ - [ ] Validate that any suggested optimization is justified by expected scale
60
+
61
+ ## Output Format
62
+
63
+ For each efficiency finding, provide:
64
+
65
+ ```
66
+ **[EFFICIENCY]** [file:line] - Brief description
67
+ Issue: [What is inefficient and at what scale it matters]
68
+ Suggestion: [Concrete fix with expected complexity improvement]
69
+ Impact: HIGH (user-facing latency/cost) | MEDIUM (noticeable at scale) | LOW (minor, worth noting)
70
+ ```
71
+
72
+ Impact guide:
73
+ - **HIGH**: Causes user-visible latency, excessive memory usage, or cost at current or near-term scale.
74
+ - **MEDIUM**: Becomes a problem as data or traffic grows; worth fixing proactively.
75
+ - **LOW**: Minor inefficiency; mention if the fix is trivial, otherwise skip.
76
+
77
+ When no efficiency concerns exist, state explicitly:
78
+
79
+ ```
80
+ **[EFFICIENCY]** No significant performance or resource issues detected in the changed code.
81
+ ```
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "datadog",
3
+ "version": "1.0.0",
4
+ "description": "Query and analyze Datadog logs, metrics, APM traces, and monitors using the Datadog API. Use when debugging production issues, monitoring application performance, or investigating alerts.",
5
+ "author": {
6
+ "name": "OpenHands",
7
+ "email": "contact@all-hands.dev"
8
+ },
9
+ "homepage": "https://github.com/OpenHands/extensions",
10
+ "repository": "https://github.com/OpenHands/extensions",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "datadog",
14
+ "monitoring",
15
+ "logs",
16
+ "metrics",
17
+ "apm"
18
+ ]
19
+ }
@@ -0,0 +1,100 @@
1
+ # Datadog
2
+
3
+ Query and analyze Datadog logs, metrics, APM traces, and monitors using the Datadog API. Use when debugging production issues, monitoring application performance, or investigating alerts.
4
+
5
+ ## Triggers
6
+
7
+ This skill is activated by the following keywords:
8
+
9
+ - `datadog`
10
+
11
+ ## Details
12
+
13
+ # Datadog
14
+
15
+ <IMPORTANT>
16
+ Before performing any Datadog operations, first check if the required environment variables are set:
17
+
18
+ ```bash
19
+ [ -n "$DD_API_KEY" ] && echo "DD_API_KEY is set" || echo "DD_API_KEY is NOT set"
20
+ [ -n "$DD_APP_KEY" ] && echo "DD_APP_KEY is set" || echo "DD_APP_KEY is NOT set"
21
+ [ -n "$DD_SITE" ] && echo "DD_SITE is set" || echo "DD_SITE is NOT set"
22
+ ```
23
+
24
+ If any of these variables are missing, ask the user to provide them before proceeding:
25
+ - **DD_API_KEY**: Datadog API key
26
+ - **DD_APP_KEY**: Datadog Application key
27
+ - **DD_SITE**: Datadog site (e.g., `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`)
28
+ </IMPORTANT>
29
+
30
+ ## Authentication Headers
31
+
32
+ ```bash
33
+ -H "DD-API-KEY: ${DD_API_KEY}" \
34
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
35
+ -H "Content-Type: application/json"
36
+ ```
37
+
38
+ ## Query Logs
39
+
40
+ ```bash
41
+ curl -s -X POST "https://api.${DD_SITE}/api/v2/logs/events/search" \
42
+ -H "DD-API-KEY: ${DD_API_KEY}" \
43
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
44
+ -H "Content-Type: application/json" \
45
+ -d '{
46
+ "filter": {
47
+ "query": "service:my-service status:error",
48
+ "from": "now-1h",
49
+ "to": "now"
50
+ },
51
+ "sort": "-timestamp",
52
+ "page": {"limit": 50}
53
+ }' | jq .
54
+ ```
55
+
56
+ ## Query Metrics
57
+
58
+ ```bash
59
+ curl -s -G "https://api.${DD_SITE}/api/v1/query" \
60
+ -H "DD-API-KEY: ${DD_API_KEY}" \
61
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
62
+ --data-urlencode "query=avg:system.cpu.user{*}" \
63
+ --data-urlencode "from=$(date -d '1 hour ago' +%s)" \
64
+ --data-urlencode "to=$(date +%s)" | jq .
65
+ ```
66
+
67
+ ## Query APM Traces
68
+
69
+ ```bash
70
+ curl -s -X POST "https://api.${DD_SITE}/api/v2/spans/events/search" \
71
+ -H "DD-API-KEY: ${DD_API_KEY}" \
72
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
73
+ -H "Content-Type: application/json" \
74
+ -d '{
75
+ "filter": {
76
+ "query": "service:my-service",
77
+ "from": "now-1h",
78
+ "to": "now"
79
+ },
80
+ "sort": "-timestamp",
81
+ "page": {"limit": 25}
82
+ }' | jq .
83
+ ```
84
+
85
+ ## List Monitors
86
+
87
+ ```bash
88
+ curl -s -G "https://api.${DD_SITE}/api/v1/monitor" \
89
+ -H "DD-API-KEY: ${DD_API_KEY}" \
90
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" | jq .
91
+ ```
92
+
93
+ ## Documentation
94
+
95
+ - [Logs API](https://docs.datadoghq.com/api/latest/logs/)
96
+ - [Metrics API](https://docs.datadoghq.com/api/latest/metrics/)
97
+ - [APM/Tracing API](https://docs.datadoghq.com/api/latest/tracing/)
98
+ - [Monitors API](https://docs.datadoghq.com/api/latest/monitors/)
99
+ - [Events API](https://docs.datadoghq.com/api/latest/events/)
100
+ - [Dashboards API](https://docs.datadoghq.com/api/latest/dashboards/)
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: datadog
3
+ description: Query and analyze Datadog logs, metrics, APM traces, and monitors using the Datadog API. Use when debugging production issues, monitoring application performance, or investigating alerts.
4
+ triggers:
5
+ - datadog
6
+ ---
7
+
8
+ # Datadog
9
+
10
+ <IMPORTANT>
11
+ Before performing any Datadog operations, first check if the required environment variables are set:
12
+
13
+ ```bash
14
+ [ -n "$DD_API_KEY" ] && echo "DD_API_KEY is set" || echo "DD_API_KEY is NOT set"
15
+ [ -n "$DD_APP_KEY" ] && echo "DD_APP_KEY is set" || echo "DD_APP_KEY is NOT set"
16
+ [ -n "$DD_SITE" ] && echo "DD_SITE is set" || echo "DD_SITE is NOT set"
17
+ ```
18
+
19
+ If any of these variables are missing, ask the user to provide them before proceeding:
20
+ - **DD_API_KEY**: Datadog API key
21
+ - **DD_APP_KEY**: Datadog Application key
22
+ - **DD_SITE**: Datadog site (e.g., `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`)
23
+ </IMPORTANT>
24
+
25
+ ## Authentication Headers
26
+
27
+ ```bash
28
+ -H "DD-API-KEY: ${DD_API_KEY}" \
29
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
30
+ -H "Content-Type: application/json"
31
+ ```
32
+
33
+ ## Query Logs
34
+
35
+ ```bash
36
+ curl -s -X POST "https://api.${DD_SITE}/api/v2/logs/events/search" \
37
+ -H "DD-API-KEY: ${DD_API_KEY}" \
38
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
39
+ -H "Content-Type: application/json" \
40
+ -d '{
41
+ "filter": {
42
+ "query": "service:my-service status:error",
43
+ "from": "now-1h",
44
+ "to": "now"
45
+ },
46
+ "sort": "-timestamp",
47
+ "page": {"limit": 50}
48
+ }' | jq .
49
+ ```
50
+
51
+ ## Query Metrics
52
+
53
+ ```bash
54
+ curl -s -G "https://api.${DD_SITE}/api/v1/query" \
55
+ -H "DD-API-KEY: ${DD_API_KEY}" \
56
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
57
+ --data-urlencode "query=avg:system.cpu.user{*}" \
58
+ --data-urlencode "from=$(date -d '1 hour ago' +%s)" \
59
+ --data-urlencode "to=$(date +%s)" | jq .
60
+ ```
61
+
62
+ ## Query APM Traces
63
+
64
+ ```bash
65
+ curl -s -X POST "https://api.${DD_SITE}/api/v2/spans/events/search" \
66
+ -H "DD-API-KEY: ${DD_API_KEY}" \
67
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
68
+ -H "Content-Type: application/json" \
69
+ -d '{
70
+ "filter": {
71
+ "query": "service:my-service",
72
+ "from": "now-1h",
73
+ "to": "now"
74
+ },
75
+ "sort": "-timestamp",
76
+ "page": {"limit": 25}
77
+ }' | jq .
78
+ ```
79
+
80
+ ## List Monitors
81
+
82
+ ```bash
83
+ curl -s -G "https://api.${DD_SITE}/api/v1/monitor" \
84
+ -H "DD-API-KEY: ${DD_API_KEY}" \
85
+ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" | jq .
86
+ ```
87
+
88
+ ## Documentation
89
+
90
+ - [Logs API](https://docs.datadoghq.com/api/latest/logs/)
91
+ - [Metrics API](https://docs.datadoghq.com/api/latest/metrics/)
92
+ - [APM/Tracing API](https://docs.datadoghq.com/api/latest/tracing/)
93
+ - [Monitors API](https://docs.datadoghq.com/api/latest/monitors/)
94
+ - [Events API](https://docs.datadoghq.com/api/latest/events/)
95
+ - [Dashboards API](https://docs.datadoghq.com/api/latest/dashboards/)
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "deno",
3
+ "version": "1.0.0",
4
+ "description": "Common project operations using Deno (tasks, run/test/lint/fmt, and dependency management).",
5
+ "author": {
6
+ "name": "OpenHands",
7
+ "email": "contact@all-hands.dev"
8
+ },
9
+ "homepage": "https://github.com/OpenHands/extensions",
10
+ "repository": "https://github.com/OpenHands/extensions",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "deno",
14
+ "typescript",
15
+ "javascript",
16
+ "runtime"
17
+ ]
18
+ }
@@ -0,0 +1,5 @@
1
+ # deno
2
+
3
+ This skill documents common project operations using **Deno** (tasks, run/test/lint/fmt, and dependency management).
4
+
5
+ See: [SKILL.md](./SKILL.md)
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: deno
3
+ description: If the project uses deno, use this skill. Use this skill to initialize and work with Deno projects, add/remove dependencies (JSR and npm), run tasks and scripts with appropriate permissions, and use built-in tooling (fmt/lint/test).
4
+ triggers:
5
+ - deno
6
+ - deno.json
7
+ - deno.jsonc
8
+ - deno.lock
9
+ ---
10
+
11
+ # Deno
12
+
13
+ Use Deno as the default runtime/tooling when the repo contains `deno.json`/`deno.jsonc`, uses `deno.lock`, or scripts/documentation reference `deno task`, `deno run`, `deno test`, etc.
14
+
15
+ ## Quick decision rules
16
+
17
+ - Prefer `deno task <name>` if the repo defines tasks.
18
+ - Use `deno add` / `deno remove` to manage dependencies (writes to config).
19
+ - Be explicit about permissions for `deno run` / `deno test`.
20
+
21
+ ## Common operations
22
+
23
+ ### Initialize a new project
24
+
25
+ ```bash
26
+ deno init
27
+ ```
28
+
29
+ ### Add dependencies (JSR and npm)
30
+
31
+ ```bash
32
+ # JSR (recommended for Deno-first packages)
33
+ deno add jsr:@std/path
34
+
35
+ # npm packages are supported too
36
+ deno add npm:react
37
+
38
+ # multiple at once
39
+ deno add jsr:@std/assert npm:chalk
40
+ ```
41
+
42
+ ### Remove dependencies
43
+
44
+ ```bash
45
+ deno remove jsr:@std/path
46
+ ```
47
+
48
+ ### Run a script
49
+
50
+ ```bash
51
+ # Minimal permissions: only what the program needs
52
+ # Examples:
53
+ # --allow-net=api.example.com
54
+ # --allow-read=./data
55
+ # --allow-env=FOO,BAR
56
+
57
+ deno run --allow-net --allow-read main.ts
58
+ ```
59
+
60
+ ### Run tasks
61
+
62
+ ```bash
63
+ # list tasks
64
+ deno task
65
+
66
+ # run a task defined in deno.json/deno.jsonc
67
+ deno task dev
68
+ ```
69
+
70
+ ### Formatting, linting, testing
71
+
72
+ ```bash
73
+ deno fmt
74
+ deno lint
75
+ deno test
76
+
77
+ # common permissioned test run
78
+ deno test --allow-net --allow-read
79
+ ```
80
+
81
+ ### Install / run CLIs
82
+
83
+ ```bash
84
+ # Run a JSR or npm package's CLI without installing globally
85
+ deno x jsr:@std/http/file-server -p 8080
86
+
87
+ # Install globally (requires choosing permissions at install time)
88
+ # Prefer the smallest set of permissions; avoid blanket flags unless necessary.
89
+ deno install -g -N -R jsr:@std/http/file-server -- -p 8080
90
+ ```
91
+
92
+ ## Notes / pitfalls
93
+
94
+ - Deno is secure-by-default: missing permissions cause runtime errors; add the smallest set of `--allow-*` flags needed.
95
+ - Dependency specifiers:
96
+ - `jsr:` for JSR registry packages
97
+ - `npm:` for npm packages
98
+ - URL imports are also supported (and cached)
99
+ - Lockfile: `deno.lock` helps ensure reproducible dependency resolution.
@@ -0,0 +1,6 @@
1
+ # References (deno)
2
+
3
+ - https://docs.deno.com/runtime/reference/cli/
4
+ - https://docs.deno.com/runtime/reference/cli/add/
5
+ - https://docs.deno.com/runtime/reference/cli/run/
6
+ - https://docs.deno.com/runtime/reference/cli/task/
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "discord",
3
+ "version": "1.0.0",
4
+ "description": "Build and automate Discord integrations (bots, webhooks, slash commands, and REST API workflows). Use when the user mentions Discord, a Discord server/guild, channels, webhooks, bot tokens, slash c...",
5
+ "author": {
6
+ "name": "OpenHands",
7
+ "email": "contact@all-hands.dev"
8
+ },
9
+ "homepage": "https://github.com/OpenHands/extensions",
10
+ "repository": "https://github.com/OpenHands/extensions",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "discord",
14
+ "bot",
15
+ "webhook",
16
+ "automation"
17
+ ]
18
+ }
@@ -0,0 +1,31 @@
1
+ # Discord
2
+
3
+ Build and automate Discord integrations (bots, webhooks, slash commands, and REST API workflows). Use when the user mentions Discord, a Discord server/guild, channels, webhooks, bot tokens, slash commands/application commands, discord.js, or discord.py.
4
+
5
+ ## Triggers
6
+
7
+ This skill is activated by the following keywords:
8
+
9
+ - `discord`
10
+ - `discord api`
11
+ - `discord bot`
12
+ - `discord webhook`
13
+ - `discord.js`
14
+ - `discord.py`
15
+
16
+ ## Details
17
+
18
+ This skill focuses on practical Discord automation patterns:
19
+
20
+ - Prefer **incoming webhooks** for one-way notifications.
21
+ - Use **bot tokens + REST API** for richer automation.
22
+ - Handle **rate limits** (HTTP 429) by waiting `retry_after` before retrying.
23
+
24
+ See also: `references/REFERENCE.md`.
25
+
26
+ ## Footguns / gotchas
27
+
28
+ - Webhook URLs contain a secret token; don’t log or share them.
29
+ - Set `allowed_mentions` strictly (e.g. `{ "parse": [] }`) to avoid accidental pings.
30
+ - Handle HTTP 429 using `retry_after` / `Retry-After` and avoid infinite retries.
31
+
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: discord
3
+ description: Build and automate Discord integrations (bots, webhooks, slash commands, and REST API workflows). Use when the user mentions Discord, a Discord server/guild, channels, webhooks, bot tokens, slash commands/application commands, discord.js, or discord.py.
4
+ triggers:
5
+ - discord
6
+ - discord api
7
+ - discord bot
8
+ - discord webhook
9
+ - discord.js
10
+ - discord.py
11
+ ---
12
+
13
+ # Discord
14
+
15
+ Use this skill when implementing or automating Discord integrations.
16
+
17
+ ## Pick the right approach
18
+
19
+ 1. **Incoming webhooks (best for one-way posting)**
20
+ - Good for CI notifications, alerts, build status, etc.
21
+ - No bot user needed.
22
+ - See: https://discord.com/developers/docs/resources/webhook#execute-webhook
23
+
24
+ 2. **Bot token + REST API (two-way / richer automation)**
25
+ - Use when you need to post as a bot, manage channels, read history, moderate, etc.
26
+ - REST API base: `https://discord.com/api/v10`
27
+ - Most REST calls use `Authorization: Bot <token>`.
28
+
29
+ 3. **Interactions / slash commands (user-invoked commands)**
30
+ - Use application commands and interaction webhooks.
31
+ - Typically requires running a web server to receive interactions and respond quickly.
32
+
33
+ ## Secrets & safety
34
+
35
+ - **Never hard-code tokens**. Use environment variables:
36
+ - `DISCORD_WEBHOOK_URL` for incoming webhooks
37
+ - `DISCORD_BOT_TOKEN` for bot REST API calls
38
+ - Treat webhook URLs as secrets (they include a token).
39
+ - Do **not** automate normal user accounts (“self-bots”). Use official bot/OAuth flows.
40
+
41
+ ## Footguns / safety notes (read this)
42
+
43
+ - **Webhook URLs are secrets** (the token is embedded in the URL). Don’t paste them into issues, logs, CI output, or chat.
44
+ - **Mentions are dangerous by default**: always set `allowed_mentions` to something strict (these examples use `{"parse": []}`) to avoid accidentally pinging `@everyone` / roles.
45
+ - **Watch for accidental secret logging**:
46
+ - If you build your own scripts, avoid including full webhook URLs in exception messages.
47
+ - The bundled scripts sanitize webhook URLs in error output, but you should still avoid printing the URL yourself.
48
+ - **Rate limits**: handle HTTP 429 with `retry_after`/`Retry-After`, and don’t retry forever.
49
+
50
+ ## Quick recipes
51
+
52
+ ### Post a message via an incoming webhook (recommended)
53
+
54
+ Discord requires at least one of `content`, `embeds`, `components`, `file`, or `poll`.
55
+
56
+ ```bash
57
+ curl -sS -X POST \
58
+ -H 'Content-Type: application/json' \
59
+ -d '{"content":"Hello from OpenHands","allowed_mentions":{"parse":[]}}' \
60
+ "$DISCORD_WEBHOOK_URL"
61
+ ```
62
+
63
+ ### Post a message to a channel with a bot token
64
+
65
+ Endpoint: `POST /channels/{channel_id}/messages` (Create Message)
66
+
67
+ ```bash
68
+ CHANNEL_ID="..."
69
+
70
+ curl -sS -X POST "https://discord.com/api/v10/channels/${CHANNEL_ID}/messages" \
71
+ -H "Authorization: Bot $DISCORD_BOT_TOKEN" \
72
+ -H 'Content-Type: application/json' \
73
+ -d '{"content":"Hello from my bot","allowed_mentions":{"parse":[]}}'
74
+ ```
75
+
76
+ Docs: https://discord.com/developers/docs/resources/channel#create-message
77
+
78
+ ## Automation scripts (bundled)
79
+
80
+ These scripts are self-contained and only use the Python standard library.
81
+
82
+ - Post to a webhook:
83
+ ```bash
84
+ python3 -m skills.discord.scripts.post_webhook --content "Build finished" --wait
85
+ ```
86
+
87
+ - Post to a channel using a bot token:
88
+ ```bash
89
+ python3 -m skills.discord.scripts.send_message --channel-id "$CHANNEL_ID" --content "Hello"
90
+ ```
91
+
92
+ ## Rate limits
93
+
94
+ - Don’t hard-code limits. Use Discord’s `Retry-After` / `retry_after` and rate-limit headers when present.
95
+ - On HTTP **429**, wait for the provided delay (clamp to a sane maximum, add small jitter), then retry.
96
+
97
+ Docs: https://discord.com/developers/docs/topics/rate-limits
98
+
99
+ ## Slash commands / application commands
100
+
101
+ - Use **guild commands** for fast iteration (instant updates).
102
+ - Use **global commands** when ready; propagation can take longer.
103
+
104
+ Docs: https://discord.com/developers/docs/interactions/application-commands
105
+
106
+ ## Reference
107
+
108
+ For more details (OAuth2 flows, command registration endpoints, troubleshooting), see:
109
+ - [references/REFERENCE.md](references/REFERENCE.md)
File without changes
@@ -0,0 +1,78 @@
1
+ # Discord reference
2
+
3
+ ## Official docs
4
+
5
+ - Discord Developer Docs (home): https://discord.com/developers/docs/intro
6
+ - REST API versioning: `https://discord.com/api/v10` (use v10 endpoints)
7
+ - Create Message (REST): https://discord.com/developers/docs/resources/channel#create-message
8
+ - Webhooks: https://discord.com/developers/docs/resources/webhook
9
+ - OAuth2: https://discord.com/developers/docs/topics/oauth2
10
+ - Application Commands (slash commands): https://discord.com/developers/docs/interactions/application-commands
11
+ - Rate limits: https://discord.com/developers/docs/topics/rate-limits
12
+
13
+ ## Footguns / gotchas
14
+
15
+ - Incoming webhook URLs contain a secret token; treat the entire URL like a password.
16
+ - If you include request URLs in error logs, sanitize `/webhooks/{id}/{token}` (the token is secret).
17
+ - Use `allowed_mentions` to prevent accidental mass pings.
18
+ - Respect rate limits. Don’t spin in tight retry loops on 429.
19
+
20
+ ## Common workflows
21
+
22
+ ### 1) Simple notifications (incoming webhook)
23
+
24
+ 1. Create an incoming webhook in the Discord client (channel settings → Integrations → Webhooks).
25
+ 2. Store it in `DISCORD_WEBHOOK_URL`.
26
+ 3. POST JSON like `{ "content": "..." }`.
27
+
28
+ Key points from Discord docs:
29
+ - Execute webhook: `POST /webhooks/{webhook.id}/{webhook.token}`.
30
+ - Must include at least one of `content`, `embeds`, `components`, `file`, or `poll`.
31
+ - Content limit is 2000 characters.
32
+ - Use `allowed_mentions` to prevent accidental pings.
33
+
34
+ ### 2) Bot token + REST API
35
+
36
+ 1. Create an app + bot user in the Discord Developer Portal.
37
+ 2. Invite the bot to a guild using an OAuth2 URL with the `bot` scope.
38
+ 3. Use `Authorization: Bot $DISCORD_BOT_TOKEN` for REST calls.
39
+
40
+ For posting messages:
41
+ - `POST /channels/{channel_id}/messages`
42
+
43
+ Helpful debugging hints:
44
+ - 401: invalid token / wrong auth header format
45
+ - 403: missing permissions in channel (e.g., Send Messages)
46
+ - 404: wrong ID or bot doesn’t have access to channel
47
+
48
+ ### 3) Slash commands / interactions
49
+
50
+ - Command registration is done via HTTP endpoints.
51
+ - Use guild commands during development for instant updates.
52
+ - If you implement the HTTP interactions endpoint yourself, you must verify request signatures.
53
+
54
+ ### 4) OAuth2 notes
55
+
56
+ Discord strongly recommends using the `state` parameter to prevent CSRF.
57
+
58
+ OAuth2 endpoints require `application/x-www-form-urlencoded` content type; JSON is not permitted.
59
+
60
+ ### 5) Rate limits
61
+
62
+ Don’t hard-code limits; parse headers like:
63
+
64
+ - `X-RateLimit-Limit`
65
+ - `X-RateLimit-Remaining`
66
+ - `X-RateLimit-Reset-After`
67
+ - `X-RateLimit-Bucket`
68
+
69
+ On HTTP 429:
70
+ - Read `Retry-After` / JSON `retry_after`, wait, then retry.
71
+
72
+ ## Suggested environment variables
73
+
74
+ - `DISCORD_WEBHOOK_URL`
75
+ - `DISCORD_BOT_TOKEN`
76
+ - `DISCORD_CHANNEL_ID` (optional convenience)
77
+ - `DISCORD_GUILD_ID` (optional, for command registration)
78
+ - `DISCORD_APPLICATION_ID` (optional, for command registration)
File without changes