docstr: Updates a skill by name, creating one if it doesn't exist
docstr_tok: ["Updates","a","skill","by","name",",","creating","one","if","it","does","n't","exist"]
code: def put(self, project_name, skill_name):
      """Updates a skill by name, creating one if it doesn't exist"""
      skills_controller = SkillsController()
  
      # Check required request format.
      if "skill" not in request.json:
          return http_error(
              HTTPStatus.BAD_REQUEST,
              "Missing parameter",
              'Must provide "skill" parameter in POST body',
          )
  
      try:
          existing_skill = skills_controller.get_skill(
              skill_name, project_name
          )
      except ValueError:
          # Project needs to exist
          return http_error(
              HTTPStatus.NOT_FOUND,
              "Project not found",
              f"Project with name {project_name} does not exist",
          )
  
      skill = request.json["skill"]
      if existing_skill is None:
          # Use same name as provided in URL.
          skill["name"] = skill_name
          return create_skill(project_name, skill)
  
      new_name = skill.get("name", None)
      new_type = skill.get("type", None)
      new_params = skill.get("params", None)
      updated_skill = skills_controller.update_skill(
          skill_name,
          new_name=new_name,
          project_name=project_name,
          type=new_type,
          params=new_params,
      )
      return updated_skill.as_dict()
  
file_path: mindsdb/mindsdb/api/http/namespaces/skills.py
imports: from http import HTTPStatus
  from flask import request
  from flask_restx import Resource
  from mindsdb.api.http.namespaces.configs.projects import ns_conf
  from mindsdb.api.http.utils import http_error
  from mindsdb.interfaces.skills.skills_controller import SkillsController
label_desc: Use image node_id 2 for calling the SkillResource obj's underlying member method code with example usage: obj.put(project_name, skill_name) and returns: updated_skill, http_error, create_skill, http_error