[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C3K98ZPG1ZFRNETHKQC1NE":3,"skill-same:01M7C3K98ZPG1ZFRNETHKQC1NE":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7C3K98ZPG1ZFRNETHKQC1NE","skilltta-task-guidance",null,"Task-specific operational guidance synthesized at test time from retrieved training examples.","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002Fskilltta-synthesis-opus47-tatumass-failed15-20260923\u002Ftasks\u002Fjpg-ocr-stat\u002Frepaired_skill\u002Fskilltta-task-guidance\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: skilltta-task-guidance\ndescription: Task-specific operational guidance synthesized at test time from retrieved training examples.\n---\n\n# SKILL.md\n\n## When to use\nUse this skill when a task requires OCR-based extraction of structured fields (e.g., dates, monetary totals) from a folder of scanned receipt\u002Fdocument images and writing results to a tabular file (Excel\u002FCSV) with a strict schema. The binding contract specifies:\n- The exact input directory and output file path.\n- The exact sheet name, column names, column order, row ordering, and formatting of each field.\n- Priority-ordered keyword rules for locating the target value and exclusion keywords to skip.\n- A null policy when extraction fails.\n- Exact evaluator comparison (line-by-line against an oracle), so any extra column\u002Frow\u002Fsheet or format drift fails.\n\nBefore acting, gather:\n- The list and count of image files in the input directory (and their extensions).\n- The task prompt's keyword priority list, exclusion list, and fallback rule (e.g., \"last number on next line\").\n- The expected formats: ISO date (YYYY-MM-DD), amount as string with exactly two decimals, filename form.\n- Which OCR\u002Fimaging libraries are pre-installed (do not install new ones unless allowed).\n\n## Possible Failure Modes\n- Writing numeric totals as floats instead of strings with exactly two decimals (e.g., `47.7` instead of `\"47.70\"`), causing line-by-line mismatch.\n- Losing leading\u002Ftrailing formatting: dropping the `.00`, keeping currency symbols (`RM`, `$`), or keeping comma thousand-separators in the stored value (must parse `1,234.56` but store `\"1234.56\"`).\n- Picking up SUBTOTAL, TAX\u002FGST\u002FSST, DISCOUNT, CHANGE, or CASH TENDERED lines because exclusion keywords weren't checked before matching total keywords.\n- Ignoring keyword priority: matching generic `TOTAL` before checking for `GRAND TOTAL` or `TOTAL RM`, producing wrong amounts.\n- Failing the two-line fallback: when the keyword line has no number, not consulting the next line's *last* number.\n- Date parsing pitfalls: ambiguous formats (DD\u002FMM\u002FYY vs MM\u002FDD\u002FYY), 2-digit years, OCR confusions (`O`↔`0`, `l`↔`1`, `S`↔`5`), producing invalid ISO strings instead of null.\n- Not setting the field to null on failure — writing empty strings, `NaN`, or `\"None\"` instead of a real null that pandas writes as an empty cell.\n- Row ordering: sorting by numeric value rather than lexicographic filename (or vice versa) when the contract says \"ordered by filename\".\n- Producing extra sheets (pandas default `Sheet1`), extra index column (forgetting `index=False`), or extra columns from debug fields.\n- Wrong sheet name capitalization\u002Fspacing (must be exactly `results`).\n- Iterating non-image files or hidden files in the directory; not filtering by extension.\n- Using an OCR config that mangles digits — no preprocessing (thresholding, resize, grayscale) can hurt accuracy on low-quality scans.\n- Not handling images that fail OCR at all (exceptions) — should degrade to null, not crash.\n\n## Possible procedures\n1. **Enumerate inputs deterministically**: list files in the input directory, filter to image extensions, and sort by filename (string sort) to guarantee stable output order.\n2. **OCR each image**:\n   - Open with PIL; consider grayscale conversion and mild upscaling for small images.\n   - Run `pytesseract.image_to_string`. Split output into lines; keep original casing for debugging but compare uppercased for keyword matching.\n3. **Extract total amount** (respect priority):\n   - First pass: skip any line containing an exclusion keyword.\n   - Search in priority tiers: (a) `GRAND TOTAL`, (b) `TOTAL RM` \u002F `TOTAL: RM`, (c) `TOTAL AMOUNT`, (d) generic `TOTAL`, `AMOUNT`, `TOTAL DUE`, `AMOUNT DUE`, `BALANCE DUE`, `NETT TOTAL`, `NET TOTAL`. Stop at the highest-priority match found.\n   - On the matched line, extract the last number matching a pattern like `\\d{1,3}(,\\d{3})*(\\.\\d+)?|\\d+\\.\\d+`. If none, look at the next non-empty line and take its last number (fallback rule).\n   - Normalize: strip currency symbols, remove commas, cast to float, then format with `f\"{value:.2f}\"` and store as string.\n   - If nothing extracted, store `None`.\n4. **Extract date**:\n   - Regex candidates for common receipt formats: `DD\u002FMM\u002FYYYY`, `DD-MM-YYYY`, `YYYY-MM-DD`, `DD MMM YYYY`, etc. Try multiple patterns.\n   - Validate with `datetime.strptime` and reformat to `YYYY-MM-DD`.\n   - If parsing fails or ambiguous, store `None`.\n5. **Assemble DataFrame** with exactly the required columns in the required order, sorted by filename.\n6. **Write Excel** with `openpyxl` engine, `sheet_name=\"results\"`, `index=False`. Do not create any other sheets. Ensure the `total_amount` column dtype is object\u002Fstring so `\"47.70\"` is preserved literally.\n7. **Recovery on OCR\u002Fparse errors**: wrap per-image processing in try\u002Fexcept; on any failure, still append a row with `None` for the failed field(s) rather than skipping the row.\n\n## Verification Checklist\n- [ ] Output file exists at the exact required path; only one sheet with the exact required name.\n- [ ] Columns are exactly `filename`, `date`, `total_amount` in that order; no index column; no extra columns.\n- [ ] Row count equals number of image files in the input directory; rows sorted by filename ascending (string order).\n- [ ] `date` values are either valid `YYYY-MM-DD` strings or empty\u002Fnull (never `NaT`, `\"None\"`, or malformed).\n- [ ] `total_amount` values are strings with exactly two decimals, no currency prefix, no thousand separators (e.g., `\"1234.56\"`), or empty\u002Fnull on failure.\n- [ ] Exclusion keywords (SUBTOTAL, SUB TOTAL, TAX, GST, SST, DISCOUNT, CHANGE, CASH TENDERED) are never the source of extracted totals.\n- [ ] Keyword priority is respected: more specific patterns override generic ones on the same receipt.\n- [ ] Two-line fallback is implemented and used when the keyword line lacks a numeric value.\n- [ ] Nothing from retrieved examples (unrelated Faker\u002FCSV\u002Fhistogram code) leaked into the solution.\n- [ ] Unrelated files in the workspace are untouched; only the required output file is created\u002Foverwritten.\n- [ ] Re-open the produced Excel with pandas to confirm sheet name, headers, dtypes (total_amount as string), and row order before finishing.\n","# SKILL.md\n\n## When to use\nUse this skill when a task requires OCR-based extraction of structured fields (e.g., dates, monetary totals) from a folder of scanned receipt\u002Fdocument images and writing results to a tabular file (Excel\u002FCSV) with a strict schema. The binding contract specifies:\n- The exact input directory and output file path.\n- The exact sheet name, column names, column order, row ordering, and formatting of each field.\n- Priority-ordered keyword rules for locating the target value and exclusion keywords to skip.\n- A null policy when extraction fails.\n- Exact evaluator comparison (line-by-line against an oracle), so any extra column\u002Frow\u002Fsheet or format drift fails.\n\nBefore acting, gather:\n- The list and count of image files in the input directory (and their extensions).\n- The task prompt's keyword priority list, exclusion list, and fallback rule (e.g., \"last number on next line\").\n- The expected formats: ISO date (YYYY-MM-DD), amount as string with exactly two decimals, filename form.\n- Which OCR\u002Fimaging libraries are pre-installed (do not install new ones unless allowed).\n\n## Possible Failure Modes\n- Writing numeric totals as floats instead of strings with exactly two decimals (e.g., `47.7` instead of `\"47.70\"`), causing line-by-line mismatch.\n- Losing leading\u002Ftrailing formatting: dropping the `.00`, keeping currency symbols (`RM`, `$`), or keeping comma thousand-separators in the stored value (must parse `1,234.56` but store `\"1234.56\"`).\n- Picking up SUBTOTAL, TAX\u002FGST\u002FSST, DISCOUNT, CHANGE, or CASH TENDERED lines because exclusion keywords weren't checked before matching total keywords.\n- Ignoring keyword priority: matching generic `TOTAL` before checking for `GRAND TOTAL` or `TOTAL RM`, producing wrong amounts.\n- Failing the two-line fallback: when the keyword line has no number, not consulting the next line's *last* number.\n- Date parsing pitfalls: ambiguous formats (DD\u002FMM\u002FYY vs MM\u002FDD\u002FYY), 2-digit years, OCR confusions (`O`↔`0`, `l`↔`1`, `S`↔`5`), producing invalid ISO strings instead of null.\n- Not setting the field to null on failure — writing empty strings, `NaN`, or `\"None\"` instead of a real null that pandas writes as an empty cell.\n- Row ordering: sorting by numeric value rather than lexicographic filename (or vice versa) when the contract says \"ordered by filename\".\n- Producing extra sheets (pandas default `Sheet1`), extra index column (forgetting `index=False`), or extra columns from debug fields.\n- Wrong sheet name capitalization\u002Fspacing (must be exactly `results`).\n- Iterating non-image files or hidden files in the directory; not filtering by extension.\n- Using an OCR config that mangles digits — no preprocessing (thresholding, resize, grayscale) can hurt accuracy on low-quality scans.\n- Not handling images that fail OCR at all (exceptions) — should degrade to null, not crash.\n\n## Possible procedures\n1. **Enumerate inputs deterministically**: list files in the input directory, filter to image extensions, and sort by filename (string sort) to guarantee stable output order.\n2. **OCR each image**:\n   - Open with PIL; consider grayscale conversion and mild upscaling for small images.\n   - Run `pytesseract.image_to_string`. Split output into lines; keep original casing for debugging but compare uppercased for keyword matching.\n3. **Extract total amount** (respect priority):\n   - First pass: skip any line containing an exclusion keyword.\n   - Search in priority tiers: (a) `GRAND TOTAL`, (b) `TOTAL RM` \u002F `TOTAL: RM`, (c) `TOTAL AMOUNT`, (d) generic `TOTAL`, `AMOUNT`, `TOTAL DUE`, `AMOUNT DUE`, `BALANCE DUE`, `NETT TOTAL`, `NET TOTAL`. Stop at the highest-priority match found.\n   - On the matched line, extract the last number matching a pattern like `\\d{1,3}(,\\d{3})*(\\.\\d+)?|\\d+\\.\\d+`. If none, look at the next non-empty line and take its last number (fallback rule).\n   - Normalize: strip currency symbols, remove commas, cast to float, then format with `f\"{value:.2f}\"` and store as string.\n   - If nothing extracted, store `None`.\n4. **Extract date**:\n   - Regex candidates for common receipt formats: `DD\u002FMM\u002FYYYY`, `DD-MM-YYYY`, `YYYY-MM-DD`, `DD MMM YYYY`, etc. Try multiple patterns.\n   - Validate with `datetime.strptime` and reformat to `YYYY-MM-DD`.\n   - If parsing fails or ambiguous, store `None`.\n5. **Assemble DataFrame** with exactly the required columns in the required order, sorted by filename.\n6. **Write Excel** with `openpyxl` engine, `sheet_name=\"results\"`, `index=False`. Do not create any other sheets. Ensure the `total_amount` column dtype is object\u002Fstring so `\"47.70\"` is preserved literally.\n7. **Recovery on OCR\u002Fparse errors**: wrap per-image processing in try\u002Fexcept; on any failure, still append a row with `None` for the failed field(s) rather than skipping the row.\n\n## Verification Checklist\n- [ ] Output file exists at the exact required path; only one sheet with the exact required name.\n- [ ] Columns are exactly `filename`, `date`, `total_amount` in that order; no index column; no extra columns.\n- [ ] Row count equals number of image files in the input directory; rows sorted by filename ascending (string order).\n- [ ] `date` values are either valid `YYYY-MM-DD` strings or empty\u002Fnull (never `NaT`, `\"None\"`, or malformed).\n- [ ] `total_amount` values are strings with exactly two decimals, no currency prefix, no thousand separators (e.g., `\"1234.56\"`), or empty\u002Fnull on failure.\n- [ ] Exclusion keywords (SUBTOTAL, SUB TOTAL, TAX, GST, SST, DISCOUNT, CHANGE, CASH TENDERED) are never the source of extracted totals.\n- [ ] Keyword priority is respected: more specific patterns override generic ones on the same receipt.\n- [ ] Two-line fallback is implemented and used when the keyword line lacks a numeric value.\n- [ ] Nothing from retrieved examples (unrelated Faker\u002FCSV\u002Fhistogram code) leaked into the solution.\n- [ ] Unrelated files in the workspace are untouched; only the required output file is created\u002Foverwritten.\n- [ ] Re-open the produced Excel with pandas to confirm sheet name, headers, dtypes (total_amount as string), and row order before finishing.\n",{"name":5,"description":7},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002Fskilltta-synthesis-opus47-tatumass-failed15-20260923\u002Ftasks\u002Fjpg-ocr-stat\u002Frepaired_skill\u002Fskilltta-task-guidance",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill skilltta-task-guidance",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill skilltta-task-guidance",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill skilltta-task-guidance","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002Fskilltta-synthesis-opus47-tatumass-failed15-20260923\u002Ftasks\u002Fjpg-ocr-stat\u002Frepaired_skill\u002Fskilltta-task-guidance\u002FSKILL.md",true,[],[46,53,60,67,72,77],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":68,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":73,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":78,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]