py-code-insight-counters
Skill by JetBrains
Counts and benchmarks the work of the Python type engine in JetBrains IDE tests. It helps developers show that a change does less work, catch performance regressions, and measure how work grows with input size.
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/.agents/skills/py-code-insight-counters ~/.claude/skills/py-code-insight-countersRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install py-code-insight-counters in Claude Code
git clone --depth 1 https://github.com/JetBrains/intellij-community /tmp/intellij-community && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/intellij-community/.agents/skills/py-code-insight-counters ~/.gemini/antigravity-cli/skills/py-code-insight-countersAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install py-code-insight-counters in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill explains how to use PyCodeInsightCounters and PyPerfProbe, two test helpers in the JetBrains Python code base. The counters track events such as getType calls, cache hits, type evaluations, context creation, overload checks, control flow builds and completion lookup items. Counting is off by default and can be limited to the calling thread or turned on for all threads with snapshots.
The skill also covers two test patterns. A gate is a fast test that fails on a performance regression and compares work growth across input sizes. A benchmark is a PerformanceUnitTest that reports time, allocations, AST loads and counter medians. It is written for developers who work on the Python plugin and its performance tests.
Written from the project's SKILL.md and checked against it.
What it can do
- Count calling-thread workUses countOnCurrentThread to count the type engine work of one call on the calling thread.
- Count all threadsTakes two snapshots with enable and snapshot to measure work on all threads during a test.
- Gate a scenarioWrites a fast regression test with a probe extension and assertGrowth or assertExpectation checks.
- Track known defectsUses PyKnownDefect so a gate fails when an open issue is fixed and the expectation is updated.
- Benchmark a scenarioRuns measure or measureEditorFile as a PerformanceUnitTest with warm-up and timed attempts.
- Report resultsPrints PYPERF lines with time quantiles, allocations, AST loads and counter ranges.
- Add a temporary counterAdds a dotted-id counter to the Counter enum and an inc or add call at a hook.
What you need
- Access to the JetBrains Python plugin source tree with the python-psi-impl and testFramework modules
Try asking
- Write a gate test that checks getType evaluations stay linear with input size
- Count how many type evaluations one getType call makes on the current thread
- Add a temporary counter for foo calls and remove it before merge
Good to know
- Counting is off by default and countOnCurrentThread does not see work on other threads
- Snapshot deltas also include background IDE work during that time
- Cold runs drop type contexts, so counts change between attempts and medians should be compared
- Benchmarks are skipped in usual test runs and run only when the fully qualified name is given to tests.cmd
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/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 →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.
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.
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.
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.
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.
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.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
py-code-insight-counters: common questions
What does PyCodeInsightCounters count?
It counts events of the native Python type engine, such as getType calls, cache hits, type evaluations, context construction, overload candidates, control flow builds and completion lookup items.
Why count work instead of measuring time?
The source says a work count does not flake like a time, so it is more stable for performance gates that run on each Safe Push.
Can I use these counters in production code?
The source describes them as test helpers. When counting is off, a counter call costs one volatile read, and temporary counters should be removed before a merge request is merged.
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.
