add-resource-type
Skill83 starsChanged 39 days agoApache-2.0View on GitHub
Add a new Agent Studio resource type to the ADK, covering the class, registration, projection parsing, tests, fixture and docs. Use when asked to support a new resource in the polyai-adk repo.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ci-checkSkill
- open-prSkill
- review-prSkill
- write-testsSkill
- poly-adk-branchingSkill
- poly-adk-conversationsSkill
- poly-adk-rtcSkill
- poly-adk-testingSkill
- poly-adk-workflowSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Read src/poly/resources/AGENTS.md first.
- Very specific: line 34
Add make_pretty / from_pretty if names or IDs need substituting, and get_resource_prefix() if other resources can reference this one.
- Very specific: line 43
Import the class in src/poly/resources/__init__.py, which makes the decorator run.
- Very specific: line 44
If the file name is a cleaned version of the real name (accents, casing or punctuation stripped, like Topic and ChildTopic), add the class …
- Very specific: line 59
Add an example of the resource to src/poly/tests/test_projects/test_project/.
- Very specific: line 66
If a user skill in skills/ describes the area, update it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a resource type
Read src/poly/resources/AGENTS.md first; this skill expands its checklist.
1. Study an existing resource
src/poly/resources/entities.py: a simpleYamlResource.src/poly/resources/resource.py: the base classes,register_resourceandload_resources_from_projection.src/poly/resources/__init__.py: where classes are imported.AgentStudioProject.find_new_kept_deletedand_make_resource_mappinginsrc/poly/project.py: how resource types are handled generically.- For a resource that belongs to a parent (a step in a flow, an overwrite in a variant):
FlowStepinflows.py. It stores the parent id and name as fields and resolves them from the enclosing folder name inread_local_resource.
2. Write the class
Create src/poly/resources/<name>.py:
- Subclass
YamlResource(orResource/MultiResourceYamlResource) and implement the abstract methods:command_typebuild_create_proto,build_update_proto,build_delete_protofile_path,raw,validateto_yaml_dict,from_yaml_dictfrom_projection,read_local_resource,discover_resources
- Add
make_pretty/from_prettyif names or IDs need substituting, andget_resource_prefix()if other resources can reference this one. - Decorate it with
@register_resource("<name>"). That fillsRESOURCE_NAME_TO_CLASS,RESOURCE_CLASS_TO_NAMEandPROJECTION_REGISTRY. There is no other registration step. from_projectionis a classmethod that parses its own keys out of the raw projection dict.validateshould reject everything the platform would reject.
3. Wire it in
- Import the class in
src/poly/resources/__init__.py, which makes the decorator run. - If the file name is a cleaned version of the real name (accents, casing or punctuation
stripped, like
TopicandChildTopic), add the class to the name-recovery condition infind_new_kept_deletedinsrc/poly/project.py, and import it there.
4. Test it
In src/poly/tests/resources_test.py (see the write-tests skill), cover:
- the YAML round-trip
validate(valid and invalid)file_pathfrom_projection
For a parent-scoped resource, also test that read_local_resource resolves the parent from the
folder name and copes with an empty resource_mappings list.
Add an example of the resource to src/poly/tests/test_projects/test_project/.
5. Document it
src/poly/docs/<name>.md: the YAML shape, served bypoly docs.docs/docs/reference/resources/: follow theAGENTS.mdin that directory, and add the page todocs/mkdocs.yml.- If a user skill in
skills/describes the area, update it.
6. Check
uv run ruff check . --fix, uv run ruff format ., then the ci-check skill. Never touch
src/poly/handlers/protobuf/ or src/poly/types/; if the protobufs lack the resource, stop and
say so.
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.

