phpcs rule or sniff for detecting usage of the "ksm()" or "kint()" function?
Yes, it is possible by Checking Drupal coding standards. You can configure PHP code sniffer to check for Drupal coding standards by following the instructions from https://www.drupal.org/docs/contributed-modules/code-review-module/installing-coder-sniffer and https://www.drupal.org/node/1587138
Edit: It turns out you can not identify all the debugging functions with standard Drupal Coding standard functions.In my testing drupalcs was able to identify only dpm()and dsm() functions but not ksm() or kint() .
There is an alternative way to identify debugging functions. You can add pre-commit hook to identify the debugging functions.
You can add the below script to git hooks.
#!/bin/sh

#
# Git pre-commit hook that prevents code that is not Drupal coding standard compliant of being committed.
#
# Fork of https://git.io/fNXBi by Dave Hall http://davehall.com.au
#

# Fetch the list of files that have changed.
FILES=&quot;$(git diff --staged --name-only HEAD --diff-filter=ACMRUXB)&quot;

echo &quot;Running PHP lint check&quot; &gt;&amp;2
LINT_FAIL=0
for filename in $FILES; do
  if ! php -l $filename; then
    LINT_FAIL=1
  fi
done;

# There is no point in running PHP Code Sniffer on broken files.
if [ $LINT_FAIL -gt 0 ]; then
  echo &quot;Commit aborted. Fix your code. Then 'git add' and 'git commit' again.&quot;
  exit 1
fi

echo &quot;Running PHP Code Sniffer Checks&quot; &gt;&amp;2
echo $FILES | xargs phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt --ignore=node_modules,bower_components,vendor,*.md
if [ $? -eq 0 ]; then
 # Exit executing the git commit.
 exit 0
else
  # Ask what to do, not executing the commit. Source: https://unix.stackexchange.com/a/121255/139407
  read -p &quot;Fix the marked Sniff violations automatically [Y/n]?&quot; line &lt;/dev/tty
  case &quot;$line&quot; in
    y|Y) echo $FILES | xargs phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt --ignore=node_modules,bower_components,vendor,*.md
      ;;
    *) echo &quot;No automatic corrections made.&quot;
      ;;
  esac

  echo &quot;Commit aborted. Make remaining manual code fixes if necessary. Then 'git add' and 'git commit' again.&quot;
  exit 1
fi

Source : Drupal git pre-commit hook