Repository navigation
Add a skill for creating BTrace extensions for target libraries and frameworks #907
Copy link
Copy link
Closed
Description
Goal
Provide an advanced prompt/skill that can design and scaffold a new BTrace extension for a target library, framework, runtime, or external system.
Unlike #906, which migrates an existing legacy integration, this workflow starts from a target system and derives a maintainable extension architecture.
Inputs
The skill should be able to work from one or more of:
- Maven coordinates and supported version range
- a local or remote source repository
- target JARs and API documentation
- example application code
- desired observations, metrics, or probe operations
Workflow
The skill should:
- Inspect the target API, dependency graph, classloading behavior, and version compatibility.
- Identify stable integration points and define the probe-facing use cases.
- Design the bootstrap-safe extension API using
@ServiceDescriptor,Objecthand-off, and@ExternalTypewhere appropriate. - Separate public API from runtime implementation and prevent target-library types from leaking onto the bootstrap classpath.
- Determine required BTrace permissions and explain why each is necessary.
- Implement target interaction through appropriate classloaders, reflection, or cached method handles when direct linkage would be unsafe.
- Create the required
META-INF/servicesprovider declaration. - Scaffold the
io.btrace.extensionGradle project, metadata, dependencies, shading rules, tests, and documentation. - Optionally scaffold example probes and a masked fat-agent configuration for deployment.
- Verify API purity, artifact contents, provider loading, supported target versions, and a live first trace.
Design requirements
- Prefer stable public target APIs; clearly flag use of internal or version-sensitive APIs.
- Keep target types out of bootstrap-visible extension interfaces unless explicitly modeled as external types.
- Use the defining/application classloader for target-library interaction.
- Support multiple target versions without silently assuming binary compatibility.
- Fail closed when permissions, provider metadata, or classloading boundaries cannot be established safely.
- Explain generated code and leave clear maintenance/version-upgrade guidance.
Acceptance criteria
- Given a representative target framework, produces a compilable API/implementation extension split
- Generates correct service, permission, and provider metadata
- Includes unit tests using realistic target API fixtures
- Includes an integration or example application test demonstrating a first trace
- Produces inspectable API, implementation, and optional fat-agent artifacts
- Documents supported target versions and known compatibility risks
- Can run in analysis-only mode before making repository changes
- Is linked from the BTrace extension-development documentation
Relationship
Related to #906, but intentionally separate:
- [3.0] Add migration prompt/skill for legacy custom system-support packaging #906: migrate an existing legacy custom integration
- this issue: design a new extension from a target library/framework/system
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
docs(extensions): reference the migration and authoring skills
jbachorik commentedon Jul 29, 2026
Delivered in btraceio/agent-plugins#4, which adds the
btrace-extension-authoringskill to thebtrace-developmentplugin (merged 2026-07-28).Scope note: the skill deliberately does not restate the full ten-step workflow from this issue. Project layout, permission scanning, and packaging are cross-referenced to the neighbouring
btrace-extensions-and-permissionsandbtrace-startup-and-packagingskills; fat-agent configuration stays with the startup/packaging guidance. What the skill carries is what nothing else covered: the analysis-first gate, the@ExternalTypeboundary and its static/virtual loader split, the hand-written escape hatch viaClassLoadingUtil/MethodHandleCache, the version strategy, and the<serviceInterfaceFqcn>Implnaming rule.Follow-ups spun out of that work are tracked separately in #930 and #931.