用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/carrot-foundation/methodology-rules --skill rule-document-extractor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | rule-document-extractor |
| description | Rule mapping for document-extractor |
Apply this rule whenever work touches:
libs/shared/document-extractor/**/*.tslibs/shared/text-extractor/**/*.tsThe document extractor framework separates concerns between parsing (extracting fields from documents) and evaluation (deciding which fields matter). Parsers are deliberately field-neutral.
Parsers implement DocumentParser<T> and extract as many fields as possible without enforcing which ones are required:
import type { DocumentParser, NonEmptyString } from '@carrot-fndn/shared/document-extractor';
export class InvoiceParser implements DocumentParser<InvoiceFields> {
parse(rawText: string, layoutId: NonEmptyString): Partial<InvoiceFields> {
return {
invoiceNumber: this.extractInvoiceNumber(rawText), // string | undefined
issueDate: this.extractDate(rawText), // string | undefined
totalAmount: this.extractAmount(rawText), // number | undefined
};
}
}
Every field in the return type is optional. If extraction fails for a field, return undefined.
The reviewRequired flag signals that a human should verify the extraction. It is triggered exclusively by extraction quality signals:
// Correct - confidence-based review trigger
const reviewRequired = matchScore < 0.5 || fields.some(f => f.confidence < THRESHOLD);
// Wrong - business rule in parser
const reviewRequired = !fields.totalAmount || fields.totalAmount < 100;
Layout IDs and layout names use the NonEmptyString type. Cast string literals explicitly:
import type { NonEmptyString } from '@carrot-fndn/shared/document-extractor';
const LAYOUT_ID = 'invoice-standard-v2' as NonEmptyString;
Only register default layouts in defaults.ts for document types that are stable and well-established. Experimental or rapidly evolving formats should be configured at the processor level instead.