Project: intellectronica/agent-skills, Eleanor Berger's agent skills collection.
License: CC0 1.0 Universal (public domain dedication). Full license text is in LICENSE alongside this file.
Snapshot: Frozen copy of intellectronica/agent-skills/skills/anki-connect as of 2026-05-22. The maintained version lives upstream and may have evolved since this snapshot.
AnkiConnect
Overview
Enable reliable interaction with Anki through the AnkiConnect local HTTP API. Use this skill to translate user requests into AnkiConnect actions, craft JSON requests, run them via curl/jq (or equivalent tools), and interpret results safely.
Preconditions and Environment
- If Anki is not running, launch Anki, then wait until the AnkiConnect server responds at
http://127.0.0.1:8765 (default). Verify readiness using curl, e.g. curl -sS http://127.0.0.1:8765 should return Anki-Connect.
Safety and Confirmation Policy (Critical)
CRITICAL — NO EXCEPTIONS
Before any destructive or modifying operation on notes or cards (adding, updating, deleting, rescheduling, suspending, unsuspending, changing deck, or changing fields/tags), request confirmation from the user. Use the AskUserQuestion tool if available; otherwise ask via chat. Only request confirmation once per logical operation, even if it requires multiple API calls (e.g., search + update + verify). Group confirmation by intent and scope (e.g., “Update 125 notes matching query X”).
Treat the following as confirmation-required by default:
- Notes:
addNote, addNotes, updateNoteFields, updateNoteTags, updateNote, updateNoteModel, deleteNotes, removeEmptyNotes, replaceTags, replaceTagsInAllNotes, clearUnusedTags.
- Cards:
setEaseFactors, setSpecificValueOfCard, suspend, unsuspend, forgetCards, relearnCards, answerCards, setDueDate, changeDeck.
- Deck or model modifications that materially change cards/notes (deck deletion, model edits). Ask even if the action is not explicitly listed above.
API Fundamentals
Request Format
Every request is JSON with:
action: string action name
version: API version (use 6 unless user specifies otherwise)
params: object of parameters (optional)
Response Format
Every response is JSON with:
result: return value
error: null on success or a string describing the error
Always check error before using result.
Permissions
- Use
requestPermission first when interacting from a non-trusted origin; it is the only action that accepts any origin.
- Use
version to ensure compatibility; older versions may omit the error field in responses when version ≤ 4.
curl + jq Patterns
Prefer jq to build JSON and parse responses. Keep requests explicit and structured.
Minimal request template
jq -n --arg action "deckNames" --argjson version 6 '{action:$action, version:$version}' \
| curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @-
With params
jq -n \
--arg action "findNotes" \
--argjson version 6 \
--arg query "deck:French tag:verbs" \
'{action:$action, version:$version, params:{query:$query}}' \
| curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @-
Handling result/error
curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @- \
| jq -e 'if .error then halt_error(1) else .result end'
Batching multiple actions
Use multi to reduce round-trips and to group actions under a single confirmation when modifying data.
jq -n --argjson version 6 --arg query "deck:French" \
'{action:"multi", version:$version, params:{actions:[
{action:"findNotes", params:{query:$query}},
{action:"notesInfo", params:{notes:[]}}
]}}' \
| curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @-
Replace the empty array with the result of the previous action when chaining; in CLI usage, split into two calls unless using a scripting language.
Core Workflow Guidance
1) Verify connectivity and version
- Call
requestPermission (safe).
- Call
version to confirm the API level and use version: 6 in requests.
2) Discover supported actions
- Use
apiReflect with scopes: ["actions"] to list supported actions.
- Use this list to map user intent to action names.
3) Resolve user request into action sequence
- Identify read-only vs destructive operations.
- For destructive/modifying operations on notes/cards, request confirmation once with the scope and count.
- Prefer
findNotes/findCards + notesInfo/cardsInfo for previews before modification.
4) Execute and validate
- Execute the call(s) in order.
- Check
error for each response.
- Report summarized results and any IDs returned.
Common Task Recipes (CLI-Oriented)
List decks
Create deck
- Action:
createDeck
- Confirmation required if the deck is being created as part of a card/note modification workflow.
Search notes / cards
- Actions:
findNotes, findCards
- Use Anki search syntax (see “Search Syntax Quick Notes” below).
Preview note data
- Action:
notesInfo (note IDs)
Add notes
- Actions:
addNote, addNotes
- Confirmation required.
- Use
canAddNotes or canAddNotesWithErrorDetail for preflight checks.
Update note fields or tags
- Actions:
updateNoteFields, updateNoteTags, or combined updateNote
- Confirmation required.
- Warning: Do not have the note open in the browser; updates may fail to apply.
Delete notes
- Action:
deleteNotes
- Confirmation required.
Suspend/unsuspend cards
- Actions:
suspend, unsuspend
- Confirmation required.
Move cards to a deck
- Action:
changeDeck
- Confirmation required.
Set due date or reschedule
- Action:
setDueDate
- Confirmation required.
Media upload/download
- Actions:
storeMediaFile, retrieveMediaFile, getMediaFilesNames, getMediaDirPath, deleteMediaFile
- Use base64 (
data), file path (path), or URL (url) for upload.
Sync
Search Syntax Quick Notes (for findNotes/findCards)
- Separate terms by spaces; terms are ANDed by default.
- Use
or, parentheses, and - for NOT logic.
- Use
deck:Name, tag:tagname, note:ModelName, card:CardName.
- Use
front:... or other field names to limit by field.
- Use
re: for regex, w: for word-boundary searches, nc: to ignore accents.
- Use
is:due, is:new, is:learn, is:review, is:suspended, is:buried to filter card states.
- Use
prop: searches for properties like interval or due date.
- Escape special characters with quotes or backslashes as needed.
Action Catalog (Use as a mapping reference)
Card Actions
getEaseFactors
setEaseFactors
setSpecificValueOfCard
suspend
unsuspend
suspended
areSuspended
areDue
getIntervals
findCards
cardsToNotes
cardsModTime
cardsInfo
forgetCards
relearnCards
answerCards
setDueDate
Deck Actions
deckNames
deckNamesAndIds
getDecks
createDeck
changeDeck
deleteDecks
getDeckConfig
saveDeckConfig
setDeckConfigId
cloneDeckConfigId
removeDeckConfigId
getDeckStats
Graphical Actions
guiBrowse
guiSelectCard
guiSelectedNotes
guiAddCards
guiEditNote
guiAddNoteSetData
guiCurrentCard
guiStartCardTimer
guiShowQuestion
guiShowAnswer
guiAnswerCard
guiUndo
guiDeckOverview
guiDeckBrowser
guiDeckReview
guiImportFile
guiExitAnki
guiCheckDatabase
guiPlayAudio
Media Actions
storeMediaFile
retrieveMediaFile
getMediaFilesNames
getMediaDirPath
deleteMediaFile
Miscellaneous Actions
requestPermission
version
apiReflect
sync
getProfiles
getActiveProfile
loadProfile
multi
exportPackage
importPackage
reloadCollection
Model Actions
modelNames
modelNamesAndIds
findModelsById
findModelsByName
modelFieldNames
modelFieldDescriptions
modelFieldFonts
modelFieldsOnTemplates
createModel
modelTemplates
modelStyling
updateModelTemplates
updateModelStyling
findAndReplaceInModels
modelTemplateRename
modelTemplateReposition
modelTemplateAdd
modelTemplateRemove
modelFieldRename
modelFieldReposition
modelFieldAdd
modelFieldRemove
modelFieldSetFont
modelFieldSetFontSize
modelFieldSetDescription
Note Actions
addNote
addNotes
canAddNotes
canAddNotesWithErrorDetail
updateNoteFields
updateNote
updateNoteModel
updateNoteTags
getNoteTags
addTags
removeTags
getTags
clearUnusedTags
replaceTags
replaceTagsInAllNotes
findNotes
notesInfo
notesModTime
deleteNotes
removeEmptyNotes
Statistic Actions
getNumCardsReviewedToday
getNumCardsReviewedByDay
getCollectionStatsHTML
cardReviews
getReviewsOfCards
getLatestReviewID
insertReviews
Notes and Pitfalls
- Keep Anki in the foreground on macOS or disable App Nap to prevent AnkiConnect from pausing.
- When updating a note, ensure it is not being viewed in the browser editor; updates may not apply.
importPackage paths are relative to the Anki collection.media folder, not the client.
deleteDecks requires cardsToo: true to delete cards along with decks.
Resources
No bundled scripts or assets are required for this skill.
1---2name: anki-connect3description: This skill is for interacting with Anki through AnkiConnect, and should be used whenever a user asks to interact with Anki, including to read or modify decks, notes, cards, models, media, or sync operations.4---56> **Project:** [`intellectronica/agent-skills`](https://github.com/intellectronica/agent-skills), Eleanor Berger's agent skills collection.7>8> **License:** [CC0 1.0 Universal](https://github.com/intellectronica/agent-skills/blob/main/LICENSE.txt) (public domain dedication). Full license text is in [`LICENSE`](LICENSE) alongside this file.9>10> **Snapshot:** Frozen copy of [`intellectronica/agent-skills/skills/anki-connect`](https://github.com/intellectronica/agent-skills/tree/main/skills/anki-connect) as of 2026-05-22. The maintained version lives upstream and may have evolved since this snapshot.1112# AnkiConnect1314## Overview1516Enable reliable interaction with Anki through the AnkiConnect local HTTP API. Use this skill to translate user requests into AnkiConnect actions, craft JSON requests, run them via curl/jq (or equivalent tools), and interpret results safely.1718## Preconditions and Environment1920- If Anki is not running, launch Anki, then wait until the AnkiConnect server responds at `http://127.0.0.1:8765` (default). Verify readiness using curl, e.g. `curl -sS http://127.0.0.1:8765` should return `Anki-Connect`.2122## Safety and Confirmation Policy (Critical)2324**CRITICAL — NO EXCEPTIONS**2526Before any destructive or modifying operation on **notes or cards** (adding, updating, deleting, rescheduling, suspending, unsuspending, changing deck, or changing fields/tags), request confirmation from the user. Use the **AskUserQuestion** tool if available; otherwise ask via chat. Only request confirmation **once** per logical operation, even if it requires multiple API calls (e.g., search + update + verify). Group confirmation by intent and scope (e.g., “Update 125 notes matching query X”).2728Treat the following as confirmation-required by default:2930- Notes: `addNote`, `addNotes`, `updateNoteFields`, `updateNoteTags`, `updateNote`, `updateNoteModel`, `deleteNotes`, `removeEmptyNotes`, `replaceTags`, `replaceTagsInAllNotes`, `clearUnusedTags`.31- Cards: `setEaseFactors`, `setSpecificValueOfCard`, `suspend`, `unsuspend`, `forgetCards`, `relearnCards`, `answerCards`, `setDueDate`, `changeDeck`.32- Deck or model modifications that materially change cards/notes (deck deletion, model edits). Ask even if the action is not explicitly listed above.3334## API Fundamentals3536### Request Format3738Every request is JSON with:3940- `action`: string action name41- `version`: API version (use `6` unless user specifies otherwise)42- `params`: object of parameters (optional)4344### Response Format4546Every response is JSON with:4748- `result`: return value49- `error`: `null` on success or a string describing the error5051Always check `error` before using `result`.5253### Permissions5455- Use `requestPermission` first when interacting from a non-trusted origin; it is the only action that accepts any origin.56- Use `version` to ensure compatibility; older versions may omit the `error` field in responses when `version` ≤ 4.5758## curl + jq Patterns5960Prefer `jq` to build JSON and parse responses. Keep requests explicit and structured.6162### Minimal request template6364```bash65jq -n --arg action "deckNames" --argjson version 6 '{action:$action, version:$version}' \66| curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @-67```6869### With params7071```bash72jq -n \73 --arg action "findNotes" \74 --argjson version 6 \75 --arg query "deck:French tag:verbs" \76 '{action:$action, version:$version, params:{query:$query}}' \77| curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @-78```7980### Handling result/error8182```bash83curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @- \84| jq -e 'if .error then halt_error(1) else .result end'85```8687### Batching multiple actions8889Use `multi` to reduce round-trips and to group actions under a single confirmation when modifying data.9091```bash92jq -n --argjson version 6 --arg query "deck:French" \93 '{action:"multi", version:$version, params:{actions:[94 {action:"findNotes", params:{query:$query}},95 {action:"notesInfo", params:{notes:[]}} 96 ]}}' \97| curl -sS http://127.0.0.1:8765 -X POST -H 'Content-Type: application/json' -d @-98```99100Replace the empty array with the result of the previous action when chaining; in CLI usage, split into two calls unless using a scripting language.101102## Core Workflow Guidance103104### 1) Verify connectivity and version105106- Call `requestPermission` (safe).107- Call `version` to confirm the API level and use `version: 6` in requests.108109### 2) Discover supported actions110111- Use `apiReflect` with `scopes: ["actions"]` to list supported actions.112- Use this list to map user intent to action names.113114### 3) Resolve user request into action sequence115116- Identify read-only vs destructive operations.117- For destructive/modifying operations on notes/cards, request confirmation once with the scope and count.118- Prefer `findNotes`/`findCards` + `notesInfo`/`cardsInfo` for previews before modification.119120### 4) Execute and validate121122- Execute the call(s) in order.123- Check `error` for each response.124- Report summarized results and any IDs returned.125126## Common Task Recipes (CLI-Oriented)127128### List decks129130- Action: `deckNames`131132### Create deck133134- Action: `createDeck`135- Confirmation required if the deck is being created as part of a card/note modification workflow.136137### Search notes / cards138139- Actions: `findNotes`, `findCards`140- Use Anki search syntax (see “Search Syntax Quick Notes” below).141142### Preview note data143144- Action: `notesInfo` (note IDs)145146### Add notes147148- Actions: `addNote`, `addNotes`149- Confirmation required.150- Use `canAddNotes` or `canAddNotesWithErrorDetail` for preflight checks.151152### Update note fields or tags153154- Actions: `updateNoteFields`, `updateNoteTags`, or combined `updateNote`155- Confirmation required.156- Warning: Do not have the note open in the browser; updates may fail to apply.157158### Delete notes159160- Action: `deleteNotes`161- Confirmation required.162163### Suspend/unsuspend cards164165- Actions: `suspend`, `unsuspend`166- Confirmation required.167168### Move cards to a deck169170- Action: `changeDeck`171- Confirmation required.172173### Set due date or reschedule174175- Action: `setDueDate`176- Confirmation required.177178### Media upload/download179180- Actions: `storeMediaFile`, `retrieveMediaFile`, `getMediaFilesNames`, `getMediaDirPath`, `deleteMediaFile`181- Use base64 (`data`), file path (`path`), or URL (`url`) for upload.182183### Sync184185- Action: `sync`186187## Search Syntax Quick Notes (for `findNotes`/`findCards`)188189- Separate terms by spaces; terms are ANDed by default.190- Use `or`, parentheses, and `-` for NOT logic.191- Use `deck:Name`, `tag:tagname`, `note:ModelName`, `card:CardName`.192- Use `front:...` or other field names to limit by field.193- Use `re:` for regex, `w:` for word-boundary searches, `nc:` to ignore accents.194- Use `is:due`, `is:new`, `is:learn`, `is:review`, `is:suspended`, `is:buried` to filter card states.195- Use `prop:` searches for properties like interval or due date.196- Escape special characters with quotes or backslashes as needed.197198## Action Catalog (Use as a mapping reference)199200### Card Actions201202- `getEaseFactors`203- `setEaseFactors`204- `setSpecificValueOfCard`205- `suspend`206- `unsuspend`207- `suspended`208- `areSuspended`209- `areDue`210- `getIntervals`211- `findCards`212- `cardsToNotes`213- `cardsModTime`214- `cardsInfo`215- `forgetCards`216- `relearnCards`217- `answerCards`218- `setDueDate`219220### Deck Actions221222- `deckNames`223- `deckNamesAndIds`224- `getDecks`225- `createDeck`226- `changeDeck`227- `deleteDecks`228- `getDeckConfig`229- `saveDeckConfig`230- `setDeckConfigId`231- `cloneDeckConfigId`232- `removeDeckConfigId`233- `getDeckStats`234235### Graphical Actions236237- `guiBrowse`238- `guiSelectCard`239- `guiSelectedNotes`240- `guiAddCards`241- `guiEditNote`242- `guiAddNoteSetData`243- `guiCurrentCard`244- `guiStartCardTimer`245- `guiShowQuestion`246- `guiShowAnswer`247- `guiAnswerCard`248- `guiUndo`249- `guiDeckOverview`250- `guiDeckBrowser`251- `guiDeckReview`252- `guiImportFile`253- `guiExitAnki`254- `guiCheckDatabase`255- `guiPlayAudio`256257### Media Actions258259- `storeMediaFile`260- `retrieveMediaFile`261- `getMediaFilesNames`262- `getMediaDirPath`263- `deleteMediaFile`264265### Miscellaneous Actions266267- `requestPermission`268- `version`269- `apiReflect`270- `sync`271- `getProfiles`272- `getActiveProfile`273- `loadProfile`274- `multi`275- `exportPackage`276- `importPackage`277- `reloadCollection`278279### Model Actions280281- `modelNames`282- `modelNamesAndIds`283- `findModelsById`284- `findModelsByName`285- `modelFieldNames`286- `modelFieldDescriptions`287- `modelFieldFonts`288- `modelFieldsOnTemplates`289- `createModel`290- `modelTemplates`291- `modelStyling`292- `updateModelTemplates`293- `updateModelStyling`294- `findAndReplaceInModels`295- `modelTemplateRename`296- `modelTemplateReposition`297- `modelTemplateAdd`298- `modelTemplateRemove`299- `modelFieldRename`300- `modelFieldReposition`301- `modelFieldAdd`302- `modelFieldRemove`303- `modelFieldSetFont`304- `modelFieldSetFontSize`305- `modelFieldSetDescription`306307### Note Actions308309- `addNote`310- `addNotes`311- `canAddNotes`312- `canAddNotesWithErrorDetail`313- `updateNoteFields`314- `updateNote`315- `updateNoteModel`316- `updateNoteTags`317- `getNoteTags`318- `addTags`319- `removeTags`320- `getTags`321- `clearUnusedTags`322- `replaceTags`323- `replaceTagsInAllNotes`324- `findNotes`325- `notesInfo`326- `notesModTime`327- `deleteNotes`328- `removeEmptyNotes`329330### Statistic Actions331332- `getNumCardsReviewedToday`333- `getNumCardsReviewedByDay`334- `getCollectionStatsHTML`335- `cardReviews`336- `getReviewsOfCards`337- `getLatestReviewID`338- `insertReviews`339340## Notes and Pitfalls341342- Keep Anki in the foreground on macOS or disable App Nap to prevent AnkiConnect from pausing.343- When updating a note, ensure it is not being viewed in the browser editor; updates may not apply.344- `importPackage` paths are relative to the Anki `collection.media` folder, not the client.345- `deleteDecks` requires `cardsToo: true` to delete cards along with decks.346347## Resources348349No bundled scripts or assets are required for this skill.