Skip to content
Back to skills

Decomposition 2026 11 05

ASecurity

Сама по себе она не «сломана» для последовательностей вроде `list`, `tuple`, `str` и неотрицательного целого `n`: `xs[:n]` вернёт первые `n` элементов. Но есть несколько проблем/подводных камней: 1. **Отрицательное `n` работает не так, как ожидается от `head`/`take`.** В Python срез `xs[:n]` при `n < 0` означает «всё, кроме последних `|n|` элементов»: ```python head([1, 2, 3], -1) # [1, 2], а не ошибка и не [] ``` Обычно для «взять первые n» отрицательное `n` должно давать `ValueError` или п...

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
ai-agentspython

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned November 11, 2026

npx -y skills add Siririn77/i-have-autism --skill decomposition-2026-11-05 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Decomposition 2026 11 05?

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

Security grade badge for Decomposition 2026 11 05
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/siririn77-decomposition-2026-11-05-f04d2b80/badge)](https://www.skillsdirectory.com/skills/siririn77-decomposition-2026-11-05-f04d2b80)

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
Сама по себе она не «сломана» для последовательностей вроде `list`, `tuple`, `str` и неотрицательного целого `n`: `xs[:n]` вернёт первые `n` элементов.

Но есть несколько проблем/подводных камней:

1. **Отрицательное `n` работает не так, как ожидается от `head`/`take`.**  
   В Python срез `xs[:n]` при `n < 0` означает «всё, кроме последних `|n|` элементов»:
   ```python
   head([1, 2, 3], -1)  # [1, 2], а не ошибка и не []
   ```
   Обычно для «взять первые n» отрицательное `n` должно давать `ValueError` или пустой результат.

2. **Имя `head` обычно означает «первый элемент», а не «первые n элементов».**  
   В Haskell/многих библиотеках `head(xs)` — это `xs[0]`. Для «первые n» лучше имя `take`.

3. **Функция работает только с объектами, поддерживающими срезы.**  
   Для генератора/итератора будет ошибка:
   ```python
   head((x for x in range(10)), 3)  # TypeError
   ```
   Для произвольного итерируемого нужно что-то вроде `itertools.islice`.

4. **Нет валидации `n`.**  
   Например, `n=None` или `n=1.5` приведут к `TypeError`; это может быть нормально, но если функция публичная, лучше явно проверять контракт.

Более аккуратный вариант для последовательностей:
```python
def take(xs, n):
    if not isinstance(n, int):
        raise TypeError("n must be an integer")
    if n < 0:
        raise ValueError("n must be non-negative")
    return xs[:n]
```

Если же нужен именно `head` как «первый элемент»:
```python
def head(xs):
    if not xs:
        raise ValueError("empty sequence")
    return xs[0]
```

Files in this skill

  • SCORE.md6.6 KB
  • answer-estimate_with-skill.md4 KB
  • answer-estimate_without-skill.md3 KB
  • answer-next-step_with-skill.md1.1 KB
  • answer-next-step_without-skill.md2.7 KB
  • answer-no-preamble_with-skill.md2.5 KB
  • answer-no-preamble_without-skill.md2.7 KB
  • cases.json14.4 KB
  • code-edge-negative_with-skill.md2 KB
  • code-edge-negative_without-skill.md2.2 KB
  • comment-says-why_with-skill.md2.8 KB
  • comment-says-why_without-skill.md1.2 KB
  • decomposition-huge_with-skill.md14.3 KB
  • decomposition-huge_without-skill.md9.8 KB
  • decomposition-small_with-skill.md1.4 KB
  • decomposition-small_without-skill.md242 B
  • destructive-needs-confirmation_with-skill.md3.5 KB
  • destructive-needs-confirmation_without-skill.md3.7 KB
  • disagree-first-line_with-skill.md1.9 KB
  • disagree-first-line_without-skill.md1.3 KB

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.