@xynogen/pix-skills 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xynogen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # pix-skills
2
+
3
+ Pi coding agent extension — skill loader tool + skills bundle.
4
+
5
+ ## What's included
6
+
7
+ | Resource | Type | Description |
8
+ |---|---|---|
9
+ | `read_skill` | tool | Load a bundled skill's full instructions by name. `name="list"` lists all skills with descriptions. |
10
+ | `skills/` | skills | 21 bundled skills (auto-loaded by pi at startup — names + descriptions in system prompt) |
11
+
12
+ ## How it works
13
+
14
+ Pi loads skill *descriptions* into the system prompt at startup (progressive disclosure). Full content
15
+ only enters context when the agent calls `read_skill(name=<skill>)` — or reads the file via the `read` tool.
16
+
17
+ `read_skill` is the safe version of "agent prompts itself":
18
+ - Agent calls tool explicitly — no autonomous injection
19
+ - Orchestrator (user or system prompt) decides when skill loading is appropriate
20
+ - Auditable: tool call is visible in the conversation
21
+
22
+ ## Skills
23
+
24
+ | Skill | Trigger |
25
+ |---|---|
26
+ | `audit` | manual |
27
+ | `bootstrap` | manual |
28
+ | `brainstorm` | manual |
29
+ | `clone` | auto — git URL / `owner/repo` |
30
+ | `commit` | manual — "commit this", "make a commit" |
31
+ | `debug` | auto — bug / error / doesn't work |
32
+ | `explain` | auto — explain / how does |
33
+ | `finish` | manual |
34
+ | `handoff` | manual |
35
+ | `plan` | auto — plan / design / architect |
36
+ | `readme` | manual |
37
+ | `review` | auto — review / check / audit |
38
+ | `runner` | manual |
39
+ | `search` | auto — search / find / look up |
40
+ | `standup` | manual |
41
+ | `suggest` | auto — suggest / recommend |
42
+ | `task` | auto — task / todo / checklist |
43
+ | `test` | auto — test / spec / coverage |
44
+ | `tldr` | auto — tldr / summarize |
45
+ | `ui` | manual |
46
+ | `verify` | auto — verify / validate / confirm |
47
+
48
+ ## Usage
49
+
50
+ ```
51
+ # Agent lists available skills
52
+ read_skill(name="list")
53
+
54
+ # Agent loads full commit procedure before committing
55
+ read_skill(name="commit")
56
+
57
+ # User explicitly triggers a skill
58
+ /skill:commit
59
+ ```
60
+
61
+ ## Install
62
+
63
+ ```bash
64
+ pi install git:github.com/xynogen/pix-mono#packages/pix-skills
65
+ ```
66
+
67
+ Or from the monorepo:
68
+
69
+ ```bash
70
+ pi install ./packages/pix-skills
71
+ ```
72
+
73
+ ## License
74
+
75
+ MIT
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@xynogen/pix-skills",
3
+ "version": "0.1.0",
4
+ "description": "Pi extension — agent skill loader (read_skill tool + skills bundle)",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "scripts": {
8
+ "test": "bun test"
9
+ },
10
+ "files": [
11
+ "src",
12
+ "skills",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "pi": {
17
+ "extensions": [
18
+ "src/index.ts"
19
+ ],
20
+ "skills": [
21
+ "./skills"
22
+ ]
23
+ },
24
+ "keywords": [
25
+ "pi",
26
+ "pi-package",
27
+ "pi-extension",
28
+ "pix"
29
+ ],
30
+ "author": "xynogen",
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/xynogen/pix-mono.git",
35
+ "directory": "packages/pix-skills"
36
+ },
37
+ "homepage": "https://github.com/xynogen/pix-mono/tree/main/packages/pix-skills#readme",
38
+ "bugs": {
39
+ "url": "https://github.com/xynogen/pix-mono/issues"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@earendil-works/pi-coding-agent": "*",
46
+ "@earendil-works/pi-tui": "*"
47
+ }
48
+ }
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: audit
3
+ description: Security audit, integrity check, and health scan. Use only on explicit request — "audit this", "security scan", "check for secrets", "is this safe", "find vulnerabilities".
4
+ disable-model-invocation: true
5
+ ---
6
+ # Audit Directive
7
+
8
+ ## Goal
9
+ Surface every risk with evidence + severity. No vague warnings — each finding locatable + actionable.
10
+
11
+ ## Below are what agent MUST do:
12
+
13
+ ### Phase 1: Scan
14
+ - **AUTO-RUN**: Run scans without confirmation unless input required.
15
+ - **SECRETS**: Grep credential patterns — API keys, tokens, `password=`, private keys, connection strings. Check committed files AND history if asked.
16
+ - **INTEGRITY**: Verify imports resolve, symlinks valid, cross-module refs intact.
17
+ - **BLOAT**: Find duplicate logic, unused deps, dead files.
18
+ - **HEALTH**: Flag outdated packages, deprecated APIs, known CVEs.
19
+ - **INPUTS**: Check unvalidated user input → injection, path traversal, unsafe deserialization.
20
+
21
+ ### Phase 2: Report
22
+ ```
23
+ ## Audit Findings
24
+
25
+ ### 🔴 Critical
26
+ - **[Issue]** — `file:line`
27
+ Evidence: [exact match/snippet]
28
+ Fix: [remediation step]
29
+
30
+ ### 🟡 Warning
31
+ - **[Issue]** — `file:line` · Fix: [step]
32
+
33
+ ### 🔵 Info
34
+ - **[Issue]** — `file:line` · Note: [context]
35
+
36
+ ## Summary
37
+ [N critical, N warning, N info. Top priority: ...]
38
+ ```
39
+
40
+ ## Severity Rules
41
+ - **🔴 Critical**: exposed secret, RCE, injection, auth bypass. Fix first.
42
+ - **🟡 Warning**: outdated dep with CVE, missing input validation, weak crypto.
43
+ - **🔵 Info**: dead code, style risk, hardening opportunity.
44
+
45
+ ## Red Flags — STOP
46
+ - Reporting finding without `file:line` evidence.
47
+ - Claiming "no issues found" without stating what scanned.
48
+ - Auto-fixing secrets in git history (destructive — confirm with user first).
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: bootstrap
3
+ description: Project and tool scaffolding using authoritative docs for best practices. Use only on explicit request — "scaffold a project", "set up X", "bootstrap this", "init a new service".
4
+ disable-model-invocation: true
5
+ ---
6
+ # Bootstrap & Scaffolding Directive
7
+
8
+ ## Goal
9
+ Produce runnable, convention-correct project skeleton. New developer clones it + runs it in five minutes.
10
+
11
+ ## Below are what agent MUST do:
12
+
13
+ ### Phase 1: Research
14
+ - **AUTO-RUN**: Run setup commands without confirmation unless input required.
15
+ - **RESEARCH**: Use authoritative docs for target language/framework setup. Don't guess flags — verify with `--help` or docs.
16
+ - **CONFIRM STACK**: Language/framework/package-manager ambiguous → ask one question before scaffolding.
17
+
18
+ ### Phase 2: Scaffold
19
+ - **INIT**: Run standard init (`npm init -y`, `cargo init`, `go mod init`, `uv init`, etc.).
20
+ - **STRUCTURE**: Create standard layout — `src/`, `tests/`, `docs/`. Mirror community conventions for that ecosystem.
21
+ - **DEPENDENCIES**: Install core libs via project manager. Pin versions.
22
+ - **ENVIRONMENT**: Generate `.env.example`; document every required env var. Never write real secrets.
23
+ - **TOOLING**: Set up linter, formatter, CI config matching ecosystem defaults.
24
+
25
+ ### Phase 3: Verify
26
+ - Run project build/test command. Confirm clean baseline passes.
27
+ - Confirm `README` or `.env.example` lists everything needed to run.
28
+
29
+ ### Phase 4: Report
30
+ ```
31
+ ## Scaffolded: [project name]
32
+
33
+ **Stack:** [lang/framework/pm]
34
+ **Layout:**
35
+ src/ ...
36
+ tests/ ...
37
+
38
+ **Run it:**
39
+ 1. [command]
40
+ 2. [command]
41
+
42
+ **Env vars required:** see `.env.example`
43
+ **Baseline:** `[test command]` → PASS
44
+ ```
45
+
46
+ ## Red Flags — STOP
47
+ - Scaffolding before confirming ambiguous stack.
48
+ - Inventing init flags instead of checking docs.
49
+ - Writing real secrets into `.env` (use `.env.example` with placeholders).
50
+ - Declaring done without running baseline build/test once.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: brainstorm
3
+ description: Design exploration and spec refinement before any implementation begins
4
+ disable-model-invocation: true
5
+ ---
6
+ # Brainstorm Directive
7
+
8
+ ## Hard Gate
9
+ ```
10
+ DO NOT write code, scaffold project, or take implementation action
11
+ until you present a design AND user approves it.
12
+ ```
13
+ Applies to EVERY request, regardless of perceived simplicity.
14
+
15
+ ## Below are what agent MUST do:
16
+
17
+ ### Step 1: Explore Context
18
+ - Check existing files, docs, recent git commits.
19
+ - Understand what already exists before proposing anything new.
20
+
21
+ ### Step 2: Ask Clarifying Questions
22
+ - Ask ONE question at a time. Don't overwhelm.
23
+ - Prefer multiple-choice when possible.
24
+ - Focus on: purpose, constraints, success criteria, edge cases.
25
+ - Continue until you understand full scope.
26
+
27
+ ### Step 3: Propose 2-3 Approaches
28
+ - Present distinct approaches with trade-offs.
29
+ - Lead with recommended option, explain WHY.
30
+ - Apply YAGNI ruthlessly — remove unnecessary features from all proposals.
31
+
32
+ ### Step 4: Present Design for Approval
33
+ - Present design in sections scaled to complexity.
34
+ - Cover: architecture, components, data flow, error handling, testing strategy.
35
+ - Ask approval after each section. Revise if needed.
36
+
37
+ ### Step 5: Write Design Doc
38
+ - Save validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`.
39
+ - Commit design document to git.
40
+
41
+ ### Step 6: Transition to Implementation
42
+ - Invoke `/plan` workflow to create detailed implementation plan.
43
+ - Do NOT start coding directly. `/plan` is next step.
44
+
45
+ ## Key Principles
46
+ - **One question at a time** — Don't overwhelm
47
+ - **YAGNI ruthlessly** — Remove unnecessary features from all designs
48
+ - **Explore alternatives** — Always propose 2-3 approaches before settling
49
+ - **Incremental validation** — Present design, get approval before moving on
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: clone
3
+ description: Clone any git repository (GitHub/GitLab/Bitbucket URL, SSH, or owner/repo shorthand) into /tmp/clones for read-only code exploration. Use proactively whenever the user provides a git URL, asks to "look at", "explore", "read", "check out", or "analyze" an external repository, or shares a github.com/gitlab.com/bitbucket.org link.
4
+ disable-model-invocation: true
5
+ ---
6
+ # Clone Directive
7
+ ## Below are what agent MUST do:
8
+ - **AUTO-RUN**: Run terminal commands proactively without confirmation unless explicit input required.
9
+ - **AUTO-INVOKE**: Trigger automatically when user message contains git URL, repo shorthand (`owner/repo`), or phrases like "clone", "look at this repo", "explore", "analyze this project", "check out <url>".
10
+ - **INPUT**: Accept git URL (https, ssh, or `github.com/owner/repo` / `owner/repo` shorthand). Normalize shorthand → `https://github.com/owner/repo`.
11
+ - **TARGET**: Derive repo name from URL (strip `.git`). Clone dest: `/tmp/clones/<repo-name>`.
12
+ - **IDEMPOTENT**: `/tmp/clones/<repo-name>` exists + is git repo → `cd` in, `git fetch --all --prune`, report current branch/HEAD instead of re-cloning. Path exists but NOT git repo → abort with error.
13
+ - **CLONE**: Use `git clone --depth=1` by default for speed. User requests full history → drop `--depth`. Always clone into `/tmp/clones/<repo-name>`.
14
+ - **EXPLORE**: After clone/fetch, immediately:
15
+ - Print absolute path of clone
16
+ - List top-level entries (`ls -la`)
17
+ - Show `README.md` first 50 lines if present
18
+ - Detect project type (package.json, Cargo.toml, go.mod, pyproject.toml, etc.) and report stack
19
+ - Print `git log --oneline -5` for recent context
20
+ - **READY**: End with one-line summary: `Repo ready at /tmp/clones/<name> — <stack> — <N> files at root`. Agent now positioned to answer follow-up questions about the code.
21
+ - **NO MUTATIONS**: Treat clone as read-only. Do NOT commit, push, or modify files unless user explicitly requests it.
22
+ - **CLEANUP NOTE**: `/tmp` is ephemeral (cleared on reboot). Inform user if they want persistence to move it elsewhere.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: commit
3
+ description: Split, write, and maintain Conventional-Commit-style commits. Use only on explicit request — "commit this", "make a commit", "split these changes", "amend/squash the history".
4
+ disable-model-invocation: true
5
+ ---
6
+ # Conventional Commit Management Directive
7
+
8
+ ## The Iron Law
9
+ ```
10
+ INVOCATION IS PERMISSION. User invoked this skill → commit without asking again.
11
+ Still forbidden: secrets, binaries, unrelated changes, trailer metadata.
12
+ ```
13
+
14
+ ## Below are what agent MUST do:
15
+
16
+ ### Phase 1: Inspect
17
+ - **AUTO-RUN**: Run `git status` and `git diff` (staged + unstaged), then proceed straight to commit. Do NOT pause for "may I commit?" confirmation — user already asked.
18
+ - **GITIGNORE**: Before staging, inspect untracked/generated files. Add obvious ignore candidates to `.gitignore` (build dirs, caches, logs, temp files, editor/OS junk, local env files). Re-run `git status`. Uncertain whether file should be ignored vs committed → ask user before changing `.gitignore` or staging it.
19
+ - **GROUP**: Cluster changes by path/module and by functionality. Each cluster → one self-contained commit.
20
+ - **GUARD**: Scan diff for secrets, binaries, debug logs, unrelated edits. Halt and report if found.
21
+
22
+ ### Phase 2: Validate
23
+
24
+ #### 2a. Detect runner
25
+ Scan project root for a task runner file in this priority order:
26
+ 1. `justfile` — run `just lint check`, `just format check`, `just test unit`
27
+ 2. `mise.toml` / `.mise.toml` — run `mise run lint check`, `mise run format check`, `mise run test unit`
28
+ 3. `Makefile` — run `make lint-check`, `make format-check`, `make test-unit`
29
+ 4. `Taskfile.yml` — run `task lint:check`, `task format:check`, `task test:unit`
30
+ 5. `package.json` — run `npm run lint:check`, `npm run format:check`, `npm run test:unit`
31
+ 6. `run.sh` — run `./run.sh lint check`, `./run.sh format check`, `./run.sh test unit`
32
+
33
+ #### 2b. Runner or tasks missing
34
+ If **no runner file exists** OR the runner exists but **lacks `lint`, `format`, or `test` tasks**:
35
+ - Ask user:
36
+ > Runner / task(s) not found. Options:
37
+ > A) **Create runner + tasks now** — invoke the `runner` skill to generate missing tasks, then run them before committing.
38
+ > B) **Skip validation** — commit without lint/format/test (risky; recorded in commit body).
39
+ > C) **Abort** — stop here; user will set up runner manually.
40
+ - If user picks A: invoke runner skill, generate the missing tasks, re-detect, then proceed with 2c.
41
+ - If user picks B: proceed to Phase 3. Append `skip-validation: lint format test` to commit body as a reminder.
42
+ - If user picks C: halt. Report what's missing and suggest running the `runner` skill manually.
43
+
44
+ #### 2c. Run checks (in order)
45
+ 1. **Lint** (`lint check`) — static analysis. Failure → STOP, report issues, do not commit.
46
+ 2. **Format** (`format check`) — style check (dry-run). Failure → auto-run `format fix`, show diff, then re-run `format check` to confirm clean. Still failing → STOP.
47
+ 3. **Unit tests** (`test unit`) — correctness. Failure → STOP, report failing tests, do not commit.
48
+
49
+ All three must be green before proceeding to Phase 3.
50
+
51
+ ### Phase 3: Compose
52
+ Format: `<type>(<scope>): <subject>`
53
+ - **type**: `feat` · `fix` · `chore` · `refactor` (also `docs`, `test`, `perf` when apt).
54
+ - **scope**: module/area touched. Clear, lowercase.
55
+ - **subject**: imperative, concise, no trailing period.
56
+
57
+ ```
58
+ feat(auth): add token refresh on 401
59
+ fix(parser): handle empty CUDA frame without panic
60
+ refactor(api): extract response builder from handler
61
+ ```
62
+
63
+ ### Phase 4: Split & Stage
64
+ - Stage per cluster: `git add <paths>` (or `-p` for partial hunks).
65
+ - One commit per logical change. Never mix `feat` + unrelated `fix` in one commit.
66
+
67
+ ### Phase 5: Maintain (when asked)
68
+ - Squash/amend/reorder to keep history clean. Remove WIP commits.
69
+ - Never rewrite pushed history without explicit confirmation (irreversible for collaborators).
70
+
71
+ ## Authorship Rule
72
+ - Commits authored solely by user's git config identity.
73
+ - Do NOT add `Co-Authored-By`, `Signed-off-by`, or any trailer metadata.
74
+
75
+ ## Red Flags — STOP
76
+ - Asking "should I commit?" after skill invoked — invocation already answered that.
77
+ - Secrets, binaries, or `console.log`/`print` debug lines in diff.
78
+ - One commit bundling unrelated changes.
79
+ - Tests/lints not run, or failing.
80
+ - Rewriting pushed history without confirmation.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: debug
3
+ description: Root-Cause Analysis and self-annealing procedure for error resolution
4
+ disable-model-invocation: true
5
+ ---
6
+ # Debug & Anneal Directive
7
+
8
+ ## The Iron Law
9
+ ```
10
+ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
11
+ ```
12
+ Phase 1 not complete → you CANNOT propose fixes.
13
+
14
+ ## First Principles Debugging
15
+ Before diving into symptoms, strip problem to fundamentals:
16
+ 1. **What MUST be true** for system to work correctly? List the invariants.
17
+ 2. **Which invariant violated?** Bug lives where reality diverges from required truth.
18
+ 3. **Why violated?** Trace from violated invariant backward — ignore surface symptoms.
19
+ 4. Do NOT reason by analogy ("last time this error meant X"). Reason from mechanism ("this error means Y in state Z, which requires W to have failed").
20
+
21
+ ## Below are what agent MUST do:
22
+
23
+ ### Phase 1: Root Cause Investigation
24
+ - **READ**: Read error messages and stack traces completely. Note line numbers, file paths, error codes.
25
+ - **REPRODUCE**: Reproduce error consistently. Not reproducible → gather more data, do NOT guess.
26
+ - **CHANGES**: Check recent changes (git diff, recent commits, new deps, config changes).
27
+ - **EVIDENCE**: Multi-component systems → add diagnostic logging at each boundary BEFORE proposing fixes. Run once to gather evidence, THEN analyze.
28
+ - **TRACE**: Trace data flow backward through call stack to find original trigger. Fix at source, not symptom.
29
+
30
+ ### Phase 2: Pattern Analysis
31
+ - **EXAMPLES**: Find working examples of similar code in codebase.
32
+ - **COMPARE**: Compare working vs broken. List every difference, however small.
33
+ - **DEPENDENCIES**: Understand what config, environment, or assumptions code relies on.
34
+
35
+ ### Phase 3: Hypothesis and Testing
36
+ - **HYPOTHESIZE**: State clearly: "I think X is root cause because Y." Write it down.
37
+ - **TEST MINIMALLY**: Make SMALLEST possible change to test hypothesis. One variable at a time.
38
+ - **VERIFY**: Worked? Yes → Phase 4. No → form NEW hypothesis. Do NOT stack fixes.
39
+
40
+ ### Phase 4: Implementation
41
+ - **TEST FIRST**: Create failing test reproducing bug BEFORE writing fix.
42
+ - **FIX**: Implement single, targeted fix addressing root cause. No "while I'm here" changes.
43
+ - **VERIFY**: Confirm test passes and no regressions via `/test`.
44
+ - **ANNEAL**: Error due to missing rules → update appropriate Directive.
45
+
46
+ ## Escalation Rule
47
+ - 3+ fixes failed → **STOP**. Question the architecture. Discuss with user before more fixes. This is wrong architecture, not wrong hypothesis.
48
+
49
+ ## Red Flags — STOP and Return to Phase 1
50
+ - "Quick fix for now, investigate later"
51
+ - "Just try changing X and see if it works"
52
+ - "It's probably X, let me fix that"
53
+ - "I don't fully understand but this might work"
54
+ - "One more fix attempt" (when already tried 2+)
55
+ - Each fix reveals new problem in different place
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: explain
3
+ description: Technical deconstruction and logic tracing. Use when user asks "how does X work", "explain this", "walk me through", "what does this do", or needs to understand existing code/architecture before changing it.
4
+ disable-model-invocation: true
5
+ ---
6
+ # Explain Directive
7
+
8
+ ## Goal
9
+ Make code understandable from local reading. After explaining, reader grasps intent without re-tracing codebase themselves.
10
+
11
+ ## Below are what agent MUST do:
12
+
13
+ ### Phase 1: Locate & Scope
14
+ - **AUTO-RUN**: Run searches and reads needed without confirmation unless input required.
15
+ - **CONTEXT**: Identify exact target — file, function, class, or concept. Quote the `file:line` under discussion.
16
+ - **READ**: Read full target plus immediate callers and callees. Don't explain from name alone.
17
+
18
+ ### Phase 2: Deconstruct
19
+ - **STRUCTURE**: Break logic into named components (inputs → transform → outputs → side effects).
20
+ - **TRACE**: Map data flow and call chain. State where data enters, what mutates it, where it exits.
21
+ - **RATIONALE**: Explain the *why* behind non-obvious choices. Why unknowable → say so, don't invent intent.
22
+ - **CONTRACTS**: Note types, invariants, assumptions code relies on.
23
+
24
+ ### Phase 3: Report
25
+ Use this structure:
26
+ ```
27
+ ## What it does
28
+ [One sentence.]
29
+
30
+ ## How it works
31
+ 1. [Step] — `file:line`
32
+ 2. [Step] — `file:line`
33
+
34
+ ## Data flow
35
+ [input] → [transform] → [output/side-effect]
36
+
37
+ ## Why this way
38
+ [Design rationale, or "rationale not documented" if unknown.]
39
+
40
+ ## Gotchas
41
+ [Non-obvious behavior, edge cases, hidden dependencies.]
42
+ ```
43
+
44
+ ## Red Flags — STOP
45
+ - Explaining from function name without reading its body.
46
+ - Inventing rationale not supported by code or comments.
47
+ - Describing *what* a line does when self-evident — explain *why* instead.
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: finish
3
+ description: Structured branch completion — verify, decide, and clean up when implementation is done
4
+ disable-model-invocation: true
5
+ ---
6
+ # Finish Directive
7
+
8
+ ## Overview
9
+ Guide completion of dev work by verifying tests + presenting clear options for the branch.
10
+
11
+ **Core principle:** Verify tests → Present options → Execute choice → Clean up.
12
+
13
+ ## Below are what agent MUST do:
14
+
15
+ ### Step 1: Verify Tests
16
+ Run full test suite BEFORE presenting any options.
17
+ ```bash
18
+ # Use the project's test command, e.g.:
19
+ pytest / npm test / go test ./... / cargo test
20
+ ```
21
+ - Tests **fail** → Show failures. Do NOT proceed to Step 2. Fix first.
22
+ - Tests **pass** → Continue.
23
+
24
+ ### Step 2: Present Options
25
+ Present exactly these 4 options — no more, no less:
26
+ ```
27
+ Implementation complete. All tests pass. What would you like to do?
28
+
29
+ 1. Merge into <base-branch> locally
30
+ 2. Push and create a Pull Request
31
+ 3. Keep the branch as-is (handle it later)
32
+ 4. Discard this work
33
+
34
+ Which option?
35
+ ```
36
+
37
+ ### Step 3: Execute Choice
38
+
39
+ **Option 1 — Merge locally:**
40
+ ```bash
41
+ git checkout <base-branch>
42
+ git pull
43
+ git merge <feature-branch>
44
+ <run tests again on merged result>
45
+ git branch -d <feature-branch>
46
+ ```
47
+
48
+ **Option 2 — Create PR:**
49
+ ```bash
50
+ git push -u origin <feature-branch>
51
+ gh pr create --title "<title>" --body "## Summary
52
+ - <bullet of what changed>
53
+
54
+ ## Test Plan
55
+ - [ ] <verification steps>"
56
+ ```
57
+
58
+ **Option 3 — Keep as-is:**
59
+ Report: "Branch `<name>` kept. No changes made."
60
+
61
+ **Option 4 — Discard:**
62
+ Require typed confirmation first:
63
+ ```
64
+ This will permanently delete branch <name> and all its commits.
65
+ Type 'discard' to confirm.
66
+ ```
67
+ Then:
68
+ ```bash
69
+ git checkout <base-branch>
70
+ git branch -D <feature-branch>
71
+ ```
72
+
73
+ ## Red Flags — Never
74
+ - Proceed with failing tests
75
+ - Merge without re-running tests on merged result
76
+ - Delete work without typed confirmation
77
+ - Force-push without explicit user request
78
+ - Add extra options beyond the 4 listed