Failure Oriented Instrumentation logo

Failure Oriented Instrumentation

Community
ArabelaTso
failure-oriented-instrumentation

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++.

Overview

PublisherArabelaTso
RepositorySkills-4-SE
Skill namefailure-oriented-instrumentation
Stars
258
Forks
25
Bundled files
4
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by ArabelaTso on GitHub. Read the source before you install it.

Installation

Install the Failure Oriented Instrumentation AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/failure-oriented-instrumentation
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git /tmp/Skills-4-SE
mkdir -p .claude/skills
cp -r /tmp/Skills-4-SE/skills/failure-oriented-instrumentation .claude/skills/failure-oriented-instrumentation
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Failure Oriented Instrumentation in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Failure Oriented Instrumentation on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Failure Oriented Instrumentation is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Failure-Oriented Instrumentation

Strategically instrument code to capture high-signal runtime data for debugging failures, focusing only on suspicious regions rather than comprehensive instrumentation.

Workflow

1. Analyze the Failure

Gather and analyze failure information:

  • Error message and exception type
  • Stack trace showing call chain
  • Failure location (file, line, function)
  • Reproduction steps or test case
  • Expected vs actual behavior

Identify suspicious code regions:

  • Functions in the stack trace
  • Code paths leading to the failure
  • Variables involved in the error
  • Conditional branches that may affect the outcome

2. Determine Instrumentation Strategy

Based on the failure type, choose instrumentation targets:

For crashes/exceptions:

  • Function entry/exit in stack trace
  • Variable values before the crash
  • Conditional branches leading to error path
  • Exception handling blocks

For incorrect results:

  • Variable values at key computation points
  • Conditional branch decisions
  • Loop iterations and state changes
  • Function return values

For performance issues:

  • Timing information for slow operations
  • Loop iteration counts
  • Resource allocation/deallocation
  • Function call frequency

For intermittent failures:

  • State variables that may cause non-determinism
  • Thread/concurrency information
  • External dependencies (I/O, network, time)
  • Retry logic and error recovery paths

3. Select Instrumentation Patterns

Choose appropriate patterns based on language and context. See language-specific references:

Common patterns:

  • Function entry/exit logging
  • Variable value tracking
  • Conditional branch tracking
  • Loop iteration monitoring
  • Timing measurements
  • Assertions for invariants

4. Insert Instrumentation

Apply instrumentation to identified code regions:

Minimal approach (start here):

  • Instrument only the immediate failure location
  • Add 2-3 key variable logs
  • Track the critical conditional branch

Expanded approach (if minimal is insufficient):

  • Instrument entire call chain from stack trace
  • Add comprehensive variable tracking
  • Monitor all branches and loops in suspicious functions

Principles:

  • Start minimal, expand as needed
  • Focus on high-signal data (variables that affect control flow)
  • Avoid instrumenting stable, well-tested code
  • Minimize performance overhead

5. Run and Collect Data

Execute the instrumented code:

  • Run the failing test case or reproduction steps
  • Capture all instrumentation output (logs, traces)
  • Ensure instrumentation doesn't change behavior (except performance)

6. Analyze Results

Review captured data to identify root cause:

  • Compare variable values against expectations
  • Identify which branch was taken and why
  • Look for unexpected state transitions
  • Check timing for performance issues
  • Correlate multiple data points

Quick Start Examples

Example 1: NullPointerException in Java

Failure:

NullPointerException at UserService.java:45
  at UserService.processUser(UserService.java:45)
  at UserController.handleRequest(UserController.java:23)

Instrumentation:

java
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);
}

Example 2: Incorrect Calculation in Python

Failure:

AssertionError: Expected 100, got 95
  at test_calculate_total (test_billing.py:12)
  at calculate_total (billing.py:34)

Instrumentation:

python
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 total

Example 3: Intermittent Test Failure in JavaScript

Failure:

Test "should process async data" fails randomly
Expected: data processed
Actual: timeout

Instrumentation:

javascript
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;
}

Instrumentation Guidelines

What to Instrument

High priority:

  • Functions in the stack trace
  • Variables mentioned in error messages
  • Conditional branches near the failure
  • Loop conditions and iteration variables
  • Function parameters and return values

Medium priority:

  • State variables that affect control flow
  • Resource allocations (memory, files, connections)
  • External dependencies (API calls, database queries)
  • Error handling and recovery logic

Low priority:

  • Stable utility functions
  • Simple getters/setters
  • Well-tested library code
  • Performance-critical hot paths (unless investigating performance)

What NOT to Instrument

  • Code unrelated to the failure
  • Third-party libraries (unless suspected)
  • Trivial operations (assignments, simple math)
  • Code that would generate excessive output
  • Security-sensitive operations (passwords, tokens)

Instrumentation Best Practices

  1. Use appropriate log levels: DEBUG for detailed tracing, INFO for key events, ERROR for exceptions
  2. Include context: Variable names, values, types, and relevant state
  3. Mark entry/exit: Clear boundaries for function execution
  4. Timestamp when relevant: For timing and ordering issues
  5. Avoid side effects: Instrumentation should not change program behavior
  6. Clean up after: Remove temporary instrumentation once bug is fixed
  7. Consider permanence: Some instrumentation may be valuable long-term for observability

Language-Specific References

Load these references for detailed instrumentation patterns:

Tips

  • Start small: Instrument one function, run, analyze, then expand if needed
  • Be specific: Log exact variable values, not just "processing data"
  • Use structured logging: Include variable names and context, not just values
  • Test instrumentation: Verify logs appear and contain expected information
  • Iterate quickly: Add instrumentation, run, analyze, repeat
  • Consider performance: For production code, use conditional compilation or feature flags
  • Document findings: Comment why instrumentation was added and what it revealed

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Failure Oriented Instrumentation AI skill do?

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++.

Why use Failure Oriented Instrumentation on TypingMind?

Because you install it once and use it with any model. Failure Oriented Instrumentation is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Failure Oriented Instrumentation in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/failure-oriented-instrumentation. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Failure Oriented Instrumentation?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Failure Oriented Instrumentation?

As many as you like. As long as a model supports skills, you can use Failure Oriented Instrumentation with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Failure Oriented Instrumentation AI skill free?

Yes. It is published on GitHub by ArabelaTso under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇