Documentation
Tags
Use tags for lightweight organization and filtering
Tags
Tags are the primary way to organize snippets in Cache. They keep one snippet discoverable from multiple contexts without forcing a folder hierarchy.
Overview
Tags are labels you apply to snippets for categorization. A single snippet can have multiple tags.
Tag Examples
A React authentication snippet might have tags such as:
text
react, auth, typescript, hooks, jwt, frontendUsing Tags
Adding Tags
Web App:
- Open a snippet.
- Add tags in the tag input.
- Save the snippet.
CLI:
bash
cache add ./auth.ts --tag react --tag auth --tag typescript
cache snippet update snip_abc123 --tag jwt --tag hooksAPI:
bash
curl -X PATCH \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"tags": ["react", "auth", "typescript"]}' \
https://cache.example.com/api/v1/snippets/snip_abc123Replacing or removing tags
bash
cache snippet update snip_abc123 --tags react,typescript
cache snippet update snip_abc123 --tags ""Update commands replace the complete tag set whenever --tag or --tags is
present. The empty --tags value removes every tag.
Conventions
Recommended Tag Taxonomy
text
Language: javascript, typescript, python, rust, go
Framework: react, nextjs, express, fastapi
Purpose: auth, validation, utils, config, testing, deploy
Context: work, personal, learning, reference
Type: function, class, interface, query, scriptNaming Best Practices
- Use lowercase names.
- Prefer hyphenated tags when needed.
- Keep them short and specific.
- Avoid duplicates such as
jsandjavascript.
Filtering by Tags
Web App
Use the dashboard filters and visible tags to narrow the result set.
CLI
bash
cache search "" --tags react
cache search "auth" --tags reactTag Statistics
bash
cache search "" --format json | jq -r '.[].tags[]?' | sort | uniq -c | sort -rnTroubleshooting
Tag Not Applying
- Keep tag names short and URL-safe.
- Save the snippet after editing tags.
- Confirm the app instance is running normally.
Tagged Snippet Not Showing Up
- Re-run the query.
- Verify spelling.
- Confirm you are using the expected Cache instance.