Skip to content
Back to skills

Safe Git And Error Handling

BSecurity

Use when running git or shell commands, editing configs, or writing backend and script error handling. Prevents data loss, leaked secrets, and silent failures.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
ai-agentspythongoshellgitapibackend

Works with

  • api

Security analysis

B85/100
  • highPerforms destructive filesystem operations

Pro shows the line behind each finding and how to fix it

Scanned November 29, 2026

npx -y skills add Ganesh-Dark/ai-coding-agent-skills --skill safe-git-and-error-handling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Safe Git And Error Handling?

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

Security grade badge for Safe Git And Error Handling
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/ganesh-dark-safe-git-and-error-handling/badge)](https://www.skillsdirectory.com/skills/ganesh-dark-safe-git-and-error-handling)

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
---
name: safe-git-and-error-handling
description: Use when running git or shell commands, editing configs, or writing backend and script error handling. Prevents data loss, leaked secrets, and silent failures.
---

# Safe Git and Error Handling

Silent failures and careless shell commands cause the worst production bugs. Never hide an error just to make a script keep running, and never run destructive workspace commands without permission.

## Rules

- Never run destructive git or file commands (`git reset --hard`, `git checkout -- .`, `git clean -fd`, `rm -rf`) without explicit user approval.
- Do not leave a repo in a detached `HEAD` state or brute-force merge conflicts with `ours`/`theirs`. Inspect the conflicting lines and preserve both sides' intent.
- Never hardcode API keys, tokens, passwords, or private `.env` values in source files, tests, or logs. Read secrets from environment variables.
- Never swallow exceptions with `except: pass`, empty `catch (err) {}`, or `except: return None`. Let failures surface with the function name and the input that broke.
- Validate bad inputs at the start of the function (`None` or `null`, empty strings or lists, missing keys, wrong types) and handle external failures like missing files, timeouts, or non-200 HTTP responses explicitly.

## Example

Bad:
```python
def get_user_age(payload):
    try:
        return int(payload["age"])
    except Exception:
        return 0
```

Good:
```python
def get_user_age(payload):
    if "age" not in payload or payload["age"] is None:
        raise ValueError("Missing required field 'age' in payload")
    return int(payload["age"])
```

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 ai-agents →

Comments

Loading comments…

Newsletter

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