natureco-cli 5.18.3 → 5.19.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.
- package/package.json +1 -1
- package/skills/airunway-aks-setup/SKILL.md +73 -0
- package/skills/algorithmic-art/SKILL.md +405 -0
- package/skills/appinsights-instrumentation/SKILL.md +76 -0
- package/skills/azure-ai/SKILL.md +71 -0
- package/skills/azure-aigateway/SKILL.md +129 -0
- package/skills/azure-cloud-migrate/SKILL.md +52 -0
- package/skills/azure-compliance/SKILL.md +108 -0
- package/skills/azure-compute/SKILL.md +46 -0
- package/skills/azure-cost/SKILL.md +45 -0
- package/skills/azure-deploy/SKILL.md +97 -0
- package/skills/azure-diagnostics/SKILL.md +151 -0
- package/skills/azure-enterprise-infra-planner/SKILL.md +54 -0
- package/skills/azure-hosted-copilot-sdk/SKILL.md +89 -0
- package/skills/azure-kubernetes/SKILL.md +153 -0
- package/skills/azure-kusto/SKILL.md +231 -0
- package/skills/azure-messaging/SKILL.md +57 -0
- package/skills/azure-prepare/SKILL.md +165 -0
- package/skills/azure-quotas/SKILL.md +276 -0
- package/skills/azure-rbac/SKILL.md +17 -0
- package/skills/azure-reliability/SKILL.md +387 -0
- package/skills/azure-resource-lookup/SKILL.md +108 -0
- package/skills/azure-resource-visualizer/SKILL.md +183 -0
- package/skills/azure-storage/SKILL.md +100 -0
- package/skills/azure-upgrade/SKILL.md +91 -0
- package/skills/azure-validate/SKILL.md +72 -0
- package/skills/brainstorming/SKILL.md +159 -0
- package/skills/brand-guidelines/SKILL.md +73 -0
- package/skills/brandkit/SKILL.md +798 -0
- package/skills/brutalist-skill/SKILL.md +92 -0
- package/skills/canvas-design/SKILL.md +130 -0
- package/skills/cavecrew/SKILL.md +82 -0
- package/skills/caveman-commit/SKILL.md +65 -0
- package/skills/caveman-help/SKILL.md +63 -0
- package/skills/caveman-review/SKILL.md +55 -0
- package/skills/caveman-stats/SKILL.md +10 -0
- package/skills/claude-api/SKILL.md +356 -0
- package/skills/composition-patterns/SKILL.md +89 -0
- package/skills/decision-mapping/SKILL.md +84 -0
- package/skills/deploy-to-vercel/SKILL.md +296 -0
- package/skills/design-an-interface/SKILL.md +94 -0
- package/skills/design-doc-mermaid/SKILL.md +498 -0
- package/skills/develop-userscripts/SKILL.md +84 -0
- package/skills/doc-coauthoring/SKILL.md +375 -0
- package/skills/documentation/SKILL.md +109 -0
- package/skills/docx/SKILL.md +590 -0
- package/skills/edit-article/SKILL.md +15 -0
- package/skills/entra-agent-id/SKILL.md +356 -0
- package/skills/entra-app-registration/SKILL.md +191 -0
- package/skills/faceless-explainer/SKILL.md +202 -0
- package/skills/fastify/SKILL.md +75 -0
- package/skills/general-video/SKILL.md +143 -0
- package/skills/git-guardrails-claude-code/SKILL.md +95 -0
- package/skills/github-actions-docs/SKILL.md +98 -0
- package/skills/gpt-tasteskill/SKILL.md +74 -0
- package/skills/grill-me/SKILL.md +7 -0
- package/skills/grilling/SKILL.md +10 -0
- package/skills/handoff/SKILL.md +16 -0
- package/skills/hyperframes/SKILL.md +152 -0
- package/skills/hyperframes-animation/SKILL.md +82 -0
- package/skills/hyperframes-cli/SKILL.md +109 -0
- package/skills/hyperframes-core/SKILL.md +78 -0
- package/skills/hyperframes-creative/SKILL.md +68 -0
- package/skills/hyperframes-media/SKILL.md +97 -0
- package/skills/image-to-code-skill/SKILL.md +1228 -0
- package/skills/imagegen-frontend-mobile/SKILL.md +1465 -0
- package/skills/imagegen-frontend-web/SKILL.md +987 -0
- package/skills/implement/SKILL.md +15 -0
- package/skills/init/SKILL.md +91 -0
- package/skills/internal-comms/SKILL.md +32 -0
- package/skills/lark-approval/SKILL.md +56 -0
- package/skills/lark-base/SKILL.md +157 -0
- package/skills/lark-doc/SKILL.md +81 -0
- package/skills/lark-shared/SKILL.md +168 -0
- package/skills/lark-workflow-meeting-summary/SKILL.md +122 -0
- package/skills/linting-neostandard-eslint9/SKILL.md +64 -0
- package/skills/loop-me/SKILL.md +32 -0
- package/skills/microsoft-foundry/SKILL.md +262 -0
- package/skills/migrate-to-shoehorn/SKILL.md +118 -0
- package/skills/minimalist-skill/SKILL.md +85 -0
- package/skills/motion-graphics/SKILL.md +170 -0
- package/skills/music-to-video/SKILL.md +197 -0
- package/skills/node/SKILL.md +94 -0
- package/skills/nodejs-core/SKILL.md +156 -0
- package/skills/oauth/SKILL.md +186 -0
- package/skills/obsidian-vault/SKILL.md +59 -0
- package/skills/octocat/SKILL.md +93 -0
- package/skills/openclaw-secure-linux-cloud/SKILL.md +157 -0
- package/skills/opensource-guide-coach/SKILL.md +218 -0
- package/skills/output-skill/SKILL.md +49 -0
- package/skills/pdf/SKILL.md +314 -0
- package/skills/pptx/SKILL.md +232 -0
- package/skills/pr-to-video/SKILL.md +235 -0
- package/skills/product-launch-video/SKILL.md +205 -0
- package/skills/python-appservice-deploy/SKILL.md +36 -0
- package/skills/qa/SKILL.md +130 -0
- package/skills/react-best-practices/SKILL.md +149 -0
- package/skills/react-native-skills/SKILL.md +121 -0
- package/skills/react-view-transitions/SKILL.md +320 -0
- package/skills/readme-i18n/SKILL.md +176 -0
- package/skills/redesign-skill/SKILL.md +178 -0
- package/skills/remotion/SKILL.md +364 -0
- package/skills/request-refactor-plan/SKILL.md +68 -0
- package/skills/resolving-merge-conflicts/SKILL.md +14 -0
- package/skills/running-claude-code-via-litellm-copilot/SKILL.md +263 -0
- package/skills/scaffold-exercises/SKILL.md +106 -0
- package/skills/secure-linux-web-hosting/SKILL.md +162 -0
- package/skills/setup-pre-commit/SKILL.md +91 -0
- package/skills/shadcn/SKILL.md +267 -0
- package/skills/simple/SKILL.md +52 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-optimizer/SKILL.md +47 -0
- package/skills/skills-cli/SKILL.md +281 -0
- package/skills/slack-gif-creator/SKILL.md +254 -0
- package/skills/snipgrapher/SKILL.md +58 -0
- package/skills/soft-skill/SKILL.md +98 -0
- package/skills/stitch-skill/SKILL.md +184 -0
- package/skills/supabase/SKILL.md +135 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/talking-head-recut/SKILL.md +1191 -0
- package/skills/taste-skill/SKILL.md +1206 -0
- package/skills/taste-skill-v1/SKILL.md +226 -0
- package/skills/tdd/SKILL.md +108 -0
- package/skills/teach/SKILL.md +140 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/theme-factory/SKILL.md +59 -0
- package/skills/to-prd/SKILL.md +75 -0
- package/skills/typescript-magician/SKILL.md +117 -0
- package/skills/tzst/SKILL.md +68 -0
- package/skills/ubiquitous-language/SKILL.md +93 -0
- package/skills/use-my-browser/SKILL.md +110 -0
- package/skills/using-superpowers/SKILL.md +121 -0
- package/skills/vercel-cli-with-tokens/SKILL.md +353 -0
- package/skills/vercel-optimize/SKILL.md +322 -0
- package/skills/viral-instagram-reels/SKILL.md +180 -0
- package/skills/viral-short-form/SKILL.md +147 -0
- package/skills/viral-short-form-ideas/SKILL.md +184 -0
- package/skills/viral-tiktok-content/SKILL.md +180 -0
- package/skills/web-artifacts-builder/SKILL.md +74 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/skills/webapp-testing/SKILL.md +96 -0
- package/skills/website-to-video/SKILL.md +145 -0
- package/skills/writing-beats/SKILL.md +67 -0
- package/skills/writing-fragments/SKILL.md +79 -0
- package/skills/writing-great-skills/SKILL.md +82 -0
- package/skills/writing-guidelines/SKILL.md +39 -0
- package/skills/writing-plans/SKILL.md +174 -0
- package/skills/writing-shape/SKILL.md +79 -0
- package/skills/xdrop/SKILL.md +78 -0
- package/skills/xget/SKILL.md +87 -0
- package/skills/xlsx/SKILL.md +292 -0
- package/src/tools/skills_download.js +217 -0
- package/src/utils/tools.js +2 -2
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opensource-guide-coach
|
|
3
|
+
description: Use when a user wants guidance on starting, contributing to, growing, governing, funding, securing, or sustaining an open source project, or asks about contributor onboarding, community health, maintainer burnout, code of conduct, metrics, legal basics, or open source project adoption.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Use the official Open Source Guides as a coaching framework for open source questions.
|
|
9
|
+
|
|
10
|
+
This skill is for diagnosis and action planning, not just summarization. Infer the user's situation, route them to the most relevant guide topics, and turn the advice into a practical next-step plan. Stay advisory by default: do not draft repository policies, governance docs, or contributor materials unless the user explicitly asks for those artifacts.
|
|
11
|
+
|
|
12
|
+
## Source Of Truth
|
|
13
|
+
|
|
14
|
+
- Use the official Open Source Guides site: <https://opensource.guide/>
|
|
15
|
+
- Use [`references/guide-map.md`](./references/guide-map.md) to select the right topic quickly
|
|
16
|
+
- Use [`references/persona-router.md`](./references/persona-router.md) to infer the closest audience persona
|
|
17
|
+
- Use [`references/attribution.md`](./references/attribution.md) for source links, attribution, and license notes
|
|
18
|
+
- Copy official guide titles and canonical URLs exactly from `references/guide-map.md`
|
|
19
|
+
|
|
20
|
+
Treat the guides as curated community practice, not binding policy. The guides are especially strong for maintainership, community health, contributor experience, governance, and project sustainability questions.
|
|
21
|
+
|
|
22
|
+
## When To Use
|
|
23
|
+
|
|
24
|
+
Use this skill when the user is trying to:
|
|
25
|
+
|
|
26
|
+
- decide whether or how to open source a project
|
|
27
|
+
- attract users or contributors
|
|
28
|
+
- improve onboarding or contribution flow
|
|
29
|
+
- reduce maintainer overload or burnout
|
|
30
|
+
- set governance or decision-making expectations
|
|
31
|
+
- adopt or enforce a code of conduct
|
|
32
|
+
- choose useful project metrics
|
|
33
|
+
- think about funding or sustainability
|
|
34
|
+
- understand open source legal basics
|
|
35
|
+
- tighten project security practices
|
|
36
|
+
|
|
37
|
+
Do not use this skill for:
|
|
38
|
+
|
|
39
|
+
- GitHub product how-to questions that need product docs
|
|
40
|
+
- repository-specific legal advice that requires a lawyer
|
|
41
|
+
- deep software security implementation guidance unrelated to open source project operations
|
|
42
|
+
|
|
43
|
+
## Working Style
|
|
44
|
+
|
|
45
|
+
### 1. Identify the situation
|
|
46
|
+
|
|
47
|
+
Infer:
|
|
48
|
+
|
|
49
|
+
- the closest persona
|
|
50
|
+
- the project stage: considering launch, early launch, growing, overwhelmed, or formalizing
|
|
51
|
+
- the main pain point
|
|
52
|
+
- whether the user wants advice, a checklist, or actual drafted artifacts
|
|
53
|
+
|
|
54
|
+
If details are missing, make a reasonable inference and state it briefly. Do not interrogate the user for every unknown if a safe assumption will do.
|
|
55
|
+
|
|
56
|
+
### 2. Choose the smallest useful guide set
|
|
57
|
+
|
|
58
|
+
Pick `1-3` guide topics.
|
|
59
|
+
|
|
60
|
+
- Use `1` guide for narrow questions
|
|
61
|
+
- Use `2` guides for common combined situations
|
|
62
|
+
- Use `3` guides only when the request clearly spans multiple concerns
|
|
63
|
+
|
|
64
|
+
Do not dump the entire guide catalog on the user.
|
|
65
|
+
|
|
66
|
+
### 3. Convert guidance into action
|
|
67
|
+
|
|
68
|
+
Translate the guide themes into a prioritized plan that fits the user's scale.
|
|
69
|
+
|
|
70
|
+
- Prefer the next `3-6` concrete actions
|
|
71
|
+
- Match the level of process to the maturity of the project
|
|
72
|
+
- Avoid recommending heavyweight governance or documentation too early
|
|
73
|
+
- Keep the plan practical for solo maintainers and volunteer projects
|
|
74
|
+
|
|
75
|
+
### 4. Link back to the official source
|
|
76
|
+
|
|
77
|
+
For each recommended guide, include the official `opensource.guide` URL and one short sentence on why it applies.
|
|
78
|
+
|
|
79
|
+
- Use the canonical URL from `references/guide-map.md`
|
|
80
|
+
- Do not shorten, guess, or rewrite article slugs
|
|
81
|
+
- Use the official article title exactly as written in `references/guide-map.md`
|
|
82
|
+
|
|
83
|
+
### 5. Stay advisory by default
|
|
84
|
+
|
|
85
|
+
Unless the user explicitly asks for drafting help:
|
|
86
|
+
|
|
87
|
+
- do not write a full `CONTRIBUTING.md`
|
|
88
|
+
- do not write a governance charter
|
|
89
|
+
- do not write a code of conduct
|
|
90
|
+
- do not generate a full legal policy
|
|
91
|
+
|
|
92
|
+
If the user does ask for an artifact, say which guide(s) you are basing it on and then draft only the requested artifact.
|
|
93
|
+
|
|
94
|
+
## Routing Heuristics
|
|
95
|
+
|
|
96
|
+
Reach for these patterns first:
|
|
97
|
+
|
|
98
|
+
- Launch decision, project scope, expectations, readiness: `starting-a-project`
|
|
99
|
+
- How newcomers can help, contribution flow, first PR path: `how-to-contribute`
|
|
100
|
+
- Adoption, awareness, project discovery: `finding-users`
|
|
101
|
+
- Welcoming environment, community participation, contributor experience: `building-community`
|
|
102
|
+
- Maintainer workload, process clarity, saying no, automation: `best-practices`
|
|
103
|
+
- Shared decision-making, leadership models, formal rules: `leadership-and-governance`
|
|
104
|
+
- Sustainability, sponsorship, funding models: `getting-paid`
|
|
105
|
+
- Behavior expectations and enforcement norms: `code-of-conduct`
|
|
106
|
+
- Measuring health and progress: `metrics`
|
|
107
|
+
- Licensing and legal basics: `legal`
|
|
108
|
+
- Burnout, boundaries, maintainership balance: `maintaining-balance-for-open-source-maintainers`
|
|
109
|
+
- Security hygiene, project trust, dependency and vulnerability practices: `security-best-practices-for-your-project`
|
|
110
|
+
|
|
111
|
+
Common pairings:
|
|
112
|
+
|
|
113
|
+
- First launch + adoption: `starting-a-project` + `finding-users`
|
|
114
|
+
- Contributor growth + community experience: `how-to-contribute` + `building-community`
|
|
115
|
+
- Maintainer overload + burnout: `best-practices` + `maintaining-balance-for-open-source-maintainers`
|
|
116
|
+
- Governance + conduct expectations: `leadership-and-governance` + `code-of-conduct`
|
|
117
|
+
- Trust + sustainability for mature projects: `security-best-practices-for-your-project` + `best-practices` or `getting-paid`
|
|
118
|
+
|
|
119
|
+
Canonical title reminders:
|
|
120
|
+
|
|
121
|
+
- `starting-a-project` -> `Starting an Open Source Project`
|
|
122
|
+
- `code-of-conduct` -> `Your Code of Conduct`
|
|
123
|
+
- `security-best-practices-for-your-project` -> `Security Best Practices for your Project`
|
|
124
|
+
|
|
125
|
+
## Response Contract
|
|
126
|
+
|
|
127
|
+
Always use this structure:
|
|
128
|
+
|
|
129
|
+
Respond in plain Markdown only.
|
|
130
|
+
|
|
131
|
+
- Do not emit pseudo-tool calls
|
|
132
|
+
- Do not emit XML-like tags
|
|
133
|
+
- Do not emit internal reasoning markers
|
|
134
|
+
- Do not rename the section headings below
|
|
135
|
+
- If you begin responding, complete all five sections
|
|
136
|
+
- Never return empty wrappers, placeholders, or partial scaffolding
|
|
137
|
+
|
|
138
|
+
## Situation
|
|
139
|
+
|
|
140
|
+
State the inferred persona, project stage, and main challenge in plain language. If you made an assumption, note it in one sentence.
|
|
141
|
+
|
|
142
|
+
## Relevant Guides
|
|
143
|
+
|
|
144
|
+
List `1-3` guides. For each one include:
|
|
145
|
+
|
|
146
|
+
- official title copied exactly from `references/guide-map.md`, including capitalization
|
|
147
|
+
- why it applies here
|
|
148
|
+
- official URL
|
|
149
|
+
|
|
150
|
+
Preferred format:
|
|
151
|
+
|
|
152
|
+
`**Official Title**`
|
|
153
|
+
|
|
154
|
+
`Why it applies: ...`
|
|
155
|
+
|
|
156
|
+
`URL: <https://opensource.guide/...>`
|
|
157
|
+
|
|
158
|
+
## Recommended Next Steps
|
|
159
|
+
|
|
160
|
+
Provide a prioritized numbered list. Keep it concrete and proportionate to the user's scale.
|
|
161
|
+
|
|
162
|
+
## Watch-outs
|
|
163
|
+
|
|
164
|
+
Call out risks, anti-patterns, or ways the user could over-process the problem.
|
|
165
|
+
|
|
166
|
+
## Optional deeper reading
|
|
167
|
+
|
|
168
|
+
Include any extra guide links only if they are genuinely useful. If not, say that the guides above are enough for now.
|
|
169
|
+
|
|
170
|
+
Mini example:
|
|
171
|
+
|
|
172
|
+
## Situation
|
|
173
|
+
|
|
174
|
+
You are an early-stage solo maintainer deciding whether your side project is ready for open source.
|
|
175
|
+
|
|
176
|
+
## Relevant Guides
|
|
177
|
+
|
|
178
|
+
**Starting an Open Source Project**
|
|
179
|
+
|
|
180
|
+
Why it applies: It helps you decide whether to launch now and what basics to prepare first.
|
|
181
|
+
|
|
182
|
+
URL: <https://opensource.guide/starting-a-project/>
|
|
183
|
+
|
|
184
|
+
## Recommended Next Steps
|
|
185
|
+
|
|
186
|
+
1. Clarify the project scope and your maintenance boundaries.
|
|
187
|
+
2. Add a license, README, and minimal contributor expectations.
|
|
188
|
+
3. Share with a small early audience before a broader announcement.
|
|
189
|
+
|
|
190
|
+
## Watch-outs
|
|
191
|
+
|
|
192
|
+
Do not over-promise support or add heavyweight process before you need it.
|
|
193
|
+
|
|
194
|
+
## Optional deeper reading
|
|
195
|
+
|
|
196
|
+
If you want to think about early contributor experience, read How to Contribute to Open Source next.
|
|
197
|
+
|
|
198
|
+
## Quality Bar
|
|
199
|
+
|
|
200
|
+
Your answer should:
|
|
201
|
+
|
|
202
|
+
- sound like coaching, not policy boilerplate
|
|
203
|
+
- reflect the likely persona and maturity level
|
|
204
|
+
- use official guide links, not third-party summaries
|
|
205
|
+
- avoid presenting legal content as legal advice
|
|
206
|
+
- avoid copying long passages from the source material
|
|
207
|
+
- leave the user with a clear next move
|
|
208
|
+
|
|
209
|
+
## Escalation Rules
|
|
210
|
+
|
|
211
|
+
Escalate carefully when:
|
|
212
|
+
|
|
213
|
+
- the user is asking for legal certainty rather than general guidance
|
|
214
|
+
- the user needs incident response or code-level security help
|
|
215
|
+
- the user wants formal governance that may be disproportionate for a tiny project
|
|
216
|
+
- the user is clearly burned out and needs boundaries more than process
|
|
217
|
+
|
|
218
|
+
In those cases, keep the recommendation practical and say what this skill can and cannot confidently cover.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: full-output-enforcement
|
|
3
|
+
description: Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Full-Output Enforcement
|
|
7
|
+
|
|
8
|
+
## Baseline
|
|
9
|
+
|
|
10
|
+
Treat every task as production-critical. A partial output is a broken output. Do not optimize for brevity — optimize for completeness. If the user asks for a full file, deliver the full file. If the user asks for 5 components, deliver 5 components. No exceptions.
|
|
11
|
+
|
|
12
|
+
## Banned Output Patterns
|
|
13
|
+
|
|
14
|
+
The following patterns are hard failures. Never produce them:
|
|
15
|
+
|
|
16
|
+
**In code blocks:** `// ...`, `// rest of code`, `// implement here`, `// TODO`, `/* ... */`, `// similar to above`, `// continue pattern`, `// add more as needed`, bare `...` standing in for omitted code
|
|
17
|
+
|
|
18
|
+
**In prose:** "Let me know if you want me to continue", "I can provide more details if needed", "for brevity", "the rest follows the same pattern", "similarly for the remaining", "and so on" (when replacing actual content), "I'll leave that as an exercise"
|
|
19
|
+
|
|
20
|
+
**Structural shortcuts:** Outputting a skeleton when the request was for a full implementation. Showing the first and last section while skipping the middle. Replacing repeated logic with one example and a description. Describing what code should do instead of writing it.
|
|
21
|
+
|
|
22
|
+
## Execution Process
|
|
23
|
+
|
|
24
|
+
1. **Scope** — Read the full request. Count how many distinct deliverables are expected (files, functions, sections, answers). Lock that number.
|
|
25
|
+
2. **Build** — Generate every deliverable completely. No partial drafts, no "you can extend this later."
|
|
26
|
+
3. **Cross-check** — Before output, re-read the original request. Compare your deliverable count against the scope count. If anything is missing, add it before responding.
|
|
27
|
+
|
|
28
|
+
## Handling Long Outputs
|
|
29
|
+
|
|
30
|
+
When a response approaches the token limit:
|
|
31
|
+
|
|
32
|
+
- Do not compress remaining sections to squeeze them in.
|
|
33
|
+
- Do not skip ahead to a conclusion.
|
|
34
|
+
- Write at full quality up to a clean breakpoint (end of a function, end of a file, end of a section).
|
|
35
|
+
- End with:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
[PAUSED — X of Y complete. Send "continue" to resume from: next section name]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
On "continue", pick up exactly where you stopped. No recap, no repetition.
|
|
42
|
+
|
|
43
|
+
## Quick Check
|
|
44
|
+
|
|
45
|
+
Before finalizing any response, verify:
|
|
46
|
+
- No banned patterns from the list above appear anywhere in the output
|
|
47
|
+
- Every item the user requested is present and finished
|
|
48
|
+
- Code blocks contain actual runnable code, not descriptions of what code would do
|
|
49
|
+
- Nothing was shortened to save space
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pdf
|
|
3
|
+
description: Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.
|
|
4
|
+
license: Proprietary. LICENSE.txt has complete terms
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PDF Processing Guide
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This guide covers essential PDF processing operations using Python libraries and command-line tools. For advanced features, JavaScript libraries, and detailed examples, see REFERENCE.md. If you need to fill out a PDF form, read FORMS.md and follow its instructions.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from pypdf import PdfReader, PdfWriter
|
|
17
|
+
|
|
18
|
+
# Read a PDF
|
|
19
|
+
reader = PdfReader("document.pdf")
|
|
20
|
+
print(f"Pages: {len(reader.pages)}")
|
|
21
|
+
|
|
22
|
+
# Extract text
|
|
23
|
+
text = ""
|
|
24
|
+
for page in reader.pages:
|
|
25
|
+
text += page.extract_text()
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Python Libraries
|
|
29
|
+
|
|
30
|
+
### pypdf - Basic Operations
|
|
31
|
+
|
|
32
|
+
#### Merge PDFs
|
|
33
|
+
```python
|
|
34
|
+
from pypdf import PdfWriter, PdfReader
|
|
35
|
+
|
|
36
|
+
writer = PdfWriter()
|
|
37
|
+
for pdf_file in ["doc1.pdf", "doc2.pdf", "doc3.pdf"]:
|
|
38
|
+
reader = PdfReader(pdf_file)
|
|
39
|
+
for page in reader.pages:
|
|
40
|
+
writer.add_page(page)
|
|
41
|
+
|
|
42
|
+
with open("merged.pdf", "wb") as output:
|
|
43
|
+
writer.write(output)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### Split PDF
|
|
47
|
+
```python
|
|
48
|
+
reader = PdfReader("input.pdf")
|
|
49
|
+
for i, page in enumerate(reader.pages):
|
|
50
|
+
writer = PdfWriter()
|
|
51
|
+
writer.add_page(page)
|
|
52
|
+
with open(f"page_{i+1}.pdf", "wb") as output:
|
|
53
|
+
writer.write(output)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Extract Metadata
|
|
57
|
+
```python
|
|
58
|
+
reader = PdfReader("document.pdf")
|
|
59
|
+
meta = reader.metadata
|
|
60
|
+
print(f"Title: {meta.title}")
|
|
61
|
+
print(f"Author: {meta.author}")
|
|
62
|
+
print(f"Subject: {meta.subject}")
|
|
63
|
+
print(f"Creator: {meta.creator}")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### Rotate Pages
|
|
67
|
+
```python
|
|
68
|
+
reader = PdfReader("input.pdf")
|
|
69
|
+
writer = PdfWriter()
|
|
70
|
+
|
|
71
|
+
page = reader.pages[0]
|
|
72
|
+
page.rotate(90) # Rotate 90 degrees clockwise
|
|
73
|
+
writer.add_page(page)
|
|
74
|
+
|
|
75
|
+
with open("rotated.pdf", "wb") as output:
|
|
76
|
+
writer.write(output)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### pdfplumber - Text and Table Extraction
|
|
80
|
+
|
|
81
|
+
#### Extract Text with Layout
|
|
82
|
+
```python
|
|
83
|
+
import pdfplumber
|
|
84
|
+
|
|
85
|
+
with pdfplumber.open("document.pdf") as pdf:
|
|
86
|
+
for page in pdf.pages:
|
|
87
|
+
text = page.extract_text()
|
|
88
|
+
print(text)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Extract Tables
|
|
92
|
+
```python
|
|
93
|
+
with pdfplumber.open("document.pdf") as pdf:
|
|
94
|
+
for i, page in enumerate(pdf.pages):
|
|
95
|
+
tables = page.extract_tables()
|
|
96
|
+
for j, table in enumerate(tables):
|
|
97
|
+
print(f"Table {j+1} on page {i+1}:")
|
|
98
|
+
for row in table:
|
|
99
|
+
print(row)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Advanced Table Extraction
|
|
103
|
+
```python
|
|
104
|
+
import pandas as pd
|
|
105
|
+
|
|
106
|
+
with pdfplumber.open("document.pdf") as pdf:
|
|
107
|
+
all_tables = []
|
|
108
|
+
for page in pdf.pages:
|
|
109
|
+
tables = page.extract_tables()
|
|
110
|
+
for table in tables:
|
|
111
|
+
if table: # Check if table is not empty
|
|
112
|
+
df = pd.DataFrame(table[1:], columns=table[0])
|
|
113
|
+
all_tables.append(df)
|
|
114
|
+
|
|
115
|
+
# Combine all tables
|
|
116
|
+
if all_tables:
|
|
117
|
+
combined_df = pd.concat(all_tables, ignore_index=True)
|
|
118
|
+
combined_df.to_excel("extracted_tables.xlsx", index=False)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### reportlab - Create PDFs
|
|
122
|
+
|
|
123
|
+
#### Basic PDF Creation
|
|
124
|
+
```python
|
|
125
|
+
from reportlab.lib.pagesizes import letter
|
|
126
|
+
from reportlab.pdfgen import canvas
|
|
127
|
+
|
|
128
|
+
c = canvas.Canvas("hello.pdf", pagesize=letter)
|
|
129
|
+
width, height = letter
|
|
130
|
+
|
|
131
|
+
# Add text
|
|
132
|
+
c.drawString(100, height - 100, "Hello World!")
|
|
133
|
+
c.drawString(100, height - 120, "This is a PDF created with reportlab")
|
|
134
|
+
|
|
135
|
+
# Add a line
|
|
136
|
+
c.line(100, height - 140, 400, height - 140)
|
|
137
|
+
|
|
138
|
+
# Save
|
|
139
|
+
c.save()
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Create PDF with Multiple Pages
|
|
143
|
+
```python
|
|
144
|
+
from reportlab.lib.pagesizes import letter
|
|
145
|
+
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
|
|
146
|
+
from reportlab.lib.styles import getSampleStyleSheet
|
|
147
|
+
|
|
148
|
+
doc = SimpleDocTemplate("report.pdf", pagesize=letter)
|
|
149
|
+
styles = getSampleStyleSheet()
|
|
150
|
+
story = []
|
|
151
|
+
|
|
152
|
+
# Add content
|
|
153
|
+
title = Paragraph("Report Title", styles['Title'])
|
|
154
|
+
story.append(title)
|
|
155
|
+
story.append(Spacer(1, 12))
|
|
156
|
+
|
|
157
|
+
body = Paragraph("This is the body of the report. " * 20, styles['Normal'])
|
|
158
|
+
story.append(body)
|
|
159
|
+
story.append(PageBreak())
|
|
160
|
+
|
|
161
|
+
# Page 2
|
|
162
|
+
story.append(Paragraph("Page 2", styles['Heading1']))
|
|
163
|
+
story.append(Paragraph("Content for page 2", styles['Normal']))
|
|
164
|
+
|
|
165
|
+
# Build PDF
|
|
166
|
+
doc.build(story)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### Subscripts and Superscripts
|
|
170
|
+
|
|
171
|
+
**IMPORTANT**: Never use Unicode subscript/superscript characters (₀₁₂₃₄₅₆₇₈₉, ⁰¹²³⁴⁵⁶⁷⁸⁹) in ReportLab PDFs. The built-in fonts do not include these glyphs, causing them to render as solid black boxes.
|
|
172
|
+
|
|
173
|
+
Instead, use ReportLab's XML markup tags in Paragraph objects:
|
|
174
|
+
```python
|
|
175
|
+
from reportlab.platypus import Paragraph
|
|
176
|
+
from reportlab.lib.styles import getSampleStyleSheet
|
|
177
|
+
|
|
178
|
+
styles = getSampleStyleSheet()
|
|
179
|
+
|
|
180
|
+
# Subscripts: use <sub> tag
|
|
181
|
+
chemical = Paragraph("H<sub>2</sub>O", styles['Normal'])
|
|
182
|
+
|
|
183
|
+
# Superscripts: use <super> tag
|
|
184
|
+
squared = Paragraph("x<super>2</super> + y<super>2</super>", styles['Normal'])
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
For canvas-drawn text (not Paragraph objects), manually adjust font the size and position rather than using Unicode subscripts/superscripts.
|
|
188
|
+
|
|
189
|
+
## Command-Line Tools
|
|
190
|
+
|
|
191
|
+
### pdftotext (poppler-utils)
|
|
192
|
+
```bash
|
|
193
|
+
# Extract text
|
|
194
|
+
pdftotext input.pdf output.txt
|
|
195
|
+
|
|
196
|
+
# Extract text preserving layout
|
|
197
|
+
pdftotext -layout input.pdf output.txt
|
|
198
|
+
|
|
199
|
+
# Extract specific pages
|
|
200
|
+
pdftotext -f 1 -l 5 input.pdf output.txt # Pages 1-5
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### qpdf
|
|
204
|
+
```bash
|
|
205
|
+
# Merge PDFs
|
|
206
|
+
qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf
|
|
207
|
+
|
|
208
|
+
# Split pages
|
|
209
|
+
qpdf input.pdf --pages . 1-5 -- pages1-5.pdf
|
|
210
|
+
qpdf input.pdf --pages . 6-10 -- pages6-10.pdf
|
|
211
|
+
|
|
212
|
+
# Rotate pages
|
|
213
|
+
qpdf input.pdf output.pdf --rotate=+90:1 # Rotate page 1 by 90 degrees
|
|
214
|
+
|
|
215
|
+
# Remove password
|
|
216
|
+
qpdf --password=mypassword --decrypt encrypted.pdf decrypted.pdf
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### pdftk (if available)
|
|
220
|
+
```bash
|
|
221
|
+
# Merge
|
|
222
|
+
pdftk file1.pdf file2.pdf cat output merged.pdf
|
|
223
|
+
|
|
224
|
+
# Split
|
|
225
|
+
pdftk input.pdf burst
|
|
226
|
+
|
|
227
|
+
# Rotate
|
|
228
|
+
pdftk input.pdf rotate 1east output rotated.pdf
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Common Tasks
|
|
232
|
+
|
|
233
|
+
### Extract Text from Scanned PDFs
|
|
234
|
+
```python
|
|
235
|
+
# Requires: pip install pytesseract pdf2image
|
|
236
|
+
import pytesseract
|
|
237
|
+
from pdf2image import convert_from_path
|
|
238
|
+
|
|
239
|
+
# Convert PDF to images
|
|
240
|
+
images = convert_from_path('scanned.pdf')
|
|
241
|
+
|
|
242
|
+
# OCR each page
|
|
243
|
+
text = ""
|
|
244
|
+
for i, image in enumerate(images):
|
|
245
|
+
text += f"Page {i+1}:\n"
|
|
246
|
+
text += pytesseract.image_to_string(image)
|
|
247
|
+
text += "\n\n"
|
|
248
|
+
|
|
249
|
+
print(text)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Add Watermark
|
|
253
|
+
```python
|
|
254
|
+
from pypdf import PdfReader, PdfWriter
|
|
255
|
+
|
|
256
|
+
# Create watermark (or load existing)
|
|
257
|
+
watermark = PdfReader("watermark.pdf").pages[0]
|
|
258
|
+
|
|
259
|
+
# Apply to all pages
|
|
260
|
+
reader = PdfReader("document.pdf")
|
|
261
|
+
writer = PdfWriter()
|
|
262
|
+
|
|
263
|
+
for page in reader.pages:
|
|
264
|
+
page.merge_page(watermark)
|
|
265
|
+
writer.add_page(page)
|
|
266
|
+
|
|
267
|
+
with open("watermarked.pdf", "wb") as output:
|
|
268
|
+
writer.write(output)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Extract Images
|
|
272
|
+
```bash
|
|
273
|
+
# Using pdfimages (poppler-utils)
|
|
274
|
+
pdfimages -j input.pdf output_prefix
|
|
275
|
+
|
|
276
|
+
# This extracts all images as output_prefix-000.jpg, output_prefix-001.jpg, etc.
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Password Protection
|
|
280
|
+
```python
|
|
281
|
+
from pypdf import PdfReader, PdfWriter
|
|
282
|
+
|
|
283
|
+
reader = PdfReader("input.pdf")
|
|
284
|
+
writer = PdfWriter()
|
|
285
|
+
|
|
286
|
+
for page in reader.pages:
|
|
287
|
+
writer.add_page(page)
|
|
288
|
+
|
|
289
|
+
# Add password
|
|
290
|
+
writer.encrypt("userpassword", "ownerpassword")
|
|
291
|
+
|
|
292
|
+
with open("encrypted.pdf", "wb") as output:
|
|
293
|
+
writer.write(output)
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Quick Reference
|
|
297
|
+
|
|
298
|
+
| Task | Best Tool | Command/Code |
|
|
299
|
+
|------|-----------|--------------|
|
|
300
|
+
| Merge PDFs | pypdf | `writer.add_page(page)` |
|
|
301
|
+
| Split PDFs | pypdf | One page per file |
|
|
302
|
+
| Extract text | pdfplumber | `page.extract_text()` |
|
|
303
|
+
| Extract tables | pdfplumber | `page.extract_tables()` |
|
|
304
|
+
| Create PDFs | reportlab | Canvas or Platypus |
|
|
305
|
+
| Command line merge | qpdf | `qpdf --empty --pages ...` |
|
|
306
|
+
| OCR scanned PDFs | pytesseract | Convert to image first |
|
|
307
|
+
| Fill PDF forms | pdf-lib or pypdf (see FORMS.md) | See FORMS.md |
|
|
308
|
+
|
|
309
|
+
## Next Steps
|
|
310
|
+
|
|
311
|
+
- For advanced pypdfium2 usage, see REFERENCE.md
|
|
312
|
+
- For JavaScript libraries (pdf-lib), see REFERENCE.md
|
|
313
|
+
- If you need to fill out a PDF form, follow the instructions in FORMS.md
|
|
314
|
+
- For troubleshooting guides, see REFERENCE.md
|