agentleFS
polyaipolyai/adk/.claude/skills/add-resource-type/SKILL.md

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.

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
  1. Very specific:

    Read src/poly/resources/AGENTS.md first.

    line 10
  2. Very specific:

    Add make_pretty / from_pretty if names or IDs need substituting, and get_resource_prefix() if other resources can reference this one.

    line 34
  3. Very specific:

    Import the class in src/poly/resources/__init__.py, which makes the decorator run.

    line 43
  4. Very specific:

    If the file name is a cleaned version of the real name (accents, casing or punctuation stripped, like Topic and ChildTopic), add the class …

    line 44
  5. Very specific:

    Add an example of the resource to src/poly/tests/test_projects/test_project/.

    line 59
  6. Very specific:

    If a user skill in skills/ describes the area, update it.

    line 66

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 simple YamlResource.
  • src/poly/resources/resource.py: the base classes, register_resource and load_resources_from_projection.
  • src/poly/resources/__init__.py: where classes are imported.
  • AgentStudioProject.find_new_kept_deleted and _make_resource_mapping in src/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): FlowStep in flows.py. It stores the parent id and name as fields and resolves them from the enclosing folder name in read_local_resource.

2. Write the class

Create src/poly/resources/<name>.py:

  • Subclass YamlResource (or Resource / MultiResourceYamlResource) and implement the abstract methods:
    • command_type
    • build_create_proto, build_update_proto, build_delete_proto
    • file_path, raw, validate
    • to_yaml_dict, from_yaml_dict
    • from_projection, read_local_resource, discover_resources
  • Add make_pretty / from_pretty if names or IDs need substituting, and get_resource_prefix() if other resources can reference this one.
  • Decorate it with @register_resource("<name>"). That fills RESOURCE_NAME_TO_CLASS, RESOURCE_CLASS_TO_NAME and PROJECTION_REGISTRY. There is no other registration step.
  • from_projection is a classmethod that parses its own keys out of the raw projection dict.
  • validate should 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 Topic and ChildTopic), add the class to the name-recovery condition in find_new_kept_deleted in src/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_path
  • from_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 by poly docs.
  • docs/docs/reference/resources/: follow the AGENTS.md in that directory, and add the page to docs/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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.