risk-assessment-1-sample-size-selection

Sub-skill of risk-assessment: 1. Sample Size Selection (+1).

5 stars

Best use case

risk-assessment-1-sample-size-selection is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sub-skill of risk-assessment: 1. Sample Size Selection (+1).

Teams using risk-assessment-1-sample-size-selection should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/1-sample-size-selection/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/engineering/marine-offshore/risk-assessment/1-sample-size-selection/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/1-sample-size-selection/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How risk-assessment-1-sample-size-selection Compares

Feature / Agentrisk-assessment-1-sample-size-selectionStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sub-skill of risk-assessment: 1. Sample Size Selection (+1).

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 1. Sample Size Selection (+1)

## 1. Sample Size Selection


```python
def determine_sample_size(
    target_pf: float,
    confidence_level: float = 0.95
) -> int:
    """
    Determine required sample size for target failure probability.

    Rule of thumb: N ≈ 10/Pf for reasonable confidence

    Args:
        target_pf: Target probability of failure
        confidence_level: Confidence level

    Returns:
        Recommended sample size

    Example:
        >>> n = determine_sample_size(target_pf=1e-4, confidence_level=0.95)
        >>> print(f"Recommended samples: {n}")
    """
    # Basic rule: need at least 10 failures
    # So N * Pf ≥ 10
    # N ≥ 10 / Pf

    n_basic = int(10 / target_pf)

    # For higher confidence, increase further
    if confidence_level >= 0.99:
        n_recommended = n_basic * 5
    elif confidence_level >= 0.95:
        n_recommended = n_basic * 3
    else:
        n_recommended = n_basic * 2

    return max(n_recommended, 1000)  # Minimum 1000 samples
```


## 2. Convergence Checking


```python
def check_monte_carlo_convergence(
    data: np.ndarray,
    window_size: int = 1000
) -> dict:
    """
    Check if Monte Carlo simulation has converged.

    Args:
        data: Simulation output data
        window_size: Window size for moving average

    Returns:
        Dictionary with convergence metrics
    """
    n = len(data)

    # Calculate cumulative mean
    cumulative_mean = np.cumsum(data) / np.arange(1, n + 1)

    # Calculate moving coefficient of variation
    if n > window_size:
        moving_std = np.std(data[-window_size:])
        moving_mean = np.mean(data[-window_size:])
        cov = moving_std / moving_mean if moving_mean != 0 else 0
    else:
        cov = np.std(data) / np.mean(data) if np.mean(data) != 0 else 0

    # Convergence criterion: COV < 5%
    converged = cov < 0.05

    return {
        'converged': converged,
        'cov': cov,
        'final_mean': cumulative_mean[-1],
        'samples_used': n
    }
```

Related Skills

test-oversized-skill

5
from vamseeachanta/workspace-hub

A test fixture skill that exceeds 200 lines with multiple H2/H3 sections for split testing.

hse-risk-analyzer

5
from vamseeachanta/workspace-hub

Analyze BSEE HSE (Health, Safety, Environment) incident data for risk assessment. Use for operator safety scoring, incident trend analysis, compliance tracking, and ESG-integrated economic evaluation.

git-blob-size-filter-cleanup

5
from vamseeachanta/workspace-hub

Strip oversized blobs from unpushed commits using git filter-branch when GitHub's 100 MB limit blocks push

risk-and-redundancy

5
from vamseeachanta/workspace-hub

Use when populating the Watch-outs section of a trip plan. Encodes failure modes (closures, weather, motion sickness, altitude, kid logistics) and the rule that every trip needs a Plan B for load-bearing legs. Invoked by trip-planner.

lodging-selection

5
from vamseeachanta/workspace-hub

Use when recommending lodging inside a trip plan. Encodes the hotel-vs-Airbnb decision matrix, walk-distance gates, never-fabricate-listings rule, and the specific search-criteria template for Airbnb/Vrbo entries. Invoked by trip-planner.

scientific-problem-selection

5
from vamseeachanta/workspace-hub

Systematic framework for scientific problem selection, project ideation, troubleshooting stuck projects, and strategic research decisions.

ai-tool-assessment

5
from vamseeachanta/workspace-hub

Assess and report on AI tool subscriptions, usage patterns, and cost-effectiveness. Use for reviewing AI subscriptions, analyzing tool usage, optimizing AI spend.

risk-assessment

5
from vamseeachanta/workspace-hub

Perform probabilistic risk assessment with Monte Carlo simulations for offshore marine operations

multi-tool-architecture-assessment

5
from vamseeachanta/workspace-hub

Systematic comparison of competing tools/approaches before committing to a multi-account, multi-tool architecture. Uses parallel subagents for research, system-state audit, and data quality analysis. Produces a decision matrix with explicit trade-offs.

legal-risk-assessment

5
from vamseeachanta/workspace-hub

Assess and classify legal risks using a severity-by-likelihood framework with escalation criteria

core-context-management-size-limits-mandatory

5
from vamseeachanta/workspace-hub

Sub-skill of core-context-management: Size Limits (MANDATORY) (+3).

clean-code-file-size-decision-tree

5
from vamseeachanta/workspace-hub

Sub-skill of clean-code: File Size Decision Tree.