Przejdź do treści
Biblioteka skilli
AI i agenci · Nauka i wyjaśnianie

agent-session-hooks

/agent-session-hooks

Wyjaśnia działanie skryptów startowych sesji agenta i wstrzykiwania kontekstu oraz pomaga, gdy hook sesji zgłasza błąd, na przykład przy nazwie gałęzi, worktree, podpisywaniu commitów lub uwierzytelnieniu gh.

Repozytorium
codebase ↗
Licencja
MIT
Ostatnia zmiana repozytorium
26.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wyjaśnia działanie skryptów startowych sesji agenta i wstrzykiwania kontekstu oraz pomaga, gdy hook sesji zgłasza błąd, na przykład przy nazwie gałęzi, worktree, podpisywaniu commitów lub uwierzytelnieniu gh.

Oryginalny opis (EN)

Explains how startup scripts run at the start of agent sessions and inject context. Use when an agent session reports a failing hook (e.g. validate-session-branch-name.sh, validate-session-worktree-name.sh, validate-session-commit-signing.sh, validate-session-gh-authentication.sh, validate-session-skills.sh), or when adding a new startup check.

Jak działa

  1. When to Use This Skill
  2. Architecture
  3. Adding a New Check
Sekcje z nagłówków SKILL.md, w oryginale · 48 linii, 520 słów
Podgląd SKILL.md
---
name: agent-session-hooks
description: Explains how startup scripts run at the start of agent sessions and inject context. Use when an agent session reports a failing hook (e.g. validate-session-branch-name.sh, validate-session-worktree-name.sh, validate-session-commit-signing.sh, validate-session-gh-authentication.sh, validate-session-skills.sh), or when adding a new startup check.
---
# Agent Session Hooks

Startup checks run at the start of every agent session and inject their failure as additional context. **Fix what they report before writing any code** — each one names the problem and the command that repairs it.

## When to Use This Skill

- When an agent session fails at startup due to a hook.
- When you need to understand how the session gets context about branches, worktrees, git signing, GitHub authentication, or missing skills.
- When you need to add a new check that should run for every agent session.

## Architecture

| Script                                  | Checks                                                                                                            |
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `validate-session-branch-name.sh`       | Shim over `validation`'s `session-branch-name`: branch follows `<type>/<scope>-<description>`                     |
| `validate-session-worktree-name.sh`     | Shim over `validation`'s `session-worktree-name`: worktree is kebab-case and gitignored                           |
| `validate-session-commit-signing.sh`    | `commit.gpgsign`, `user.signingkey`, and a GPG signing smoke test                                                 |
| `validate-session-gh-authentication.sh` | The active `gh` account plus Projects access                                                                      |
| `validate-session-skills.sh`            | Shim over `synchronization`'s `installed-skills check`: every skill in `skills-lock.json` is present              |
| `validate-session-hooks-path.sh`        | `core.hooksPath` resolves to a directory holding a pre-commit hook; git runs no hooks, silently, when it does not |

Each script is registered twice, once per harness, and both registrations point at the same file:

| Harness        | Registration                                      |
| -------------- | ------------------------------------------------- |
| Claude Code    | `SessionStart` entries in `.claude/settings.json` |
| GitHub Copilot | `sessionStart` entries in `.github/hooks/*.json`  |

## Adding a New Check

When adding a check: put the script under `scripts/git/`, emit through `scripts/git/emit-session-hook-context.sh` so both harnesses can read it, and register it in both places.

A check that needs real logic belongs in a NestJS command that only prints the context and sets an exit code, with the hook reduced to a shim over it. `validate-session-skills.sh`, `validate-session-branch-name.sh`, and `validate-session-worktree-name.sh` are the pattern: from the repository root, run the command with standard error discarded, exit when it succeeds, and otherwise pipe whatever it printed into the emitter, naming how a person reruns the check:

```bash
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 0
CONTEXT="$(<command> 2>/dev/null)" && exit 0
printf '%s' "${CONTEXT}" | bash scripts/git/emit-session-hook-context.sh "<rerun command>"
```

An empty context is how the emitter learns the command could not run at all. With no finished install (`node_modules/.modules.yaml` absent) it directs the agent to run `pnpm install`; otherwise it directs the agent to the rerun command, whose error the shim discarded. Without `node` it stays silent, since nothing can be emitted.

The command must therefore print nothing to standard output except the context, which is why the `synchronization` and `validation` command-line applications send their logs to standard error; a project hosting a new hook command must do the same. Which project a command belongs in follows each project's own rule: a `check` with a `write` belongs in `synchronization`, a one-sided check in `validation`.

The signing and authentication hooks stay pure shell on purpose, since they must still work when `node_modules` is broken; see `validation/AGENTS.md`.

Why the credential checks resolve the session's own token and signing configuration rather than the hook shell's, and why a hook can fail but never hang, is in [ADR 0010](../../documentation/adr/0010-judge-the-credentials-a-session-really-uses.md).

Wersje

W bazie nie ma innych skilli o nazwie agent-session-hooks.

Migawka bazy z 13.11.2026 · wersja paczki a51833360548 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100sessions
    Listuje i czyta sesje oraz wątki agentów, a także dopasowuje worktree lub proces do sesji.
  • 100hooks-session-start-hook
    Tworzy hook SessionStart dla Claude Code w przeglądarce, aby przy starcie zdalnej sesji automatycznie instalowały się zależności oraz uruchamiały testy i lintery.
  • 95agent-workflow
    Planuje i ulepsza codzienny przepływ pracy z agentami kodującymi: start sesji, odzyskiwanie kontekstu, weryfikację i worktree.
  • 100skill-session-analyzer
    Analizuje zapisane sesje Claude Code i sprawdza, czy skill, agent lub hook działały zgodnie ze specyfikacją.
  • 100plugin-hooks
    Opisuje hooki Claude Code, czyli skrypty uruchamiane przed i po wywołaniach narzędzi, zdarzeniach sesji i zmianach plików: PreToolUse, PostToolUse, SessionStart, Stop, Notification, FileChanged i WorktreeCreate.
  • 100hooks-author
    Podpowiada, kiedy użyć hooka użytkownika w pi zamiast doraźnego polecenia bash lub pełnego rozszerzenia, na przykład do logowania poleceń, formatowania po edycji czy wstrzykiwania kontekstu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.