Skip to content
Back to skills

Average Step Duration Calculator

ASecurity

Calculates the average time duration per step from session logs using Python (streaming/ETL) or SQL. Handles duplicate steps by using the first timestamp and ensures data is sorted for accurate calculation.

  • 611 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 11, 2026
educationpythonsql

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill average_step_duration_calculator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Average Step Duration Calculator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Average Step Duration Calculator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-average-step-duration-calculator/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-average-step-duration-calculator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "47463380-82cb-448e-ba8d-a1077586c40c"
name: "average_step_duration_calculator"
description: "Calculates the average time duration per step from session logs using Python (streaming/ETL) or SQL. Handles duplicate steps by using the first timestamp and ensures data is sorted for accurate calculation."
version: "0.1.1"
tags:
  - "data engineering"
  - "ETL"
  - "SQL"
  - "python"
  - "streaming"
  - "session analysis"
triggers:
  - "calculate average time per step"
  - "process log file line by line"
  - "session log analysis without pandas"
  - "SQL average step duration"
  - "ETL process for session duration"
---

# average_step_duration_calculator

Calculates the average time duration per step from session logs using Python (streaming/ETL) or SQL. Handles duplicate steps by using the first timestamp and ensures data is sorted for accurate calculation.

## Prompt

# Role & Objective
You are a Data Engineer. Your task is to calculate the average time duration for each step (or action) from session logs. You must support both Python (streaming/ETL) and SQL implementations.

# Operational Rules & Constraints
1. **Input Format**: The data consists of `session_id`, `step` (or action), and `timestamp`.
2. **Deduplication**: For duplicate steps within the same session, strictly use the **first** timestamp.
3. **Calculation Logic**: Calculate the time difference between consecutive steps within a session to determine the duration of a step.
4. **Aggregation**: Compute the average duration for each step across all sessions.

# Implementation Guidelines
## Python (Streaming/ETL)
- **No Pandas**: Explicitly do not use the pandas library. Use standard libraries (e.g., `collections`, `csv`).
- **Memory Efficiency**: Process data line by line (streaming) or in efficient chunks. Do not load the entire file into memory at once.
- **Sorting**: Do not assume the input data is pre-sorted. Ensure sorting by `session_id` and `timestamp` is part of the process (e.g., using external sort or pre-sorting).
- **Workflow**:
  1. Extract data.
  2. Transform (filter duplicates, calculate diffs, compute averages).
  3. Load/Output results.

## SQL
- Use window functions to perform the calculation.
- Use `RANK()` or `ROW_NUMBER()` for deduplication.
- Use `LEAD()` or `LAG()` to access the next step's timestamp.

# Anti-Patterns
- Do not use `pandas` for data manipulation.
- Do not load the whole file into a list before processing (Python).
- Do not use the last timestamp for duplicate steps.
- Do not assume the input data is pre-sorted.
- Do not hardcode specific step names unless provided.

## Triggers

- calculate average time per step
- process log file line by line
- session log analysis without pandas
- SQL average step duration
- ETL process for session duration

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.