Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

py-code-insight-counters

Skill by JetBrains

Counts Python type engine work in tests with PyCodeInsightCounters and PyPerfProbe. Built for JetBrains developers who need to show a change does less work or guard against performance regressions.

  • Score 78
  • 21k stars
  • NOASSERTION
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install py-code-insight-counters

Built from the published package, never by AI.

git clone --depth 1 https://github.com/JetBrains/intellij-community /tmp/intellij-community && mkdir -p ~/.claude/skills && cp -r /tmp/intellij-community/.claude/skills/py-code-insight-counters ~/.claude/skills/py-code-insight-counters

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install py-code-insight-counters in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill is a guide for counting the work of the native Python type engine in tests. The PyCodeInsightCounters class tracks events such as getType calls, cache hits, type evaluations, context construction, type match steps, control flow builds and completion lookup items. The PyPerfProbe helper measures a scenario with these counters, along with wall time, allocations and AST loads.

The guide explains how to count on the current thread or across all threads using snapshots, and how to gate a scenario so a test fails on a performance regression. It also covers running benchmarks as IJ Perf subtests and adding temporary counters. It is aimed at developers working on Python code insight who want to prove that a change does less work or pin a performance defect in a test.

Written from the project's SKILL.md and checked against it.

What it can do

  • Count type engine work in a testUse countOnCurrentThread to count getType calls, cache hits and evaluations for the calling thread.
  • Snapshot counts across all threadsTake before and after snapshots to measure work from all threads, including highlighting passes.
  • Gate performance regressionsWrite a normal test that fails when a counter grows worse than expected across input sizes.
  • Track known defectsUse PyKnownDefect so a gate fails when work is worse than an open issue and when the fix lands.
  • Benchmark a scenarioRun measure, measureEditorFile or measureScaled to publish time, counters, allocations and AST loads.
  • Report benchmark resultsPrint PYPERF lines with time quantiles, allocations, AST loads and counter medians and ranges.
  • Add a temporary counterRegister a new counter with a stable dotted id and call it at a hook while counting is enabled.

What you need

  • Access to the JetBrains Python plugin test sources
  • Kotlin test code using the PyCodeInsightTestCase base class
  • tests.cmd to run benchmarks by fully qualified name

Try asking

  • Count getType evaluations for this expression in a test using PyCodeInsightCounters
  • Write a scaling gate for this scenario with sizes n, 2n and 4n
  • Benchmark this highlighting scenario with measureEditorFile and report the results

Good to know

  • Counting is off by default and must be enabled per test.
  • countOnCurrentThread does not see work done on other threads, such as highlighting passes.
  • Snapshot deltas also include background IDE work during that time.
  • Benchmarks are skipped in usual test runs and run in the performance test builds of TeamCity.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: .claude/skills/py-code-insight-counters/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md5 KB

Alternatives to py-code-insight-counters

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

py-code-insight-counters: common questions

Why do counts change between attempts of the same scenario?

cold() drops the PSI caches and type contexts before each attempt, while other caches stay. The guide says to compare medians and read the range before claiming a difference.

Should I assert exact counter values in a test?

Assert an exact count only for the calling thread. For all-thread snapshots, the guide recommends asserting a bound or a ratio instead.

Why use work counts instead of time for performance tests?

The source says a work count does not flake like a time, so it is suited to gating regressions on machines of different speed.

How do I install py-code-insight-counters?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is py-code-insight-counters free?

The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.

Is py-code-insight-counters safe to use?

It scores 78 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to py-code-insight-counters?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

py-code-insight-counters Install

Add to stack

Loading.