> Find all CPython internal headers and structs used in the codebase, particularly for profiling functionality. Use this when adding support for a new Python version to identify what CPython internals we depend on.
npx skills add https://github.com/DataDog/dd-trace-py --skill find-cpython-usage
This skill helps identify all CPython internal headers and structures used in the
codebase, which is essential when adding support for new Python versions.
Use this skill when:
Search for CPython header includes across all C/C++/Cython files:
# Find all CPython internal header includes
grep -r "include.*internal/pycore" ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp" --include="*.pyx"
# Find all CPython cpython header includes
grep -r "include.*cpython" ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp" --include="*.pyx"
# Find all Python.h includes (indicates CPython API usage)
grep -r "#include.*Python\.h" ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp" --include="*.pyx"
# Find frameobject.h includes (common CPython API)
grep -r "#include.*frameobject\.h" ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp" --include="*.pyx"
# Find PyO3 FFI usage in Rust (Rust extensions may use CPython internals)
grep -r "pyo3_ffi::\|pyo3::ffi::" src/native/ --include="*.rs" || true
Note: These patterns search across all native extension files (.c, .cpp, .h, .hpp, .pyx, .rs)
regardless of their location in the codebase. Check setup.py to see which extensions are built.
Rust extensions use PyO3 which may access CPython internals through the pyo3_ffi module.
Search for direct struct field access and struct definitions across all native files:
# Find struct field accesses (arrow operator)
grep -r "->f_\|->[a-z_]*\." ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp"
# Find struct definitions
grep -r "struct.*Py" ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp"
# Find common CPython struct usage
grep -r "PyFrameObject\|PyThreadState\|_PyInterpreterFrame" ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp" --include="*.pyx"
grep -r "PyFrameObject\|PyThreadState\|PyInterpreterState" src/native/ --include="*.rs" || true
# Find PyCodeObject usage
grep -r "PyCodeObject" ddtrace/ --include="*.c" --include="*.cpp" --include="*.h" --include="*.hpp" --include="*.pyx"
grep -r "PyCodeObject" src/native/ --include="*.rs" || true
Look for patterns like:
PyFrameObject, _PyInterpreterFrame)PyThreadState)PyCodeObject)Common CPython structures we typically access:
Frame structures:
PyFrameObject / struct _frame_PyInterpreterFrameState structures:
PyThreadStatePyInterpreterState_PyRuntimeStateCode structures:
PyCodeObjectGenerator structures:
PyGenObjectPyAsyncGenASendAsyncio structures:
FutureObjTaskObjCreate a list of:
This will be used in the next step to compare against the new Python version.
To find all native extensions that may use CPython APIs, check setup.py:
# View all native extensions defined in setup.py
grep -A 5 "Extension\|CMakeExtension\|Cython.Distutils.Extension\|RustExtension" setup.py
The setup.py file defines all native extensions (C, C++, CMake, Cython, and Rust) that
are built for the project. Not all extensions use CPython internals - focus on those
that access frame objects, thread state, or internal structures when searching for
CPython API usage.
Note: Rust extensions use PyO3 bindings which may access CPython internals through
pyo3_ffi module. Search Rust source files (.rs) for CPython API usage as well.
The grep commands above will identify which CPython headers are actually used in the codebase.
Common patterns include:
Public Headers:
*.h in Include/ directory (e.g., frameobject.h, unicodeobject.h)Include/cpython/ directory (e.g., cpython/genobject.h)Internal Headers (require Py_BUILD_CORE):
internal/pycore*.h patternFocus on headers that are actually found by the grep commands rather than maintaining
a hardcoded list, as the headers used may change over time.
After running this skill, you should have:
This information can then be used with the compare-cpython-versions skill to identify what changed.
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take datadog/find-cpython-usage from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.