@kolbo/kolbo-code-linux-arm64-musl 0.0.0-dev-202604161628
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/bin/kolbo +0 -0
- package/package.json +14 -0
- package/skills/brainstorming/SKILL.md +164 -0
- package/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/brainstorming/scripts/server.cjs +354 -0
- package/skills/brainstorming/scripts/start-server.sh +148 -0
- package/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +287 -0
- package/skills/color-grading/SKILL.md +152 -0
- package/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/skills/docx/.skillfish.json +10 -0
- package/skills/docx/SKILL.md +196 -0
- package/skills/docx/docx-js.md +350 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/ooxml/scripts/pack.py +159 -0
- package/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/skills/docx/ooxml/scripts/validate.py +69 -0
- package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/docx/ooxml.md +599 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/document.py +1272 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/docx/scripts/utilities.py +374 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/ffmpeg-patterns/SKILL.md +240 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/frontend-design/SKILL.md +42 -0
- package/skills/fullstack-app/SKILL.md +621 -0
- package/skills/image-prompting-guide/SKILL.md +143 -0
- package/skills/kolbo/SKILL.md +610 -0
- package/skills/music-prompting/SKILL.md +146 -0
- package/skills/pdf/.skillfish.json +10 -0
- package/skills/pdf/FORMS.md +205 -0
- package/skills/pdf/REFERENCE.md +612 -0
- package/skills/pdf/SKILL.md +293 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/skills/pdf/scripts/create_validation_image.py +41 -0
- package/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/skills/photo-studio/SKILL.md +130 -0
- package/skills/pptx/.skillfish.json +10 -0
- package/skills/pptx/SKILL.md +483 -0
- package/skills/pptx/html2pptx.md +626 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/pptx/ooxml.md +427 -0
- package/skills/pptx/scripts/html2pptx.js +995 -0
- package/skills/pptx/scripts/inventory.py +1020 -0
- package/skills/pptx/scripts/rearrange.py +231 -0
- package/skills/pptx/scripts/replace.py +385 -0
- package/skills/pptx/scripts/thumbnail.py +450 -0
- package/skills/production-review/SKILL.md +152 -0
- package/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/remotion-best-practices/SKILL.md +62 -0
- package/skills/remotion-best-practices/rules/3d.md +86 -0
- package/skills/remotion-best-practices/rules/animations.md +27 -0
- package/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
- package/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
- package/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +103 -0
- package/skills/remotion-best-practices/rules/assets.md +78 -0
- package/skills/remotion-best-practices/rules/audio-visualization.md +198 -0
- package/skills/remotion-best-practices/rules/audio.md +169 -0
- package/skills/remotion-best-practices/rules/calculate-metadata.md +134 -0
- package/skills/remotion-best-practices/rules/can-decode.md +81 -0
- package/skills/remotion-best-practices/rules/charts.md +120 -0
- package/skills/remotion-best-practices/rules/compositions.md +154 -0
- package/skills/remotion-best-practices/rules/display-captions.md +184 -0
- package/skills/remotion-best-practices/rules/extract-frames.md +229 -0
- package/skills/remotion-best-practices/rules/ffmpeg.md +38 -0
- package/skills/remotion-best-practices/rules/fonts.md +152 -0
- package/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
- package/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
- package/skills/remotion-best-practices/rules/get-video-duration.md +60 -0
- package/skills/remotion-best-practices/rules/gifs.md +141 -0
- package/skills/remotion-best-practices/rules/images.md +134 -0
- package/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
- package/skills/remotion-best-practices/rules/light-leaks.md +73 -0
- package/skills/remotion-best-practices/rules/lottie.md +70 -0
- package/skills/remotion-best-practices/rules/maps.md +412 -0
- package/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
- package/skills/remotion-best-practices/rules/measuring-text.md +140 -0
- package/skills/remotion-best-practices/rules/motion-design.md +215 -0
- package/skills/remotion-best-practices/rules/parameters.md +109 -0
- package/skills/remotion-best-practices/rules/sequencing.md +118 -0
- package/skills/remotion-best-practices/rules/sfx.md +30 -0
- package/skills/remotion-best-practices/rules/subtitles.md +36 -0
- package/skills/remotion-best-practices/rules/tailwind.md +11 -0
- package/skills/remotion-best-practices/rules/text-animations.md +20 -0
- package/skills/remotion-best-practices/rules/timing.md +179 -0
- package/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
- package/skills/remotion-best-practices/rules/transitions.md +197 -0
- package/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
- package/skills/remotion-best-practices/rules/trimming.md +51 -0
- package/skills/remotion-best-practices/rules/videos.md +171 -0
- package/skills/remotion-best-practices/rules/voiceover.md +99 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/short-form-video/SKILL.md +168 -0
- package/skills/sound-design/SKILL.md +154 -0
- package/skills/storytelling/SKILL.md +139 -0
- package/skills/subagent-driven-development/SKILL.md +277 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/subtitle-production/SKILL.md +244 -0
- package/skills/subtitle-production/reference/burn_to_video.py +222 -0
- package/skills/subtitle-production/reference/export_srts.py +127 -0
- package/skills/subtitle-production/reference/gen_srt.py +42 -0
- package/skills/supabase/.skillfish.json +10 -0
- package/skills/supabase/SKILL.md +106 -0
- package/skills/supabase/assets/feedback-issue-template.md +17 -0
- package/skills/supabase/references/skill-feedback.md +17 -0
- package/skills/supabase-postgres-best-practices/.skillfish.json +10 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/skills/supabase-postgres-best-practices/references/security-rls-performance.md +57 -0
- package/skills/supabase-quickstart/SKILL.md +400 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/typography-video/SKILL.md +182 -0
- package/skills/typography-video/reference/KineticTitleScene.tsx +345 -0
- package/skills/using-git-worktrees/SKILL.md +218 -0
- package/skills/using-superpowers/SKILL.md +115 -0
- package/skills/using-superpowers/references/codex-tools.md +100 -0
- package/skills/using-superpowers/references/gemini-tools.md +33 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/video-editing/SKILL.md +128 -0
- package/skills/video-production/SKILL.md +247 -0
- package/skills/video-prompting-guide/SKILL.md +268 -0
- package/skills/writing-plans/SKILL.md +152 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-skills/SKILL.md +655 -0
- package/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
- package/skills/writing-skills/render-graphs.js +168 -0
- package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/skills/xlsx/.skillfish.json +10 -0
- package/skills/xlsx/SKILL.md +288 -0
- package/skills/xlsx/recalc.py +178 -0
- package/skills/youtube-clipper/SKILL.md +187 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xlsx
|
|
3
|
+
description: "Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requirements for Outputs
|
|
7
|
+
|
|
8
|
+
## All Excel files
|
|
9
|
+
|
|
10
|
+
### Zero Formula Errors
|
|
11
|
+
- Every Excel model MUST be delivered with ZERO formula errors (#REF!, #DIV/0!, #VALUE!, #N/A, #NAME?)
|
|
12
|
+
|
|
13
|
+
### Preserve Existing Templates (when updating templates)
|
|
14
|
+
- Study and EXACTLY match existing format, style, and conventions when modifying files
|
|
15
|
+
- Never impose standardized formatting on files with established patterns
|
|
16
|
+
- Existing template conventions ALWAYS override these guidelines
|
|
17
|
+
|
|
18
|
+
## Financial models
|
|
19
|
+
|
|
20
|
+
### Color Coding Standards
|
|
21
|
+
Unless otherwise stated by the user or existing template
|
|
22
|
+
|
|
23
|
+
#### Industry-Standard Color Conventions
|
|
24
|
+
- **Blue text (RGB: 0,0,255)**: Hardcoded inputs, and numbers users will change for scenarios
|
|
25
|
+
- **Black text (RGB: 0,0,0)**: ALL formulas and calculations
|
|
26
|
+
- **Green text (RGB: 0,128,0)**: Links pulling from other worksheets within same workbook
|
|
27
|
+
- **Red text (RGB: 255,0,0)**: External links to other files
|
|
28
|
+
- **Yellow background (RGB: 255,255,0)**: Key assumptions needing attention or cells that need to be updated
|
|
29
|
+
|
|
30
|
+
### Number Formatting Standards
|
|
31
|
+
|
|
32
|
+
#### Required Format Rules
|
|
33
|
+
- **Years**: Format as text strings (e.g., "2024" not "2,024")
|
|
34
|
+
- **Currency**: Use $#,##0 format; ALWAYS specify units in headers ("Revenue ($mm)")
|
|
35
|
+
- **Zeros**: Use number formatting to make all zeros "-", including percentages (e.g., "$#,##0;($#,##0);-")
|
|
36
|
+
- **Percentages**: Default to 0.0% format (one decimal)
|
|
37
|
+
- **Multiples**: Format as 0.0x for valuation multiples (EV/EBITDA, P/E)
|
|
38
|
+
- **Negative numbers**: Use parentheses (123) not minus -123
|
|
39
|
+
|
|
40
|
+
### Formula Construction Rules
|
|
41
|
+
|
|
42
|
+
#### Assumptions Placement
|
|
43
|
+
- Place ALL assumptions (growth rates, margins, multiples, etc.) in separate assumption cells
|
|
44
|
+
- Use cell references instead of hardcoded values in formulas
|
|
45
|
+
- Example: Use =B5*(1+$B$6) instead of =B5*1.05
|
|
46
|
+
|
|
47
|
+
#### Formula Error Prevention
|
|
48
|
+
- Verify all cell references are correct
|
|
49
|
+
- Check for off-by-one errors in ranges
|
|
50
|
+
- Ensure consistent formulas across all projection periods
|
|
51
|
+
- Test with edge cases (zero values, negative numbers)
|
|
52
|
+
- Verify no unintended circular references
|
|
53
|
+
|
|
54
|
+
#### Documentation Requirements for Hardcodes
|
|
55
|
+
- Comment or in cells beside (if end of table). Format: "Source: [System/Document], [Date], [Specific Reference], [URL if applicable]"
|
|
56
|
+
- Examples:
|
|
57
|
+
- "Source: Company 10-K, FY2024, Page 45, Revenue Note, [SEC EDGAR URL]"
|
|
58
|
+
- "Source: Company 10-Q, Q2 2025, Exhibit 99.1, [SEC EDGAR URL]"
|
|
59
|
+
- "Source: Bloomberg Terminal, 8/15/2025, AAPL US Equity"
|
|
60
|
+
- "Source: FactSet, 8/20/2025, Consensus Estimates Screen"
|
|
61
|
+
|
|
62
|
+
# XLSX creation, editing, and analysis
|
|
63
|
+
|
|
64
|
+
## Overview
|
|
65
|
+
|
|
66
|
+
A user may ask you to create, edit, or analyze the contents of an .xlsx file. You have different tools and workflows available for different tasks.
|
|
67
|
+
|
|
68
|
+
## Important Requirements
|
|
69
|
+
|
|
70
|
+
**LibreOffice Required for Formula Recalculation**: You can assume LibreOffice is installed for recalculating formula values using the `recalc.py` script. The script automatically configures LibreOffice on first run
|
|
71
|
+
|
|
72
|
+
## Reading and analyzing data
|
|
73
|
+
|
|
74
|
+
### Data analysis with pandas
|
|
75
|
+
For data analysis, visualization, and basic operations, use **pandas** which provides powerful data manipulation capabilities:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import pandas as pd
|
|
79
|
+
|
|
80
|
+
# Read Excel
|
|
81
|
+
df = pd.read_excel('file.xlsx') # Default: first sheet
|
|
82
|
+
all_sheets = pd.read_excel('file.xlsx', sheet_name=None) # All sheets as dict
|
|
83
|
+
|
|
84
|
+
# Analyze
|
|
85
|
+
df.head() # Preview data
|
|
86
|
+
df.info() # Column info
|
|
87
|
+
df.describe() # Statistics
|
|
88
|
+
|
|
89
|
+
# Write Excel
|
|
90
|
+
df.to_excel('output.xlsx', index=False)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Excel File Workflows
|
|
94
|
+
|
|
95
|
+
## CRITICAL: Use Formulas, Not Hardcoded Values
|
|
96
|
+
|
|
97
|
+
**Always use Excel formulas instead of calculating values in Python and hardcoding them.** This ensures the spreadsheet remains dynamic and updateable.
|
|
98
|
+
|
|
99
|
+
### ❌ WRONG - Hardcoding Calculated Values
|
|
100
|
+
```python
|
|
101
|
+
# Bad: Calculating in Python and hardcoding result
|
|
102
|
+
total = df['Sales'].sum()
|
|
103
|
+
sheet['B10'] = total # Hardcodes 5000
|
|
104
|
+
|
|
105
|
+
# Bad: Computing growth rate in Python
|
|
106
|
+
growth = (df.iloc[-1]['Revenue'] - df.iloc[0]['Revenue']) / df.iloc[0]['Revenue']
|
|
107
|
+
sheet['C5'] = growth # Hardcodes 0.15
|
|
108
|
+
|
|
109
|
+
# Bad: Python calculation for average
|
|
110
|
+
avg = sum(values) / len(values)
|
|
111
|
+
sheet['D20'] = avg # Hardcodes 42.5
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### ✅ CORRECT - Using Excel Formulas
|
|
115
|
+
```python
|
|
116
|
+
# Good: Let Excel calculate the sum
|
|
117
|
+
sheet['B10'] = '=SUM(B2:B9)'
|
|
118
|
+
|
|
119
|
+
# Good: Growth rate as Excel formula
|
|
120
|
+
sheet['C5'] = '=(C4-C2)/C2'
|
|
121
|
+
|
|
122
|
+
# Good: Average using Excel function
|
|
123
|
+
sheet['D20'] = '=AVERAGE(D2:D19)'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This applies to ALL calculations - totals, percentages, ratios, differences, etc. The spreadsheet should be able to recalculate when source data changes.
|
|
127
|
+
|
|
128
|
+
## Common Workflow
|
|
129
|
+
1. **Choose tool**: pandas for data, openpyxl for formulas/formatting
|
|
130
|
+
2. **Create/Load**: Create new workbook or load existing file
|
|
131
|
+
3. **Modify**: Add/edit data, formulas, and formatting
|
|
132
|
+
4. **Save**: Write to file
|
|
133
|
+
5. **Recalculate formulas (MANDATORY IF USING FORMULAS)**: Use the recalc.py script
|
|
134
|
+
```bash
|
|
135
|
+
python recalc.py output.xlsx
|
|
136
|
+
```
|
|
137
|
+
6. **Verify and fix any errors**:
|
|
138
|
+
- The script returns JSON with error details
|
|
139
|
+
- If `status` is `errors_found`, check `error_summary` for specific error types and locations
|
|
140
|
+
- Fix the identified errors and recalculate again
|
|
141
|
+
- Common errors to fix:
|
|
142
|
+
- `#REF!`: Invalid cell references
|
|
143
|
+
- `#DIV/0!`: Division by zero
|
|
144
|
+
- `#VALUE!`: Wrong data type in formula
|
|
145
|
+
- `#NAME?`: Unrecognized formula name
|
|
146
|
+
|
|
147
|
+
### Creating new Excel files
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
# Using openpyxl for formulas and formatting
|
|
151
|
+
from openpyxl import Workbook
|
|
152
|
+
from openpyxl.styles import Font, PatternFill, Alignment
|
|
153
|
+
|
|
154
|
+
wb = Workbook()
|
|
155
|
+
sheet = wb.active
|
|
156
|
+
|
|
157
|
+
# Add data
|
|
158
|
+
sheet['A1'] = 'Hello'
|
|
159
|
+
sheet['B1'] = 'World'
|
|
160
|
+
sheet.append(['Row', 'of', 'data'])
|
|
161
|
+
|
|
162
|
+
# Add formula
|
|
163
|
+
sheet['B2'] = '=SUM(A1:A10)'
|
|
164
|
+
|
|
165
|
+
# Formatting
|
|
166
|
+
sheet['A1'].font = Font(bold=True, color='FF0000')
|
|
167
|
+
sheet['A1'].fill = PatternFill('solid', start_color='FFFF00')
|
|
168
|
+
sheet['A1'].alignment = Alignment(horizontal='center')
|
|
169
|
+
|
|
170
|
+
# Column width
|
|
171
|
+
sheet.column_dimensions['A'].width = 20
|
|
172
|
+
|
|
173
|
+
wb.save('output.xlsx')
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Editing existing Excel files
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
# Using openpyxl to preserve formulas and formatting
|
|
180
|
+
from openpyxl import load_workbook
|
|
181
|
+
|
|
182
|
+
# Load existing file
|
|
183
|
+
wb = load_workbook('existing.xlsx')
|
|
184
|
+
sheet = wb.active # or wb['SheetName'] for specific sheet
|
|
185
|
+
|
|
186
|
+
# Working with multiple sheets
|
|
187
|
+
for sheet_name in wb.sheetnames:
|
|
188
|
+
sheet = wb[sheet_name]
|
|
189
|
+
print(f"Sheet: {sheet_name}")
|
|
190
|
+
|
|
191
|
+
# Modify cells
|
|
192
|
+
sheet['A1'] = 'New Value'
|
|
193
|
+
sheet.insert_rows(2) # Insert row at position 2
|
|
194
|
+
sheet.delete_cols(3) # Delete column 3
|
|
195
|
+
|
|
196
|
+
# Add new sheet
|
|
197
|
+
new_sheet = wb.create_sheet('NewSheet')
|
|
198
|
+
new_sheet['A1'] = 'Data'
|
|
199
|
+
|
|
200
|
+
wb.save('modified.xlsx')
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Recalculating formulas
|
|
204
|
+
|
|
205
|
+
Excel files created or modified by openpyxl contain formulas as strings but not calculated values. Use the provided `recalc.py` script to recalculate formulas:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
python recalc.py <excel_file> [timeout_seconds]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Example:
|
|
212
|
+
```bash
|
|
213
|
+
python recalc.py output.xlsx 30
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The script:
|
|
217
|
+
- Automatically sets up LibreOffice macro on first run
|
|
218
|
+
- Recalculates all formulas in all sheets
|
|
219
|
+
- Scans ALL cells for Excel errors (#REF!, #DIV/0!, etc.)
|
|
220
|
+
- Returns JSON with detailed error locations and counts
|
|
221
|
+
- Works on both Linux and macOS
|
|
222
|
+
|
|
223
|
+
## Formula Verification Checklist
|
|
224
|
+
|
|
225
|
+
Quick checks to ensure formulas work correctly:
|
|
226
|
+
|
|
227
|
+
### Essential Verification
|
|
228
|
+
- [ ] **Test 2-3 sample references**: Verify they pull correct values before building full model
|
|
229
|
+
- [ ] **Column mapping**: Confirm Excel columns match (e.g., column 64 = BL, not BK)
|
|
230
|
+
- [ ] **Row offset**: Remember Excel rows are 1-indexed (DataFrame row 5 = Excel row 6)
|
|
231
|
+
|
|
232
|
+
### Common Pitfalls
|
|
233
|
+
- [ ] **NaN handling**: Check for null values with `pd.notna()`
|
|
234
|
+
- [ ] **Far-right columns**: FY data often in columns 50+
|
|
235
|
+
- [ ] **Multiple matches**: Search all occurrences, not just first
|
|
236
|
+
- [ ] **Division by zero**: Check denominators before using `/` in formulas (#DIV/0!)
|
|
237
|
+
- [ ] **Wrong references**: Verify all cell references point to intended cells (#REF!)
|
|
238
|
+
- [ ] **Cross-sheet references**: Use correct format (Sheet1!A1) for linking sheets
|
|
239
|
+
|
|
240
|
+
### Formula Testing Strategy
|
|
241
|
+
- [ ] **Start small**: Test formulas on 2-3 cells before applying broadly
|
|
242
|
+
- [ ] **Verify dependencies**: Check all cells referenced in formulas exist
|
|
243
|
+
- [ ] **Test edge cases**: Include zero, negative, and very large values
|
|
244
|
+
|
|
245
|
+
### Interpreting recalc.py Output
|
|
246
|
+
The script returns JSON with error details:
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"status": "success", // or "errors_found"
|
|
250
|
+
"total_errors": 0, // Total error count
|
|
251
|
+
"total_formulas": 42, // Number of formulas in file
|
|
252
|
+
"error_summary": { // Only present if errors found
|
|
253
|
+
"#REF!": {
|
|
254
|
+
"count": 2,
|
|
255
|
+
"locations": ["Sheet1!B5", "Sheet1!C10"]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Best Practices
|
|
262
|
+
|
|
263
|
+
### Library Selection
|
|
264
|
+
- **pandas**: Best for data analysis, bulk operations, and simple data export
|
|
265
|
+
- **openpyxl**: Best for complex formatting, formulas, and Excel-specific features
|
|
266
|
+
|
|
267
|
+
### Working with openpyxl
|
|
268
|
+
- Cell indices are 1-based (row=1, column=1 refers to cell A1)
|
|
269
|
+
- Use `data_only=True` to read calculated values: `load_workbook('file.xlsx', data_only=True)`
|
|
270
|
+
- **Warning**: If opened with `data_only=True` and saved, formulas are replaced with values and permanently lost
|
|
271
|
+
- For large files: Use `read_only=True` for reading or `write_only=True` for writing
|
|
272
|
+
- Formulas are preserved but not evaluated - use recalc.py to update values
|
|
273
|
+
|
|
274
|
+
### Working with pandas
|
|
275
|
+
- Specify data types to avoid inference issues: `pd.read_excel('file.xlsx', dtype={'id': str})`
|
|
276
|
+
- For large files, read specific columns: `pd.read_excel('file.xlsx', usecols=['A', 'C', 'E'])`
|
|
277
|
+
- Handle dates properly: `pd.read_excel('file.xlsx', parse_dates=['date_column'])`
|
|
278
|
+
|
|
279
|
+
## Code Style Guidelines
|
|
280
|
+
**IMPORTANT**: When generating Python code for Excel operations:
|
|
281
|
+
- Write minimal, concise Python code without unnecessary comments
|
|
282
|
+
- Avoid verbose variable names and redundant operations
|
|
283
|
+
- Avoid unnecessary print statements
|
|
284
|
+
|
|
285
|
+
**For Excel files themselves**:
|
|
286
|
+
- Add comments to cells with complex formulas or important assumptions
|
|
287
|
+
- Document data sources for hardcoded values
|
|
288
|
+
- Include notes for key calculations and model sections
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Excel Formula Recalculation Script
|
|
4
|
+
Recalculates all formulas in an Excel file using LibreOffice
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import sys
|
|
9
|
+
import subprocess
|
|
10
|
+
import os
|
|
11
|
+
import platform
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from openpyxl import load_workbook
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def setup_libreoffice_macro():
|
|
17
|
+
"""Setup LibreOffice macro for recalculation if not already configured"""
|
|
18
|
+
if platform.system() == 'Darwin':
|
|
19
|
+
macro_dir = os.path.expanduser('~/Library/Application Support/LibreOffice/4/user/basic/Standard')
|
|
20
|
+
else:
|
|
21
|
+
macro_dir = os.path.expanduser('~/.config/libreoffice/4/user/basic/Standard')
|
|
22
|
+
|
|
23
|
+
macro_file = os.path.join(macro_dir, 'Module1.xba')
|
|
24
|
+
|
|
25
|
+
if os.path.exists(macro_file):
|
|
26
|
+
with open(macro_file, 'r') as f:
|
|
27
|
+
if 'RecalculateAndSave' in f.read():
|
|
28
|
+
return True
|
|
29
|
+
|
|
30
|
+
if not os.path.exists(macro_dir):
|
|
31
|
+
subprocess.run(['soffice', '--headless', '--terminate_after_init'],
|
|
32
|
+
capture_output=True, timeout=10)
|
|
33
|
+
os.makedirs(macro_dir, exist_ok=True)
|
|
34
|
+
|
|
35
|
+
macro_content = '''<?xml version="1.0" encoding="UTF-8"?>
|
|
36
|
+
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
|
37
|
+
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">
|
|
38
|
+
Sub RecalculateAndSave()
|
|
39
|
+
ThisComponent.calculateAll()
|
|
40
|
+
ThisComponent.store()
|
|
41
|
+
ThisComponent.close(True)
|
|
42
|
+
End Sub
|
|
43
|
+
</script:module>'''
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
with open(macro_file, 'w') as f:
|
|
47
|
+
f.write(macro_content)
|
|
48
|
+
return True
|
|
49
|
+
except Exception:
|
|
50
|
+
return False
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def recalc(filename, timeout=30):
|
|
54
|
+
"""
|
|
55
|
+
Recalculate formulas in Excel file and report any errors
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
filename: Path to Excel file
|
|
59
|
+
timeout: Maximum time to wait for recalculation (seconds)
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
dict with error locations and counts
|
|
63
|
+
"""
|
|
64
|
+
if not Path(filename).exists():
|
|
65
|
+
return {'error': f'File {filename} does not exist'}
|
|
66
|
+
|
|
67
|
+
abs_path = str(Path(filename).absolute())
|
|
68
|
+
|
|
69
|
+
if not setup_libreoffice_macro():
|
|
70
|
+
return {'error': 'Failed to setup LibreOffice macro'}
|
|
71
|
+
|
|
72
|
+
cmd = [
|
|
73
|
+
'soffice', '--headless', '--norestore',
|
|
74
|
+
'vnd.sun.star.script:Standard.Module1.RecalculateAndSave?language=Basic&location=application',
|
|
75
|
+
abs_path
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
# Handle timeout command differences between Linux and macOS
|
|
79
|
+
if platform.system() != 'Windows':
|
|
80
|
+
timeout_cmd = 'timeout' if platform.system() == 'Linux' else None
|
|
81
|
+
if platform.system() == 'Darwin':
|
|
82
|
+
# Check if gtimeout is available on macOS
|
|
83
|
+
try:
|
|
84
|
+
subprocess.run(['gtimeout', '--version'], capture_output=True, timeout=1, check=False)
|
|
85
|
+
timeout_cmd = 'gtimeout'
|
|
86
|
+
except (FileNotFoundError, subprocess.TimeoutExpired):
|
|
87
|
+
pass
|
|
88
|
+
|
|
89
|
+
if timeout_cmd:
|
|
90
|
+
cmd = [timeout_cmd, str(timeout)] + cmd
|
|
91
|
+
|
|
92
|
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
93
|
+
|
|
94
|
+
if result.returncode != 0 and result.returncode != 124: # 124 is timeout exit code
|
|
95
|
+
error_msg = result.stderr or 'Unknown error during recalculation'
|
|
96
|
+
if 'Module1' in error_msg or 'RecalculateAndSave' not in error_msg:
|
|
97
|
+
return {'error': 'LibreOffice macro not configured properly'}
|
|
98
|
+
else:
|
|
99
|
+
return {'error': error_msg}
|
|
100
|
+
|
|
101
|
+
# Check for Excel errors in the recalculated file - scan ALL cells
|
|
102
|
+
try:
|
|
103
|
+
wb = load_workbook(filename, data_only=True)
|
|
104
|
+
|
|
105
|
+
excel_errors = ['#VALUE!', '#DIV/0!', '#REF!', '#NAME?', '#NULL!', '#NUM!', '#N/A']
|
|
106
|
+
error_details = {err: [] for err in excel_errors}
|
|
107
|
+
total_errors = 0
|
|
108
|
+
|
|
109
|
+
for sheet_name in wb.sheetnames:
|
|
110
|
+
ws = wb[sheet_name]
|
|
111
|
+
# Check ALL rows and columns - no limits
|
|
112
|
+
for row in ws.iter_rows():
|
|
113
|
+
for cell in row:
|
|
114
|
+
if cell.value is not None and isinstance(cell.value, str):
|
|
115
|
+
for err in excel_errors:
|
|
116
|
+
if err in cell.value:
|
|
117
|
+
location = f"{sheet_name}!{cell.coordinate}"
|
|
118
|
+
error_details[err].append(location)
|
|
119
|
+
total_errors += 1
|
|
120
|
+
break
|
|
121
|
+
|
|
122
|
+
wb.close()
|
|
123
|
+
|
|
124
|
+
# Build result summary
|
|
125
|
+
result = {
|
|
126
|
+
'status': 'success' if total_errors == 0 else 'errors_found',
|
|
127
|
+
'total_errors': total_errors,
|
|
128
|
+
'error_summary': {}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# Add non-empty error categories
|
|
132
|
+
for err_type, locations in error_details.items():
|
|
133
|
+
if locations:
|
|
134
|
+
result['error_summary'][err_type] = {
|
|
135
|
+
'count': len(locations),
|
|
136
|
+
'locations': locations[:20] # Show up to 20 locations
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Add formula count for context - also check ALL cells
|
|
140
|
+
wb_formulas = load_workbook(filename, data_only=False)
|
|
141
|
+
formula_count = 0
|
|
142
|
+
for sheet_name in wb_formulas.sheetnames:
|
|
143
|
+
ws = wb_formulas[sheet_name]
|
|
144
|
+
for row in ws.iter_rows():
|
|
145
|
+
for cell in row:
|
|
146
|
+
if cell.value and isinstance(cell.value, str) and cell.value.startswith('='):
|
|
147
|
+
formula_count += 1
|
|
148
|
+
wb_formulas.close()
|
|
149
|
+
|
|
150
|
+
result['total_formulas'] = formula_count
|
|
151
|
+
|
|
152
|
+
return result
|
|
153
|
+
|
|
154
|
+
except Exception as e:
|
|
155
|
+
return {'error': str(e)}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def main():
|
|
159
|
+
if len(sys.argv) < 2:
|
|
160
|
+
print("Usage: python recalc.py <excel_file> [timeout_seconds]")
|
|
161
|
+
print("\nRecalculates all formulas in an Excel file using LibreOffice")
|
|
162
|
+
print("\nReturns JSON with error details:")
|
|
163
|
+
print(" - status: 'success' or 'errors_found'")
|
|
164
|
+
print(" - total_errors: Total number of Excel errors found")
|
|
165
|
+
print(" - total_formulas: Number of formulas in the file")
|
|
166
|
+
print(" - error_summary: Breakdown by error type with locations")
|
|
167
|
+
print(" - #VALUE!, #DIV/0!, #REF!, #NAME?, #NULL!, #NUM!, #N/A")
|
|
168
|
+
sys.exit(1)
|
|
169
|
+
|
|
170
|
+
filename = sys.argv[1]
|
|
171
|
+
timeout = int(sys.argv[2]) if len(sys.argv) > 2 else 30
|
|
172
|
+
|
|
173
|
+
result = recalc(filename, timeout)
|
|
174
|
+
print(json.dumps(result, indent=2))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
if __name__ == '__main__':
|
|
178
|
+
main()
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: youtube-clipper
|
|
3
|
+
description: >
|
|
4
|
+
YouTube video smart clipping tool. Downloads video and subtitles, uses AI to analyze
|
|
5
|
+
and generate fine-grained chapters (2-5 minute segments), lets user select clips,
|
|
6
|
+
then auto-clips, translates subtitles to bilingual format, burns subtitles, and generates
|
|
7
|
+
summary copy. Use when: clipping YouTube videos, generating short clips, making bilingual
|
|
8
|
+
subtitle versions, creating Shorts/Reels/TikTok from long-form video.
|
|
9
|
+
Keywords: video clip, YouTube, subtitle translation, bilingual subtitles, video download,
|
|
10
|
+
shorts, reels, tiktok, yt-dlp, ffmpeg, clip video
|
|
11
|
+
allowed-tools:
|
|
12
|
+
- Read
|
|
13
|
+
- Write
|
|
14
|
+
- Bash
|
|
15
|
+
- Glob
|
|
16
|
+
- AskUserQuestion
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# YouTube Video Smart Clipper
|
|
20
|
+
|
|
21
|
+
## Workflow — 6 Phases
|
|
22
|
+
|
|
23
|
+
### Phase 1: Environment Check
|
|
24
|
+
|
|
25
|
+
Verify required tools are installed:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yt-dlp --version
|
|
29
|
+
ffmpeg -version
|
|
30
|
+
ffmpeg -filters 2>&1 | grep subtitles # verify libass for subtitle burn
|
|
31
|
+
python3 -c "import pysrt; print('ok')"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**If missing**:
|
|
35
|
+
- yt-dlp: `brew install yt-dlp` or `pip install yt-dlp`
|
|
36
|
+
- FFmpeg without libass (macOS): `brew install ffmpeg-full`
|
|
37
|
+
- Python deps: `pip install pysrt`
|
|
38
|
+
|
|
39
|
+
> **Note**: Standard Homebrew FFmpeg lacks libass. On macOS install `ffmpeg-full`. On Windows, gyan.dev FFmpeg builds include libass.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### Phase 2: Download Video
|
|
44
|
+
|
|
45
|
+
Ask user for YouTube URL, then download video + English subtitles:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
yt-dlp -f "bestvideo[height<=1080][ext=mp4]+bestaudio/best" \
|
|
49
|
+
--write-auto-sub --sub-lang en --convert-subs srt \
|
|
50
|
+
-o "%(id)s.%(ext)s" <youtube_url>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Show user: title, duration, file size, download path.
|
|
54
|
+
|
|
55
|
+
**Output**: `<id>.mp4` + `<id>.en.srt`
|
|
56
|
+
|
|
57
|
+
**If 429 rate limit on subtitles**: download video first (`--no-write-subs`), then retry subtitle download separately after a delay.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Phase 3: AI Chapter Analysis
|
|
62
|
+
|
|
63
|
+
Parse the subtitle file and analyze content semantically:
|
|
64
|
+
|
|
65
|
+
1. Read full subtitle text with timestamps
|
|
66
|
+
2. Identify natural topic transitions
|
|
67
|
+
3. Generate chapters at **2-5 minute granularity** (not coarse 30-minute cuts)
|
|
68
|
+
|
|
69
|
+
For each chapter provide:
|
|
70
|
+
- **Title**: concise topic summary (10-20 words)
|
|
71
|
+
- **Time range**: start → end (MM:SS or HH:MM:SS)
|
|
72
|
+
- **Summary**: 1-2 sentences on what this segment covers
|
|
73
|
+
- **Keywords**: 3-5 key concepts
|
|
74
|
+
|
|
75
|
+
Show numbered chapter list with all segments covered, no gaps.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### Phase 4: User Selection
|
|
80
|
+
|
|
81
|
+
Ask user which chapters to clip (multi-select by number).
|
|
82
|
+
|
|
83
|
+
Also ask:
|
|
84
|
+
- Generate bilingual subtitles? (original + translated)
|
|
85
|
+
- Burn subtitles into video? (hardcoded)
|
|
86
|
+
- Generate summary copy for social media?
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Phase 5: Process Selected Clips
|
|
91
|
+
|
|
92
|
+
For each selected chapter:
|
|
93
|
+
|
|
94
|
+
#### 5.1 — Cut clip
|
|
95
|
+
```bash
|
|
96
|
+
ffmpeg -i input.mp4 -ss <start> -to <end> -c copy clip.mp4
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### 5.2 — Extract subtitle segment
|
|
100
|
+
Filter subtitle entries within the time range, reset timestamps to start from 00:00:00.
|
|
101
|
+
|
|
102
|
+
#### 5.3 — Translate subtitles (if requested)
|
|
103
|
+
Batch translate in groups of 20 entries to minimize API calls. Target language: user's preferred language. Keep technical terms accurate; use natural spoken language suitable for short video.
|
|
104
|
+
|
|
105
|
+
#### 5.4 — Generate bilingual SRT (if requested)
|
|
106
|
+
Merge original + translated lines into dual-language SRT (original on top, translation below).
|
|
107
|
+
|
|
108
|
+
#### 5.5 — Burn subtitles (if requested)
|
|
109
|
+
```bash
|
|
110
|
+
ffmpeg -i clip.mp4 -vf "subtitles=subs.srt:force_style='FontSize=24,MarginV=30,Bold=1'" \
|
|
111
|
+
-c:v libx264 -crf 18 -c:a copy output_with_subs.mp4
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> **Windows path fix**: copy files to `tempfile.mkdtemp()` before running FFmpeg to avoid subtitle filter failures on paths with spaces.
|
|
115
|
+
|
|
116
|
+
#### 5.6 — Generate summary copy (if requested)
|
|
117
|
+
Based on chapter title, summary, and keywords — generate social media copy (title, key points, platform-appropriate format).
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Phase 6: Output Results
|
|
122
|
+
|
|
123
|
+
Organize output under `./youtube-clips/<datetime>/`:
|
|
124
|
+
```
|
|
125
|
+
<chapter-title>/
|
|
126
|
+
├── clip.mp4 # raw cut
|
|
127
|
+
├── clip_with_subtitles.mp4 # burned subtitle version
|
|
128
|
+
├── bilingual.srt # bilingual subtitle file
|
|
129
|
+
└── summary.md # social media copy
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Show file list with sizes and quick-open commands. Ask if user wants to clip more chapters.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 9:16 Vertical (Shorts / Reels / TikTok)
|
|
137
|
+
|
|
138
|
+
When user requests vertical format — use blurred background fill, never crop:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
[0:v]split[bg][fg];
|
|
142
|
+
[bg]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,gblur=sigma=40[blurred];
|
|
143
|
+
[fg]scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:color=black@0[front];
|
|
144
|
+
[blurred][front]overlay=0:0,subtitles=subs.srt:force_style='FontSize=28,MarginV=120,Bold=1'
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Rules**:
|
|
148
|
+
- Never crop original content — presenter/slides must be fully visible
|
|
149
|
+
- Place subtitles in the lower blurred area (MarginV=120)
|
|
150
|
+
- Black letterbox padding is not acceptable — blurred background only
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## RTL Subtitles (Hebrew / Arabic)
|
|
155
|
+
|
|
156
|
+
Basic burn with SRT works for simple subtitles. For per-word karaoke highlight with RTL:
|
|
157
|
+
|
|
158
|
+
- Each word needs its own ASS `Dialogue` line with `\pos(x,y)` — no inline tags within a text run
|
|
159
|
+
- Use PIL to measure word widths with `~0.74` scale factor (PIL→libass calibration)
|
|
160
|
+
- Use `Alignment=7` and `Encoding=177` (Hebrew) in ASS style
|
|
161
|
+
- Render punctuation as separate positioned elements to the left of the last word
|
|
162
|
+
- Use two named ASS styles (e.g., White + Yellow) instead of inline `\c` color tags
|
|
163
|
+
|
|
164
|
+
**Critical**: Inline ASS tags (`\c`, `\K`, etc.) between RTL words break Unicode bidi in libass — causing words to render left-to-right. Always use separate Dialogue lines per word.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Shorts Mode (~40s clips)
|
|
169
|
+
|
|
170
|
+
When user wants highlights rather than full chapters, identify:
|
|
171
|
+
|
|
172
|
+
1. **Strong hook** — opening line that grabs attention immediately
|
|
173
|
+
2. **Pain point** — relatable problem statement
|
|
174
|
+
3. **WOW moment** — impressive demo or revelation
|
|
175
|
+
4. **Core value prop** — clear, concise statement of the main idea
|
|
176
|
+
5. **Counter-intuitive insight** — breaks common assumptions
|
|
177
|
+
|
|
178
|
+
For each candidate clip provide: timestamps, content summary, why it works as a short, suggested title.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Key Technical Notes
|
|
183
|
+
|
|
184
|
+
- **Batch translation** (20 entries/call) saves ~95% API calls vs per-entry
|
|
185
|
+
- **Chapter granularity**: semantic topic transitions, not mechanical time splits
|
|
186
|
+
- **File naming**: strip special chars (`/ \ : * ? " < > |`), replace spaces with `_`, max 100 chars
|
|
187
|
+
- **Windows encoding**: set `PYTHONIOENCODING=utf-8` when running Python scripts that print Unicode
|