Selectively instruments code to capture runtime data for debugging failures and bugs. Use when investigating crashes, exceptions, unexpected behavior, test failures, or performance issues. Analyzes stack traces and error messages to identify suspicious code regions, then adds targeted logging, tracing, and assertions to capture variable values, execution paths, timing, and conditional branches. Supports Python, JavaScript/TypeScript, Java, and C/C++.
Install with Tessl CLI
npx tessl i github:ArabelaTso/Skills-4-SE --skill failure-oriented-instrumentation87
Does it follow best practices?
If you maintain this skill, you can automatically optimize it using the tessl CLI to improve its score:
npx tessl skill review --optimize ./path/to/skillValidation for skill structure
Strategically instrument code to capture high-signal runtime data for debugging failures, focusing only on suspicious regions rather than comprehensive instrumentation.
Gather and analyze failure information:
Identify suspicious code regions:
Based on the failure type, choose instrumentation targets:
For crashes/exceptions:
For incorrect results:
For performance issues:
For intermittent failures:
Choose appropriate patterns based on language and context. See language-specific references:
Common patterns:
Apply instrumentation to identified code regions:
Minimal approach (start here):
Expanded approach (if minimal is insufficient):
Principles:
Execute the instrumented code:
Review captured data to identify root cause:
Failure:
NullPointerException at UserService.java:45
at UserService.processUser(UserService.java:45)
at UserController.handleRequest(UserController.java:23)Instrumentation:
public void processUser(String userId) {
logger.debug("ENTER processUser: userId={}", userId);
User user = userRepository.findById(userId);
logger.debug("Retrieved user: {}", user); // Check if null
if (user == null) {
logger.warn("User not found for userId={}", userId);
return;
}
String email = user.getEmail(); // Line 45 - was failing here
logger.debug("User email: {}", email);
sendNotification(email);
}Failure:
AssertionError: Expected 100, got 95
at test_calculate_total (test_billing.py:12)
at calculate_total (billing.py:34)Instrumentation:
def calculate_total(items, discount_rate):
logger.debug(f"ENTER calculate_total: items={items}, discount_rate={discount_rate}")
subtotal = sum(item.price for item in items)
logger.debug(f"Subtotal: {subtotal}")
if discount_rate > 0:
logger.debug(f"Applying discount: rate={discount_rate}")
discount = subtotal * discount_rate
logger.debug(f"Discount amount: {discount}")
else:
logger.debug("No discount applied")
discount = 0
total = subtotal - discount
logger.debug(f"Final total: {total}")
return totalFailure:
Test "should process async data" fails randomly
Expected: data processed
Actual: timeoutInstrumentation:
async function processAsyncData(dataId) {
console.log(`ENTER processAsyncData: dataId=${dataId}, time=${Date.now()}`);
const data = await fetchData(dataId);
console.log(`Fetched data: ${JSON.stringify(data)}, time=${Date.now()}`);
if (!data) {
console.warn(`No data returned for dataId=${dataId}`);
return null;
}
const processed = await processData(data);
console.log(`Processed data: ${JSON.stringify(processed)}, time=${Date.now()}`);
return processed;
}High priority:
Medium priority:
Low priority:
Load these references for detailed instrumentation patterns:
c1fb172
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.