@ngockhoale/ukit 1.6.8 → 2.0.2
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/CHANGELOG.md +43 -0
- package/manifests/platform.full.yaml +47 -0
- package/package.json +2 -1
- package/scripts/skill/audit-skill.mjs +39 -0
- package/src/cli/commands/doctor.js +22 -2
- package/src/cli/commands/memory.js +76 -1
- package/src/core/memory/store.js +125 -1
- package/src/core/skillProfile.js +45 -0
- package/src/skill/auditSkill.js +99 -0
- package/templates/.claude/agents/code-reviewer.md +51 -7
- package/templates/.claude/agents/handoff-planner.md +18 -2
- package/templates/.claude/hooks/context-hardcap-gate.sh +102 -0
- package/templates/.claude/hooks/reset-compact-pressure.sh +25 -0
- package/templates/.claude/settings.json +15 -0
- package/templates/.claude/skills/canvas-design/SKILL.md +2 -20
- package/templates/.claude/skills/canvas-design/philosophy-examples.md +23 -0
- package/templates/.claude/skills/debugging-toolkit/SKILL.md +2 -30
- package/templates/.claude/skills/debugging-toolkit/reference-tables.md +33 -0
- package/templates/.claude/skills/docs-manager/SKILL.md +7 -249
- package/templates/.claude/skills/docs-manager/conventions-and-examples.md +221 -0
- package/templates/.claude/skills/docx/SKILL.md +3 -34
- package/templates/.claude/skills/docx/redlining-reference.md +34 -0
- package/templates/.claude/skills/duraone/SKILL.md +12 -16
- package/templates/.claude/skills/executing-plans/SKILL.md +31 -19
- package/templates/.claude/skills/file-organizer/SKILL.md +2 -170
- package/templates/.claude/skills/file-organizer/examples-and-practices.md +173 -0
- package/templates/.claude/skills/pdf/SKILL.md +1 -62
- package/templates/.claude/skills/pdf/reference.md +65 -0
- package/templates/.claude/skills/pdf-processing-pro/SKILL.md +2 -73
- package/templates/.claude/skills/pdf-processing-pro/workflows-and-troubleshooting.md +80 -0
- package/templates/.claude/skills/pptx/SKILL.md +14 -286
- package/templates/.claude/skills/pptx/design-references.md +81 -0
- package/templates/.claude/skills/pptx/template-replacement-reference.md +150 -0
- package/templates/.claude/skills/pptx/utilities.md +62 -0
- package/templates/.claude/skills/project-learning/SKILL.md +32 -0
- package/templates/.claude/skills/root-cause-tracing/SKILL.md +2 -35
- package/templates/.claude/skills/root-cause-tracing/diagrams.md +44 -0
- package/templates/.claude/skills/sharing-skills/SKILL.md +1 -41
- package/templates/.claude/skills/sharing-skills/complete-example.md +41 -0
- package/templates/.claude/skills/skill-quality/SKILL.md +37 -0
- package/templates/.claude/skills/skill-quality/pressure-scenario-template.md +20 -0
- package/templates/.claude/skills/skill-quality/rationalization-table-template.md +15 -0
- package/templates/.claude/skills/skill-quality/trigger-accuracy-template.md +32 -0
- package/templates/.claude/skills/sql-optimization-patterns/SKILL.md +13 -440
- package/templates/.claude/skills/sql-optimization-patterns/references/advanced-techniques.md +128 -0
- package/templates/.claude/skills/sql-optimization-patterns/references/core-concepts.md +112 -0
- package/templates/.claude/skills/sql-optimization-patterns/references/query-patterns.md +204 -0
- package/templates/.claude/skills/subagent-driven-development/SKILL.md +4 -51
- package/templates/.claude/skills/subagent-driven-development/example-workflow.md +40 -0
- package/templates/.claude/skills/systematic-debugging/SKILL.md +2 -28
- package/templates/.claude/skills/systematic-debugging/reference-tables.md +33 -0
- package/templates/.claude/skills/test-driven-development/SKILL.md +2 -51
- package/templates/.claude/skills/test-driven-development/reference-tables.md +56 -0
- package/templates/.claude/skills/testing-anti-patterns/SKILL.md +1 -10
- package/templates/.claude/skills/testing-anti-patterns/reference-tables.md +14 -0
- package/templates/.claude/skills/verification-before-completion/SKILL.md +1 -31
- package/templates/.claude/skills/verification-before-completion/key-patterns.md +33 -0
- package/templates/.claude/ukit/runtime/compact-threshold.mjs +28 -0
- package/templates/.claude/ukit/runtime/reinject-context.mjs +14 -1
- package/templates/CLAUDE.md +4 -0
- package/templates/ukit/storage/config.json +4 -0
- package/src/core/memory/index.js +0 -2
- package/src/core/router/index.js +0 -2
- package/src/core/validation/index.js +0 -2
|
@@ -15,11 +15,23 @@ Load plan, review critically, execute tasks in batches, report for review betwee
|
|
|
15
15
|
|
|
16
16
|
## The Process
|
|
17
17
|
|
|
18
|
-
### Step 1: Load and Review Plan
|
|
18
|
+
### Step 1: Preflight, then Load and Review Plan
|
|
19
19
|
1. Read plan file
|
|
20
|
-
2.
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
2. Run the preflight checklist — each ✓ needs a real check, not an assumption:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Plan received
|
|
24
|
+
✓ dependencies available - referenced files/packages/tests exist
|
|
25
|
+
✓ instructions executable - each step is a concrete action, not a question
|
|
26
|
+
✓ verification possible - each step's check actually runs
|
|
27
|
+
✓ no contradictory steps - no step conflicts with an earlier one
|
|
28
|
+
✓ no missing prerequisite - nothing earlier is silently assumed done
|
|
29
|
+
✓ environment compatible - required tools/versions installed
|
|
30
|
+
READY TO EXECUTE
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3. If any ✓ fails: Raise it with your human partner before starting
|
|
34
|
+
4. If READY TO EXECUTE: Create TodoWrite and proceed
|
|
23
35
|
|
|
24
36
|
### Step 2: Execute Batch
|
|
25
37
|
**Default: First 3 tasks**
|
|
@@ -49,28 +61,28 @@ After all tasks complete and verified:
|
|
|
49
61
|
- **REQUIRED SUB-SKILL:** Use superpowers:finishing-a-development-branch
|
|
50
62
|
- Follow that skill to verify tests, present options, execute choice
|
|
51
63
|
|
|
52
|
-
##
|
|
64
|
+
## Blocker Classifier
|
|
53
65
|
|
|
54
|
-
**
|
|
55
|
-
- Hit a blocker mid-batch (missing dependency, test fails, instruction unclear)
|
|
56
|
-
- Plan has critical gaps preventing starting
|
|
57
|
-
- You don't understand an instruction
|
|
58
|
-
- Verification fails repeatedly
|
|
66
|
+
**Classify every mid-batch blocker before reacting:**
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
```
|
|
69
|
+
BLOCKER TYPE
|
|
70
|
+
🟡 Recoverable → retry/fallback, note it, continue
|
|
71
|
+
🟠 Planning defect → return to Step 1 (Preflight), do not guess a fix
|
|
72
|
+
🔵 Missing information → ask the human partner, do not proceed on assumption
|
|
73
|
+
🔴 Hard stop → execution unsafe/impossible, stop immediately, explain why
|
|
74
|
+
```
|
|
63
75
|
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
76
|
+
- Missing dependency → 🟠 · Test fails once → 🟡, repeatedly → 🔴
|
|
77
|
+
- Instruction unclear → 🔵 · Critical gap blocks starting → 🔴
|
|
78
|
+
- Partner revises the plan, or approach needs rethinking → return to Preflight
|
|
67
79
|
|
|
68
|
-
**
|
|
80
|
+
**Ask for clarification rather than guessing.**
|
|
69
81
|
|
|
70
82
|
## Remember
|
|
71
|
-
-
|
|
83
|
+
- Preflight before executing
|
|
72
84
|
- Follow plan steps exactly
|
|
73
85
|
- Don't skip verifications
|
|
74
86
|
- Reference skills when plan says to
|
|
75
87
|
- Between batches: just report and wait
|
|
76
|
-
-
|
|
88
|
+
- Classify blockers before reacting, don't guess
|
|
@@ -259,175 +259,7 @@ When a user requests file organization help:
|
|
|
259
259
|
Want to organize another folder?
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
## Examples
|
|
262
|
+
## Examples and Reference
|
|
263
263
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
**User**: "My Downloads folder is a mess with 500+ files. Help me organize it."
|
|
267
|
-
|
|
268
|
-
**Process**:
|
|
269
|
-
1. Analyzes Downloads folder
|
|
270
|
-
2. Finds patterns: work docs, personal photos, installers, random PDFs
|
|
271
|
-
3. Proposes structure:
|
|
272
|
-
- Downloads/
|
|
273
|
-
- Work/
|
|
274
|
-
- Personal/
|
|
275
|
-
- Installers/ (DMG, PKG files)
|
|
276
|
-
- Archive/
|
|
277
|
-
- ToSort/ (things needing decisions)
|
|
278
|
-
4. Asks for confirmation
|
|
279
|
-
5. Moves files intelligently based on content and names
|
|
280
|
-
6. Results: 500 files → 5 organized folders
|
|
281
|
-
|
|
282
|
-
### Example 2: Finding and Removing Duplicates
|
|
283
|
-
|
|
284
|
-
**User**: "Find duplicate files in my Documents and help me decide which to keep."
|
|
285
|
-
|
|
286
|
-
**Output**:
|
|
287
|
-
```markdown
|
|
288
|
-
# Found 23 Sets of Duplicates (156 MB total)
|
|
289
|
-
|
|
290
|
-
## Duplicate Set 1: "proposal.pdf"
|
|
291
|
-
- `/Documents/proposal.pdf` (2.3 MB, modified: 2024-03-15)
|
|
292
|
-
- `/Documents/old/proposal.pdf` (2.3 MB, modified: 2024-03-15)
|
|
293
|
-
- `/Desktop/proposal.pdf` (2.3 MB, modified: 2024-03-10)
|
|
294
|
-
|
|
295
|
-
**Recommendation**: Keep `/Documents/proposal.pdf` (most recent in correct location)
|
|
296
|
-
Delete the other 2 copies?
|
|
297
|
-
|
|
298
|
-
[Continue for all duplicates...]
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### Example 3: Restructuring Projects Folder
|
|
302
|
-
|
|
303
|
-
**User**: "Review my ~/Projects directory and suggest improvements."
|
|
304
|
-
|
|
305
|
-
**Output**:
|
|
306
|
-
```markdown
|
|
307
|
-
# Analysis of ~/Projects
|
|
308
|
-
|
|
309
|
-
## Current Structure Issues
|
|
310
|
-
- Mix of active and archived projects (3+ years old)
|
|
311
|
-
- No consistent naming convention
|
|
312
|
-
- Some projects at root, others in random subfolders
|
|
313
|
-
- Duplicate folders (project-name, project-name-old, project-name-v2)
|
|
314
|
-
|
|
315
|
-
## Proposed Structure
|
|
316
|
-
|
|
317
|
-
```
|
|
318
|
-
Projects/
|
|
319
|
-
├── Active/
|
|
320
|
-
│ ├── client-work/
|
|
321
|
-
│ ├── side-projects/
|
|
322
|
-
│ └── learning/
|
|
323
|
-
├── Archive/
|
|
324
|
-
│ ├── 2022/
|
|
325
|
-
│ ├── 2023/
|
|
326
|
-
│ └── 2024/
|
|
327
|
-
└── Templates/
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
## Specific Changes
|
|
331
|
-
1. Move 12 projects not touched since 2022 → Archive/
|
|
332
|
-
2. Consolidate 4 duplicate project folders
|
|
333
|
-
3. Rename projects to consistent format: "client-name-project-name"
|
|
334
|
-
4. Create Archive for old work
|
|
335
|
-
|
|
336
|
-
Want me to implement this?
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Example 4: Organizing Photos by Date
|
|
340
|
-
|
|
341
|
-
**User**: "Organize my photo folders by year and month."
|
|
342
|
-
|
|
343
|
-
**Output**: Creates structure like:
|
|
344
|
-
```
|
|
345
|
-
Photos/
|
|
346
|
-
├── 2023/
|
|
347
|
-
│ ├── 01-January/
|
|
348
|
-
│ ├── 02-February/
|
|
349
|
-
│ └── ...
|
|
350
|
-
├── 2024/
|
|
351
|
-
│ ├── 01-January/
|
|
352
|
-
│ └── ...
|
|
353
|
-
└── Unsorted/
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
Then moves photos based on EXIF data or file modification dates.
|
|
357
|
-
|
|
358
|
-
## Common Organization Tasks
|
|
359
|
-
|
|
360
|
-
### Downloads Cleanup
|
|
361
|
-
```
|
|
362
|
-
Organize my Downloads folder - move documents to Documents,
|
|
363
|
-
images to Pictures, keep installers separate, and archive files
|
|
364
|
-
older than 3 months.
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Project Organization
|
|
368
|
-
```
|
|
369
|
-
Review my Projects folder structure and help me separate active
|
|
370
|
-
projects from old ones I should archive.
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
### Duplicate Removal
|
|
374
|
-
```
|
|
375
|
-
Find all duplicate files in my Documents folder and help me
|
|
376
|
-
decide which ones to keep.
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
### Desktop Cleanup
|
|
380
|
-
```
|
|
381
|
-
My Desktop is covered in files. Help me organize everything into
|
|
382
|
-
my Documents folder properly.
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
### Photo Organization
|
|
386
|
-
```
|
|
387
|
-
Organize all photos in this folder by date (year/month) based
|
|
388
|
-
on when they were taken.
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
### Work/Personal Separation
|
|
392
|
-
```
|
|
393
|
-
Help me separate my work files from personal files across my
|
|
394
|
-
Documents folder.
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
## Pro Tips
|
|
398
|
-
|
|
399
|
-
1. **Start Small**: Begin with one messy folder (like Downloads) to build trust
|
|
400
|
-
2. **Regular Maintenance**: Run weekly cleanup on Downloads
|
|
401
|
-
3. **Consistent Naming**: Use "YYYY-MM-DD - Description" format for important files
|
|
402
|
-
4. **Archive Aggressively**: Move old projects to Archive instead of deleting
|
|
403
|
-
5. **Keep Active Separate**: Maintain clear boundaries between active and archived work
|
|
404
|
-
6. **Trust the Process**: Let Claude handle the cognitive load of where things go
|
|
405
|
-
|
|
406
|
-
## Best Practices
|
|
407
|
-
|
|
408
|
-
### Folder Naming
|
|
409
|
-
- Use clear, descriptive names
|
|
410
|
-
- Avoid spaces (use hyphens or underscores)
|
|
411
|
-
- Be specific: "client-proposals" not "docs"
|
|
412
|
-
- Use prefixes for ordering: "01-current", "02-archive"
|
|
413
|
-
|
|
414
|
-
### File Naming
|
|
415
|
-
- Include dates: "2024-10-17-meeting-notes.md"
|
|
416
|
-
- Be descriptive: "q3-financial-report.xlsx"
|
|
417
|
-
- Avoid version numbers in names (use version control instead)
|
|
418
|
-
- Remove download artifacts: "document-final-v2 (1).pdf" → "document.pdf"
|
|
419
|
-
|
|
420
|
-
### When to Archive
|
|
421
|
-
- Projects not touched in 6+ months
|
|
422
|
-
- Completed work that might be referenced later
|
|
423
|
-
- Old versions after migration to new systems
|
|
424
|
-
- Files you're hesitant to delete (archive first)
|
|
425
|
-
|
|
426
|
-
## Related Use Cases
|
|
427
|
-
|
|
428
|
-
- Setting up organization for a new computer
|
|
429
|
-
- Preparing files for backup/archiving
|
|
430
|
-
- Cleaning up before storage cleanup
|
|
431
|
-
- Organizing shared team folders
|
|
432
|
-
- Structuring new project directories
|
|
264
|
+
Four worked examples (Downloads cleanup, duplicate detection output, project-folder restructuring, photo organization by date), common request phrasings, pro tips, and folder/file naming best practices are in [`examples-and-practices.md`](examples-and-practices.md).
|
|
433
265
|
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# File Organizer — Examples and Practices
|
|
2
|
+
|
|
3
|
+
## Examples
|
|
4
|
+
|
|
5
|
+
### Example 1: Organizing Downloads (From Justin Dielmann)
|
|
6
|
+
|
|
7
|
+
**User**: "My Downloads folder is a mess with 500+ files. Help me organize it."
|
|
8
|
+
|
|
9
|
+
**Process**:
|
|
10
|
+
1. Analyzes Downloads folder
|
|
11
|
+
2. Finds patterns: work docs, personal photos, installers, random PDFs
|
|
12
|
+
3. Proposes structure:
|
|
13
|
+
- Downloads/
|
|
14
|
+
- Work/
|
|
15
|
+
- Personal/
|
|
16
|
+
- Installers/ (DMG, PKG files)
|
|
17
|
+
- Archive/
|
|
18
|
+
- ToSort/ (things needing decisions)
|
|
19
|
+
4. Asks for confirmation
|
|
20
|
+
5. Moves files intelligently based on content and names
|
|
21
|
+
6. Results: 500 files → 5 organized folders
|
|
22
|
+
|
|
23
|
+
### Example 2: Finding and Removing Duplicates
|
|
24
|
+
|
|
25
|
+
**User**: "Find duplicate files in my Documents and help me decide which to keep."
|
|
26
|
+
|
|
27
|
+
**Output**:
|
|
28
|
+
```markdown
|
|
29
|
+
# Found 23 Sets of Duplicates (156 MB total)
|
|
30
|
+
|
|
31
|
+
## Duplicate Set 1: "proposal.pdf"
|
|
32
|
+
- `/Documents/proposal.pdf` (2.3 MB, modified: 2024-03-15)
|
|
33
|
+
- `/Documents/old/proposal.pdf` (2.3 MB, modified: 2024-03-15)
|
|
34
|
+
- `/Desktop/proposal.pdf` (2.3 MB, modified: 2024-03-10)
|
|
35
|
+
|
|
36
|
+
**Recommendation**: Keep `/Documents/proposal.pdf` (most recent in correct location)
|
|
37
|
+
Delete the other 2 copies?
|
|
38
|
+
|
|
39
|
+
[Continue for all duplicates...]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Example 3: Restructuring Projects Folder
|
|
43
|
+
|
|
44
|
+
**User**: "Review my ~/Projects directory and suggest improvements."
|
|
45
|
+
|
|
46
|
+
**Output**:
|
|
47
|
+
```markdown
|
|
48
|
+
# Analysis of ~/Projects
|
|
49
|
+
|
|
50
|
+
## Current Structure Issues
|
|
51
|
+
- Mix of active and archived projects (3+ years old)
|
|
52
|
+
- No consistent naming convention
|
|
53
|
+
- Some projects at root, others in random subfolders
|
|
54
|
+
- Duplicate folders (project-name, project-name-old, project-name-v2)
|
|
55
|
+
|
|
56
|
+
## Proposed Structure
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Projects/
|
|
60
|
+
├── Active/
|
|
61
|
+
│ ├── client-work/
|
|
62
|
+
│ ├── side-projects/
|
|
63
|
+
│ └── learning/
|
|
64
|
+
├── Archive/
|
|
65
|
+
│ ├── 2022/
|
|
66
|
+
│ ├── 2023/
|
|
67
|
+
│ └── 2024/
|
|
68
|
+
└── Templates/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Specific Changes
|
|
72
|
+
1. Move 12 projects not touched since 2022 → Archive/
|
|
73
|
+
2. Consolidate 4 duplicate project folders
|
|
74
|
+
3. Rename projects to consistent format: "client-name-project-name"
|
|
75
|
+
4. Create Archive for old work
|
|
76
|
+
|
|
77
|
+
Want me to implement this?
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Example 4: Organizing Photos by Date
|
|
81
|
+
|
|
82
|
+
**User**: "Organize my photo folders by year and month."
|
|
83
|
+
|
|
84
|
+
**Output**: Creates structure like:
|
|
85
|
+
```
|
|
86
|
+
Photos/
|
|
87
|
+
├── 2023/
|
|
88
|
+
│ ├── 01-January/
|
|
89
|
+
│ ├── 02-February/
|
|
90
|
+
│ └── ...
|
|
91
|
+
├── 2024/
|
|
92
|
+
│ ├── 01-January/
|
|
93
|
+
│ └── ...
|
|
94
|
+
└── Unsorted/
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Then moves photos based on EXIF data or file modification dates.
|
|
98
|
+
|
|
99
|
+
## Common Organization Tasks
|
|
100
|
+
|
|
101
|
+
### Downloads Cleanup
|
|
102
|
+
```
|
|
103
|
+
Organize my Downloads folder - move documents to Documents,
|
|
104
|
+
images to Pictures, keep installers separate, and archive files
|
|
105
|
+
older than 3 months.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Project Organization
|
|
109
|
+
```
|
|
110
|
+
Review my Projects folder structure and help me separate active
|
|
111
|
+
projects from old ones I should archive.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Duplicate Removal
|
|
115
|
+
```
|
|
116
|
+
Find all duplicate files in my Documents folder and help me
|
|
117
|
+
decide which ones to keep.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Desktop Cleanup
|
|
121
|
+
```
|
|
122
|
+
My Desktop is covered in files. Help me organize everything into
|
|
123
|
+
my Documents folder properly.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Photo Organization
|
|
127
|
+
```
|
|
128
|
+
Organize all photos in this folder by date (year/month) based
|
|
129
|
+
on when they were taken.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Work/Personal Separation
|
|
133
|
+
```
|
|
134
|
+
Help me separate my work files from personal files across my
|
|
135
|
+
Documents folder.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Pro Tips
|
|
139
|
+
|
|
140
|
+
1. **Start Small**: Begin with one messy folder (like Downloads) to build trust
|
|
141
|
+
2. **Regular Maintenance**: Run weekly cleanup on Downloads
|
|
142
|
+
3. **Consistent Naming**: Use "YYYY-MM-DD - Description" format for important files
|
|
143
|
+
4. **Archive Aggressively**: Move old projects to Archive instead of deleting
|
|
144
|
+
5. **Keep Active Separate**: Maintain clear boundaries between active and archived work
|
|
145
|
+
6. **Trust the Process**: Let Claude handle the cognitive load of where things go
|
|
146
|
+
|
|
147
|
+
## Best Practices
|
|
148
|
+
|
|
149
|
+
### Folder Naming
|
|
150
|
+
- Use clear, descriptive names
|
|
151
|
+
- Avoid spaces (use hyphens or underscores)
|
|
152
|
+
- Be specific: "client-proposals" not "docs"
|
|
153
|
+
- Use prefixes for ordering: "01-current", "02-archive"
|
|
154
|
+
|
|
155
|
+
### File Naming
|
|
156
|
+
- Include dates: "2024-10-17-meeting-notes.md"
|
|
157
|
+
- Be descriptive: "q3-financial-report.xlsx"
|
|
158
|
+
- Avoid version numbers in names (use version control instead)
|
|
159
|
+
- Remove download artifacts: "document-final-v2 (1).pdf" → "document.pdf"
|
|
160
|
+
|
|
161
|
+
### When to Archive
|
|
162
|
+
- Projects not touched in 6+ months
|
|
163
|
+
- Completed work that might be referenced later
|
|
164
|
+
- Old versions after migration to new systems
|
|
165
|
+
- Files you're hesitant to delete (archive first)
|
|
166
|
+
|
|
167
|
+
## Related Use Cases
|
|
168
|
+
|
|
169
|
+
- Setting up organization for a new computer
|
|
170
|
+
- Preparing files for backup/archiving
|
|
171
|
+
- Cleaning up before storage cleanup
|
|
172
|
+
- Organizing shared team folders
|
|
173
|
+
- Structuring new project directories
|
|
@@ -210,68 +210,7 @@ pdftk input.pdf rotate 1east output rotated.pdf
|
|
|
210
210
|
|
|
211
211
|
## Common Tasks
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
```python
|
|
215
|
-
# Requires: pip install pytesseract pdf2image
|
|
216
|
-
import pytesseract
|
|
217
|
-
from pdf2image import convert_from_path
|
|
218
|
-
|
|
219
|
-
# Convert PDF to images
|
|
220
|
-
images = convert_from_path('scanned.pdf')
|
|
221
|
-
|
|
222
|
-
# OCR each page
|
|
223
|
-
text = ""
|
|
224
|
-
for i, image in enumerate(images):
|
|
225
|
-
text += f"Page {i+1}:\n"
|
|
226
|
-
text += pytesseract.image_to_string(image)
|
|
227
|
-
text += "\n\n"
|
|
228
|
-
|
|
229
|
-
print(text)
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Add Watermark
|
|
233
|
-
```python
|
|
234
|
-
from pypdf import PdfReader, PdfWriter
|
|
235
|
-
|
|
236
|
-
# Create watermark (or load existing)
|
|
237
|
-
watermark = PdfReader("watermark.pdf").pages[0]
|
|
238
|
-
|
|
239
|
-
# Apply to all pages
|
|
240
|
-
reader = PdfReader("document.pdf")
|
|
241
|
-
writer = PdfWriter()
|
|
242
|
-
|
|
243
|
-
for page in reader.pages:
|
|
244
|
-
page.merge_page(watermark)
|
|
245
|
-
writer.add_page(page)
|
|
246
|
-
|
|
247
|
-
with open("watermarked.pdf", "wb") as output:
|
|
248
|
-
writer.write(output)
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Extract Images
|
|
252
|
-
```bash
|
|
253
|
-
# Using pdfimages (poppler-utils)
|
|
254
|
-
pdfimages -j input.pdf output_prefix
|
|
255
|
-
|
|
256
|
-
# This extracts all images as output_prefix-000.jpg, output_prefix-001.jpg, etc.
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Password Protection
|
|
260
|
-
```python
|
|
261
|
-
from pypdf import PdfReader, PdfWriter
|
|
262
|
-
|
|
263
|
-
reader = PdfReader("input.pdf")
|
|
264
|
-
writer = PdfWriter()
|
|
265
|
-
|
|
266
|
-
for page in reader.pages:
|
|
267
|
-
writer.add_page(page)
|
|
268
|
-
|
|
269
|
-
# Add password
|
|
270
|
-
writer.encrypt("userpassword", "ownerpassword")
|
|
271
|
-
|
|
272
|
-
with open("encrypted.pdf", "wb") as output:
|
|
273
|
-
writer.write(output)
|
|
274
|
-
```
|
|
213
|
+
OCR on scanned PDFs, adding a watermark, extracting embedded images, and basic password protection: [`reference.md`](reference.md#common-quick-tasks).
|
|
275
214
|
|
|
276
215
|
## Quick Reference
|
|
277
216
|
|
|
@@ -2,6 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
This document contains advanced PDF processing features, detailed examples, and additional libraries not covered in the main skill instructions.
|
|
4
4
|
|
|
5
|
+
## Common Quick Tasks
|
|
6
|
+
|
|
7
|
+
### Extract Text from Scanned PDFs
|
|
8
|
+
```python
|
|
9
|
+
# Requires: pip install pytesseract pdf2image
|
|
10
|
+
import pytesseract
|
|
11
|
+
from pdf2image import convert_from_path
|
|
12
|
+
|
|
13
|
+
# Convert PDF to images
|
|
14
|
+
images = convert_from_path('scanned.pdf')
|
|
15
|
+
|
|
16
|
+
# OCR each page
|
|
17
|
+
text = ""
|
|
18
|
+
for i, image in enumerate(images):
|
|
19
|
+
text += f"Page {i+1}:\n"
|
|
20
|
+
text += pytesseract.image_to_string(image)
|
|
21
|
+
text += "\n\n"
|
|
22
|
+
|
|
23
|
+
print(text)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Add Watermark
|
|
27
|
+
```python
|
|
28
|
+
from pypdf import PdfReader, PdfWriter
|
|
29
|
+
|
|
30
|
+
# Create watermark (or load existing)
|
|
31
|
+
watermark = PdfReader("watermark.pdf").pages[0]
|
|
32
|
+
|
|
33
|
+
# Apply to all pages
|
|
34
|
+
reader = PdfReader("document.pdf")
|
|
35
|
+
writer = PdfWriter()
|
|
36
|
+
|
|
37
|
+
for page in reader.pages:
|
|
38
|
+
page.merge_page(watermark)
|
|
39
|
+
writer.add_page(page)
|
|
40
|
+
|
|
41
|
+
with open("watermarked.pdf", "wb") as output:
|
|
42
|
+
writer.write(output)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Extract Images
|
|
46
|
+
```bash
|
|
47
|
+
# Using pdfimages (poppler-utils)
|
|
48
|
+
pdfimages -j input.pdf output_prefix
|
|
49
|
+
|
|
50
|
+
# This extracts all images as output_prefix-000.jpg, output_prefix-001.jpg, etc.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Password Protection
|
|
54
|
+
```python
|
|
55
|
+
from pypdf import PdfReader, PdfWriter
|
|
56
|
+
|
|
57
|
+
reader = PdfReader("input.pdf")
|
|
58
|
+
writer = PdfWriter()
|
|
59
|
+
|
|
60
|
+
for page in reader.pages:
|
|
61
|
+
writer.add_page(page)
|
|
62
|
+
|
|
63
|
+
# Add password
|
|
64
|
+
writer.encrypt("userpassword", "ownerpassword")
|
|
65
|
+
|
|
66
|
+
with open("encrypted.pdf", "wb") as output:
|
|
67
|
+
writer.write(output)
|
|
68
|
+
```
|
|
69
|
+
|
|
5
70
|
## pypdfium2 Library (Apache/BSD License)
|
|
6
71
|
|
|
7
72
|
### Overview
|
|
@@ -147,54 +147,7 @@ python scripts/validate_pdf.py input.pdf
|
|
|
147
147
|
|
|
148
148
|
## Common workflows
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
# 1. Analyze form structure
|
|
154
|
-
python scripts/analyze_form.py template.pdf --output schema.json
|
|
155
|
-
|
|
156
|
-
# 2. Validate submission data
|
|
157
|
-
python scripts/validate_form.py submission.json schema.json
|
|
158
|
-
|
|
159
|
-
# 3. Fill form
|
|
160
|
-
python scripts/fill_form.py template.pdf submission.json completed.pdf
|
|
161
|
-
|
|
162
|
-
# 4. Validate output
|
|
163
|
-
python scripts/validate_pdf.py completed.pdf
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Workflow 2: Extract data from reports
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
# 1. Extract tables
|
|
170
|
-
python scripts/extract_tables.py monthly_report.pdf --output data.csv
|
|
171
|
-
|
|
172
|
-
# 2. Extract text for analysis
|
|
173
|
-
python scripts/extract_text.py monthly_report.pdf --output report.txt
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### Workflow 3: Batch processing
|
|
177
|
-
|
|
178
|
-
```python
|
|
179
|
-
import glob
|
|
180
|
-
from pathlib import Path
|
|
181
|
-
import subprocess
|
|
182
|
-
|
|
183
|
-
# Process all PDFs in directory
|
|
184
|
-
for pdf_file in glob.glob("invoices/*.pdf"):
|
|
185
|
-
output_file = Path("processed") / Path(pdf_file).name
|
|
186
|
-
|
|
187
|
-
result = subprocess.run([
|
|
188
|
-
"python", "scripts/extract_text.py",
|
|
189
|
-
pdf_file,
|
|
190
|
-
"--output", str(output_file)
|
|
191
|
-
], capture_output=True)
|
|
192
|
-
|
|
193
|
-
if result.returncode == 0:
|
|
194
|
-
print(f"✓ Processed: {pdf_file}")
|
|
195
|
-
else:
|
|
196
|
-
print(f"✗ Failed: {pdf_file} - {result.stderr}")
|
|
197
|
-
```
|
|
150
|
+
Three worked workflows (form submissions, report data extraction, batch processing): [`workflows-and-troubleshooting.md`](workflows-and-troubleshooting.md#common-workflows).
|
|
198
151
|
|
|
199
152
|
## Error handling
|
|
200
153
|
|
|
@@ -255,31 +208,7 @@ Optional for OCR:
|
|
|
255
208
|
|
|
256
209
|
## Troubleshooting
|
|
257
210
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
**"Module not found" errors**:
|
|
261
|
-
```bash
|
|
262
|
-
pip install -r requirements.txt
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**Tesseract not found**:
|
|
266
|
-
```bash
|
|
267
|
-
# Install tesseract system package (see Dependencies)
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
**Memory errors with large PDFs**:
|
|
271
|
-
```python
|
|
272
|
-
# Process page by page instead of loading entire PDF
|
|
273
|
-
with pdfplumber.open("large.pdf") as pdf:
|
|
274
|
-
for page in pdf.pages:
|
|
275
|
-
text = page.extract_text()
|
|
276
|
-
# Process page immediately
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
**Permission errors**:
|
|
280
|
-
```bash
|
|
281
|
-
chmod +x scripts/*.py
|
|
282
|
-
```
|
|
211
|
+
Common issues (missing modules, tesseract not found, memory errors on large PDFs, permission errors) and fixes: [`workflows-and-troubleshooting.md`](workflows-and-troubleshooting.md#troubleshooting).
|
|
283
212
|
|
|
284
213
|
## Getting help
|
|
285
214
|
|