simonw/research/datasette-plugin-skill
Claude Code and agent skill by simonw/research
- community
- ext:[{"type":"template","description":"Custom templates for code generation"}]
Checking that the SKILL.md file is still in the repository.
Guide for writing Datasette plugins. This skill should be used when users want to create or develop plugins for Datasette, including information about plugin hooks, the cookiecutter template, database APIs, request/response handling, and plugin configuration.
Install
npx vskill@latest install simonw/research/datasette-plugin-skillSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Writing Datasette Plugins
Use this skill to build plugins for Datasette, the open source multi-tool for exploring and publishing data.
Quick Start with Cookiecutter Template
Start a new plugin using the datasette-plugin cookiecutter template with newline-delimited variables:
Example for a plugin called "my-cool-plugin":
The last two y responses enable static/ and templates/ directories.
After creating the plugin:
Plugin Structure
A typical plugin structure:
Essential Plugin Hooks
prepare_connection(conn, database, datasette)
Register custom SQL functions. Called when SQLite connections are created:
register_routes(datasette)
Add custom URL routes. Return list of (regex, view_function) pairs:
View functions can accept: datasette, request, scope, send, receive.
render_cell(row, value, column, table, database, datasette, request)
Customize how table cell values are displayed:
extra_template_vars(template, database, table, columns, view_name, request, datasette)
Add variables to template context:
Can also return async functions for database queries.
table_actions(datasette, actor, database, table, request)
Add menu items to table pages:
actor_from_request(datasette, request)
Implement authentication. Return actor dict or None:
Can return async function for database lookups.
permission_allowed(datasette, actor, action, resource)
Control permissions. Return True (allow), False (deny), or None (no opinion):
Request and Response Objects
Request Object
Available in many plugin hooks:
Response Object
Create responses in view functions:
Database API
Access databases in plugins:
Plugin Configuration
Users configure plugins in datasette.yaml:
Or per-database:
Access in plugin code:
Configuration lookup: table → database → instance level.
Static Assets and Templates
Static Files
Place in static/ directory, reference with:
Templates
Place in templates/ directory. Override Datasette templates:
database.html- Database pagetable.html- Table pagerow.html- Row pagequery.html- Query page
Access template functions:
Common Patterns
Add a custom SQL function
Add a custom page
Render custom output format
Check permissions
URL Design
Use /-/ prefix to avoid conflicts with database names:
/-/my-plugin- Instance-level page/dbname/-/my-plugin- Database-level page/dbname/table/-/my-plugin- Table-level page
Build URLs with base_url support:
Testing Plugins
Create tests in tests/test_my_plugin.py:
Run tests: pytest
Publishing
To GitHub
To PyPI
Configure GitHub release environment with PyPI trusted publisher, then create a GitHub release matching your version number. The GitHub Action will automatically publish to PyPI.
Key Resources
- Plugin hooks reference: https://docs.datasette.io/en/stable/plugin_hooks.html
- Internals documentation: https://docs.datasette.io/en/stable/internals.html
- Example plugins: https://datasette.io/plugins
- Cookiecutter template: https://github.com/simonw/datasette-plugin
Important Notes
- Accept only the parameters you need in hook functions (dependency injection)
- Use
@hookimpldecorator for all plugin hooks - Async functions need
async defandawait - CSRF tokens required for POST forms:
<input type="hidden" name="csrftoken" value="{{ csrftoken() }}"> - Plugin package name uses underscores, pip name uses hyphens
- Use
-prefix in URLs:/-/plugin-path - Access internal database with
datasette.get_internal_database()
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdatasette-plugin-skill/SKILL.md
Popularity
- Repository stars
- 411
- Repository forks
- 34
- 7-day trend score
- 30
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 8 months ago.
Extension points
templateCustom templates for code generation
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/simonw/research/datasette-plugin-skill)