Token导航 LogoToken导航

Agent Skill · 研究检索

affinda(affinda 搜索)

affinda 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

affinda 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 71,596。

总安装 194周安装 8GitHub Stars 公开资料未说明下载 63核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:affinda(affinda 搜索)
来源仓库:https://github.com/affinda/skills
仓库路径:skills/affinda
安装命令:
npx skills add https://github.com/affinda/skills --skill affinda
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/affinda/skills --skill affinda

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于从各类文档中提取结构化数据,如发票、简历、合同等,支持 AI 自动解析。适合处理超过 2.5 亿份文档的企业级应用场景,覆盖全球 40 多个国家客户。通过 npx 命令从 GitHub 安装,依赖 Affinda API 进行文件上传与 JSON 输出转换。

使用前需注册账号获取 API key,并遵守服务条款与数据安全规范要求。affinda 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/affinda

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/affinda/skills --skill affinda;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

affinda 怎么安装?

在终端执行 npx skills add https://github.com/affinda/skills --skill affinda。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

affinda 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

affinda 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

affinda 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

affinda 用的人多吗?

公开数据是累计安装 194 次,近一周安装 8 次,下载 63 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

affinda 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
affinda

affinda 搜索 · 本页

194—接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Affinda — AI Document Processing Platform

Affinda extracts structured data from documents (invoices, resumes, receipts, contracts, and any custom document type) using machine learning. The API turns uploaded files into clean JSON. Over 250 million documents processed for 500+ organisations in 40 countries.

Full documentation: https://docs.affinda.com OpenAPI spec: https://api.affinda.com/static/v3/api_spec.yaml Support: support@affinda.com


Core Concepts

ConceptDescription
OrganizationTop-level account. Contains users, billing, document types, and workspaces.
WorkspaceLogical container for documents. Scopes permissions, webhooks, and processing settings.
Document TypeA model configuration defining how a specific kind of document is parsed (invoice, resume, custom).
DocumentAn uploaded file (PDF, image, DOCX, etc.) plus its extracted data and metadata.

The workflow is: Upload -> Pre-process -> Split -> Classify -> Extract -> Validate -> Export.


API Basics

Base URLs

RegionAPI Base URLApp URL
Australia (Global)https://api.affinda.comhttps://app.affinda.com
United Stateshttps://api.us1.affinda.comhttps://app.us1.affinda.com
European Unionhttps://api.eu1.affinda.comhttps://app.eu1.affinda.com

Use the base URL matching the region where the user's account was created.

Authentication

All requests require a Bearer token:

Authorization: Bearer <API_KEY>

API keys are per-user, managed at *Settings -> API Keys* in the Affinda dashboard. Up to 3 keys per user. Keys can have custom names and expiry dates. A key is only visible once at creation -- store it securely.

Rate Limits and File Constraints

  • High-priority queue: 30 documents/minute (exceeding returns 429)
  • Low-priority queue: No submission limit (set lowPriority: true)
  • Max file size: 20 MB (5 MB for resumes)
  • Default page limit: 20 pages per document (can be increased on request)
  • Supported formats: PDF, DOC, DOCX, XLSX, ODT, RTF, TXT, HTML, PNG, JPG, TIFF, JPEG

Client Libraries

Python (recommended)

pip install affinda
from pathlib import Path
from affinda import AffindaAPI, TokenCredential

credential = TokenCredential(token="YOUR_API_KEY")
client = AffindaAPI(credential=credential)

with Path("invoice.pdf").open("rb") as f:
    doc = client.create_document(file=f, workspace="YOUR_WORKSPACE_ID")

print(doc.data)  # Extracted JSON

GitHub: https://github.com/affinda/affinda-python PyPI: https://pypi.org/project/affinda/

TypeScript / JavaScript (recommended)

npm install @affinda/affinda
import { AffindaAPI, AffindaCredential } from "@affinda/affinda";
import * as fs from "fs";

const credential = new AffindaCredential("YOUR_API_KEY");
const client = new AffindaAPI(credential);

const doc = await client.createDocument({
  file: fs.createReadStream("invoice.pdf"),
  workspace: "YOUR_WORKSPACE_ID",
});

console.log(doc.data); // Extracted JSON

GitHub: https://github.com/affinda/affinda-typescript npm: https://www.npmjs.com/package/@affinda/affinda

Other Libraries

Note: The.NET and Java libraries may lag behind the Python and TypeScript libraries in feature parity.

Direct HTTP (cURL)

curl -X POST https://api.affinda.com/v3/documents \
  -H "Authorization: Bearer $AFFINDA_API_KEY" \
  -F "file=@invoice.pdf" \
  -F "workspace=YOUR_WORKSPACE_ID"

Structured Outputs (Type-Safe Responses)

This is the recommended approach for building robust integrations. Affinda can generate typed models from your document type configuration, giving you auto-completion, validation, and type safety.

Python -- Pydantic Models

Generate Pydantic v2 models that match your document type's field schema:

# Set your API key (or export AFFINDA_API_KEY)
python -m affinda generate_models --workspace-id=YOUR_WORKSPACE_ID

This creates a ./affinda_models/ directory with one .py file per document type. Each file contains Pydantic BaseModel classes with all your configured fields as typed, optional attributes.

Use the generated models when calling the API:

from pathlib import Path
from affinda import AffindaAPI, TokenCredential
from affinda_models.invoice import Invoice  # Generated model

credential = TokenCredential(token="YOUR_API_KEY")
client = AffindaAPI(credential=credential)

with Path("invoice.pdf").open("rb") as f:
    doc = client.create_document(
        file=f,
        workspace="YOUR_WORKSPACE_ID",
        data_model=Invoice,  # Enables Pydantic validation
    )

# doc.parsed is a typed Invoice instance
print(doc.parsed.invoice_number)
print(doc.parsed.total_amount)

# doc.data is still available as raw JSON
print(doc.data)

Handling validation errors gracefully:

with Path("invoice.pdf").open("rb") as f:
    doc = client.create_document(
        file=f,
        workspace="YOUR_WORKSPACE_ID",
        data_model=Invoice,
        ignore_validation_errors=True,  # Don't raise on schema mismatch
    )

if doc.parsed:
    print(doc.parsed.invoice_number)  # Type-safe access
else:
    print("Validation failed, falling back to raw data")
    print(doc.data)

CLI options:

python -m affinda generate_models --workspace-id=ID        # All types in a workspace
python -m affinda generate_models --document-type-id=ID    # Single document type
python -m affinda generate_models --organization-id=ID     # All types in an org
python -m affinda generate_models --output-dir=./my_models # Custom output path
python -m affinda generate_models --help                   # All options

TypeScript -- Generated Interfaces

Generate TypeScript interfaces that match your document type's field schema:

# Set your API key (or export AFFINDA_API_KEY)
npm exec affinda-generate-interfaces -- --workspace-id=YOUR_WORKSPACE_ID

This creates an ./affinda-interfaces/ directory with one .ts file per document type. Each file contains TypeScript interfaces with all your configured fields.

Use the generated interfaces for type-safe access:

import { AffindaAPI, AffindaCredential } from "@affinda/affinda";
import * as fs from "fs";
import { Invoice } from "./affinda-interfaces/Invoice";

const credential = new AffindaCredential("YOUR_API_KEY");
const client = new AffindaAPI(credential);

const doc = await client.createDocument({
  file: fs.createReadStream("invoice.pdf"),
  workspace: "YOUR_WORKSPACE_ID",
});

const parsed = doc.data as Invoice;
console.log(parsed.invoiceNumber);  // Type-safe access
console.log(parsed.totalAmount);

CLI options:

npm exec affinda-generate-interfaces -- --workspace-id=ID       # All types in workspace
npm exec affinda-generate-interfaces -- --document-type-id=ID   # Single document type
npm exec affinda-generate-interfaces -- --output-dir=./types    # Custom output path
npm exec affinda-generate-interfaces -- --help                  # All options

Why Use Structured Outputs?

  • Type safety: Catch field name typos and type mismatches at compile/lint time
  • Auto-completion: IDE support for all extracted fields
  • Validation: Pydantic automatically validates the API response structure
  • Schema-driven: Models stay in sync with your document type configuration -- regenerate after schema changes
  • Documentation as code: The generated models serve as living documentation of your extraction schema

Document Upload Options

There are three patterns for submitting documents and retrieving results:

1. Synchronous (simplest)

Upload and block until parsing completes. The response contains the extracted data.

doc = client.create_document(file=f, workspace="WORKSPACE_ID")
# wait defaults to True -- blocks until ready
print(doc.data)

Best for: Interactive apps, low volume, quick prototyping. Limitation: Can timeout on large or complex documents.

2. Asynchronous with Polling

Upload with wait=false, receive a document ID, then poll GET /documents/{id} until ready is true.

doc = client.create_document(file=f, workspace="WORKSPACE_ID", wait=False)
# doc.data is empty -- poll until ready
doc = client.get_document(doc.meta.identifier)

Best for: Batch processing, large documents, high volume.

3. Asynchronous with Webhooks (recommended for production)

Upload the document, then receive a webhook notification when processing completes. This is the most efficient pattern for production systems.

# 1. Upload
doc = client.create_document(file=f, workspace="WORKSPACE_ID", wait=False)

# 2. Receive webhook at your endpoint when ready
# 3. Fetch full data
doc = client.get_document(identifier_from_webhook)

Best for: Real-time workflows, event-driven architectures, production systems.

See the Webhooks section below for setup details.

Upload Parameters

ParameterTypeDescription
filebinaryThe document file. Mutually exclusive with url.
urlstringURL to download and process. Mutually exclusive with file.
workspacestringWorkspace identifier (required).
documentTypestringDocument type identifier (optional -- enables skip-classification).
waitbooleantrue (default): block until done. false: return immediately.
customIdentifierstringYour internal ID for the document.
expiryTimeISO-8601Auto-delete the document at this time.
rejectDuplicatesbooleanReject if duplicate of existing document.
lowPrioritybooleanRoute to low-priority queue (no rate limit).
compactbooleanReturn compact response (with wait=true).
deleteAfterParsebooleanDelete data after parsing (requires wait=true).
enableValidationToolbooleanMake document viewable in validation UI. Set false for speed.

Response Structure

Each extracted field in the response includes metadata:

FieldDescription
rawRaw extracted text before processing
parsedProcessed value after formatting and mapping
confidenceOverall confidence score (0-1)
classificationConfidenceConfidence the field was correctly classified
textExtractionConfidenceConfidence text was correctly extracted
isVerifiedWhether the value has been validated (any means)
isClientVerifiedWhether validated by a human
isAutoVerifiedWhether auto-validated by rules
rectangleBounding box coordinates on the page
pageIndexWhich page the data appears on

Document-level metadata includes ready, failed, language, pages, isOcrd, ocrConfidence, reviewUrl, isConfirmed, isRejected, isArchived, errorCode, and errorDetail.

Full metadata reference: https://docs.affinda.com/reference/metadata


Webhooks

Affinda uses RESTHooks -- webhook subscriptions managed via REST API. Webhooks can be scoped to an organization or workspace.

Available Events

EventDescription
document.parse.completedParsing finished (succeeded or failed)
document.parse.succeededParsing succeeded
document.parse.failedParsing failed
document.validate.completedDocument confirmed (manually or auto)
document.classify.completedClassification finished
document.classify.succeededClassification succeeded
document.classify.failedClassification failed
document.rejectedDocument rejected

Setup Flow

  1. Subscribe -- POST /v3/resthook_subscriptions with targetUrl, event, and organization (or workspace).
  2. Confirm -- Affinda sends a POST to your targetUrl with an X-Hook-Secret header. Respond with 200, then call POST /v3/resthook_subscriptions/activate with that secret.
  3. Receive -- Affinda sends webhook payloads to your endpoint. Respond 200 to acknowledge.

Signature Verification

Enable payload signing via Organization Settings -> Webhook Signature Key. Incoming webhooks include an X-Hook-Signature header (<timestamp>.<signature>). Verify using HMAC-SHA256:

import hmac, hashlib, json, time

def verify_webhook(request, sig_key: bytes) -> bool:
    sig_header = request.headers["X-Hook-Signature"]
    timestamp, sig_received = sig_header.split(".")
    sig_calculated = hmac.new(sig_key, msg=request.body, digestmod=hashlib.sha256).hexdigest()

    sig_ok = hmac.compare_digest(sig_received, sig_calculated)
    body = json.loads(request.body)
    time_ok = (time.time() - body["timestamp"]) < 600  # 10 min window
    return sig_ok and time_ok

Webhook Payload

The payload contains document metadata (not the full parsed data). Use the identifier to fetch full results:

{
  "id": "e3bd1942-...",
  "event": "document.parse.completed",
  "timestamp": 1665637107,
  "payload": {
    "identifier": "abcdXYZ",
    "ready": true,
    "failed": false,
    "fileName": "invoice.pdf",
    "workspace": { "identifier": "...", "name": "..." }
  }
}

Retry Behavior

  • 200 -- Success, delivery confirmed
  • 410 -- Subscription auto-deleted (endpoint "gone")
  • Other 4xx/5xx -- Retried with exponential backoff for ~1 day

Full webhook docs: https://docs.affinda.com/reference/webhooks


Embedded Validation UI

Affinda provides a human-in-the-loop validation interface that can be embedded in your application via iframe. Each document response includes a reviewUrl -- a signed URL valid for 60 minutes.

Implementation pattern:

  1. Store only the Affinda document identifier in your system
  2. When a user needs to review, fetch a fresh reviewUrl via GET /documents/{id}
  3. Embed the URL in an iframe
  4. Do not persist the URL -- treat it as ephemeral

The UI supports custom theming (colors, fonts, border radius) in embedded mode. Contact Affinda to configure.

Full embedded docs: https://docs.affinda.com/reference/embedded


Key API Methods

Documents

MethodEndpointDescription
POST/v3/documentsUpload and parse a document
GET/v3/documents/{id}Retrieve a document and its data
PATCH/v3/documents/{id}Update document fields/status
DELETE/v3/documents/{id}Delete a document
GET/v3/documentsList documents (with filtering)
GET/v3/documents/{id}/redactedDownload redacted PDF

Workspaces

MethodEndpointDescription
GET/v3/workspacesList workspaces
POST/v3/workspacesCreate a workspace
GET/v3/workspaces/{id}Get workspace details
PATCH/v3/workspaces/{id}Update workspace
DELETE/v3/workspaces/{id}Delete workspace

Annotations

MethodEndpointDescription
GET/v3/annotationsList annotations for a document
POST/v3/annotationsCreate an annotation
PATCH/v3/annotations/{id}Update an annotation
POST/v3/annotations/batch_createBatch create annotations
POST/v3/annotations/batch_updateBatch update annotations
POST/v3/annotations/batch_deleteBatch delete annotations

Webhooks

MethodEndpointDescription
POST/v3/resthook_subscriptionsCreate subscription
POST/v3/resthook_subscriptions/activateActivate with X-Hook-Secret
GET/v3/resthook_subscriptionsList subscriptions
PATCH/v3/resthook_subscriptions/{id}Update subscription
DELETE/v3/resthook_subscriptions/{id}Delete subscription

Full API reference: https://docs.affinda.com/reference/getting-started OpenAPI spec: https://api.affinda.com/static/v3/api_spec.yaml


Common Integration Patterns

Affinda supports six integration workflow patterns depending on where validation logic lives and where exceptions are handled:

PatternDescriptionWebhook Event
W1 -- No validationUpload -> get JSON. No rules, no human review.document.parse.completed
W2 -- Client-side validationSame as W1; your system applies rules after export.document.parse.completed
W3 -- Affinda validation logicAffinda validates automatically; no human review.document.validate.completed
W4 -- Review all in AffindaHumans review every document in Affinda UI.document.validate.completed
W5 -- Client rules + Affinda reviewYour rules, pushed back as warnings; flagged docs reviewed in Affinda.document.parse.completed then document.validate.completed
W6 -- Full Affinda validationAffinda validates; exceptions reviewed in Affinda UI.document.validate.completed

For most new integrations, W1 or W2 is the simplest starting point. W6 provides the most automation with human-in-the-loop for exceptions.

Full solution design guide: https://docs.affinda.com/academy/solution-design


Common Errors

Error CodeMeaningResolution
duplicate_document_errorDocument rejected as duplicateDisable "Reject duplicates" or upload unique files
no_text_foundNo extractable textCheck file is not a photo of an object; try OCR
file_corruptedFile is corruptedRe-upload a valid file
file_too_largeExceeds 20 MB limitReduce file size
invalid_file_typeUnsupported formatUse PDF, DOC, DOCX, XLSX, ODT, RTF, TXT, HTML, PNG, JPG, TIFF, JPEG
no_parsing_creditsOut of creditsPurchase more credits and reparse
password_protectedFile is password-protectedRemove password and re-upload
document_classification_failedNo matching document typeCheck document type configuration or disable "Reject Documents"
capacity_exceededSystem capacity exceededWait and retry
parse_terminatedExceeded timeoutContact Affinda for custom limits

Full error reference: https://docs.affinda.com/error-glossary


Documentation Map

Use this index to find detailed information on specific topics. Each link goes to the full documentation page.

Affinda Academy (Tutorials)

Configuration Guide

Overview & Workflow:

  • Workflow -- End-to-end document processing pipeline stages.
  • Glossary -- Platform terminology definitions.
  • Document Status -- For Review, Confirmed, Archived, Rejected states.

Ingestion & Pre-Processing:

  • Ingestion -- Upload methods: manual, email, API.
  • Email Upload -- Email-to-workspace document ingestion.
  • Pre-Processing -- Automated cleaning before extraction.
  • OCR -- OCR modes: Skip, Auto-detect, Partial, Full.
  • Duplicates -- Duplicate detection and rejection.

Splitting, Classification & Extraction:

Validation & Export:

API Reference

Resume Parsing Guide

Additional Resources

平台分布

Codex

34.02%
按下载量换算21

Claude

30.5%
按下载量换算19

Cursor

19.62%
按下载量换算12

Gemini CLI

9.61%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills