add-resource
Skill0 starsChanged 7 months agoApache-2.0View on GitHub
Scaffold a new FastMCP resource following project conventions. Use when: adding a read-only data source, exposing structured or binary content via MCP, creating a resource URI, implementing a static or templated resource endpoint, or adding resource tests. Asks questions then generates the resource file, registers the import, and creates matching tests.
We split this skill into the rules it gives an agent
8 rules. 0 are common, 0 are distinctive, and 8 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Before asking questions, read pyproject.toml to find the current package name from:
- Very specific: line 25
Use this as PACKAGE for all file paths and imports below.
- Very specific: line 29
Ask the following questions.
- Very specific: line 42
If the URI contains {param} segments, this is a template resource — use @mcp.resource("uri") with matching function parameters
- Very specific: line 47
Create src/PACKAGE/resources/RESOURCE_NAME.py using ./assets/resource_template.md as the base.
- Very specific: line 62
Add the import line to src/PACKAGE/__main__.py after any existing resource imports:
- Very specific: line 68
Keep # noqa: F401 — the import exists only for side-effect registration.
- Very specific: line 72
Create tests/test_RESOURCE_NAME.py using ./assets/test_template.md as the base.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a New FastMCP Resource
Scaffolds a fully wired FastMCP resource in the correct location following the conventions already used in this project.
When to use
- Adding any MCP resource that exposes read-only data to the LLM
- Wanting the correct URI pattern, return contract, and error handling in one step
- Unsure about static vs. templated resources or how to serialize return values
Step 1 — Detect the package name
Before asking questions, read pyproject.toml to find the current package name from:
packages = ["src/<package_name>"]Use this as PACKAGE for all file paths and imports below.
Step 2 — Interview the user
Ask the following questions. Use vscode_askQuestions if available.
| # | Question | Notes |
| 1 | Resource URI | e.g. resource://config, resource://user/{user_id} |
| 2 | Resource name | snake_case identifier, used for the function and file name |
| 3 | What does this resource expose? | One sentence — becomes the docstring |
| 4 | Static or templated? | Static: fixed URI. Templated: URI contains {param} segments |
| 5 | Return type | plain text (str), binary (bytes), or structured data (JSON string) |
| 6 | MIME type | e.g. text/plain, application/json, image/png (leave blank for default) |
| 7 | What should raise a ResourceError? | e.g. item not found, invalid ID, upstream failure |
Derive automatically:
- If the URI contains
{param}segments, this is a template resource — use@mcp.resource("uri")with matching function parameters - File name:
RESOURCE_NAME.pyundersrc/PACKAGE/resources/
Step 3 — Generate the resource file
Create src/PACKAGE/resources/RESOURCE_NAME.py using ./assets/resource_template.md as the base.
Fill in:
@mcp.resource("URI")with the full URI- Function signature — include path params as typed arguments for templated resources
- Docstring from the resource description answer
- Return type annotation (
strorbytes) mime_type=argument if non-defaultResourceErrorraises for stated error cases- Actual data retrieval or construction logic
See ./references/resource-conventions.md for exact patterns.
Step 4 — Register the import in __main__.py
Add the import line to src/PACKAGE/__main__.py after any existing resource imports:
from PACKAGE.resources import RESOURCE_NAME # noqa: F401Keep # noqa: F401 — the import exists only for side-effect registration.
Step 5 — Generate the test file
Create tests/test_RESOURCE_NAME.py using ./assets/test_template.md as the base.
Include at minimum:
- A success-path test reading the resource via
await client.read_resource("URI") - An error-path test for invalid or missing parameters (templated resources)
- For structured data: parse and assert specific fields, not just status
Step 6 — Validate
ruff check .
pytest tests/test_RESOURCE_NAME.py -vFix any issues before reporting completion.
Step 7 — Report
Tell the user:
- The path of the new resource file
- The path of the new test file
- What was added to
__main__.py - The full URI to use when reading the resource with an MCP client
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- luxury-yacht/app★ 444same name
- deepmodeling/Uni-Lab-OS★ 178same name
- PostHog/posthog-definitions★ 16same name
- Avinava/agentic-react-express-ts★ 0same name
- ficaviolaodorata520/met-museum-mcp-server★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-routeSkill
- add-toolSkill
- auth-setupSkill
- bootstrap-personalizeSkill
- deployment-profileSkill
- docs-syncSkill
- observability-setupSkill
- release-readinessSkill
- rename-projectSkill
- test-scaffoldSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

