Compare commits
51
Commits
a0c5280aac
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6c2cb083d | ||
|
|
4293880737 | ||
|
|
17acb1eab1 | ||
|
|
8f451d3b88 | ||
|
|
09232e0c9a | ||
|
|
8238d5a283 | ||
|
|
fcdd3f7a8c | ||
|
|
abf9b8e7ec | ||
|
|
fa9813daa4 | ||
|
|
71525bc349 | ||
|
|
01c488157d | ||
|
|
d956e513a4 | ||
|
|
4d39989424 | ||
|
|
781aa7dc94 | ||
|
|
eacd08426f | ||
|
|
a8b7227500 | ||
|
|
7c62958c31 | ||
|
|
8be5a50b1e | ||
|
|
31d225e5b9 | ||
|
|
18ef02a331 | ||
|
|
53da2f7094 | ||
|
|
dab262ac23 | ||
|
|
b9567c5e39 | ||
|
|
3be0f20eef | ||
|
|
c97603c937 | ||
|
|
eb4a13166e | ||
|
|
77cc1c7c8b | ||
|
|
103bc141dc | ||
|
|
a9669c28ec | ||
|
|
0a4bac7adf | ||
|
|
149dde905b | ||
|
|
4a4ed5cb14 | ||
|
|
f65a6ec812 | ||
|
|
7dc4758e9a | ||
|
|
07198e9aad | ||
|
|
8a7201b898 | ||
|
|
f4e953186e | ||
|
|
5a6d1fccb0 | ||
|
|
fa7619bfde | ||
|
|
0daa11851d | ||
|
|
22c3b3e45f | ||
|
|
102b163fc5 | ||
|
|
2a87789523 | ||
|
|
9b4c6952c5 | ||
|
|
d8be029afb | ||
|
|
cc10b66365 | ||
|
|
36536e0e11 | ||
|
|
e16ca1114a | ||
|
|
8829e27004 | ||
|
|
1b5398afdc | ||
|
|
c68f6b4267 |
+19
-90
@@ -1,103 +1,32 @@
|
|||||||
# Project Context Pack
|
# Project Context Pack
|
||||||
|
|
||||||
Generated: 2026-06-25
|
|
||||||
Root: /home/sjb/Documents/ai-workflows/skills
|
|
||||||
Working directory: .
|
|
||||||
Status: fresh
|
|
||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
A collection of agent skills (slash commands and behaviors) loaded into Steve Beaulac's AI coding agents. Each skill is a SKILL.md file that teaches the agent how to handle a specific task — from codebase design and TDD to Obsidian PKM workflows and forge interaction.
|
|
||||||
|
|
||||||
## Project type
|
Repository of agent skills: each skill is a folder with a `SKILL.md` plus optional references, scripts, or assets.
|
||||||
- **Agent skill repository** — markdown-defined agent instructions
|
|
||||||
- Languages: Markdown (100%)
|
|
||||||
- Package managers: none
|
|
||||||
- Build/test tools: none
|
|
||||||
- Agent guidance: `AGENTS.md` at root, `docs/invocation.md` for invocation conventions, `docs/agents/` for issue tracker / triage labels / ADR wiki / domain docs
|
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
```
|
|
||||||
.
|
|
||||||
├── AGENTS.md # Top-level agent instructions for this repo
|
|
||||||
├── README.md # Project overview, lists user-invoked and model-invoked skills
|
|
||||||
├── .gitignore # Excludes docs/adr/
|
|
||||||
├── docs/
|
|
||||||
│ ├── invocation.md # Model-invoked vs user-invoked definitions
|
|
||||||
│ ├── agents/
|
|
||||||
│ │ ├── adr-wiki.md # ADR wiki setup docs
|
|
||||||
│ │ ├── domain.md # Domain docs layout
|
|
||||||
│ │ ├── issue-tracker.md # Gitea issue tracker docs
|
|
||||||
│ │ └── triage-labels.md # Five-label triage vocabulary
|
|
||||||
│ └── adr/ # ADR wiki clone (gitignored)
|
|
||||||
└── common/
|
|
||||||
├── README.md # Lists all common skills by invocation type
|
|
||||||
├── engineering/ # Model-invoked: forge-interaction, project-context-pack; also sub-skills for codebase-design, domain-modeling, tdd, triage, etc.
|
|
||||||
├── productivity/ # User-invoked: grill-me, handoff, writing-great-skills; Model-invoked: grilling
|
|
||||||
├── pkm/ # User-invoked: conversation-summary, crit, knowledge-gardener, research-vault
|
|
||||||
├── personal/ # User-invoked: pkm-curation; Model-invoked: forge-preferences
|
|
||||||
└── deprecated/ # Deprecated skills (audio-production-dispatcher, dsp-research-dispatcher, forge-*)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Important files
|
- `skills/` — skills grouped by category; each bucket has a README index.
|
||||||
- `AGENTS.md` — Agent entry point that describes structure, categories, and references docs
|
- `skills/setup-skills/` — one-time repo configuration skill and its supporting guides.
|
||||||
- `README.md` — Index of all skills divided into user-invoked and model-invoked (recently updated to fix broken links, add missing skills, correct invocation classification)
|
- `README.md` — complete index of skills by invocation type and category.
|
||||||
- `docs/invocation.md` — Defines the invocation model (disable-model-invocation frontmatter key, human vs model reachability, dependency rules)
|
- `AGENTS.md` — repository conventions and pointers to agent documentation.
|
||||||
- `docs/agents/` — Agent documentation for issue tracker, triage labels, ADR wiki, domain docs
|
- `docs/invocation.md` — user-invoked vs model-invoked behavior.
|
||||||
- `common/engineering/project-context-pack/SKILL.md` — The currently running skill
|
- `docs/agents/` — issue tracker, triage labels, ADR wiki, and domain-document conventions.
|
||||||
- `common/engineering/codebase-design/SKILL.md` — Deep module design vocabulary (referenced by other skills)
|
- `docs/engineering/` — reusable engineering process references.
|
||||||
- `common/engineering/domain-modeling/SKILL.md` — Domain modeling with ADRs and CONTEXT files
|
- `docs/adr/` — ADR wiki clone; gitignored.
|
||||||
- `common/engineering/tdd/SKILL.md` — Test-driven development discipline
|
- `.agent/project-context.md` — this context pack.
|
||||||
- `common/productivity/grilling/SKILL.md` — Relentless plan/design interview (model-invoked, triggers)
|
|
||||||
- `common/productivity/writing-great-skills/SKILL.md` — Reference for writing/editing skills
|
|
||||||
|
|
||||||
## Commands
|
## Skill categories
|
||||||
- Build: none
|
|
||||||
- Test: none
|
|
||||||
- Lint/typecheck: none
|
|
||||||
- Run/dev: skills are invoked by AI agents — no server or dev command
|
|
||||||
|
|
||||||
## Entry points
|
`engineering`, `in-progress`, `misc`, `personal`, `pkm`, `pstack`, `productivity`, `setup-skills`, `skill-authoring`, and `thinking-and-docs`.
|
||||||
- `AGENTS.md` — loaded by the AI agent as project instructions (referred to in pi's agent config)
|
|
||||||
- Each `SKILL.md` under `common/` — referenced by agents via slash commands or auto-invocation
|
|
||||||
|
|
||||||
## Search and symbol notes
|
## Conventions
|
||||||
- All skills are `SKILL.md` files — search with `fd SKILL.md`
|
|
||||||
- Bucket READMEs: `fd README.md common/`
|
|
||||||
- Skills are classified as **user-invoked** (`disable-model-invocation: true` in frontmatter) or **model-invoked** (default, no frontmatter flag)
|
|
||||||
- Dependencies between skills use prose invocation ("Run the `/grilling` skill"), not file cross-references
|
|
||||||
- Shared reference docs live inside the owning skill's directory; other skills reach that material by invoking the skill
|
|
||||||
|
|
||||||
## Files inspected
|
- Skills are user-invoked when frontmatter sets `disable-model-invocation: true`; otherwise they are model-invoked.
|
||||||
- `AGENTS.md` — root agent instructions — fresh
|
- Keep root and bucket README indexes synchronized with `SKILL.md` frontmatter and file paths.
|
||||||
- `README.md` — project overview — updated (all links fixed, missing skills added, invocation corrected)
|
- Read `docs/invocation.md` for invocation rules; read the relevant `docs/agents/` guide for tracker, triage, ADR, or domain-doc work.
|
||||||
- `docs/invocation.md` — invocation model definitions — fresh
|
- Source files in this repository are authoritative; global installed copies are separate.
|
||||||
- `.gitignore` — excludes docs/adr/ — fresh
|
|
||||||
- `common/engineering/README.md` — engineering bucket index — updated (all engineering skills added, misclassified skills corrected)
|
|
||||||
- `common/README.md` — common bucket index — updated (links fixed, missing skills added)
|
|
||||||
- `common/productivity/README.md` — productivity bucket index — fresh (was already correct)
|
|
||||||
- `common/pkm/README.md` — pkm bucket index — updated (pkm-curation added)
|
|
||||||
- `common/personal/README.md` — personal bucket index — updated (noted both skills moved elsewhere)
|
|
||||||
- `common/deprecated/README.md` — deprecated bucket index — updated (all forge skills added)
|
|
||||||
- All `SKILL.md` files — frontmatter checked for invocation status
|
|
||||||
|
|
||||||
## Exclusions
|
## Validation
|
||||||
- `.git/` — VCS data
|
|
||||||
- `docs/adr/` — gitignored ADR wiki clone
|
|
||||||
- `node_modules/`, `dist/`, `build/`, `target/`, `.venv/`, `__pycache__/`, `vendor/`, `coverage/` — not present, but excluded by policy
|
|
||||||
- Binary files, large artifacts, credentials, secrets, personal data
|
|
||||||
|
|
||||||
## Navigation rules for future agents
|
There is no build or test suite. For index changes, verify every `SKILL.md` appears once in the root index and its category index, links resolve, and invocation grouping matches frontmatter.
|
||||||
- Start with `fd SKILL.md` to find all skills, then narrow by `fd SKILL.md common/<category>/`
|
|
||||||
- To understand a skill's purpose, read its `SKILL.md` and the bucket `README.md` that indexes it
|
|
||||||
- For invocation rules (user-invoked vs model-invoked), read `docs/invocation.md`
|
|
||||||
- For agent-level docs (issue tracker, triage, ADR, domain), check `docs/agents/`
|
|
||||||
- Do not browse directories file-by-file; use `fd` and `rg` first
|
|
||||||
- Track every inspected file in this cache
|
|
||||||
- Re-read a file only when it changed, the cache is stale, or exact details are needed
|
|
||||||
|
|
||||||
## Refresh notes
|
|
||||||
- This is a markdown-only repo with no build artifacts; refreshes are rarely needed unless skills are added or removed
|
|
||||||
- To refresh, re-run `tree -a -I '.git' -L 4` and re-read any changed bucket READMEs or SKILL.md files
|
|
||||||
- The `docs/adr/` directory is gitignored — if ADR data is needed, check the Gitea wiki directly
|
|
||||||
- All README.md files were updated on 2026-06-25 to fix broken links, add missing skills, and correct invocation classification
|
|
||||||
- If a skill is moved between buckets, update all README.md files that reference it (root, common, source bucket, destination bucket)
|
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
docs/adr/
|
docs/adr/
|
||||||
|
.orchestrate/
|
||||||
|
|||||||
@@ -1,28 +1,19 @@
|
|||||||
# Steve Beaulac Skills
|
# Steve Beaulac Skills
|
||||||
|
|
||||||
A collection of agent skills (slash commands and behaviors) loaded into my agent.
|
A collection of agent skills (slash commands and behaviors) loaded into AI coding agents. Skills live under `skills/`, grouped by purpose; each bucket README and the root README index its `SKILL.md` files by invocation type.
|
||||||
|
|
||||||
# Structure
|
## Skill buckets
|
||||||
|
|
||||||
Skills are organized into buckets based on where they can be used and their category.
|
|
||||||
|
|
||||||
- Use `/common/` for skills that work in all CLI agents.
|
|
||||||
- Use `/common/misc/` for skills that work in all CLI agents and are in the misc category.
|
|
||||||
- Use an agent-specific bucket only when a skill is intended for a specific agent.
|
|
||||||
|
|
||||||
Skill are organized into categories based on their function. For example, `/common/misc/` is a bucket for miscellaneous skills that work in all CLI agents.
|
|
||||||
|
|
||||||
If we have a skill that is only relevant to a specific agent, we can put it in an agent-specific bucket. For example, if we have a skill that is only relevant to the `opencode` agent, we can put it in `/opencode/misc`.
|
|
||||||
|
|
||||||
|
|
||||||
## list of categories
|
|
||||||
- `engineering/` — daily code work
|
- `engineering/` — daily code work
|
||||||
- `productivity/` — daily non-code workflow tools
|
|
||||||
- `misc/` — kept around but rarely used
|
|
||||||
- `personal/` — tied to my own setup, not promoted
|
|
||||||
- `pkm/` — personal knowledge management
|
|
||||||
- `in-progress/` — drafts not yet ready to ship
|
- `in-progress/` — drafts not yet ready to ship
|
||||||
- `deprecated/` — no longer used
|
- `misc/` — kept around but rarely used
|
||||||
|
- `personal/` — tied to the user's own setup, not promoted
|
||||||
|
- `pkm/` — personal knowledge management
|
||||||
|
- `pstack/` — personal agent workflow skills
|
||||||
|
- `productivity/` — general workflow tools
|
||||||
|
- `setup-skills/` — one-time repository setup skill and its references
|
||||||
|
- `skill-authoring/` — create and maintain agent skills
|
||||||
|
- `thinking-and-docs/` — decisions and documentation workflows
|
||||||
|
|
||||||
Each bucket folder has a `README.md` that lists every skill in the bucket with a one-line description, with the skill name linked to its `SKILL.md`. Bucket `README.md`s and the top-level `README.md` group entries into **User-invoked** and **Model-invoked**.
|
Each bucket folder has a `README.md` that lists every skill in the bucket with a one-line description, with the skill name linked to its `SKILL.md`. Bucket `README.md`s and the top-level `README.md` group entries into **User-invoked** and **Model-invoked**.
|
||||||
|
|
||||||
@@ -36,7 +27,7 @@ Issues are tracked in Gitea on gitea.sagacity.ca. See `docs/agents/issue-tracker
|
|||||||
|
|
||||||
### Triage labels
|
### Triage labels
|
||||||
|
|
||||||
Five-label vocabulary with default names (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See `docs/agents/triage-labels.md`.
|
Seven-label vocabulary with default names (needs-triage, needs-info, needs-review, ready-for-agent, ready-for-human, in-progress, wontfix). See `docs/agents/triage-labels.md`.
|
||||||
|
|
||||||
### Domain docs
|
### Domain docs
|
||||||
|
|
||||||
@@ -44,7 +35,11 @@ Single-context layout. See `docs/agents/domain.md`.
|
|||||||
|
|
||||||
### ADR wiki
|
### ADR wiki
|
||||||
|
|
||||||
Gitea wiki at git@gitea.sagacity.ca:steve/Skills.wiki.git, cloned into docs/adr/, SSH key auth. See `docs/agents/adr-wiki.md`.
|
Gitea wiki at `git@gitea.sagacity.ca:steve/Skills.wiki.git`, cloned into `docs/adr/`, SSH key auth. See `docs/agents/adr-wiki.md`.
|
||||||
|
|
||||||
|
## Project Context Pack
|
||||||
|
|
||||||
|
Agent memory file that describes the repo's context, codebase, and navigation rules. See `.agent/project-context.md`.
|
||||||
|
|
||||||
### Agent CLI
|
### Agent CLI
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,139 @@
|
|||||||
# Skills
|
# Skills
|
||||||
|
|
||||||
A collection of agent skills (slash commands and behaviors) loaded into Steve Beaulac's agents.
|
Agent skills (slash commands and behaviors) loaded into AI coding agents.
|
||||||
|
|
||||||
|
Skills are grouped by invocation type. [User-invoked](docs/invocation.md) skills run only when a person invokes them; model-invoked skills can also be selected automatically.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
Many of these skills were created or originated by the following people and organizations:
|
||||||
|
|
||||||
|
- [Matt Pocock](http://mattpocock.com)
|
||||||
|
- [poteto](https://github.com/poteto?tab=repositories)
|
||||||
|
|
||||||
## User-invoked
|
## User-invoked
|
||||||
|
|
||||||
- [conversation-summary](common/pkm/conversation-summary/SKILL.md) — Summarize the current AI conversation into a new Obsidian markdown note and matching transcript file.
|
### Setup
|
||||||
- [crit](common/pkm/crit/SKILL.md) — Brainstorm with AI using the CRIT framework to generate and evaluate ideas.
|
|
||||||
- [grill-me](common/productivity/grill-me/SKILL.md) — A relentless interview to sharpen a plan or design.
|
|
||||||
- [grill-with-docs](common/engineering/grill-with-docs/SKILL.md) — A relentless interview to sharpen a plan or design, which also creates docs (ADRs and glossary) as we go.
|
|
||||||
- [handoff](common/productivity/handoff/SKILL.md) — Compact the current conversation into a handoff document for another agent to pick up.
|
|
||||||
- [implement-issue](common/engineering/implement-issue/SKILL.md) — Dispatch a child agent in an isolated git worktree to implement a ready-for-agent issue end-to-end.
|
|
||||||
- [improve-codebase-architecture](common/engineering/improve-codebase-architecture/SKILL.md) — Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
|
|
||||||
- [knowledge-gardener](common/pkm/knowledge-gardener/SKILL.md) — Run vault-aware semantic search, synthesis, note creation, linking, and Zettelkasten workflows for this Obsidian vault.
|
|
||||||
- [pkm-curation](common/pkm/pkm-curation/SKILL.md) — Curate an Obsidian vault — classify notes, normalize frontmatter, add wikilinks, extract atomic notes. Use when curating, batch-processing, reviewing, or doing a serendipity pick.
|
|
||||||
- [project-context-pack](common/engineering/project-context-pack/SKILL.md) — Build and refresh a bounded repo context memory file so agents use disciplined search instead of repeated browsing.
|
|
||||||
- [research-vault](common/pkm/research-vault/SKILL.md) — Research a topic through a one-question-at-a-time learning conversation, answer directly, share resources when useful, and save a linked Obsidian research packet.
|
|
||||||
- [setup-skills](common/engineering/setup-skills/SKILL.md) — Configure this repo for the engineering skills, set up its issue tracker, triage label vocabulary, and domain doc layout.
|
|
||||||
- [to-issues](common/engineering/to-issues/SKILL.md) — Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.
|
|
||||||
- [to-prd](common/engineering/to-prd/SKILL.md) — Turn the current conversation into a PRD and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.
|
|
||||||
- [triage](common/engineering/triage/SKILL.md) — Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.
|
|
||||||
- [writing-great-skills](common/productivity/writing-great-skills/SKILL.md) — Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.
|
|
||||||
|
|
||||||
**Deprecated / user-invoked:**
|
- [setup-skills](skills/setup-skills/SKILL.md) — Configure this repo for the engineering skills, issue tracker, triage label vocabulary, and domain doc layout.
|
||||||
- [forge-router](common/deprecated/forge-router/SKILL.md) — High-level guidance for choosing the right forge skill.
|
|
||||||
|
### Engineering
|
||||||
|
|
||||||
|
- [thermo-nuclear-code-quality-review](skills/engineering/code-quality-review/SKILL.md) — Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review.
|
||||||
|
- [commit-staged](skills/engineering/commit-staged/SKILL.md) — Commit staged files with a conventional commit message.
|
||||||
|
- [grill-with-docs](skills/engineering/grill-with-docs/SKILL.md) — A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
|
||||||
|
- [implement](skills/engineering/implement/SKILL.md) — Implement a piece of work based on a spec or set of tickets.
|
||||||
|
- [implement-isolation](skills/engineering/implement-isolation/SKILL.md) — Implement a piece of work based on a spec or set of tickets in isolation.
|
||||||
|
- [implement-isolation-tmux](skills/engineering/implement-isolation-tmux/SKILL.md) — Dispatch a child agent in an isolated git worktree to implement a piece of work based on a PRD or set of issues.
|
||||||
|
- [implement-spec](skills/engineering/implement-spec/SKILL.md) — Implement the result of /to-spec and /to-tickets in code.
|
||||||
|
- [implementation-orchestrator](skills/engineering/implementation-orchestrator/SKILL.md) — Implements ready-for-agent tracker tickets through isolated worktrees, pull requests, review, conflict resolution, and merge. Use after wayfinder and planning have produced tickets, with or without a ticket ID/URL; no ticket ID/URL means process available tickets. Does not create planning tickets.
|
||||||
|
- [improve-codebase-architecture](skills/engineering/improve-codebase-architecture/SKILL.md) — Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
|
||||||
|
- [orchestrate-herdr](skills/engineering/orchestrate-herdr/SKILL.md) — Start or monitor a Herdr/Pi planner for a published spec ticket; re-invoke after an orchestrator outage.
|
||||||
|
- [project-context-pack](skills/engineering/project-context-pack/SKILL.md) — Use when the user wants a bounded repo context pack, project map, codebase index, or cached memory file so later work uses fd/rg/tree-sitter/LSP instead of repeated browsing.
|
||||||
|
- [recipe-diagrams](skills/engineering/recipe-diagrams/SKILL.md) — Recipe diagrams: convert any recipe into a high-resolution Cooking for Engineers-style PNG process-flow table with aligned ingredient streams, preparation branches, joins, temperatures, timings, and finish steps. Use when the user asks for a recipe diagram.
|
||||||
|
- [security-audit](skills/engineering/security-audit/SKILL.md) — Comprehensive security and correctness audit of a branch's changes. Use for deep review requests, or branch/PR diff audits focused on bugs, breaking changes, security issues, devex regressions, and feature-gate leaks.
|
||||||
|
- [triage](skills/engineering/triage/SKILL.md) — Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
|
||||||
|
- [wayfinder](skills/engineering/wayfinder/SKILL.md) — Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.
|
||||||
|
|
||||||
|
### In Progress
|
||||||
|
|
||||||
|
- [agent-handoff](skills/in-progress/agent-handoff/SKILL.md) — Hand the current conversation off to a fresh background agent that picks up the work immediately.
|
||||||
|
- [knowledge-gardener](skills/in-progress/knowledge-gardener/SKILL.md) — Run vault-aware semantic search, synthesis, note creation, linking, and Zettelkasten workflows for this Obsidian vault.
|
||||||
|
|
||||||
|
### Misc
|
||||||
|
|
||||||
|
- [bro](skills/misc/bro/SKILL.md) — Restate the last message in plain human language, with no jargon.
|
||||||
|
- [show-me](skills/misc/show-me/SKILL.md) — Help the user understand the current topic visually with concise diagrams, code-shape sketches, and focused HTML artifacts.
|
||||||
|
- [tmux-launch-agent](skills/misc/tmux-launch-agent/SKILL.md) — Fork a new agent CLI session into a new tmux window, detected from the current agent.
|
||||||
|
- [visual-verification](skills/misc/visual-verification/SKILL.md) — Verify running desktop UI changes with screenshots and recordings. Use when changing shell styling, layout, panels, menus, notifications, animations, transitions, or capture flows; inspect the artifacts before reporting completion.
|
||||||
|
|
||||||
|
### Personal
|
||||||
|
|
||||||
|
- [arch-maintenance](skills/personal/arch-maintenance/SKILL.md) — Keep an Arch or CachyOS system updated and healthy with status, check, and update workflows.
|
||||||
|
- [arch-troubleshooting](skills/personal/arch-troubleshooting/SKILL.md) — Diagnose and repair Arch or CachyOS system problems.
|
||||||
|
|
||||||
|
### Pkm
|
||||||
|
|
||||||
|
- [conversation-summary](skills/pkm/conversation-summary/SKILL.md) — Save the current conversation as a comprehensive report note in your Obsidian vault, following OKF v0.1 conventions.
|
||||||
|
- [crit](skills/pkm/crit/SKILL.md) — Run the CRIT framework — give the AI Context, assign it a Role, let it Interview you one question at a time, then issue the Task.
|
||||||
|
- [research-vault](skills/pkm/research-vault/SKILL.md) — Research a topic through a one-question-at-a-time learning conversation, answer directly, share resources when useful, and save a linked OKF-conformant research packet in the Obsidian vault.
|
||||||
|
- [youtube-video-capture](skills/pkm/youtube-video-capture/SKILL.md) — Fetch subtitles from a YouTube video, summarize the content, and save both the summary and raw subtitles to the Video bundle in the Obsidian vault. Use when the user wants to capture a YouTube video, mentions "summarize this video", "capture this talk", or pastes a YouTube URL wanting it saved to vault.
|
||||||
|
|
||||||
|
### Productivity
|
||||||
|
|
||||||
|
- [grill-me](skills/productivity/grill-me/SKILL.md) — A relentless interview to sharpen a plan or design.
|
||||||
|
- [handoff](skills/productivity/handoff/SKILL.md) — Compact the current conversation into a handoff document for another agent to pick up.
|
||||||
|
- [to-questionnaire](skills/productivity/to-questionnaire/SKILL.md) — Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
|
||||||
|
- [wait-what](skills/productivity/wait-what/SKILL.md) — Stop. That last message did not land: re-pitch it.
|
||||||
|
|
||||||
|
### Pstack
|
||||||
|
|
||||||
|
- [bugfix-regression-test](skills/pstack/bugfix-regression-test/SKILL.md) — Fix bugs test-first with a focused regression test when practical.
|
||||||
|
- [interrogate](skills/pstack/interrogate/SKILL.md) — Use for "interrogate", "adversarial review", "multi-model review", "challenge this", "stress test this code", "find blind spots", or "tear this apart". Uses available subagents for independent, evidence-backed review.
|
||||||
|
|
||||||
|
### Thinking And Docs
|
||||||
|
|
||||||
|
- [before-building](skills/thinking-and-docs/before-building/SKILL.md) — Fire the moment the user proposes a build. Instantly surface the 1-3 consequential choices hidden in his idea. Can also be invoked with /before-building.
|
||||||
|
- [decisions](skills/thinking-and-docs/decisions/SKILL.md) — Ask the agent to list all choices it made during the current work that it is not confident of. Manual-only; invoke with /decisions.
|
||||||
|
- [level-up](skills/thinking-and-docs/level-up/SKILL.md) — Gauge the user''s technical + product knowledge through 7 adaptive questions, log verbatim answers with honest ratings, and grow a learning plan from the gaps found. Use when the user says "level up", "level-up session", "quiz me", "gauge my knowledge", or wants a new assessment round. Differentiator: this finds and maps gaps; the `teach` skill delivers lessons on them.
|
||||||
|
- [read-all-adrs](skills/thinking-and-docs/read-all-adrs/SKILL.md) — Read every ADR markdown file in the project's docs/adr/ folder so you have full context on past decisions. Use only when the user explicitly calls it.
|
||||||
|
- [remind](skills/thinking-and-docs/remind/SKILL.md) — Rewrite the last response simpler and shorter in plain English, prefixed with a 3-5 sentence TLDR of the conversation so far. Manual-only, invoked as /remind.
|
||||||
|
- [short](skills/thinking-and-docs/short/SKILL.md) — Manually-invoked skill that forces the agent to compress its current answer — strip filler, simplify wording, and cut length while keeping the substance. Use when the user says "short", "shorter", "simpler", "too long", "tl;dr", or wants a more concise version of the previous response.
|
||||||
|
- [teach](skills/thinking-and-docs/teach/SKILL.md) — Teach the user a new skill or concept, within this workspace.
|
||||||
|
|
||||||
## Model-invoked
|
## Model-invoked
|
||||||
|
|
||||||
- [codebase-design](common/engineering/codebase-design/SKILL.md) — Shared vocabulary for designing deep modules.
|
### Engineering
|
||||||
- [domain-modeling](common/engineering/domain-modeling/SKILL.md) — Build and sharpen a project's domain model.
|
|
||||||
- [grilling](common/productivity/grilling/SKILL.md) — Interview the user relentlessly about a plan or design.
|
|
||||||
- [resolving-merge-conflicts](common/engineering/resolving-merge-conflicts/SKILL.md) — Resolve an in-progress git merge/rebase conflict.
|
|
||||||
- [tdd](common/engineering/tdd/SKILL.md) — Test-driven development.
|
|
||||||
|
|
||||||
**Deprecated / user-invoked:**
|
- [feedback-bundle](skills/engineering/feedback-bundle/SKILL.md) — Post a Gitea feedback issue linked to the current commit and attach logs or screenshots. Use when the user reports a problem and asks to file it with evidence, open a bug ticket, or says “feedback-bundle” or “attach the log.”
|
||||||
- [audio-product-dsp](common/deprecated/audio-production-dispatcher/SKILL.md) — Dispatch audio product DSP hardware/software engineering requests to the best specialist workflow with measurable product-focused outputs.
|
- [code-review](skills/engineering/code-review/SKILL.md) — Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
|
||||||
- [dsp-research-engineering](common/deprecated/dsp-research-dispatcher/SKILL.md) — Route DSP hardware and software research-engineering requests to the best specialist workflow and return a unified, decision-ready output.
|
- [codebase-design](skills/engineering/codebase-design/SKILL.md) — Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
|
||||||
- [forge-gitea](common/deprecated/forge-gitea/SKILL.md) — Work with Gitea repositories, issues, pull requests, releases, and CI.
|
- [diagnosing-bugs](skills/engineering/diagnosing-bugs/SKILL.md) — Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
|
||||||
- [forge-github](common/deprecated/forge-github/SKILL.md) — Work with GitHub repositories, issues, pull requests, releases, and CI.
|
- [domain-modeling](skills/engineering/domain-modeling/SKILL.md) — Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording or editing an ADR.
|
||||||
- [forge-interaction](common/deprecated/forge-interaction/SKILL.md) — Work safely with GitHub and Gitea repositories, issues, pull requests, releases, and remote forge state.
|
- [dual-review](skills/engineering/dual-review/SKILL.md) — Run two independent, read-only reviews of a branch diff in parallel — correctness/security and maintainability — then synthesize prioritized findings. Use for a second review axis alongside code-review, a combined deep plus code-quality audit, or when the user asks for dual review. Runs both axes as parallel sub-agents so they do not pollute each other's context.
|
||||||
- [forge-preferences](common/deprecated/forge-preferences/SKILL.md) — Apply Steve's personal or project-specific GitHub/Gitea forge preferences.
|
- [forge-cli](skills/engineering/forge-cli/SKILL.md) — Provides copy-paste, non-interactive tea, gh, and glab commands for issue and pull or merge request work. Use whenever a task needs tracker inspection, assignment, labels, comments, reviews, CI, or merge operations.
|
||||||
|
- [lsp-code-analysis](skills/engineering/lsp-code-analysis/SKILL.md) — Semantic code analysis via LSP. Navigate code (definitions, references, implementations), search symbols, preview refactorings, and get file outlines. Use for exploring unfamiliar codebases or performing safe refactoring.
|
||||||
|
- [pr](skills/engineering/pr/SKILL.md) — Use when writing a PR body.
|
||||||
|
- [prototype](skills/engineering/prototype/SKILL.md) — Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
|
||||||
|
- [research](skills/engineering/research/SKILL.md) — Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.
|
||||||
|
- [resolving-merge-conflicts](skills/engineering/resolving-merge-conflicts/SKILL.md) — Use when you need to resolve an in-progress git merge/rebase conflict.
|
||||||
|
- [tdd](skills/engineering/tdd/SKILL.md) — Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
|
||||||
|
- [to-spec](skills/engineering/to-spec/SKILL.md) — Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed. Use when the user wants a spec from the current conversation or an orchestration workflow needs to publish one from context.
|
||||||
|
- [to-tickets](skills/engineering/to-tickets/SKILL.md) — Break a plan, spec, or the current conversation into tracer-bullet tickets with blocking edges, published to the configured tracker. Use when the user wants tickets from a plan or spec, or an orchestration workflow needs agent-grabbable tickets.
|
||||||
|
- [wizard](skills/engineering/wizard/SKILL.md) — Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.
|
||||||
|
- [worktrees](skills/engineering/worktrees/SKILL.md) — Manage Git worktrees in a canonical `.bare` repository root. Use when creating, reusing, listing, removing, or repairing worktrees, or when setting up a repository to keep all branch checkouts under one root.
|
||||||
|
- [write-discoverable-code](skills/engineering/write-discoverable-code/SKILL.md) — |
|
||||||
|
|
||||||
|
### Misc
|
||||||
|
|
||||||
|
- [migrate-to-shoehorn](skills/misc/migrate-to-shoehorn/SKILL.md) — Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
|
||||||
|
- [scaffold-exercises](skills/misc/scaffold-exercises/SKILL.md) — Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
|
||||||
|
- [setup-pre-commit](skills/misc/setup-pre-commit/SKILL.md) — Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
|
||||||
|
|
||||||
|
### Pkm
|
||||||
|
|
||||||
|
- [pkm-curation](skills/pkm/pkm-curation/SKILL.md) — Curate an Obsidian vault — classify notes, normalize frontmatter, add links, extract atomic notes. Use when curating, batch-processing, reviewing, or doing a serendipity pick.
|
||||||
|
|
||||||
|
### Productivity
|
||||||
|
|
||||||
|
- [grilling](skills/productivity/grilling/SKILL.md) — Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
|
||||||
|
- [writing-for-agents](skills/productivity/writing-for-agents/SKILL.md) — Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
|
||||||
|
|
||||||
|
### Pstack
|
||||||
|
|
||||||
|
- [fix-merge-conflicts](skills/pstack/fix-merge-conflicts/SKILL.md) — Resolve merge conflicts non-interactively, validate build and tests, and finalize conflict resolution
|
||||||
|
- [how](skills/pstack/how/SKILL.md) — Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Can critique architecture. Use why for motivation.
|
||||||
|
- [reflect](skills/pstack/reflect/SKILL.md) — Review a conversation for durable learnings and propose targeted edits to existing agent skills. Use when the user says "reflect", or when a complex workflow, correction, or recoverable dead end produced a reusable lesson.
|
||||||
|
- [unslop](skills/pstack/unslop/SKILL.md) — Cut AI writing patterns while preserving meaning and voice. Use when drafting, editing, or polishing prose, messages, or documentation.
|
||||||
|
- [why](skills/pstack/why/SKILL.md) — Investigate why code exists or behaves this way using cited historical evidence. Use for design rationale, tradeoffs, regressions, postmortems, and data-backed thresholds. Distinguishes motivation from how the code currently works.
|
||||||
|
|
||||||
|
### Skill Authoring
|
||||||
|
|
||||||
|
- [effective-agent-skills](skills/skill-authoring/effective-agent-skills/SKILL.md) — How to write effective agent skills — what to do, what not to do, anatomy, progressive disclosure, design patterns, anti-patterns, testing, security. Read this whenever a skill (Claude Skill, Agent Skill, SKILL.md) is being created, edited, reviewed, or debugged. Use when the user says "create a skill", "new skill", "update this skill", "improve a skill", "why isn't my skill triggering", or anything else involving authoring or editing SKILL.md files.
|
||||||
|
|
||||||
|
### Thinking And Docs
|
||||||
|
|
||||||
|
- [brain-to-docs](skills/thinking-and-docs/brain-to-docs/SKILL.md) — Use when the user wants to extract project vision, decisions, and preferences from his head into clear documentation (README + ADRs) through a back-and-forth Q&A loop. Triggers on "brain-to-docs", "build out the docs", "extract the vision", "let's document this project".
|
||||||
|
- [next-decision](skills/thinking-and-docs/next-decision/SKILL.md) — Drill open decisions one at a time — present the most important decision not yet clarified, give the top four choices, state a preference, ask the user. Use when the user says "next decision", "one decision at a time", or a plan has several unresolved choices. Differentiator: forward-looking; the decisions skill is retrospective (choices already made). Can be invoked with /next-decision.
|
||||||
|
- [prompt-me](skills/thinking-and-docs/prompt-me/SKILL.md) — Prompt the user with pointed questions to extract what is in his head about a project — remaining work, what is being avoided, what really matters, what does not. Use when the user says "prompt me", "ask me questions", or wants the agent to figure out priorities by questioning him.
|
||||||
|
- [save-idea](skills/thinking-and-docs/save-idea/SKILL.md) — Quickly capture a content idea into ~/code/content from any repo or chat. Video ideas go to VIDEO-IDEAS.md; smaller podcast topics, guest ideas, questions, and AI observations go to TOPICS.md. Every entry gets a source line referencing the chat and repo it came from. Use when the user says "/save-idea", "save this idea", "video idea", "add a topic", "write this down for a video/podcast". Differentiator: appends to the user''s content backlog — not a reminder, task, or general note tool.
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
# Common Skills
|
|
||||||
|
|
||||||
Skills that work in all CLI agents.
|
|
||||||
|
|
||||||
## User-invoked
|
|
||||||
|
|
||||||
- [conversation-summary](pkm/conversation-summary/SKILL.md) — Summarize the current AI conversation into a new Obsidian markdown note and matching transcript file.
|
|
||||||
- [crit](pkm/crit/SKILL.md) — Brainstorm with AI using the CRIT framework to generate and evaluate ideas.
|
|
||||||
- [grill-me](productivity/grill-me/SKILL.md) — A relentless interview to sharpen a plan or design.
|
|
||||||
- [grill-with-docs](engineering/grill-with-docs/SKILL.md) — A relentless interview to sharpen a plan or design, which also creates docs (ADRs and glossary) as we go.
|
|
||||||
- [handoff](productivity/handoff/SKILL.md) — Compact the current conversation into a handoff document for another agent to pick up.
|
|
||||||
- [improve-codebase-architecture](engineering/improve-codebase-architecture/SKILL.md) — Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
|
|
||||||
- [knowledge-gardener](pkm/knowledge-gardener/SKILL.md) — Run vault-aware semantic search, synthesis, note creation, linking, and Zettelkasten workflows for this Obsidian vault.
|
|
||||||
- [pkm-curation](pkm/pkm-curation/SKILL.md) — Curate an Obsidian vault — classify notes, normalize frontmatter, add wikilinks, extract atomic notes. Use when curating, batch-processing, reviewing, or doing a serendipity pick.
|
|
||||||
- [project-context-pack](engineering/project-context-pack/SKILL.md) — Build and refresh a bounded repo context memory file so agents use disciplined search instead of repeated browsing.
|
|
||||||
- [research-vault](pkm/research-vault/SKILL.md) — Research a topic through a one-question-at-a-time learning conversation, answer directly, share resources when useful, and save a linked Obsidian research packet.
|
|
||||||
- [setup-skills](engineering/setup-skills/SKILL.md) — Configure this repo for the engineering skills, set up its issue tracker, triage label vocabulary, and domain doc layout.
|
|
||||||
- [to-issues](engineering/to-issues/SKILL.md) — Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.
|
|
||||||
- [to-prd](engineering/to-prd/SKILL.md) — Turn the current conversation into a PRD and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.
|
|
||||||
- [triage](engineering/triage/SKILL.md) — Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.
|
|
||||||
- [writing-great-skills](productivity/writing-great-skills/SKILL.md) — Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.
|
|
||||||
|
|
||||||
**Deprecated / user-invoked:**
|
|
||||||
- [forge-router](deprecated/forge-router/SKILL.md) — High-level guidance for choosing the right forge skill.
|
|
||||||
|
|
||||||
## Model-invoked
|
|
||||||
|
|
||||||
- [codebase-design](engineering/codebase-design/SKILL.md) — Shared vocabulary for designing deep modules.
|
|
||||||
- [domain-modeling](engineering/domain-modeling/SKILL.md) — Build and sharpen a project's domain model.
|
|
||||||
- [grilling](productivity/grilling/SKILL.md) — Interview the user relentlessly about a plan or design.
|
|
||||||
- [resolving-merge-conflicts](engineering/resolving-merge-conflicts/SKILL.md) — Resolve an in-progress git merge/rebase conflict.
|
|
||||||
- [tdd](engineering/tdd/SKILL.md) — Test-driven development.
|
|
||||||
|
|
||||||
**Deprecated / user-invoked:**
|
|
||||||
- [audio-product-dsp](deprecated/audio-production-dispatcher/SKILL.md) — Dispatch audio product DSP hardware/software engineering requests to the best specialist workflow with measurable product-focused outputs.
|
|
||||||
- [dsp-research-engineering](deprecated/dsp-research-dispatcher/SKILL.md) — Route DSP hardware and software research-engineering requests to the best specialist workflow and return a unified, decision-ready output.
|
|
||||||
- [forge-gitea](deprecated/forge-gitea/SKILL.md) — Work with Gitea repositories, issues, pull requests, releases, and CI.
|
|
||||||
- [forge-github](deprecated/forge-github/SKILL.md) — Work with GitHub repositories, issues, pull requests, releases, and CI.
|
|
||||||
- [forge-interaction](deprecated/forge-interaction/SKILL.md) — Work safely with GitHub and Gitea repositories, issues, pull requests, releases, and remote forge state.
|
|
||||||
- [forge-preferences](deprecated/forge-preferences/SKILL.md) — Apply Steve's personal or project-specific GitHub/Gitea forge preferences.
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# Deprecated Skills
|
|
||||||
|
|
||||||
## User-invoked
|
|
||||||
|
|
||||||
- [forge-router](forge-router/SKILL.md) — High-level guidance for choosing the right forge skill.
|
|
||||||
|
|
||||||
**Deprecated / user-invoked:**
|
|
||||||
- [audio-product-dsp](audio-production-dispatcher/SKILL.md) — Dispatch audio product DSP hardware/software engineering requests to the best specialist workflow with measurable product-focused outputs.
|
|
||||||
- [dsp-research-engineering](dsp-research-dispatcher/SKILL.md) — Route DSP hardware and software research-engineering requests to the best specialist workflow and return a unified, decision-ready output.
|
|
||||||
- [forge-gitea](forge-gitea/SKILL.md) — Work with Gitea repositories, issues, pull requests, releases, and CI.
|
|
||||||
- [forge-github](forge-github/SKILL.md) — Work with GitHub repositories, issues, pull requests, releases, and CI.
|
|
||||||
- [forge-interaction](forge-interaction/SKILL.md) — Work safely with GitHub and Gitea repositories, issues, pull requests, releases, and remote forge state.
|
|
||||||
- [forge-preferences](forge-preferences/SKILL.md) — Apply Steve's personal or project-specific GitHub/Gitea forge preferences.
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
---
|
|
||||||
disable-model-invocation: true
|
|
||||||
name: audio-product-dsp
|
|
||||||
description: Dispatch audio product DSP hardware/software engineering requests to the best specialist workflow with measurable product-focused outputs
|
|
||||||
---
|
|
||||||
|
|
||||||
Role: You are a dispatcher skill for audio product DSP research and engineering. You route requests to the right specialist path(s), enforce product constraints, and return one decision-ready answer.
|
|
||||||
|
|
||||||
Primary objectives:
|
|
||||||
- Classify audio product requests across algorithm, embedded implementation, hardware integration, tuning, and validation.
|
|
||||||
- Route to the best specialist workflow(s) using explicit scoring.
|
|
||||||
- Deliver outputs tied to user-perceived quality, latency, power, and manufacturable constraints.
|
|
||||||
- Keep recommendations testable and release-oriented.
|
|
||||||
|
|
||||||
Scope:
|
|
||||||
- In scope: speech/audio enhancement, ANC, beamforming, AEC/NS/AGC, codec pipelines, loudness/tuning, fixed-point deployment, RT embedded audio, product validation plans.
|
|
||||||
- Out of scope: medical diagnosis claims, regulatory/legal sign-off, unsafe hearing-level recommendations, fabricated bench/listening data.
|
|
||||||
|
|
||||||
Non-goals:
|
|
||||||
- Do not claim audible improvements without metric or listening-test basis.
|
|
||||||
- Do not suggest architecture changes that violate hard latency/power/platform constraints without calling out tradeoffs.
|
|
||||||
- Do not present lab verification as completed if only conceptual.
|
|
||||||
|
|
||||||
Inputs expected:
|
|
||||||
- User request text
|
|
||||||
- Conversation context
|
|
||||||
- Available specialist agents/skills
|
|
||||||
- Product constraints (if available):
|
|
||||||
- device type (earbuds, headset, speakerphone, soundbar, hearing-assist, etc.)
|
|
||||||
- mic/speaker topology
|
|
||||||
- sample rate/frame size
|
|
||||||
- end-to-end latency budget
|
|
||||||
- CPU/MIPS, RAM/flash
|
|
||||||
- battery/power target
|
|
||||||
- codec/transport constraints (BT, USB, VoIP, etc.)
|
|
||||||
- target metrics and UX goals
|
|
||||||
|
|
||||||
Required output contract:
|
|
||||||
- Always provide:
|
|
||||||
1) Selected route
|
|
||||||
2) Why route fits product goals
|
|
||||||
3) Final recommendation
|
|
||||||
4) Assumptions and open risks
|
|
||||||
5) Verification plan (objective + subjective)
|
|
||||||
6) Confidence level
|
|
||||||
|
|
||||||
Dispatch taxonomy (audio product specific):
|
|
||||||
- Voice Quality Path: AEC/NS/AGC, double-talk robustness, far-end preservation, speech intelligibility.
|
|
||||||
- Playback Quality Path: EQ/DRC/loudness, distortion management, clipping avoidance, tonal balance.
|
|
||||||
- Spatial/Array Path: beamforming, DOA, mic calibration sensitivity, wind/noise robustness.
|
|
||||||
- ANC Path: feedforward/feedback/hybrid ANC stability, leakage robustness, fit variance strategy.
|
|
||||||
- Embedded RT Path: buffering, ISR/DMA, frame deadlines, SIMD acceleration, memory bandwidth.
|
|
||||||
- Hardware Integration Path: codec clocks, interfaces, mic bias/noise floor, amp/headroom, thermal limits.
|
|
||||||
- Validation Path: objective metrics, golden references, listening tests, production regression.
|
|
||||||
- Research Synthesis Path: state-of-the-art comparison, feasibility/risk, phased experiment plan.
|
|
||||||
|
|
||||||
Routing policy:
|
|
||||||
1. Parse request into one or more intents.
|
|
||||||
2. Extract success criteria and hard product constraints.
|
|
||||||
3. Score candidate routes:
|
|
||||||
- Relevance (0-5)
|
|
||||||
- Product-fit (0-5)
|
|
||||||
- Feasibility/safety (0-5)
|
|
||||||
- Evidence readiness (0-5)
|
|
||||||
- Implementation cost (0-5, lower is better)
|
|
||||||
4. Select single-route or multi-route orchestration.
|
|
||||||
5. Dispatch structured task packets.
|
|
||||||
6. Reconcile into one release-oriented recommendation.
|
|
||||||
|
|
||||||
Confidence rules:
|
|
||||||
- High: clear winner and all critical constraints known.
|
|
||||||
- Medium: winner exists but one non-critical constraint unknown; proceed with explicit assumptions.
|
|
||||||
- Low: tied routes or missing critical constraint; ask exactly one targeted question.
|
|
||||||
|
|
||||||
Critical constraints checklist:
|
|
||||||
- Product form factor and acoustic topology
|
|
||||||
- Sample rate, frame size, channel count
|
|
||||||
- End-to-end latency budget (capture->process->render)
|
|
||||||
- CPU/MIPS and memory budgets
|
|
||||||
- Power target and thermal envelope
|
|
||||||
- Numeric format (float/fixed word lengths)
|
|
||||||
- UX priority (call clarity, music fidelity, ANC depth, wake-word reliability, etc.)
|
|
||||||
- Acceptance metrics and pass/fail thresholds
|
|
||||||
|
|
||||||
Audio product metrics catalog:
|
|
||||||
- Voice/call: PESQ/POLQA, STOI, ERLE, double-talk performance, barge-in robustness.
|
|
||||||
- Playback: THD+N, frequency response error, max SPL before limiting artifacts, crest-factor handling.
|
|
||||||
- ANC: attenuation vs frequency, residual noise spectra, stability margin, fit-leak sensitivity.
|
|
||||||
- System: RTL latency, glitch/dropout rate, CPU load, memory headroom, battery impact.
|
|
||||||
- Subjective: MUSHRA/AB preference tests, panel notes, artifact taxonomy.
|
|
||||||
|
|
||||||
Safety and integrity gates:
|
|
||||||
- Never fabricate measurements, listening outcomes, or citations.
|
|
||||||
- If hearing safety could be impacted, require explicit level limits and verification steps.
|
|
||||||
- If irreversible hardware actions are requested, require explicit confirmation and safe fallback path.
|
|
||||||
- Protect credentials and proprietary parameters.
|
|
||||||
|
|
||||||
Specialist route mapping:
|
|
||||||
- "Improve call quality" -> Voice Quality + Validation paths
|
|
||||||
- "Reduce earbud power while keeping ANC" -> ANC + Embedded RT + Hardware Integration
|
|
||||||
- "Fix audio glitches" -> Embedded RT + Hardware Integration + Validation
|
|
||||||
- "Compare beamforming methods" -> Spatial/Array + Research Synthesis
|
|
||||||
- "Ship-ready tuning plan" -> Playback/Voice/ANC (as relevant) + Validation
|
|
||||||
|
|
||||||
Task packet format for downstream specialists:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"objective": "<single product outcome>",
|
|
||||||
"constraints": {
|
|
||||||
"latency_ms": "<value or unknown>",
|
|
||||||
"cpu_budget": "<value or unknown>",
|
|
||||||
"power_budget": "<value or unknown>",
|
|
||||||
"platform": "<SoC/DSP/MCU>",
|
|
||||||
"sample_rate_hz": "<value>",
|
|
||||||
"frame_size": "<value>
|
|
||||||
"
|
|
||||||
},
|
|
||||||
"required_output": [
|
|
||||||
"Recommended approach",
|
|
||||||
"Why it fits product goals",
|
|
||||||
"Tradeoffs",
|
|
||||||
"Top 3 risks",
|
|
||||||
"Objective metrics to track",
|
|
||||||
"Subjective listening checks",
|
|
||||||
"Implementation next steps"
|
|
||||||
],
|
|
||||||
"limits": [
|
|
||||||
"No fabricated data",
|
|
||||||
"State assumptions explicitly"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Orchestration rules:
|
|
||||||
- Split only when subproblems are independent and interfaces are clear.
|
|
||||||
- Normalize units (ms, dB, Hz, mW, MIPS) and definitions across outputs.
|
|
||||||
- Resolve conflicts by preferring measured evidence > validated simulation > reasoned estimate.
|
|
||||||
- If conflict remains, present it as a decision fork with verification to break the tie.
|
|
||||||
|
|
||||||
Fallback behavior:
|
|
||||||
- If selected specialist fails, retry once with narrower objective and stricter output schema.
|
|
||||||
- If retry fails, route to a generalist technical path and lower confidence.
|
|
||||||
- If critical constraints are missing, provide best-effort baseline + one blocking question.
|
|
||||||
|
|
||||||
Response template:
|
|
||||||
```text
|
|
||||||
Route Selected:
|
|
||||||
- <specialist path(s)>
|
|
||||||
|
|
||||||
Why This Route:
|
|
||||||
- <1-3 product-focused bullets>
|
|
||||||
|
|
||||||
Recommendation:
|
|
||||||
<final user-facing answer>
|
|
||||||
|
|
||||||
Assumptions and Risks:
|
|
||||||
- <bullets>
|
|
||||||
|
|
||||||
Verification Plan:
|
|
||||||
- Objective: <3-7 checks with metrics and thresholds>
|
|
||||||
- Subjective: <2-5 listening test checks>
|
|
||||||
|
|
||||||
Confidence:
|
|
||||||
- <High|Medium|Low> with one-line rationale
|
|
||||||
```
|
|
||||||
|
|
||||||
Clarification template (only when blocked):
|
|
||||||
```text
|
|
||||||
I can dispatch this accurately, but I need one detail:
|
|
||||||
- <single targeted question>
|
|
||||||
|
|
||||||
Default I will assume for speed:
|
|
||||||
- <recommended default>
|
|
||||||
```
|
|
||||||
|
|
||||||
Quality bar:
|
|
||||||
- Product impact over algorithm novelty.
|
|
||||||
- Verifiable claims over qualitative promises.
|
|
||||||
- Fast experiment loops over broad rewrites.
|
|
||||||
- Explicit uncertainty over false precision.
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
---
|
|
||||||
disable-model-invocation: true
|
|
||||||
name: research-engineering
|
|
||||||
description: Route DSP hardware and software research-engineering requests to the best specialist workflow and return a unified, decision-ready output
|
|
||||||
---
|
|
||||||
|
|
||||||
Role: You are a dispatcher skill for DSP hardware and software research engineering. You triage requests, select the right specialist path(s), enforce safety and reproducibility constraints, and return one coherent response.
|
|
||||||
|
|
||||||
Primary objectives:
|
|
||||||
- Identify technical intent across algorithms, embedded implementation, hardware architecture, tooling, and validation.
|
|
||||||
- Route work to the most appropriate specialist workflow(s) with explicit assumptions.
|
|
||||||
- Produce practical, testable outputs for research engineering decisions.
|
|
||||||
- Minimize unnecessary handoffs and avoid over-engineering.
|
|
||||||
|
|
||||||
Scope:
|
|
||||||
- In scope: signal analysis, DSP algorithm design, fixed-point strategy, embedded audio/DSP implementation, architecture tradeoffs, measurement plans, benchmarking, verification strategy, literature-grounded research synthesis.
|
|
||||||
- Out of scope: legal/compliance claims, medical claims, fabrication process sign-off, irreversible production actions.
|
|
||||||
|
|
||||||
Non-goals:
|
|
||||||
- Do not pretend to run lab measurements that were not run.
|
|
||||||
- Do not claim numerical performance without source, simulation, or measurement basis.
|
|
||||||
- Do not bypass hardware safety, power, thermal, EMC, or hearing-safety constraints.
|
|
||||||
|
|
||||||
Inputs expected:
|
|
||||||
- User request text
|
|
||||||
- Current conversation context
|
|
||||||
- Available specialist agents/skills
|
|
||||||
- Environment/tooling constraints
|
|
||||||
- Optional project constraints (sample rate, latency budget, CPU target, memory budget, power target, BOM constraints)
|
|
||||||
|
|
||||||
Required output contract:
|
|
||||||
- Always provide:
|
|
||||||
1) Selected route
|
|
||||||
2) Why this route
|
|
||||||
3) Final user-facing result
|
|
||||||
4) Assumptions and unknowns
|
|
||||||
5) Verification plan (how to confirm correctness/performance)
|
|
||||||
|
|
||||||
Dispatch taxonomy:
|
|
||||||
- Algorithm Design: filters, adaptive processing, beamforming, detection/classification front-ends, denoising, dynamics, time-frequency methods.
|
|
||||||
- Numerical Implementation: fixed-point, quantization noise, saturation behavior, scaling, coefficient sensitivity, stability under finite precision.
|
|
||||||
- Embedded Software: RT constraints, DMA/ISR design, buffering, scheduling, memory layout, SIMD/accelerators, portability.
|
|
||||||
- Hardware/Platform: MCU/DSP/FPGA partitioning, codec/interface constraints, clocking, throughput, latency, power/thermal tradeoffs.
|
|
||||||
- Validation and Measurement: objective metrics, stimulus design, golden references, regression tests, bench/lab measurement plans.
|
|
||||||
- Research Synthesis: literature scan, method comparison, risk/novelty assessment, experiment roadmap.
|
|
||||||
|
|
||||||
Routing policy:
|
|
||||||
1. Parse request into one or more intents.
|
|
||||||
2. Extract hard constraints and success criteria.
|
|
||||||
3. Score candidate routes on:
|
|
||||||
- Relevance (0-5)
|
|
||||||
- Capability fit (0-5)
|
|
||||||
- Safety/feasibility (0-5)
|
|
||||||
- Evidence availability (0-5)
|
|
||||||
- Execution cost (0-5, lower is better)
|
|
||||||
4. Select route:
|
|
||||||
- Single-route if one clear winner.
|
|
||||||
- Multi-route if subproblems are separable and independent.
|
|
||||||
5. Dispatch with structured task packets.
|
|
||||||
6. Reconcile outputs into a single final response.
|
|
||||||
|
|
||||||
Confidence rules:
|
|
||||||
- High: top route exceeds second by >= 3 and all hard constraints are known.
|
|
||||||
- Medium: top route exceeds second by 1-2 or one non-critical constraint missing; proceed with explicit assumptions.
|
|
||||||
- Low: tie score or missing critical constraint (platform, sample rate, latency, safety limit); ask exactly one targeted question.
|
|
||||||
|
|
||||||
Critical constraints checklist:
|
|
||||||
- Target platform (e.g., Cortex-M4/M7, SHARC, FPGA family)
|
|
||||||
- Sample rate and channel count
|
|
||||||
- End-to-end latency budget
|
|
||||||
- CPU/memory budget
|
|
||||||
- Power/thermal envelope (if embedded/portable)
|
|
||||||
- Numeric format (float/fixed, word lengths)
|
|
||||||
- Required performance metrics (SNR, THD+N, PESQ/STOI, detection F1, etc.)
|
|
||||||
|
|
||||||
Safety and integrity gates (must run before dispatch):
|
|
||||||
- If safety-critical or human-impacting audio claims are requested, include explicit uncertainty and verification requirements.
|
|
||||||
- If destructive hardware actions are requested, require explicit confirmation and safe fallback.
|
|
||||||
- Never expose secrets, proprietary keys, or internal credentials.
|
|
||||||
- Never fabricate measurement data or citations.
|
|
||||||
|
|
||||||
Specialist route mapping:
|
|
||||||
- Signal characterization question -> Signal Analysis specialist
|
|
||||||
- Embedded DSP implementation/debug -> Embedded DSP specialist
|
|
||||||
- Hardware/software partitioning -> Embedded hardware architect path
|
|
||||||
- Literature-heavy "state of the art" request -> Research Assistant or literature path
|
|
||||||
- Cross-domain request (algorithm + embedded + validation) -> Multi-route orchestration with unified recommendation
|
|
||||||
|
|
||||||
Task packet format for downstream specialists:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"objective": "<single clear objective>",
|
|
||||||
"context": ["<key constraints>", "<known assumptions>"],
|
|
||||||
"required_output": [
|
|
||||||
"Approach",
|
|
||||||
"Tradeoffs",
|
|
||||||
"Risks",
|
|
||||||
"Verification steps",
|
|
||||||
"Confidence"
|
|
||||||
],
|
|
||||||
"limits": ["No fabricated data", "State unknowns explicitly"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Multi-route orchestration rules:
|
|
||||||
- Split only when interfaces between subproblems are clear.
|
|
||||||
- Normalize units and terminology across outputs.
|
|
||||||
- Resolve disagreements by preferring: measured evidence > validated simulation > reasoned estimate.
|
|
||||||
- If unresolved conflict remains, surface it as a decision risk.
|
|
||||||
|
|
||||||
Fallback behavior:
|
|
||||||
- If selected specialist fails, retry once with narrowed objective and stricter output format.
|
|
||||||
- If retry fails, route to a generalist technical path and label confidence reduced.
|
|
||||||
- If key constraints are missing, provide a best-effort scaffold plus one blocking question.
|
|
||||||
|
|
||||||
Response template:
|
|
||||||
```text
|
|
||||||
Route Selected:
|
|
||||||
- <specialist path(s)>
|
|
||||||
|
|
||||||
Why This Route:
|
|
||||||
- <1-3 concise bullets>
|
|
||||||
|
|
||||||
Result:
|
|
||||||
<final user-facing answer>
|
|
||||||
|
|
||||||
Assumptions and Unknowns:
|
|
||||||
- <bullet list or "None">
|
|
||||||
|
|
||||||
Verification Plan:
|
|
||||||
- <3-7 concrete checks/tests/measurements>
|
|
||||||
|
|
||||||
Confidence:
|
|
||||||
- <High|Medium|Low> with one-line rationale
|
|
||||||
```
|
|
||||||
|
|
||||||
Clarification template (only when blocked):
|
|
||||||
```text
|
|
||||||
I can dispatch this precisely, but I need one detail:
|
|
||||||
- <single targeted question>
|
|
||||||
|
|
||||||
Default I will assume if you prefer speed:
|
|
||||||
- <recommended default>
|
|
||||||
```
|
|
||||||
|
|
||||||
Quality bar:
|
|
||||||
- Actionable over theoretical.
|
|
||||||
- Reproducible over vague.
|
|
||||||
- Explicit uncertainty over false precision.
|
|
||||||
- Deliver the smallest valid plan that can be tested quickly.
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
---
|
|
||||||
name: forge-gitea
|
|
||||||
---
|
|
||||||
|
|
||||||
# Gitea Forge Interaction
|
|
||||||
|
|
||||||
Use this skill for Gitea forge work when the user wants to interact with Gitea repositories, issues, pull requests, releases, or CI.
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
Choose the correct Gitea CLI (`tea`) and use it to interact with Gitea issues, pull requests, releases, CI, and repository state.
|
|
||||||
|
|
||||||
This skill is intended to perform Gitea forge actions, including mutating actions, when the user asks for them. Do not turn every requested forge action into a confirmation loop; if the user clearly asks to create, edit, comment, publish, or release, do the requested action after selecting the correct CLI.
|
|
||||||
|
|
||||||
## Strict Decision Tree
|
|
||||||
|
|
||||||
Follow this order every time.
|
|
||||||
|
|
||||||
### 1. Determine the target remote
|
|
||||||
|
|
||||||
1. If the user explicitly says which remote or forge to use, use that.
|
|
||||||
2. Else, if user/project memory or repo guidance states where to find the forge, use that.
|
|
||||||
3. Else, if a remote named `forge` exists, use `forge`.
|
|
||||||
4. Else, if the user has configured a default remote, use that.
|
|
||||||
5. Else, use `origin`.
|
|
||||||
|
|
||||||
Useful inspection commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git remote -v
|
|
||||||
git config --get checkout.defaultRemote
|
|
||||||
git config --get clone.defaultRemoteName
|
|
||||||
git config --get branch.$(git branch --show-current).remote
|
|
||||||
```
|
|
||||||
|
|
||||||
Interpretation:
|
|
||||||
|
|
||||||
- A remote named `forge` is the preferred convention for the canonical forge remote.
|
|
||||||
- If no `forge` remote exists, `origin` is the fallback.
|
|
||||||
- If the current branch has an upstream remote and no stronger rule applies, treat that as the user's configured default for the current work.
|
|
||||||
|
|
||||||
Only mention this selection if there is ambiguity or a conflict.
|
|
||||||
|
|
||||||
### 2. Choose the CLI
|
|
||||||
|
|
||||||
Use `tea` for Gitea interactions.
|
|
||||||
|
|
||||||
Check whether the chosen CLI is available:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
command -v tea >/dev/null 2>&1 && tea --version
|
|
||||||
```
|
|
||||||
|
|
||||||
If the needed CLI is missing:
|
|
||||||
|
|
||||||
- Tell the user which CLI is required: `tea` for Gitea.
|
|
||||||
- Tell the user to install it.
|
|
||||||
- If it may already be installed but not discoverable, tell the user to add it to their `PATH`.
|
|
||||||
- Do not use the wrong CLI as a fallback.
|
|
||||||
|
|
||||||
### 3. Check authentication/context
|
|
||||||
|
|
||||||
Use read-only checks for the selected tool:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
tea login list
|
|
||||||
tea repos ls
|
|
||||||
```
|
|
||||||
|
|
||||||
If authentication is missing, tell the user which CLI needs login/configuration. Do not ask the user to paste tokens or secrets.
|
|
||||||
|
|
||||||
### 4. Do the requested forge task
|
|
||||||
|
|
||||||
Perform the requested action with `tea` commands such as:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
tea issues list
|
|
||||||
tea issues create
|
|
||||||
tea issues comment
|
|
||||||
tea pulls list
|
|
||||||
tea pulls create
|
|
||||||
tea pulls view
|
|
||||||
tea pulls comment
|
|
||||||
tea pulls merge
|
|
||||||
tea releases list
|
|
||||||
tea releases create
|
|
||||||
```
|
|
||||||
|
|
||||||
Use exact command syntax supported by the installed CLI version; inspect help when needed:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
tea help
|
|
||||||
```
|
|
||||||
|
|
||||||
## Mutating Actions
|
|
||||||
|
|
||||||
Mutating forge actions are allowed when clearly requested by the user, including:
|
|
||||||
|
|
||||||
- create an issue;
|
|
||||||
- modify an issue;
|
|
||||||
- comment on an issue;
|
|
||||||
- create a pull request;
|
|
||||||
- modify a pull request;
|
|
||||||
- comment on a pull request;
|
|
||||||
- push a branch;
|
|
||||||
- publish changes;
|
|
||||||
- create a release.
|
|
||||||
|
|
||||||
Still be careful with destructive or high-impact actions:
|
|
||||||
|
|
||||||
- Ask before deleting branches, tags, releases, issues, or repositories.
|
|
||||||
- Ask before force-pushing.
|
|
||||||
- Ask before merging a PR unless the user explicitly asked to merge it.
|
|
||||||
- Ask before overwriting existing release assets or tags.
|
|
||||||
|
|
||||||
## Branch and PR Preparation
|
|
||||||
|
|
||||||
Before creating or updating a PR:
|
|
||||||
|
|
||||||
1. Select the remote using the strict decision tree.
|
|
||||||
2. Inspect branch state and upstream tracking.
|
|
||||||
3. Inspect the diff against the target branch.
|
|
||||||
4. Read the PR template if one exists.
|
|
||||||
5. Push the branch if needed and requested by the workflow.
|
|
||||||
6. Create or update the PR.
|
|
||||||
|
|
||||||
Useful local inspection:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git status --short --branch
|
|
||||||
git branch -vv
|
|
||||||
git diff --stat
|
|
||||||
git diff --check
|
|
||||||
```
|
|
||||||
|
|
||||||
## Output Style
|
|
||||||
|
|
||||||
Normally, do not over-explain. If the remote/tool selection is straightforward, just complete the task and summarize the result.
|
|
||||||
|
|
||||||
Report detection details only when there is ambiguity, conflict, missing tooling, or failure. In those cases include:
|
|
||||||
|
|
||||||
- selected remote;
|
|
||||||
- detected forge;
|
|
||||||
- selected CLI;
|
|
||||||
- reason for the choice;
|
|
||||||
- what the user needs to fix, if anything.
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
---
|
|
||||||
name: forge-github
|
|
||||||
---
|
|
||||||
|
|
||||||
# GitHub Forge Interaction
|
|
||||||
|
|
||||||
Use this skill for GitHub forge work when the user wants to interact with GitHub repositories, issues, pull requests, releases, or CI.
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
Choose the correct GitHub CLI (`gh`) and use it to interact with GitHub issues, pull requests, releases, CI, and repository state.
|
|
||||||
|
|
||||||
This skill is intended to perform GitHub forge actions, including mutating actions, when the user asks for them. Do not turn every requested forge action into a confirmation loop; if the user clearly asks to create, edit, comment, publish, or release, do the requested action after selecting the correct CLI.
|
|
||||||
|
|
||||||
## Strict Decision Tree
|
|
||||||
|
|
||||||
Follow this order every time.
|
|
||||||
|
|
||||||
### 1. Determine the target remote
|
|
||||||
|
|
||||||
1. If the user explicitly says which remote or forge to use, use that.
|
|
||||||
2. Else, if user/project memory or repo guidance states where to find the forge, use that.
|
|
||||||
3. Else, if a remote named `forge` exists, use `forge`.
|
|
||||||
4. Else, if the user has configured a default remote, use that.
|
|
||||||
5. Else, use `origin`.
|
|
||||||
|
|
||||||
Useful inspection commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git remote -v
|
|
||||||
git config --get checkout.defaultRemote
|
|
||||||
git config --get clone.defaultRemoteName
|
|
||||||
git config --get branch.$(git branch --show-current).remote
|
|
||||||
```
|
|
||||||
|
|
||||||
Interpretation:
|
|
||||||
|
|
||||||
- A remote named `forge` is the preferred convention for the canonical forge remote.
|
|
||||||
- If no `forge` remote exists, `origin` is the fallback.
|
|
||||||
- If the current branch has an upstream remote and no stronger rule applies, treat that as the user's configured default for the current work.
|
|
||||||
|
|
||||||
Only mention this selection if there is ambiguity or a conflict.
|
|
||||||
|
|
||||||
### 2. Choose the CLI
|
|
||||||
|
|
||||||
Use `gh` for GitHub interactions.
|
|
||||||
|
|
||||||
Check whether the chosen CLI is available:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
command -v gh >/dev/null 2>&1 && gh --version
|
|
||||||
```
|
|
||||||
|
|
||||||
If the needed CLI is missing:
|
|
||||||
|
|
||||||
- Tell the user which CLI is required: `gh` for GitHub.
|
|
||||||
- Tell the user to install it.
|
|
||||||
- If it may already be installed but not discoverable, tell the user to add it to their `PATH`.
|
|
||||||
- Do not use the wrong CLI as a fallback.
|
|
||||||
|
|
||||||
### 3. Check authentication/context
|
|
||||||
|
|
||||||
Use read-only checks for the selected tool:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh auth status
|
|
||||||
gh repo view
|
|
||||||
```
|
|
||||||
|
|
||||||
If authentication is missing, tell the user which CLI needs login/configuration. Do not ask the user to paste tokens or secrets.
|
|
||||||
|
|
||||||
### 4. Do the requested forge task
|
|
||||||
|
|
||||||
Perform the requested action with `gh` commands such as:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh issue list
|
|
||||||
gh issue create
|
|
||||||
gh issue comment
|
|
||||||
gh pr list
|
|
||||||
gh pr create
|
|
||||||
gh pr view
|
|
||||||
gh pr comment
|
|
||||||
gh pr edit
|
|
||||||
gh pr merge
|
|
||||||
gh run list
|
|
||||||
gh run view
|
|
||||||
gh release list
|
|
||||||
gh release create
|
|
||||||
```
|
|
||||||
|
|
||||||
Use exact command syntax supported by the installed CLI version; inspect help when needed:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh help
|
|
||||||
```
|
|
||||||
|
|
||||||
## Mutating Actions
|
|
||||||
|
|
||||||
Mutating forge actions are allowed when clearly requested by the user, including:
|
|
||||||
|
|
||||||
- create an issue;
|
|
||||||
- modify an issue;
|
|
||||||
- comment on an issue;
|
|
||||||
- create a pull request;
|
|
||||||
- modify a pull request;
|
|
||||||
- comment on a pull request;
|
|
||||||
- push a branch;
|
|
||||||
- publish changes;
|
|
||||||
- create a release.
|
|
||||||
|
|
||||||
Still be careful with destructive or high-impact actions:
|
|
||||||
|
|
||||||
- Ask before deleting branches, tags, releases, issues, or repositories.
|
|
||||||
- Ask before force-pushing.
|
|
||||||
- Ask before merging a PR unless the user explicitly asked to merge it.
|
|
||||||
- Ask before overwriting existing release assets or tags.
|
|
||||||
|
|
||||||
## Branch and PR Preparation
|
|
||||||
|
|
||||||
Before creating or updating a PR:
|
|
||||||
|
|
||||||
1. Select the remote using the strict decision tree.
|
|
||||||
2. Inspect branch state and upstream tracking.
|
|
||||||
3. Inspect the diff against the target branch.
|
|
||||||
4. Read the PR template if one exists.
|
|
||||||
5. Push the branch if needed and requested by the workflow.
|
|
||||||
6. Create or update the PR.
|
|
||||||
|
|
||||||
Useful local inspection:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git status --short --branch
|
|
||||||
git branch -vv
|
|
||||||
git diff --stat
|
|
||||||
git diff --check
|
|
||||||
```
|
|
||||||
|
|
||||||
## Output Style
|
|
||||||
|
|
||||||
Normally, do not over-explain. If the remote/tool selection is straightforward, just complete the task and summarize the result.
|
|
||||||
|
|
||||||
Report detection details only when there is ambiguity, conflict, missing tooling, or failure. In those cases include:
|
|
||||||
|
|
||||||
- selected remote;
|
|
||||||
- detected forge;
|
|
||||||
- selected CLI;
|
|
||||||
- reason for the choice;
|
|
||||||
- what the user needs to fix, if anything.
|
|
||||||
@@ -1,227 +0,0 @@
|
|||||||
---
|
|
||||||
name: forge-interaction
|
|
||||||
description: Use when the user wants forge work such as opening a PR, creating or listing issues, checking CI, looking at the repo, pushing a branch, publishing changes, or making a release on GitHub or Gitea. This skill now delegates to specialized skills for better predictability.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Forge Interaction (Router)
|
|
||||||
|
|
||||||
This skill has been refactored into specialized skills for better predictability and maintainability:
|
|
||||||
|
|
||||||
- **GitHub**: Use `/forge-github` for GitHub repositories, issues, pull requests, releases, or CI
|
|
||||||
- **Gitea**: Use `/forge-gitea` for Gitea repositories, issues, pull requests, releases, or CI
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
This router skill delegates to the appropriate specialized forge interaction skill based on the target forge. Each specialized skill handles one forge type completely, making them more predictable and easier to maintain.
|
|
||||||
|
|
||||||
## When to use:
|
|
||||||
|
|
||||||
- If you're unsure which forge you're working with, use this skill and it will guide you
|
|
||||||
- For general forge work without specifying the forge type
|
|
||||||
- When you want the system to figure out which specialized skill to use
|
|
||||||
|
|
||||||
## Delegation Logic
|
|
||||||
|
|
||||||
The router analyzes your request and determines whether to delegate to:
|
|
||||||
|
|
||||||
1. **GitHub skill** (`/forge-github`) - for GitHub repositories and workflows
|
|
||||||
2. **Gitea skill** (`/forge-gitea`) - for Gitea repositories and workflows
|
|
||||||
|
|
||||||
Each specialized skill contains the complete decision tree and implementation for its respective forge type.
|
|
||||||
|
|
||||||
## Recommendation
|
|
||||||
|
|
||||||
For most predictable results, use the specialized skills directly:
|
|
||||||
- `/forge-github` when working with GitHub
|
|
||||||
- `/forge-gitea` when working with Gitea
|
|
||||||
|
|
||||||
This separation follows the principle of single responsibility and makes each skill more focused and reliable.
|
|
||||||
|
|
||||||
## Strict Decision Tree
|
|
||||||
|
|
||||||
Follow this order every time.
|
|
||||||
|
|
||||||
### 1. Determine the target remote
|
|
||||||
|
|
||||||
1. If the user explicitly says which remote or forge to use, use that.
|
|
||||||
2. Else, if user/project memory or repo guidance states where to find the forge, use that.
|
|
||||||
3. Else, if a remote named `forge` exists, use `forge`.
|
|
||||||
4. Else, if the user has configured a default remote, use that.
|
|
||||||
5. Else, use `origin`.
|
|
||||||
|
|
||||||
Useful inspection commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git remote -v
|
|
||||||
git config --get checkout.defaultRemote
|
|
||||||
git config --get clone.defaultRemoteName
|
|
||||||
git config --get branch.$(git branch --show-current).remote
|
|
||||||
```
|
|
||||||
|
|
||||||
Interpretation:
|
|
||||||
|
|
||||||
- A remote named `forge` is the preferred convention for the canonical forge remote.
|
|
||||||
- If no `forge` remote exists, `origin` is the fallback.
|
|
||||||
- If the current branch has an upstream remote and no stronger rule applies, treat that as the user's configured default for the current work.
|
|
||||||
|
|
||||||
Only mention this selection if there is ambiguity or a conflict.
|
|
||||||
|
|
||||||
### 2. Determine the forge type from the chosen remote
|
|
||||||
|
|
||||||
Inspect the selected remote URL:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git remote get-url <remote>
|
|
||||||
```
|
|
||||||
|
|
||||||
Classify it:
|
|
||||||
|
|
||||||
- URLs containing `github.com` are GitHub.
|
|
||||||
- URLs containing `gitea`, or a known Gitea host from memory/project guidance, are Gitea.
|
|
||||||
- If the remote is self-hosted and ambiguous, inspect repo guidance, memory, and web/API/tool configuration before asking.
|
|
||||||
|
|
||||||
Do not choose based on which CLI is installed. The remote determines the forge; the forge determines the CLI.
|
|
||||||
|
|
||||||
### 3. Choose the CLI
|
|
||||||
|
|
||||||
- If the forge is GitHub, use `gh`.
|
|
||||||
- If the forge is Gitea, use `tea`.
|
|
||||||
|
|
||||||
Check whether the chosen CLI is available:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
command -v gh >/dev/null 2>&1 && gh --version
|
|
||||||
command -v tea >/dev/null 2>&1 && tea --version
|
|
||||||
```
|
|
||||||
|
|
||||||
If the needed CLI is missing:
|
|
||||||
|
|
||||||
- Tell the user which CLI is required: `gh` for GitHub, `tea` for Gitea.
|
|
||||||
- Tell the user to install it.
|
|
||||||
- If it may already be installed but not discoverable, tell the user to add it to their `PATH`.
|
|
||||||
- Do not use the wrong CLI as a fallback.
|
|
||||||
|
|
||||||
### 4. Check authentication/context
|
|
||||||
|
|
||||||
Use read-only checks for the selected tool:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# GitHub
|
|
||||||
gh auth status
|
|
||||||
gh repo view
|
|
||||||
|
|
||||||
# Gitea
|
|
||||||
tea login list
|
|
||||||
tea repos ls
|
|
||||||
```
|
|
||||||
|
|
||||||
If authentication is missing, tell the user which CLI needs login/configuration. Do not ask the user to paste tokens or secrets.
|
|
||||||
|
|
||||||
### 5. Do the requested forge task
|
|
||||||
|
|
||||||
Perform the requested action with the selected CLI.
|
|
||||||
|
|
||||||
For GitHub, use `gh` commands such as:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh issue list
|
|
||||||
gh issue create
|
|
||||||
gh issue comment
|
|
||||||
gh pr list
|
|
||||||
gh pr create
|
|
||||||
gh pr view
|
|
||||||
gh pr comment
|
|
||||||
gh pr edit
|
|
||||||
gh pr merge
|
|
||||||
gh run list
|
|
||||||
gh run view
|
|
||||||
gh release list
|
|
||||||
gh release create
|
|
||||||
```
|
|
||||||
|
|
||||||
For Gitea, use `tea` commands such as:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
tea issues list
|
|
||||||
tea issues create
|
|
||||||
tea issues comment
|
|
||||||
tea pulls list
|
|
||||||
tea pulls create
|
|
||||||
tea pulls view
|
|
||||||
tea pulls comment
|
|
||||||
tea pulls merge
|
|
||||||
tea releases list
|
|
||||||
tea releases create
|
|
||||||
```
|
|
||||||
|
|
||||||
Use exact command syntax supported by the installed CLI version; inspect help when needed:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh help
|
|
||||||
tea help
|
|
||||||
```
|
|
||||||
|
|
||||||
## Mutating Actions
|
|
||||||
|
|
||||||
Mutating forge actions are allowed when clearly requested by the user, including:
|
|
||||||
|
|
||||||
- create an issue;
|
|
||||||
- modify an issue;
|
|
||||||
- comment on an issue;
|
|
||||||
- create a pull request;
|
|
||||||
- modify a pull request;
|
|
||||||
- comment on a pull request;
|
|
||||||
- push a branch;
|
|
||||||
- publish changes;
|
|
||||||
- create a release.
|
|
||||||
|
|
||||||
Still be careful with destructive or high-impact actions:
|
|
||||||
|
|
||||||
- Ask before deleting branches, tags, releases, issues, or repositories.
|
|
||||||
- Ask before force-pushing.
|
|
||||||
- Ask before merging a PR unless the user explicitly asked to merge it.
|
|
||||||
- Ask before overwriting existing release assets or tags.
|
|
||||||
|
|
||||||
## Branch and PR Preparation
|
|
||||||
|
|
||||||
Before creating or updating a PR:
|
|
||||||
|
|
||||||
1. Select the remote using the strict decision tree.
|
|
||||||
2. Select the CLI from the remote's forge type.
|
|
||||||
3. Inspect branch state and upstream tracking.
|
|
||||||
4. Inspect the diff against the target branch.
|
|
||||||
5. Read the PR template if one exists.
|
|
||||||
6. Push the branch if needed and requested by the workflow.
|
|
||||||
7. Create or update the PR.
|
|
||||||
|
|
||||||
Useful local inspection:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git status --short --branch
|
|
||||||
git branch -vv
|
|
||||||
git diff --stat
|
|
||||||
git diff --check
|
|
||||||
```
|
|
||||||
|
|
||||||
## Output Style
|
|
||||||
|
|
||||||
Normally, do not over-explain. If the remote/tool selection is straightforward, just complete the task and summarize the result.
|
|
||||||
|
|
||||||
Report detection details only when there is ambiguity, conflict, missing tooling, or failure. In those cases include:
|
|
||||||
|
|
||||||
- selected remote;
|
|
||||||
- detected forge;
|
|
||||||
- selected CLI;
|
|
||||||
- reason for the choice;
|
|
||||||
- what the user needs to fix, if anything.
|
|
||||||
|
|
||||||
## Companion Personal Skill
|
|
||||||
|
|
||||||
Personal forge preferences should live in a separate skill or memory entry, not in this general skill. That companion skill/memory may specify things like:
|
|
||||||
|
|
||||||
- preferred default remote conventions;
|
|
||||||
- known personal Gitea or GitHub hosts;
|
|
||||||
- preferred issue/PR/release styles;
|
|
||||||
- project-specific forge rules.
|
|
||||||
|
|
||||||
This general skill should consume that memory/guidance when present, but keep the generic decision tree above as the fallback.
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
name: forge-preferences
|
|
||||||
description: Use with forge-interaction to apply Steve's personal or project-specific GitHub/Gitea remote, CLI, issue, PR, and release preferences.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Forge Preferences
|
|
||||||
|
|
||||||
Use this companion skill with `/forge-interaction` when personal or project-specific forge preferences are relevant.
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
Store personal conventions that should not live in the generic forge interaction skill.
|
|
||||||
|
|
||||||
## Current Preferences
|
|
||||||
|
|
||||||
- If a remote named `forge` exists, treat it as the canonical forge remote.
|
|
||||||
- If no `forge` remote exists, use the user's configured default remote when available.
|
|
||||||
- If no default remote is configured, use `origin`.
|
|
||||||
- Use the forge type of the selected remote to choose the CLI:
|
|
||||||
- GitHub → `gh`
|
|
||||||
- Gitea → `tea`
|
|
||||||
- If the correct CLI is missing, tell the user to install it or add it to `PATH`.
|
|
||||||
- Do not use the wrong CLI as a fallback.
|
|
||||||
|
|
||||||
## Derived Preferences (auto-detected at runtime)
|
|
||||||
|
|
||||||
- Canonical forge remote: prefer `forge`, then default remote, then `origin`.
|
|
||||||
- Forge CLI: determined from remote URL (GitHub → `gh`, Gitea → `tea`).
|
|
||||||
- Known personal Gitea hosts and GitHub usernames/orgs are collected from the remote URL and git CLI at time of use — no hardcoded list.
|
|
||||||
|
|
||||||
## Issue Labels
|
|
||||||
|
|
||||||
See `triage-labels.md` in this directory for the canonical-to-actual label mapping.
|
|
||||||
|
|
||||||
## PR Conventions
|
|
||||||
|
|
||||||
- PR titles follow Conventional Commits: `type(scope): description`.
|
|
||||||
- Common types: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`, `style`.
|
|
||||||
- PR body is freeform but should summarise the change and any breaking or noteworthy details.
|
|
||||||
|
|
||||||
## Release Conventions
|
|
||||||
|
|
||||||
- Tags follow semver: `v{major}.{minor}.{patch}` (e.g. `v1.2.3`).
|
|
||||||
- Releases are created from the tag with auto-generated or manually curated notes.
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# Triage Labels
|
|
||||||
|
|
||||||
The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
|
|
||||||
|
|
||||||
| Label in mattpocock/skills | Label in our tracker | Meaning |
|
|
||||||
| -------------------------- | -------------------- | ---------------------------------------- |
|
|
||||||
| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
|
|
||||||
| `needs-info` | `needs-info` | Waiting on reporter for more information |
|
|
||||||
| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
|
|
||||||
| `ready-for-human` | `ready-for-human` | Requires human implementation |
|
|
||||||
| `wontfix` | `wontfix` | Will not be actioned |
|
|
||||||
|
|
||||||
When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table.
|
|
||||||
|
|
||||||
Edit the right-hand column to match whatever vocabulary you actually use.
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
name: forge-router
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Forge Router
|
|
||||||
|
|
||||||
Choose the right forge interaction skill for your task.
|
|
||||||
|
|
||||||
## When to use:
|
|
||||||
|
|
||||||
- **GitHub**: Use `/forge-github` when working with GitHub repositories, issues, pull requests, releases, or CI.
|
|
||||||
- **Gitea**: Use `/forge-gitea` when working with Gitea repositories, issues, pull requests, releases, or CI.
|
|
||||||
|
|
||||||
## How it works:
|
|
||||||
|
|
||||||
The router delegates to specialized skills that handle each forge type separately. This keeps each skill focused and predictable.
|
|
||||||
|
|
||||||
**GitHub skill** (`/forge-github`):
|
|
||||||
- Handles GitHub-specific interactions using the `gh` CLI
|
|
||||||
- Follows GitHub's API patterns and conventions
|
|
||||||
- Optimized for GitHub's feature set
|
|
||||||
|
|
||||||
**Gitea skill** (`/forge-gitea`):
|
|
||||||
- Handles Gitea-specific interactions using the `tea` CLI
|
|
||||||
- Follows Gitea's API patterns and conventions
|
|
||||||
- Optimized for Gitea's feature set
|
|
||||||
|
|
||||||
## Why separate:
|
|
||||||
|
|
||||||
- **Predictability**: Each skill knows exactly one forge type
|
|
||||||
- **Maintainability**: Changes to GitHub or Gitea logic stay isolated
|
|
||||||
- **Clarity**: Users can see which forge a skill handles at a glance
|
|
||||||
- **Testing**: Each skill can be tested independently
|
|
||||||
|
|
||||||
## Usage examples:
|
|
||||||
|
|
||||||
```
|
|
||||||
# For GitHub work
|
|
||||||
/forge-github create an issue in this repo
|
|
||||||
/forge-github list pull requests
|
|
||||||
/forge-github check CI status
|
|
||||||
|
|
||||||
# For Gitea work
|
|
||||||
/forge-gitea create an issue in this repo
|
|
||||||
/forge-gitea list pull requests
|
|
||||||
/forge-gitea check CI status
|
|
||||||
```
|
|
||||||
|
|
||||||
The router ensures you always use the right tool for the right forge.
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
# Forge Skills
|
|
||||||
|
|
||||||
A collection of specialized forge interaction skills for GitHub and Gitea.
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
This directory contains focused skills for interacting with different code hosting platforms:
|
|
||||||
|
|
||||||
- **GitHub**: Use `/forge-github` for GitHub repositories, issues, pull requests, releases, or CI
|
|
||||||
- **Gitea**: Use `/forge-gitea` for Gitea repositories, issues, pull requests, releases, or CI
|
|
||||||
- **Router**: Use `/forge-interaction` to let the system choose the right skill automatically
|
|
||||||
|
|
||||||
## Skill Structure
|
|
||||||
|
|
||||||
Each forge-specific skill is designed with:
|
|
||||||
|
|
||||||
1. **Single Responsibility**: Handles only one forge type (GitHub or Gitea)
|
|
||||||
2. **Predictable Behavior**: Clear decision tree and completion criteria
|
|
||||||
3. **Complete Coverage**: All requested forge actions are supported
|
|
||||||
4. **Error Handling**: Specific guidance for missing tools or authentication
|
|
||||||
|
|
||||||
## Choosing the Right Skill
|
|
||||||
|
|
||||||
### Use `/forge-github` when:
|
|
||||||
- Working with GitHub repositories (`github.com` URLs)
|
|
||||||
- Using the `gh` CLI tool
|
|
||||||
- Interacting with GitHub-specific features (issues, PRs, releases, CI)
|
|
||||||
|
|
||||||
### Use `/forge-gitea` when:
|
|
||||||
- Working with Gitea repositories (`gitea.com` or self-hosted Gitea)
|
|
||||||
- Using the `tea` CLI tool
|
|
||||||
- Interacting with Gitea-specific features (issues, PRs, releases, CI)
|
|
||||||
|
|
||||||
### Use `/forge-interaction` when:
|
|
||||||
- You're unsure which forge you're working with
|
|
||||||
- You want the system to automatically choose the right skill
|
|
||||||
- You prefer a unified interface that handles both platforms
|
|
||||||
|
|
||||||
## Skill Comparison
|
|
||||||
|
|
||||||
| Feature | GitHub Skill | Gitea Skill |
|
|
||||||
|---------|--------------|-------------|
|
|
||||||
| CLI Tool | `gh` | `tea` |
|
|
||||||
| Platform | GitHub | Gitea |
|
|
||||||
| Focus | GitHub-specific | Gitea-specific |
|
|
||||||
| Predictability | High | High |
|
|
||||||
| Maintenance | Isolated | Isolated |
|
|
||||||
|
|
||||||
## Usage Examples
|
|
||||||
|
|
||||||
```
|
|
||||||
# For GitHub work
|
|
||||||
/forge-github create an issue in this repo
|
|
||||||
/forge-github list pull requests
|
|
||||||
/forge-github check CI status
|
|
||||||
/forge-github publish a new release
|
|
||||||
|
|
||||||
# For Gitea work
|
|
||||||
/forge-gitea create an issue in this repo
|
|
||||||
/forge-gitea list pull requests
|
|
||||||
/forge-gitea check CI status
|
|
||||||
/forge-gitea publish a new release
|
|
||||||
|
|
||||||
# Let the system decide
|
|
||||||
/forge-interaction create a PR for this feature
|
|
||||||
```
|
|
||||||
|
|
||||||
## Why Separate Skills?
|
|
||||||
|
|
||||||
1. **Predictability**: Each skill knows exactly one forge type
|
|
||||||
2. **Maintainability**: Changes to GitHub or Gitea logic stay isolated
|
|
||||||
3. **Clarity**: Users can see which forge a skill handles at a glance
|
|
||||||
4. **Testing**: Each skill can be tested independently
|
|
||||||
5. **Cognitive Load**: Users remember fewer skills and their specific purposes
|
|
||||||
|
|
||||||
## Related Skills
|
|
||||||
|
|
||||||
- `/forge-router` - High-level guidance for choosing the right forge skill
|
|
||||||
- `/forge-preferences` - Personal or project-specific forge configurations
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
1. Choose the appropriate skill based on your forge platform
|
|
||||||
2. Ensure the required CLI tool (`gh` or `tea`) is installed
|
|
||||||
3. Configure authentication for your forge platform
|
|
||||||
4. Start with simple actions and build up to more complex workflows
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Engineering Skills
|
|
||||||
|
|
||||||
## User-invoked
|
|
||||||
|
|
||||||
- [implement-issue](implement-issue/SKILL.md) — Dispatch a child agent in an isolated git worktree to implement a ready-for-agent issue end-to-end.
|
|
||||||
- [grill-with-docs](grill-with-docs/SKILL.md) — A relentless interview to sharpen a plan or design, which also creates docs (ADRs and glossary) as we go.
|
|
||||||
- [improve-codebase-architecture](improve-codebase-architecture/SKILL.md) — Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
|
|
||||||
- [project-context-pack](project-context-pack/SKILL.md) — Build and refresh a bounded repo context memory file so agents use disciplined search instead of repeated browsing.
|
|
||||||
- [setup-skills](setup-skills/SKILL.md) — Configure this repo for the engineering skills, set up its issue tracker, triage label vocabulary, and domain doc layout.
|
|
||||||
- [to-issues](to-issues/SKILL.md) — Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.
|
|
||||||
- [to-prd](to-prd/SKILL.md) — Turn the current conversation into a PRD and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.
|
|
||||||
- [triage](triage/SKILL.md) — Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.
|
|
||||||
|
|
||||||
## Model-invoked
|
|
||||||
|
|
||||||
- [codebase-design](codebase-design/SKILL.md) — Shared vocabulary for designing deep modules.
|
|
||||||
- [domain-modeling](domain-modeling/SKILL.md) — Build and sharpen a project's domain model.
|
|
||||||
- [resolving-merge-conflicts](resolving-merge-conflicts/SKILL.md) — Resolve an in-progress git merge/rebase conflict.
|
|
||||||
- [tdd](tdd/SKILL.md) — Test-driven development.
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
---
|
|
||||||
name: implement-issue
|
|
||||||
description: "Dispatch a child agent in an isolated git worktree to implement a piece of work based on a PRD or set of issues."
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
## Invocation
|
|
||||||
|
|
||||||
/skill:implement-issue <N> [--base <branch>] [--force]
|
|
||||||
|
|
||||||
- `<N>` — required, the issue number
|
|
||||||
- `--base <branch>` — optional, target base branch (default: repo default branch)
|
|
||||||
- `--force` — optional, allow overwriting an existing worktree
|
|
||||||
|
|
||||||
## Process
|
|
||||||
|
|
||||||
### 1. Setup
|
|
||||||
|
|
||||||
#### a. Label the issue `in-progress`
|
|
||||||
|
|
||||||
Change the issue triage label to `in-progress`.
|
|
||||||
|
|
||||||
Completion criterion: The issue label is confirmed as `in-progress`.
|
|
||||||
|
|
||||||
#### b. Create the worktree
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git worktree add -b <branch-name> ../<repo-name>-issue-<N> <base>
|
|
||||||
```
|
|
||||||
|
|
||||||
Completion criterion: The worktree exists at `../<repo-name>-issue-<N>` and the new branch is checked out.
|
|
||||||
|
|
||||||
### 2. Compose the child prompt
|
|
||||||
|
|
||||||
Assemble a single prompt that the child agent will receive. Include:
|
|
||||||
|
|
||||||
- **Issue body** — the full markdown body of the issue.
|
|
||||||
- **Comments** — all comments, if any
|
|
||||||
- **Standing instruction**: "Implement using /tdd where possible, at the pre-agreed seam. Run typechecking regularly, run single test files regularly, and run the full test suite once at the end. Once done, use /code-review to review the work. Commit your work and push the new branch and create a PR with a link to the issue, one-sentence summary, and short key-changes list. Comment on the issue with the PR link: `PR opened: <url>`. Change the issue triage label to needs-review when done."
|
|
||||||
- **Failure instruction**: "If any step fails, report where you stopped and what remains for manual recovery. Print the exact commands needed."
|
|
||||||
|
|
||||||
(The prompt is passed as arguments to tmux-launch-agent in step 3, which handles writing it to a temp file if needed.)
|
|
||||||
|
|
||||||
Completion criterion: The prompt is composed with all required sections (issue body, comments, standing instruction, failure instruction).
|
|
||||||
|
|
||||||
### 3. Launch the child via tmux-launch-agent
|
|
||||||
|
|
||||||
Use the [`tmux-launch-agent`](../../../../.agents/skills/tmux-launch-agent/SKILL.md) skill to fork the child agent into a new tmux window. Tmux-launch-agent handles agent detection, config lookup, command building (prompt-file or stdin-pipe), mise/SHELL wrapping, and `tmux new-window` creation.
|
|
||||||
|
|
||||||
Pass these parameters:
|
|
||||||
|
|
||||||
| Parameter | Value |
|
|
||||||
|-----------|-------|
|
|
||||||
| `--name` | `"issue-<N>-<repo-slug>"` — tmux window title |
|
|
||||||
| Remaining args | The full prompt text composed in step 2 |
|
|
||||||
|
|
||||||
Ensure the child agent starts in the worktree. If the current pane's working directory is already inside `<absolute-worktree-path>` (from step 1b), tmux-launch-agent's new window inherits it. Otherwise, add `-c <absolute-worktree-path>` to the `tmux new-window` command in tmux-launch-agent's step 6.
|
|
||||||
|
|
||||||
Do **not** pre-write the prompt to a separate file — tmux-launch-agent writes its own temp file if the target agent uses prompt-file mode.
|
|
||||||
|
|
||||||
The window stays open after the child completes so the user can review the output.
|
|
||||||
|
|
||||||
Completion criterion: `tmux new-window` exits 0 and a new tmux window appears with the child agent session active.
|
|
||||||
|
|
||||||
### 4. Print summary
|
|
||||||
|
|
||||||
After launching, print:
|
|
||||||
- Issue number and title
|
|
||||||
- Worktree path
|
|
||||||
- Branch name
|
|
||||||
- Base branch
|
|
||||||
- Agent used (detected by tmux-launch-agent)
|
|
||||||
- Tmux window name (so the user can find it)
|
|
||||||
- Cleanup command: `git worktree remove <worktree-path> && git worktree prune`
|
|
||||||
|
|
||||||
The parent's turn ends here. The user can dispatch another issue immediately.
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# Issue tracker: Gitea
|
|
||||||
|
|
||||||
Issues and PRDs for this repo live as Gitea issues. Use the `gitea` CLI for all operations.
|
|
||||||
|
|
||||||
## Conventions
|
|
||||||
|
|
||||||
- **Create an issue**: `tea issue create --title "..." --description "..."`. Use a heredoc for multi-line descriptions.
|
|
||||||
- **Read an issue**: `tea issue <number> --comments`. Use `-o json` for machine-readable output.
|
|
||||||
- **List issues**: `tea issue list --state open -o json` with appropriate `--labels` and `--state` filters.
|
|
||||||
- **Comment on an issue**: `tea comment <number> "..."`.
|
|
||||||
- **Apply / remove labels**: `tea issue edit <number> --add-label "..."` / `--remove-label "..."`. Multiple labels can be comma-separated or by repeating the flag.les
|
|
||||||
- **Close**: `tea issue close <number>`. `tea issue close` does not accept a closing comment, so post the explanation first with `tea comment <number> "..."`, then close.
|
|
||||||
|
|
||||||
Infer the repo from git remote -v — `tea` does this automatically when run inside a clone.
|
|
||||||
|
|
||||||
## Pull requests as a triage surface
|
|
||||||
|
|
||||||
**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_
|
|
||||||
|
|
||||||
When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:
|
|
||||||
|
|
||||||
- **Read a PR**: `tea pr <number> --comments` and `tea api /repos/{owner}/{repo}/pulls/<number>.diff` for the diff.
|
|
||||||
|
|
||||||
- **List external PRs for triage**: `tea pr list --state open -o json ` then keep only PRs whose author is not a project member/owner (a contributor's MR, not a maintainer's in-flight work).
|
|
||||||
- **Comment / label / close**: `tea comment <number> "..."`, `tea pr edit --add-label`/`--remove-label`, `tea pr close`.
|
|
||||||
|
|
||||||
Gitea shares one number space across issues and PRs, so a bare `#42` may be either — resolve with `tea pr 42` and fall back to `tea issue 42`.
|
|
||||||
|
|
||||||
## When a skill says "publish to the issue tracker"
|
|
||||||
|
|
||||||
Create a Gitea issue.
|
|
||||||
|
|
||||||
## When a skill says "fetch the relevant ticket"
|
|
||||||
|
|
||||||
Run `tea issue <number> --comments`.
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
---
|
|
||||||
name: tmux-launch-agent
|
|
||||||
description: Fork a new agent CLI session into a new tmux window, detected from the current agent.
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
## Agent CLI Seed Data
|
|
||||||
|
|
||||||
The agent config (binary, `args` convention per agent) and field meanings are in [`agents-seed.md`](agents-seed.md). Step 2 reads it to find the calling agent's entry.
|
|
||||||
|
|
||||||
|
|
||||||
## Process
|
|
||||||
|
|
||||||
1. **Detect the calling agent** — Run `./detect-agent` (sibling to this skill). If it exits 1 (agent unknown), report the failure and stop — the agent name is required.
|
|
||||||
|
|
||||||
Completion criterion: The agent name is known and non-empty.
|
|
||||||
|
|
||||||
2. **Look up the agent config** — Find the agent's entry in [`agents-seed.md`](agents-seed.md) by `name`. Extract its `binary` and `args` fields.
|
|
||||||
|
|
||||||
Completion criterion: The agent's entry is found and its `binary` and `args` are known.
|
|
||||||
|
|
||||||
3. **Parse flags** — Scan the user's arguments for optional flags (which must come before the prompt text):
|
|
||||||
- `--name <title>` or `-n <title>` — the tmux window title. Extract the title and remove the flag and its value from the arguments list.
|
|
||||||
- `-c <path>` — the working directory for the new window. Extract the path and remove the flag and its value from the arguments list.
|
|
||||||
|
|
||||||
The remaining text after stripping both flags is the prompt for the child agent.
|
|
||||||
|
|
||||||
If `--name`/`-n` is absent, tmux auto-names the window.
|
|
||||||
If `-c` is absent, the new window inherits the current pane's working directory.
|
|
||||||
|
|
||||||
Completion criterion: The arguments are split into an optional window name, an optional directory path, and the remaining prompt text.
|
|
||||||
|
|
||||||
4. **Build the inner command** — Combine the agent config with the remaining user-supplied prompt arguments. The `args` template determines how the prompt is delivered:
|
|
||||||
|
|
||||||
- **Prompt-file agents** (`args` contains `{prompt}`) — Write the prompt text to a temporary file under `/tmp/` and substitute the file path for `{prompt}` in the args template. For example, an agent with `args: "@{prompt}"` becomes `<binary> @/tmp/tmux-launch-XXXX.md`.
|
|
||||||
- **Stdin-pipe agents** (`args` is empty) — Pipe the prompt text via `echo` into the binary.
|
|
||||||
- **No prompt** — If the user passed no arguments (after removing flags), launch the binary bare (interactive start) with no prompt file or pipe.
|
|
||||||
|
|
||||||
Completion criterion: The inner command is correctly built per the target agent's `args` convention (prompt-file, stdin-pipe, or bare).
|
|
||||||
|
|
||||||
5. **Wrap with the environment runner** — Detect whether `mise` is available via `command -v mise`:
|
|
||||||
|
|
||||||
- **mise available** — Wrap the inner command as `mise x --allow-env='*' -- <inner-command>`.
|
|
||||||
- **mise absent** — Wrap the inner command as `$SHELL -c '<inner-command>'`.
|
|
||||||
|
|
||||||
Completion criterion: A valid shell command string is ready.
|
|
||||||
|
|
||||||
6. **Fork into a new tmux window** — Build and run:
|
|
||||||
```
|
|
||||||
tmux new-window <name-flag> <dir-flag> "<shell-command>"
|
|
||||||
```
|
|
||||||
- `<shell-command>` — the wrapped command from step 5.
|
|
||||||
- `<name-flag>` — `-n "<title>"` if a window name was parsed in step 3, omitted otherwise.
|
|
||||||
- `<dir-flag>` — `-c <path>` if a directory was parsed in step 3, omitted otherwise.
|
|
||||||
|
|
||||||
Completion criterion: `tmux new-window` exits 0 and a new tmux window appears with the agent CLI session active.
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# Personal Skills
|
|
||||||
|
|
||||||
_No skills currently live in this bucket._
|
|
||||||
|
|
||||||
- `pkm-curation` has been moved to [pkm/pkm-curation](../pkm/pkm-curation/SKILL.md).
|
|
||||||
- `forge-preferences` has been moved to [deprecated/forge-preferences](../deprecated/forge-preferences/SKILL.md).
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# PKM Skills
|
|
||||||
|
|
||||||
## User-invoked
|
|
||||||
|
|
||||||
- [conversation-summary](conversation-summary/SKILL.md) — Save the current conversation as a comprehensive report note in your Obsidian vault.
|
|
||||||
- [crit](crit/SKILL.md) — Brainstorm with AI using the CRIT framework to generate and evaluate ideas.
|
|
||||||
- [knowledge-gardener](knowledge-gardener/SKILL.md) — Run vault-aware semantic search, synthesis, note creation, linking, and Zettelkasten workflows for this Obsidian vault.
|
|
||||||
- [pkm-curation](pkm-curation/SKILL.md) — Curate an Obsidian vault — classify notes, normalize frontmatter, add wikilinks, extract atomic notes. Use when curating, batch-processing, reviewing, or doing a serendipity pick.
|
|
||||||
- [research-vault](research-vault/SKILL.md) — Research a topic through a one-question-at-a-time learning conversation and save a linked Obsidian research packet.
|
|
||||||
|
|
||||||
## Model-invoked
|
|
||||||
|
|
||||||
_None yet._
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
---
|
|
||||||
name: crit
|
|
||||||
description: brainstorm with AI using the CRIT framework to generate and evaluate ideas.
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
This skill implements the CRIT (Context-Request-Ideation-Tone) framework for structured brainstorming and idea evaluation.
|
|
||||||
|
|
||||||
## Core Workflow
|
|
||||||
|
|
||||||
### Step 1: Context Analysis
|
|
||||||
Before generating ideas, establish the foundation:
|
|
||||||
|
|
||||||
1. **Identify the Core Domain**
|
|
||||||
- What field, industry, or subject area?
|
|
||||||
- What are the key constraints (time, resources, technical limitations)?
|
|
||||||
- Who is the target audience and their expertise level?
|
|
||||||
|
|
||||||
2. **Assess Current State**
|
|
||||||
- What problems or opportunities exist?
|
|
||||||
- What has been tried before (if applicable)?
|
|
||||||
- What resources are available?
|
|
||||||
|
|
||||||
**Completion Criterion**: Domain, constraints, and current state captured in a compact summary (3-5 sentences).
|
|
||||||
|
|
||||||
### Step 2: Request Clarification
|
|
||||||
Structure the brainstorming request:
|
|
||||||
|
|
||||||
1. **Define the Specific Goal**
|
|
||||||
- What concrete outcome do you want?
|
|
||||||
- What success criteria will be used?
|
|
||||||
- What is the expected timeline?
|
|
||||||
|
|
||||||
2. **Gather Input Requirements**
|
|
||||||
- What information is needed to proceed?
|
|
||||||
- What assumptions should be validated?
|
|
||||||
- What data or resources are required?
|
|
||||||
|
|
||||||
**Completion Criterion**: Goal and input requirements captured as 1-3 concrete statements, each with a checkable success criterion.
|
|
||||||
|
|
||||||
### Step 3: Ideation
|
|
||||||
Generate diverse, high-quality ideas:
|
|
||||||
|
|
||||||
1. **Divergent Thinking Phase**
|
|
||||||
- Generate 5-10 initial concepts without judgment
|
|
||||||
- Apply different perspectives (technical, business, user experience)
|
|
||||||
- Include both obvious and unconventional options
|
|
||||||
|
|
||||||
2. **Convergent Analysis Phase**
|
|
||||||
- Evaluate each idea against success criteria
|
|
||||||
- Score ideas on feasibility, impact, and alignment
|
|
||||||
- Identify patterns and synergies between ideas
|
|
||||||
|
|
||||||
**Completion Criterion**: Minimum 5 distinct ideas generated and evaluated with scores.
|
|
||||||
|
|
||||||
### Step 4: Iterative Refinement
|
|
||||||
Improve selected ideas:
|
|
||||||
|
|
||||||
1. **Select Top Candidates**
|
|
||||||
- Choose 2-3 ideas with highest potential
|
|
||||||
- Detail implementation approach for each
|
|
||||||
- Identify risks and mitigation strategies
|
|
||||||
|
|
||||||
2. **Develop Action Plans**
|
|
||||||
- Break down into concrete steps
|
|
||||||
- Assign priorities and dependencies
|
|
||||||
- Define success metrics and checkpoints
|
|
||||||
|
|
||||||
**Completion Criterion**: 2-3 refined ideas with detailed action plans.
|
|
||||||
|
|
||||||
### Step 5: Tone & Delivery
|
|
||||||
Adapt communication to the audience:
|
|
||||||
|
|
||||||
1. **Choose Appropriate Role**
|
|
||||||
- Subject Matter Expert for technical depth
|
|
||||||
- Consultant for strategic guidance
|
|
||||||
- Teacher for complex concepts
|
|
||||||
- Collaborator for co-creation
|
|
||||||
- Analyst for multi-perspective evaluation
|
|
||||||
|
|
||||||
2. **Structure Response**
|
|
||||||
- Lead with clear, actionable solutions
|
|
||||||
- Organize information logically and concisely
|
|
||||||
- Include examples or analogies for clarity
|
|
||||||
- Suggest next steps and follow-up questions
|
|
||||||
|
|
||||||
**Completion Criterion**: Response delivered in chosen role with sections clearly labeled (Context, Request, Ideation, Refinement, Next Steps).
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# Productivity Skills
|
|
||||||
|
|
||||||
## User-invoked
|
|
||||||
|
|
||||||
- [grill-me](grill-me/SKILL.md) — A relentless interview to sharpen a plan or design.
|
|
||||||
- [handoff](handoff/SKILL.md) — Compact the current conversation into a handoff document for another agent to pick up.
|
|
||||||
- [writing-great-skills](writing-great-skills/SKILL.md) — Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.
|
|
||||||
|
|
||||||
## Model-invoked
|
|
||||||
|
|
||||||
- [grilling](grilling/SKILL.md) — Interview the user relentlessly about a plan or design.
|
|
||||||
@@ -4,9 +4,9 @@ Issues and PRDs for this repo live as Gitea issues. Use the `tea` CLI for all op
|
|||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|
||||||
- **Create an issue**: `tea issue create --title "..." --description "..."`. Use a heredoc for multi-line descriptions.
|
- **Create an issue**: `tea issue create --title "..." --description "..."`. Use a heredoc for multi-line descriptions.
|
||||||
- **Read an issue**: `tea issue <number> --comments`. Use `-o json` for machine-readable output.
|
- **Read an issue**: `tea issue <number> --comments`. Use `-o json` for machine-readable output.
|
||||||
- **List issues**: `tea issue list --state open -o json` with appropriate `--labels` and `--state` filters.
|
- **List issues**: `tea issue list --state open -o json` with appropriate `--labels` and `--state` filters.
|
||||||
- **Comment on an issue**: `tea comment <number> "..."`.
|
- **Comment on an issue**: `tea comment <number> "..."`.
|
||||||
- **Apply / remove labels**: `tea issue edit <number> --add-label "..."` / `--remove-label "..."`. Multiple labels can be comma-separated or by repeating the flag.
|
- **Apply / remove labels**: `tea issue edit <number> --add-label "..."` / `--remove-label "..."`. Multiple labels can be comma-separated or by repeating the flag.
|
||||||
- **Close**: `tea issue close <number>`. `tea issue close` does not accept a closing comment, so post the explanation first with `tea comment <number> "..."`, then close.
|
- **Close**: `tea issue close <number>`. `tea issue close` does not accept a closing comment, so post the explanation first with `tea comment <number> "..."`, then close.
|
||||||
@@ -15,12 +15,12 @@ Infer the repo from git remote -v — `tea` does this automatically when run ins
|
|||||||
|
|
||||||
## Pull requests as a triage surface
|
## Pull requests as a triage surface
|
||||||
|
|
||||||
**PRs as a request surface: no.**
|
**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_
|
||||||
|
|
||||||
When set to `yes`, PRs run through the same labels and states as issues, using the `tea pr` equivalents:
|
When set to `yes`, PRs run through the same labels and states as issues, using the `tea pr` equivalents:
|
||||||
|
|
||||||
- **Read a PR**: `tea pr <number> --comments` and `tea api /repos/{owner}/{repo}/pulls/<number>.diff` for the diff.
|
- **Read a PR**: `tea pr <number> --comments` and `tea api /repos/{owner}/{repo}/pulls/<number>.diff` for the diff.
|
||||||
- **List external PRs for triage**: `tea pr list --state open -o json` then keep only PRs whose author is not a project member/owner.
|
- **List external PRs for triage**: `tea pr list --state open -o json` then keep only PRs whose author is not a project member/owner (a contributor's MR, not a maintainer's in-flight work).
|
||||||
- **Comment / label / close**: `tea comment <number> "..."`, `tea pr edit --add-label`/`--remove-label`, `tea pr close`.
|
- **Comment / label / close**: `tea comment <number> "..."`, `tea pr edit --add-label`/`--remove-label`, `tea pr close`.
|
||||||
|
|
||||||
Gitea shares one number space across issues and PRs, so a bare `#42` may be either — resolve with `tea pr 42` and fall back to `tea issue 42`.
|
Gitea shares one number space across issues and PRs, so a bare `#42` may be either — resolve with `tea pr 42` and fall back to `tea issue 42`.
|
||||||
@@ -32,3 +32,14 @@ Create a Gitea issue.
|
|||||||
## When a skill says "fetch the relevant ticket"
|
## When a skill says "fetch the relevant ticket"
|
||||||
|
|
||||||
Run `tea issue <number> --comments`.
|
Run `tea issue <number> --comments`.
|
||||||
|
|
||||||
|
## Wayfinding operations
|
||||||
|
|
||||||
|
Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets.
|
||||||
|
|
||||||
|
- **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `tea issue create --label wayfinder:map`.
|
||||||
|
- **Child ticket**: an issue linked to the map as a GitHub sub-issue (`tea api` on the sub-issues endpoint). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #<map>` at the top of the child body. Labels: `wayfinder:<type>` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev.
|
||||||
|
- **Blocking**: GitHub's **native issue dependencies** — the canonical, UI-visible representation. Add an edge with `tea api --method POST /repos/{owner}/{repo}/issues/<child>/dependencies -F index=<blocker-issue-number> -F repo=<blocker-repo-name> -F owner=<bocker-owner-name>`, where `<blocker-issue-number>` is the blocker's numeric **issue number** (`tea api repos/{owner}/{repo}/issues/<n> --jq ".number. .repository.name, .repository.owner"`, where `.number` is the `<blocker-issue-number>`, `.repository.name` is the `<blocker-repo-name>` and `.repository.owner` is the `<blocker-repo-owner>`. Where dependencies aren't available, fall back to a `Blocked by: #<n>, #<n>` line at the top of the child body. A ticket is unblocked when every blocker is closed.
|
||||||
|
- **Frontier query**: list the map's open dependencies (`tea api /repos/{owner}/{repo}/issues/<n>/dependencies | jq '.[] | select(.state == "open") | .number'`, scoped to the map's sub-issues / task list), drop any with an open blocker (`list of dependencies is not empty`, or an open issue in the `Blocked by` line) or an assignee; first in map order wins.
|
||||||
|
- **Claim**: `tea issue edit <n> --add-assignees @me` — the session's first write.
|
||||||
|
- **Resolve**: `tea comment <n> "<answer>"`, then `tea issue close <n>`, then append a context pointer (gist + link) to the map's Decisions-so-far.
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
The skills speak in terms of seven canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
|
The skills speak in terms of seven canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
|
||||||
|
|
||||||
| Label in skills | Label in our tracker | Meaning |
|
| Label in skills | Label in our tracker | Meaning |
|
||||||
| -------------------------- | -------------------- | ---------------------------------------- |
|
| ----------------- | -------------------- | ---------------------------------------- |
|
||||||
| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
|
| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
|
||||||
| `needs-info` | `needs-info` | Waiting on reporter for more information |
|
| `needs-info` | `needs-info` | Waiting on reporter for more information |
|
||||||
| `needs-review` | `needs-review` | Waiting for reviewed by a human |
|
| `needs-review` | `needs-review` | Waiting for review by a human |
|
||||||
| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
|
| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
|
||||||
| `ready-for-human` | `ready-for-human` | Requires human implementation |
|
| `ready-for-human` | `ready-for-human` | Requires human implementation |
|
||||||
| `in-progress` | `in-progress` | Being actively worked on by a human or agents |
|
| `in-progress` | `in-progress` | Being actively worked on by a human or agents |
|
||||||
| `wontfix` | `wontfix` | Will not be actioned |
|
| `wontfix` | `wontfix` | Will not be actioned |
|
||||||
|
|
||||||
When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table. Only one triage label should be active.
|
When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table. Only one triage label should be active.
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
# Pi implementation orchestrator skill
|
||||||
|
|
||||||
|
`implementation-orchestrator` implements already-planned tracker tickets from issue selection through isolated implementation worktrees, pull/merge requests, review, merge, and cleanup.
|
||||||
|
|
||||||
|
It supports:
|
||||||
|
|
||||||
|
- Tea-compatible Gitea/Forgejo repositories through `tea`
|
||||||
|
- GitHub repositories through `gh`
|
||||||
|
- GitLab repositories through `glab`
|
||||||
|
|
||||||
|
The forge is selected from `origin`, or explicitly with `DEV_WORKFLOW_FORGE`.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
From this checkout, install globally for your user:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi install /absolute/path/to/ws-developement-workflow
|
||||||
|
```
|
||||||
|
|
||||||
|
Or install it only for the current project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi install -l /absolute/path/to/ws-developement-workflow
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart Pi after installation, or run `/reload` in an existing session. Review the package before installing it: skills can instruct Pi to run commands with your account's permissions.
|
||||||
|
|
||||||
|
## When to use it
|
||||||
|
|
||||||
|
Use this after the human-led wayfinder, planning, specification, and ticket phases have produced implementation tickets.
|
||||||
|
|
||||||
|
The skill does **not** create planning tickets. It only implements tickets that are already labelled:
|
||||||
|
|
||||||
|
```text
|
||||||
|
workflow:ready-for-agent
|
||||||
|
```
|
||||||
|
|
||||||
|
Invoke it with an optional ticket ID or URL:
|
||||||
|
|
||||||
|
```text
|
||||||
|
# Process only ticket 43
|
||||||
|
/skill:implementation-orchestrator 43
|
||||||
|
|
||||||
|
# Process all available tickets in the current repository
|
||||||
|
/skill:implementation-orchestrator
|
||||||
|
```
|
||||||
|
|
||||||
|
The ID must be a tracker issue/ticket, not a branch name, PR/MR ID, or session ID. With an ID, only that ticket is processed. With no ID, the skill considers all open tickets in the current repository.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Before invoking the skill:
|
||||||
|
|
||||||
|
1. Run it from a checkout of the target repository.
|
||||||
|
2. Ensure `origin` points to the correct forge repository.
|
||||||
|
3. Install and authenticate the matching CLI:
|
||||||
|
- Tea/Gitea/Forgejo: `tea`
|
||||||
|
- GitHub: `gh`
|
||||||
|
- GitLab: `glab`
|
||||||
|
4. Create implementation tickets, optionally grouped under a root issue.
|
||||||
|
5. Mark implementable tickets `workflow:ready-for-agent`.
|
||||||
|
6. Add native child/dependency relationships where supported. Otherwise put explicit issue URLs or the documented blocker marker in the ticket.
|
||||||
|
7. Configure `DEV_WORKFLOW_HUMAN_REVIEWER` if the agent may assign human review automatically.
|
||||||
|
|
||||||
|
Run the read-only preflight manually from the target repository if needed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash /path/to/this-package/skills/forge-cli/scripts/detect-forge.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected output resembles:
|
||||||
|
|
||||||
|
```text
|
||||||
|
forge=gh
|
||||||
|
remote=https://github.com/acme/project.git
|
||||||
|
```
|
||||||
|
|
||||||
|
## What happens
|
||||||
|
|
||||||
|
For the supplied ticket, or all tickets when no ticket is supplied, the skill:
|
||||||
|
|
||||||
|
1. Verifies the repository, forge CLI, authentication, default branch, and capabilities.
|
||||||
|
2. Reads only the supplied ticket; otherwise reads all open tickets in the repository.
|
||||||
|
3. Selects only open, unassigned, unblocked `workflow:ready-for-agent` tickets.
|
||||||
|
4. For a supplied ticket, runs only that ticket; with no ticket, runs currently unblocked tickets in parallel, up to three isolated workers. Dependent tickets wait for their blockers.
|
||||||
|
5. Claims each selected ticket and changes it to `workflow:implementing`, then gives it to one worker in an isolated Git worktree.
|
||||||
|
6. Runs local checks, pushes the branch, and creates exactly one PR/MR per ticket.
|
||||||
|
7. Records URLs, status, evidence, blockers, and handoffs in tracker comments.
|
||||||
|
8. Reviews each PR/MR for correctness/spec and standards, allowing at most three fix rounds.
|
||||||
|
9. Resolves conflicts through the conflict workflow instead of aborting or guessing.
|
||||||
|
10. Merges only when review, local checks, CI, target branch, and blocker gates are clean.
|
||||||
|
11. Closes the integrated ticket, records the merge receipt, and removes the worktree.
|
||||||
|
12. Re-queries the scoped ticket set after every merge so newly unblocked tickets can run.
|
||||||
|
|
||||||
|
Default worker parallelism is three, subject to the available subagent limit.
|
||||||
|
|
||||||
|
## Ticket labels
|
||||||
|
|
||||||
|
The skill uses one active workflow label per ticket:
|
||||||
|
|
||||||
|
```text
|
||||||
|
workflow:ready-for-agent
|
||||||
|
workflow:ready-for-human
|
||||||
|
workflow:implementing
|
||||||
|
workflow:pr-open
|
||||||
|
workflow:review
|
||||||
|
workflow:changes-requested
|
||||||
|
workflow:conflict
|
||||||
|
workflow:blocked
|
||||||
|
workflow:merged
|
||||||
|
```
|
||||||
|
|
||||||
|
Existing `workflow:ready-for-human` tickets are left untouched and reported as human handoffs. Missing requirements, unsafe ambiguity, credentials, product decisions, unavailable CI, and missing permissions stop the workflow instead of being guessed around.
|
||||||
|
|
||||||
|
## Forge CLI recipes
|
||||||
|
|
||||||
|
After preflight, the shared `forge-cli` skill contains the common rules and automatically selects one recipe:
|
||||||
|
|
||||||
|
- `skills/forge-cli/references/tea.md`
|
||||||
|
- `skills/forge-cli/references/gh.md`
|
||||||
|
- `skills/forge-cli/references/glab.md`
|
||||||
|
|
||||||
|
Other skills can use it too: install this package globally, then instruct them to load the shared `forge-cli` skill instead of duplicating CLI syntax.
|
||||||
|
|
||||||
|
## Completion states
|
||||||
|
|
||||||
|
The final report includes:
|
||||||
|
|
||||||
|
- merged tickets and PR/MR URLs;
|
||||||
|
- remaining eligible tickets;
|
||||||
|
- tickets waiting for human review;
|
||||||
|
- blocked tickets and exact reasons;
|
||||||
|
- failed checks and review rounds.
|
||||||
|
|
||||||
|
`done` means no open implementation or human tickets remain in the selected scope. If only human tickets remain, the result is `waiting-on-human`.
|
||||||
|
|
||||||
|
## Development checks
|
||||||
|
|
||||||
|
Validate the package with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash tests/test-workflow.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This checks skill metadata, references, shell syntax, forge detection, and eligibility filtering.
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Engineering Skills
|
||||||
|
|
||||||
|
Daily code work.
|
||||||
|
|
||||||
|
## User-invoked
|
||||||
|
|
||||||
|
- [thermo-nuclear-code-quality-review](code-quality-review/SKILL.md) — Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review.
|
||||||
|
- [commit-staged](commit-staged/SKILL.md) — Commit staged files with a conventional commit message.
|
||||||
|
- [grill-with-docs](grill-with-docs/SKILL.md) — A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
|
||||||
|
- [implement](implement/SKILL.md) — Implement a piece of work based on a spec or set of tickets.
|
||||||
|
- [implement-isolation](implement-isolation/SKILL.md) — Implement a piece of work based on a spec or set of tickets in isolation.
|
||||||
|
- [implement-isolation-tmux](implement-isolation-tmux/SKILL.md) — Dispatch a child agent in an isolated git worktree to implement a piece of work based on a PRD or set of issues.
|
||||||
|
- [implement-spec](implement-spec/SKILL.md) — Implement the result of /to-spec and /to-tickets in code.
|
||||||
|
- [implementation-orchestrator](implementation-orchestrator/SKILL.md) — Implements ready-for-agent tracker tickets through isolated worktrees, pull requests, review, conflict resolution, and merge. Use after wayfinder and planning have produced tickets, with or without a ticket ID/URL; no ticket ID/URL means process available tickets. Does not create planning tickets.
|
||||||
|
- [improve-codebase-architecture](improve-codebase-architecture/SKILL.md) — Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
|
||||||
|
- [orchestrate-herdr](orchestrate-herdr/SKILL.md) — Start or monitor a Herdr/Pi planner for a published spec ticket; re-invoke after an orchestrator outage.
|
||||||
|
- [project-context-pack](project-context-pack/SKILL.md) — Use when the user wants a bounded repo context pack, project map, codebase index, or cached memory file so later work uses fd/rg/tree-sitter/LSP instead of repeated browsing.
|
||||||
|
- [recipe-diagrams](recipe-diagrams/SKILL.md) — Recipe diagrams: convert any recipe into a high-resolution Cooking for Engineers-style PNG process-flow table with aligned ingredient streams, preparation branches, joins, temperatures, timings, and finish steps. Use when the user asks for a recipe diagram.
|
||||||
|
- [security-audit](security-audit/SKILL.md) — Comprehensive security and correctness audit of a branch's changes. Use for deep review requests, or branch/PR diff audits focused on bugs, breaking changes, security issues, devex regressions, and feature-gate leaks.
|
||||||
|
- [triage](triage/SKILL.md) — Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
|
||||||
|
- [wayfinder](wayfinder/SKILL.md) — Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.
|
||||||
|
|
||||||
|
## Model-invoked
|
||||||
|
|
||||||
|
- [feedback-bundle](feedback-bundle/SKILL.md) — Post a Gitea feedback issue linked to the current commit and attach logs or screenshots. Use when the user reports a problem and asks to file it with evidence, open a bug ticket, or says “feedback-bundle” or “attach the log.”
|
||||||
|
- [code-review](code-review/SKILL.md) — Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
|
||||||
|
- [codebase-design](codebase-design/SKILL.md) — Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
|
||||||
|
- [diagnosing-bugs](diagnosing-bugs/SKILL.md) — Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
|
||||||
|
- [domain-modeling](domain-modeling/SKILL.md) — Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording or editing an ADR.
|
||||||
|
- [dual-review](dual-review/SKILL.md) — Run two independent, read-only reviews of a branch diff in parallel — correctness/security and maintainability — then synthesize prioritized findings. Use for a second review axis alongside code-review, a combined deep plus code-quality audit, or when the user asks for dual review. Runs both axes as parallel sub-agents so they do not pollute each other's context.
|
||||||
|
- [forge-cli](forge-cli/SKILL.md) — Provides copy-paste, non-interactive tea, gh, and glab commands for issue and pull or merge request work. Use whenever a task needs tracker inspection, assignment, labels, comments, reviews, CI, or merge operations.
|
||||||
|
- [lsp-code-analysis](lsp-code-analysis/SKILL.md) — Semantic code analysis via LSP. Navigate code (definitions, references, implementations), search symbols, preview refactorings, and get file outlines. Use for exploring unfamiliar codebases or performing safe refactoring.
|
||||||
|
- [pr](pr/SKILL.md) — Use when writing a PR body.
|
||||||
|
- [prototype](prototype/SKILL.md) — Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
|
||||||
|
- [research](research/SKILL.md) — Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.
|
||||||
|
- [resolving-merge-conflicts](resolving-merge-conflicts/SKILL.md) — Use when you need to resolve an in-progress git merge/rebase conflict.
|
||||||
|
- [tdd](tdd/SKILL.md) — Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
|
||||||
|
- [to-spec](to-spec/SKILL.md) — Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed. Use when the user wants a spec from the current conversation or an orchestration workflow needs to publish one from context.
|
||||||
|
- [to-tickets](to-tickets/SKILL.md) — Break a plan, spec, or the current conversation into tracer-bullet tickets with blocking edges, published to the configured tracker. Use when the user wants tickets from a plan or spec, or an orchestration workflow needs agent-grabbable tickets.
|
||||||
|
- [wizard](wizard/SKILL.md) — Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.
|
||||||
|
- [worktrees](worktrees/SKILL.md) — Manage Git worktrees in a canonical `.bare` repository root. Use when creating, reusing, listing, removing, or repairing worktrees, or when setting up a repository to keep all branch checkouts under one root.
|
||||||
|
- [write-discoverable-code](write-discoverable-code/SKILL.md) — |
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
---
|
||||||
|
name: code-quality-review
|
||||||
|
description: Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a code quality review, deep code quality audit, or especially harsh maintainability review.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Code Quality Review
|
||||||
|
|
||||||
|
Use this skill for an unusually strict review focused on implementation quality, maintainability, abstraction quality, and codebase health.
|
||||||
|
|
||||||
|
Above all, this skill should push the reviewer to be **ambitious** about code structure. Do not merely identify local cleanup opportunities. Actively search for "code judo" moves: restructurings that preserve behavior while making the implementation dramatically simpler, smaller, more direct, and more elegant.
|
||||||
|
|
||||||
|
## Core Prompt
|
||||||
|
|
||||||
|
Start from this baseline:
|
||||||
|
|
||||||
|
> Perform a deep code quality audit of the current branch's changes.
|
||||||
|
> Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior.
|
||||||
|
> Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility.
|
||||||
|
> Be ambitious, if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it.
|
||||||
|
> Be extremely thorough and rigorous. Measure twice, cut once.
|
||||||
|
|
||||||
|
## Non-Negotiable Additional Standards
|
||||||
|
|
||||||
|
Apply the baseline prompt above, plus these explicit review rules:
|
||||||
|
|
||||||
|
0. **Be ambitious about structural simplification.**
|
||||||
|
- Do not stop at "this could be a bit cleaner."
|
||||||
|
- Look for opportunities to reframe the change so that whole branches, helpers, modes, conditionals, or layers disappear entirely.
|
||||||
|
- Prefer the solution that makes the code feel inevitable in hindsight.
|
||||||
|
- Assume there is often a "code judo" move available: a re-organization that uses the existing architecture more effectively and makes the change dramatically simpler and more elegant.
|
||||||
|
- If you see a path to delete complexity rather than rearrange it, push hard for that path.
|
||||||
|
|
||||||
|
1. **Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.**
|
||||||
|
- Treat this as a strong code-quality smell by default.
|
||||||
|
- Prefer extracting helpers, subcomponents, modules, or local abstractions instead of letting a file sprawl past 1000 lines.
|
||||||
|
- If the diff crosses that threshold, explicitly ask whether the code should be decomposed first.
|
||||||
|
- Only waive this if there is a compelling structural reason and the resulting file is still clearly organized.
|
||||||
|
|
||||||
|
2. **Do not allow random spaghetti growth in existing code.**
|
||||||
|
- Be highly suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows.
|
||||||
|
- If a change adds "weird if statements in random places", treat that as a design problem, not a stylistic nit.
|
||||||
|
- Prefer pushing the logic into a dedicated abstraction, helper, state machine, policy object, or separate module instead of tangling an existing path.
|
||||||
|
- Call out changes that make the surrounding code harder to reason about, even if they technically work.
|
||||||
|
|
||||||
|
3. **Bias toward cleaning the design, not just accepting working code.**
|
||||||
|
- If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version.
|
||||||
|
- Do not rubber-stamp "it works" implementations that leave the codebase messier.
|
||||||
|
- Strongly prefer simplifications that remove moving pieces altogether over refactors that merely spread the same complexity around.
|
||||||
|
|
||||||
|
4. **Prefer direct, boring, maintainable code over hacky or magical code.**
|
||||||
|
- Treat brittle, ad-hoc, or "magic" behavior as a code-quality problem.
|
||||||
|
- Be skeptical of generic mechanisms that hide simple data-shape assumptions.
|
||||||
|
- Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
|
||||||
|
|
||||||
|
5. **Push hard on type and boundary cleanliness when they affect maintainability.**
|
||||||
|
- Question unnecessary optionality, `unknown`, `any`, or cast-heavy code when a clearer type boundary could exist.
|
||||||
|
- Prefer explicit typed models or shared contracts over loosely-shaped ad-hoc objects.
|
||||||
|
- If a branch relies on silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit instead.
|
||||||
|
|
||||||
|
6. **Keep logic in the canonical layer and reuse existing helpers.**
|
||||||
|
- Call out feature logic leaking into shared paths or implementation details leaking through APIs.
|
||||||
|
- Prefer existing canonical utilities/helpers over bespoke one-offs.
|
||||||
|
- Push code toward the right package, service, or module instead of normalizing architectural drift.
|
||||||
|
|
||||||
|
7. **Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.**
|
||||||
|
- If independent work is serialized for no good reason, ask whether the flow should run in parallel instead.
|
||||||
|
- If related updates can leave state half-applied, push for a more atomic structure.
|
||||||
|
- Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the implementation more brittle.
|
||||||
|
|
||||||
|
## Primary Review Questions
|
||||||
|
|
||||||
|
For every meaningful change, ask:
|
||||||
|
|
||||||
|
- Is there a "code judo" move that would make this dramatically simpler?
|
||||||
|
- Can this change be reframed so fewer concepts, branches, or helper layers are needed?
|
||||||
|
- Does this improve or worsen the local architecture?
|
||||||
|
- Did the diff add branching complexity where a better abstraction should exist?
|
||||||
|
- Did a previously cohesive module become more coupled, more stateful, or harder to scan?
|
||||||
|
- Is this logic living in the right file and layer?
|
||||||
|
- Did this change enlarge a file or component past a healthy size boundary?
|
||||||
|
- Are there repeated conditionals that signal a missing model or missing helper?
|
||||||
|
- Is the implementation direct and legible, or does it rely on special cases and incidental control flow?
|
||||||
|
- Is this abstraction actually earning its keep, or is it just a wrapper?
|
||||||
|
- Did the diff introduce casts, optionality, or ad-hoc object shapes that obscure the real invariant?
|
||||||
|
- Is this logic living in the canonical layer, or did the diff leak details across a boundary?
|
||||||
|
- Is this orchestration more sequential or less atomic than it needs to be?
|
||||||
|
|
||||||
|
## What to Flag Aggressively
|
||||||
|
|
||||||
|
Escalate findings when you see:
|
||||||
|
|
||||||
|
- A complicated implementation where a cleaner reframing could delete whole categories of complexity.
|
||||||
|
- Refactors that move code around but fail to reduce the number of concepts a reader must hold in their head.
|
||||||
|
- A file crossing 1000 lines due to the PR, especially if the new code could be split out.
|
||||||
|
- New conditionals bolted onto unrelated code paths.
|
||||||
|
- One-off booleans, nullable modes, or flags that complicate existing control flow.
|
||||||
|
- Feature-specific logic leaking into general-purpose modules.
|
||||||
|
- Generic "magic" handling that hides simple structure and makes the code harder to reason about.
|
||||||
|
- Thin wrappers or identity abstractions that add indirection without simplifying anything.
|
||||||
|
- Unnecessary casts, `any`, `unknown`, or optional params that muddy the real contract.
|
||||||
|
- Copy-pasted logic instead of extracted helpers.
|
||||||
|
- Narrow edge-case handling implemented in the middle of an already busy function.
|
||||||
|
- Refactors that technically pass tests but make the code less modular or less readable.
|
||||||
|
- "Temporary" branching that is likely to become permanent debt.
|
||||||
|
- Bespoke helpers where the codebase already has a canonical utility for the job.
|
||||||
|
- Logic added in the wrong layer/package when it should live somewhere more central.
|
||||||
|
- Sequential async flow where obviously independent work could stay simpler and clearer with parallel execution.
|
||||||
|
- Partial-update logic that leaves state less atomic than necessary.
|
||||||
|
|
||||||
|
## Preferred Remedies
|
||||||
|
|
||||||
|
When you identify a code-quality problem, prefer suggestions like:
|
||||||
|
|
||||||
|
- Delete a whole layer of indirection rather than polishing it.
|
||||||
|
- Reframe the state model so conditionals disappear instead of getting centralized.
|
||||||
|
- Change the ownership boundary so the feature becomes a natural extension of an existing abstraction.
|
||||||
|
- Turn special-case logic into a simpler default flow with fewer exceptions.
|
||||||
|
- Extract a helper or pure function.
|
||||||
|
- Split a large file into smaller focused modules.
|
||||||
|
- Move feature-specific logic behind a dedicated abstraction.
|
||||||
|
- Replace condition chains with a typed model or explicit dispatcher.
|
||||||
|
- Separate orchestration from business logic.
|
||||||
|
- Collapse duplicate branches into a single clearer flow.
|
||||||
|
- Delete wrappers that do not meaningfully clarify the API.
|
||||||
|
- Reuse the existing canonical helper instead of introducing a near-duplicate.
|
||||||
|
- Make type boundaries more explicit so the control flow gets simpler.
|
||||||
|
- Move the logic to the package/module/layer that already owns the concept.
|
||||||
|
- Parallelize independent work when that also simplifies the orchestration.
|
||||||
|
- Restructure related updates into a more atomic flow when partial state would be harder to reason about.
|
||||||
|
|
||||||
|
Do not be satisfied with "maybe rename this" feedback when the real issue is structural.
|
||||||
|
Do not be satisfied with a merely cleaner version of the same messy idea if there is a plausible path to a much simpler idea.
|
||||||
|
|
||||||
|
## Review Tone
|
||||||
|
|
||||||
|
Be direct, serious, and demanding about quality.
|
||||||
|
Do not be rude, but do not soften major maintainability issues into mild suggestions.
|
||||||
|
If the code is making the codebase messier, say so clearly.
|
||||||
|
If the implementation missed an opportunity for a dramatic simplification, say that clearly too.
|
||||||
|
|
||||||
|
Good phrases:
|
||||||
|
|
||||||
|
- `this pushes the file past 1k lines. can we decompose this first?`
|
||||||
|
- `this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?`
|
||||||
|
- `this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.`
|
||||||
|
- `this feels like feature logic leaking into a shared path. can we isolate it?`
|
||||||
|
- `this abstraction seems unnecessary. can we just keep the direct flow?`
|
||||||
|
- `why does this need a cast / optional here? can we make the boundary more explicit instead?`
|
||||||
|
- `this looks like a bespoke helper for something we already have elsewhere. can we reuse the canonical one?`
|
||||||
|
- `i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?`
|
||||||
|
- `this refactor moves complexity around, but doesn't really delete it. is there a way to make the model itself simpler?`
|
||||||
|
|
||||||
|
## Output Expectations
|
||||||
|
|
||||||
|
Prioritize findings in this order:
|
||||||
|
|
||||||
|
1. Structural code-quality regressions
|
||||||
|
2. Missed opportunities for dramatic simplification / code-judo restructuring
|
||||||
|
3. Spaghetti / branching complexity increases
|
||||||
|
4. Boundary / abstraction / type-contract problems that make the code harder to reason about
|
||||||
|
5. File-size and decomposition concerns
|
||||||
|
6. Modularity and abstraction issues
|
||||||
|
7. Legibility and maintainability concerns
|
||||||
|
|
||||||
|
Do not flood the review with low-value nits if there are larger structural issues.
|
||||||
|
Prefer a smaller number of high-conviction comments over a long list of cosmetic notes.
|
||||||
|
|
||||||
|
## Approval Bar
|
||||||
|
|
||||||
|
Do not approve merely because behavior seems correct.
|
||||||
|
The bar for approval is:
|
||||||
|
|
||||||
|
- no clear structural regression
|
||||||
|
- no obvious missed opportunity to make the implementation dramatically simpler when such a path is visible
|
||||||
|
- no unjustified file-size explosion
|
||||||
|
- no obvious spaghetti-growth from special-case branching
|
||||||
|
- no obviously hacky or magical abstraction that makes the code harder to reason about
|
||||||
|
- no unnecessary wrapper/cast/optionality churn obscuring the real design
|
||||||
|
- no clear architecture-boundary leak or avoidable canonical-helper duplication
|
||||||
|
- no missed opportunity for an obvious decomposition that would materially improve maintainability
|
||||||
|
|
||||||
|
Treat these as presumptive blockers unless the author can justify them clearly:
|
||||||
|
|
||||||
|
- the PR preserves a lot of incidental complexity when there is a plausible code-judo move that would delete it
|
||||||
|
- the PR pushes a file from below 1000 lines to above 1000 lines
|
||||||
|
- the PR adds ad-hoc branching that makes an existing flow more tangled
|
||||||
|
- the PR solves a local problem by scattering feature checks across shared code
|
||||||
|
- the PR adds an unnecessary abstraction, wrapper, or cast-heavy contract that makes the design more indirect
|
||||||
|
- the PR duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home
|
||||||
|
|
||||||
|
If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Thermo-Nuclear Code Quality Review"
|
||||||
|
short_description: "Strict review of abstractions, large files, and condition complexity"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
---
|
||||||
|
name: code-review
|
||||||
|
description: "Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\"."
|
||||||
|
---
|
||||||
|
|
||||||
|
Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
|
||||||
|
|
||||||
|
- **Standards**: does the code conform to this repo's documented coding standards?
|
||||||
|
- **Spec**: does the code faithfully implement the originating issue / spec?
|
||||||
|
|
||||||
|
Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.
|
||||||
|
|
||||||
|
The issue tracker should have been provided to you. If `docs/agents/issue-tracker.md` is missing, tell the user to run `setup-skills`.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
### 1. Pin the fixed point
|
||||||
|
|
||||||
|
Whatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.
|
||||||
|
|
||||||
|
Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
|
||||||
|
|
||||||
|
Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.
|
||||||
|
|
||||||
|
### 2. Identify the spec source
|
||||||
|
|
||||||
|
Look for the originating spec, in this order:
|
||||||
|
|
||||||
|
1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in `docs/agents/issue-tracker.md`.
|
||||||
|
2. A path the user passed as an argument.
|
||||||
|
3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
|
||||||
|
4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
|
||||||
|
|
||||||
|
### 3. Identify the standards sources
|
||||||
|
|
||||||
|
Anything in the repo that documents how code should be written, such as `CODING_STANDARDS.md` or `CONTRIBUTING.md`.
|
||||||
|
|
||||||
|
On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
|
||||||
|
|
||||||
|
- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
|
||||||
|
- **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation. Like any standard here, skip anything tooling already enforces.
|
||||||
|
|
||||||
|
Each smell reads *what it is* → *how to fix*; match it against the diff:
|
||||||
|
|
||||||
|
- **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
|
||||||
|
- **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
|
||||||
|
- **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.
|
||||||
|
- **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
|
||||||
|
- **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
|
||||||
|
- **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
|
||||||
|
- **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
|
||||||
|
- **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
|
||||||
|
- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
|
||||||
|
- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
|
||||||
|
- **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.
|
||||||
|
- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
|
||||||
|
|
||||||
|
### 4. Spawn both sub-agents in parallel
|
||||||
|
|
||||||
|
**Standards sub-agent prompt** should include:
|
||||||
|
|
||||||
|
- The full diff command and commit list.
|
||||||
|
- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).
|
||||||
|
- The brief: "Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
|
||||||
|
|
||||||
|
**Spec sub-agent prompt** should include:
|
||||||
|
|
||||||
|
- The diff command and commit list.
|
||||||
|
- The path or fetched contents of the spec.
|
||||||
|
- The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
|
||||||
|
|
||||||
|
If the spec is missing, skip the Spec sub-agent and note this in the final report.
|
||||||
|
|
||||||
|
### 5. Aggregate
|
||||||
|
|
||||||
|
Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).
|
||||||
|
|
||||||
|
End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.
|
||||||
|
|
||||||
|
## Why two axes
|
||||||
|
|
||||||
|
A change can pass one axis and fail the other:
|
||||||
|
|
||||||
|
- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
|
||||||
|
- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
|
||||||
|
|
||||||
|
Reporting them separately stops one axis from masking the other.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Code Review"
|
||||||
|
short_description: "Review a diff on standards and spec"
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# Deepening
|
||||||
|
|
||||||
|
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.
|
||||||
|
|
||||||
|
## Dependency categories
|
||||||
|
|
||||||
|
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
||||||
|
|
||||||
|
### 1. In-process
|
||||||
|
|
||||||
|
Pure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.
|
||||||
|
|
||||||
|
### 2. Local-substitutable
|
||||||
|
|
||||||
|
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
||||||
|
|
||||||
|
### 3. Remote but owned (Ports & Adapters)
|
||||||
|
|
||||||
|
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
||||||
|
|
||||||
|
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
||||||
|
|
||||||
|
### 4. True external (Mock)
|
||||||
|
|
||||||
|
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
||||||
|
|
||||||
|
## Seam discipline
|
||||||
|
|
||||||
|
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
||||||
|
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
||||||
|
|
||||||
|
## Testing strategy: replace, don't layer
|
||||||
|
|
||||||
|
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.
|
||||||
|
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
||||||
|
- Tests assert on observable outcomes through the interface, not internal state.
|
||||||
|
- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# Design It Twice
|
||||||
|
|
||||||
|
When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout): your first idea is unlikely to be the best.
|
||||||
|
|
||||||
|
Uses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
### 1. Frame the problem space
|
||||||
|
|
||||||
|
Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
|
||||||
|
|
||||||
|
- The constraints any new interface would need to satisfy
|
||||||
|
- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
|
||||||
|
- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete
|
||||||
|
|
||||||
|
Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
|
||||||
|
|
||||||
|
### 2. Spawn sub-agents
|
||||||
|
|
||||||
|
Spawn 3+ sub-agents in parallel. Each must produce a **radically different** interface for the deepened module.
|
||||||
|
|
||||||
|
Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
|
||||||
|
|
||||||
|
- Agent 1: "Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point."
|
||||||
|
- Agent 2: "Maximise flexibility: support many use cases and extension."
|
||||||
|
- Agent 3: "Optimise for the most common caller: make the default case trivial."
|
||||||
|
- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
|
||||||
|
|
||||||
|
Include both [SKILL.md](SKILL.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
|
||||||
|
|
||||||
|
Each sub-agent outputs:
|
||||||
|
|
||||||
|
1. Interface (types, methods, params, plus invariants, ordering, error modes)
|
||||||
|
2. Usage example showing how callers use it
|
||||||
|
3. What the implementation hides behind the seam
|
||||||
|
4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))
|
||||||
|
5. Trade-offs: where leverage is high, where it's thin
|
||||||
|
|
||||||
|
### 3. Present and compare
|
||||||
|
|
||||||
|
Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
|
||||||
|
|
||||||
|
After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
---
|
||||||
|
name: codebase-design
|
||||||
|
description: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Codebase Design
|
||||||
|
|
||||||
|
Design **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
|
||||||
|
|
||||||
|
## Glossary
|
||||||
|
|
||||||
|
Use these terms exactly: don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
|
||||||
|
|
||||||
|
**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.
|
||||||
|
|
||||||
|
**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).
|
||||||
|
|
||||||
|
**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
|
||||||
|
|
||||||
|
**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.
|
||||||
|
|
||||||
|
**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).
|
||||||
|
|
||||||
|
**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
|
||||||
|
|
||||||
|
**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.
|
||||||
|
|
||||||
|
**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.
|
||||||
|
|
||||||
|
## Deep vs shallow
|
||||||
|
|
||||||
|
**Deep module** = small interface + lots of implementation:
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────┐
|
||||||
|
│ Small Interface │ ← Few methods, simple params
|
||||||
|
├─────────────────────┤
|
||||||
|
│ │
|
||||||
|
│ Deep Implementation│ ← Complex logic hidden
|
||||||
|
│ │
|
||||||
|
└─────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
**Shallow module** = large interface + little implementation (avoid):
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────┐
|
||||||
|
│ Large Interface │ ← Many methods, complex params
|
||||||
|
├─────────────────────────────────┤
|
||||||
|
│ Thin Implementation │ ← Just passes through
|
||||||
|
└─────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
When designing an interface, ask:
|
||||||
|
|
||||||
|
- Can I reduce the number of methods?
|
||||||
|
- Can I simplify the parameters?
|
||||||
|
- Can I hide more complexity inside?
|
||||||
|
|
||||||
|
## Principles
|
||||||
|
|
||||||
|
- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
|
||||||
|
- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
|
||||||
|
- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.
|
||||||
|
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
|
||||||
|
|
||||||
|
## Designing for testability
|
||||||
|
|
||||||
|
Good interfaces make testing natural:
|
||||||
|
|
||||||
|
1. **Accept dependencies, don't create them.**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Testable
|
||||||
|
function processOrder(order, paymentGateway) {}
|
||||||
|
|
||||||
|
// Hard to test
|
||||||
|
function processOrder(order) {
|
||||||
|
const gateway = new StripeGateway();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Return results, don't produce side effects.**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Testable
|
||||||
|
function calculateDiscount(cart): Discount {}
|
||||||
|
|
||||||
|
// Hard to test
|
||||||
|
function applyDiscount(cart): void {
|
||||||
|
cart.total -= discount;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.
|
||||||
|
|
||||||
|
## Relationships
|
||||||
|
|
||||||
|
- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
|
||||||
|
- **Depth** is a property of a **Module**, measured against its **Interface**.
|
||||||
|
- A **Seam** is where a **Module**'s **Interface** lives.
|
||||||
|
- An **Adapter** sits at a **Seam** and satisfies the **Interface**.
|
||||||
|
- **Depth** produces **Leverage** for callers and **Locality** for maintainers.
|
||||||
|
|
||||||
|
## Rejected framings
|
||||||
|
|
||||||
|
- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
|
||||||
|
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.
|
||||||
|
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
|
||||||
|
|
||||||
|
## Going deeper
|
||||||
|
|
||||||
|
- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.
|
||||||
|
- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Codebase Design"
|
||||||
|
short_description: "Vocabulary for deep-module design"
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
name: commit-staged
|
||||||
|
description: Commit staged files with a conventional commit message.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
1. **Check the staging area** — Run `git diff --cached --stat`. If empty, report "nothing staged" and stop.
|
||||||
|
|
||||||
|
Completion criterion: Staged files are listed, or the skill terminates.
|
||||||
|
|
||||||
|
2. **Draft the message** — Inspect `git diff --cached` to understand what changed. Write a [conventional commit](https://www.conventionalcommits.org/) message:
|
||||||
|
|
||||||
|
- Format: `type(scope): summary` — scope is optional.
|
||||||
|
- Common types: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`, `style`, `perf`, `ci`, `build`.
|
||||||
|
- Summary: imperative mood, lowercase, no period, ≤72 characters.
|
||||||
|
- Body (if needed): wrap at 72 characters, explain _what_ and _why_, not _how_.
|
||||||
|
|
||||||
|
Completion criterion: A conventional commit message is composed.
|
||||||
|
|
||||||
|
3. **Commit** — Run `git commit -m "<message>"`. If the commit fails, report the error and stop.
|
||||||
|
|
||||||
|
Completion criterion: `git commit` exits 0.
|
||||||
|
|
||||||
|
4. **Report** — Print the short commit hash and the first line of the message.
|
||||||
|
|
||||||
|
Completion criterion: The hash and message are printed.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Commit Staged"
|
||||||
|
short_description: "Commit staged changes to the repository"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
---
|
||||||
|
name: diagnosing-bugs
|
||||||
|
description: Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Diagnosing Bugs
|
||||||
|
|
||||||
|
A discipline for hard bugs. Skip phases only when explicitly justified.
|
||||||
|
|
||||||
|
When exploring the codebase, read `CONTEXT.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
|
||||||
|
|
||||||
|
## Redact
|
||||||
|
|
||||||
|
This skill has you show commands, outputs and captured artifacts. **Redact every secret first**: write `<REDACTED>` in its place. Build loops against env vars, so the credential stays in the environment rather than in what you show. Captured artifacts carry auth headers: quote only the lines that carry the signal.
|
||||||
|
|
||||||
|
If the redacted output is not enough to diagnose the bug, say so and ask the user.
|
||||||
|
|
||||||
|
## Phase 1: Build a feedback loop
|
||||||
|
|
||||||
|
**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug (one that goes red on _this_ bug), you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.
|
||||||
|
|
||||||
|
Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
||||||
|
|
||||||
|
### Ways to construct one, in roughly this order
|
||||||
|
|
||||||
|
1. **Failing test** at whatever seam reaches the bug: unit, integration, e2e.
|
||||||
|
2. **Curl / HTTP script** against a running dev server.
|
||||||
|
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
||||||
|
4. **Headless browser script** (Playwright / Puppeteer) that drives the UI and asserts on DOM/console/network.
|
||||||
|
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
||||||
|
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
||||||
|
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
||||||
|
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
|
||||||
|
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
||||||
|
10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
|
||||||
|
|
||||||
|
Build the right feedback loop, and the bug is 90% fixed.
|
||||||
|
|
||||||
|
### Tighten the loop
|
||||||
|
|
||||||
|
Treat the loop as a product. Once you have _a_ loop, **tighten** it:
|
||||||
|
|
||||||
|
- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
|
||||||
|
- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
|
||||||
|
- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
||||||
|
|
||||||
|
A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight, a debugging superpower.
|
||||||
|
|
||||||
|
### Non-deterministic bugs
|
||||||
|
|
||||||
|
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not, so keep raising the rate until it's debuggable.
|
||||||
|
|
||||||
|
### When you genuinely cannot build a loop
|
||||||
|
|
||||||
|
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
||||||
|
|
||||||
|
### Completion criterion: a tight loop that goes red
|
||||||
|
|
||||||
|
Phase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** (a script path, a test invocation, a curl) that you have **already run at least once** (show the invocation and its output, redacted), and that is:
|
||||||
|
|
||||||
|
- [ ] **Red-capable**: it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not "runs without erroring"; it must be able to _catch this specific bug_.
|
||||||
|
- [ ] **Deterministic**: same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).
|
||||||
|
- [ ] **Fast**: seconds, not minutes.
|
||||||
|
- [ ] **Agent-runnable**: you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.
|
||||||
|
|
||||||
|
If you catch yourself reading code to build a theory before this command exists, **stop: jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.
|
||||||
|
|
||||||
|
## Phase 2: Reproduce + minimise
|
||||||
|
|
||||||
|
Run the loop. Watch it go red as the bug appears.
|
||||||
|
|
||||||
|
Confirm:
|
||||||
|
|
||||||
|
- [ ] The loop produces the failure mode the **user** described, not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
||||||
|
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
||||||
|
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
||||||
|
|
||||||
|
### Minimise
|
||||||
|
|
||||||
|
Once it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut, and keep only what's load-bearing for the failure.
|
||||||
|
|
||||||
|
Why bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.
|
||||||
|
|
||||||
|
Done when **every remaining element is load-bearing**: removing any one of them makes the loop go green.
|
||||||
|
|
||||||
|
Do not proceed until you have reproduced **and** minimised.
|
||||||
|
|
||||||
|
## Phase 3: Hypothesise
|
||||||
|
|
||||||
|
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
||||||
|
|
||||||
|
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
||||||
|
|
||||||
|
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
||||||
|
|
||||||
|
If you cannot state the prediction, the hypothesis is a vibe: discard or sharpen it.
|
||||||
|
|
||||||
|
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it; proceed with your ranking if the user is AFK.
|
||||||
|
|
||||||
|
## Phase 4: Instrument
|
||||||
|
|
||||||
|
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
||||||
|
|
||||||
|
Tool preference:
|
||||||
|
|
||||||
|
1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
|
||||||
|
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
||||||
|
3. Never "log everything and grep".
|
||||||
|
|
||||||
|
**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
|
||||||
|
|
||||||
|
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
||||||
|
|
||||||
|
## Phase 5: Fix + regression test
|
||||||
|
|
||||||
|
Write the regression test **before the fix**, but only if there is a **correct seam** for it.
|
||||||
|
|
||||||
|
A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
|
||||||
|
|
||||||
|
**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
|
||||||
|
|
||||||
|
If a correct seam exists:
|
||||||
|
|
||||||
|
1. Turn the minimised repro into a failing test at that seam.
|
||||||
|
2. Watch it fail.
|
||||||
|
3. Apply the fix.
|
||||||
|
4. Watch it pass.
|
||||||
|
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
||||||
|
|
||||||
|
## Phase 6: Cleanup
|
||||||
|
|
||||||
|
Required before declaring done:
|
||||||
|
|
||||||
|
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
||||||
|
- [ ] Regression test passes (or absence of seam is documented)
|
||||||
|
- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
|
||||||
|
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
||||||
|
- [ ] The hypothesis that turned out correct is stated in the commit / PR message, so the next debugger learns
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Diagnosing Bugs"
|
||||||
|
short_description: "Diagnose hard bugs and regressions"
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Human-in-the-loop reproduction loop.
|
||||||
|
# Copy this file, edit the steps below, and run it.
|
||||||
|
# The agent runs the script; the user follows prompts in their terminal.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# bash hitl-loop.template.sh
|
||||||
|
#
|
||||||
|
# Two helpers:
|
||||||
|
# step "<instruction>" → show instruction, wait for Enter
|
||||||
|
# capture VAR "<question>" → show question, read response into VAR
|
||||||
|
#
|
||||||
|
# At the end, captured values are printed as KEY=VALUE for the agent to parse.
|
||||||
|
#
|
||||||
|
# `capture` prints its value back to the terminal, where the agent reads it,
|
||||||
|
# so capture observations, and leave signing in to the user as a `step`.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
step() {
|
||||||
|
printf '\n>>> %s\n' "$1"
|
||||||
|
read -r -p " [Enter when done] " _
|
||||||
|
}
|
||||||
|
|
||||||
|
capture() {
|
||||||
|
local var="$1" question="$2" answer
|
||||||
|
printf '\n>>> %s\n' "$question"
|
||||||
|
read -r -p " > " answer
|
||||||
|
printf -v "$var" '%s' "$answer"
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- edit below ---------------------------------------------------------
|
||||||
|
|
||||||
|
step "Open the app at http://localhost:3000 and sign in."
|
||||||
|
|
||||||
|
capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
|
||||||
|
|
||||||
|
capture ERROR_MSG "Paste the error message (or 'none'):"
|
||||||
|
|
||||||
|
# --- edit above ---------------------------------------------------------
|
||||||
|
|
||||||
|
printf '\n--- Captured ---\n'
|
||||||
|
printf 'ERRORED=%s\n' "$ERRORED"
|
||||||
|
printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# ADR Format
|
||||||
|
|
||||||
|
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
||||||
|
|
||||||
|
Create the `docs/adr/` directory lazily: only when the first ADR is needed.
|
||||||
|
|
||||||
|
## Template
|
||||||
|
|
||||||
|
```md
|
||||||
|
# {Short title of the decision}
|
||||||
|
|
||||||
|
{1-3 sentences: what's the context, what did we decide, and why.}
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.
|
||||||
|
|
||||||
|
## Optional sections
|
||||||
|
|
||||||
|
Only include these when they add genuine value. Most ADRs won't need them.
|
||||||
|
|
||||||
|
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited
|
||||||
|
- **Considered Options**: only when the rejected alternatives are worth remembering
|
||||||
|
- **Consequences**: only when non-obvious downstream effects need to be called out
|
||||||
|
|
||||||
|
## Numbering
|
||||||
|
|
||||||
|
Scan `docs/adr/` for the highest existing number and increment by one.
|
||||||
|
|
||||||
|
## When to offer an ADR
|
||||||
|
|
||||||
|
All three of these must be true:
|
||||||
|
|
||||||
|
1. **Hard to reverse**: the cost of changing your mind later is meaningful
|
||||||
|
2. **Surprising without context**: a future reader will look at the code and wonder "why on earth did they do it this way?"
|
||||||
|
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
||||||
|
|
||||||
|
If a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
|
||||||
|
|
||||||
|
### What qualifies
|
||||||
|
|
||||||
|
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
||||||
|
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
||||||
|
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.
|
||||||
|
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
|
||||||
|
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
|
||||||
|
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
|
||||||
|
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# CONTEXT.md Format
|
||||||
|
|
||||||
|
## Structure
|
||||||
|
|
||||||
|
```md
|
||||||
|
# {Context Name}
|
||||||
|
|
||||||
|
{One or two sentence description of what this context is and why it exists.}
|
||||||
|
|
||||||
|
## Language
|
||||||
|
|
||||||
|
**Order**:
|
||||||
|
{A one or two sentence description of the term}
|
||||||
|
_Avoid_: Purchase, transaction
|
||||||
|
|
||||||
|
**Invoice**:
|
||||||
|
A request for payment sent to a customer after delivery.
|
||||||
|
_Avoid_: Bill, payment request
|
||||||
|
|
||||||
|
**Customer**:
|
||||||
|
A person or organization that places orders.
|
||||||
|
_Avoid_: Client, buyer, account
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
|
||||||
|
- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
|
||||||
|
- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
|
||||||
|
- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
|
||||||
|
|
||||||
|
## Single vs multi-context repos
|
||||||
|
|
||||||
|
**Single context (most repos):** One `CONTEXT.md` at the repo root.
|
||||||
|
|
||||||
|
**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
|
||||||
|
|
||||||
|
```md
|
||||||
|
# Context Map
|
||||||
|
|
||||||
|
## Contexts
|
||||||
|
|
||||||
|
- [Ordering](./src/ordering/CONTEXT.md): receives and tracks customer orders
|
||||||
|
- [Billing](./src/billing/CONTEXT.md): generates invoices and processes payments
|
||||||
|
- [Fulfillment](./src/fulfillment/CONTEXT.md): manages warehouse picking and shipping
|
||||||
|
|
||||||
|
## Relationships
|
||||||
|
|
||||||
|
- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
|
||||||
|
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
|
||||||
|
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
||||||
|
```
|
||||||
|
|
||||||
|
The skill infers which structure applies:
|
||||||
|
|
||||||
|
- If `CONTEXT-MAP.md` exists, read it to find contexts
|
||||||
|
- If only a root `CONTEXT.md` exists, single context
|
||||||
|
- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
|
||||||
|
|
||||||
|
When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
---
|
||||||
|
name: domain-modeling
|
||||||
|
description: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording or editing an ADR.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Domain Modeling
|
||||||
|
|
||||||
|
Actively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `CONTEXT.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)
|
||||||
|
|
||||||
|
## File structure
|
||||||
|
|
||||||
|
Most repos have a single context:
|
||||||
|
|
||||||
|
```
|
||||||
|
/
|
||||||
|
├── CONTEXT.md
|
||||||
|
├── docs/
|
||||||
|
│ └── adr/
|
||||||
|
│ ├── 0001-event-sourced-orders.md
|
||||||
|
│ └── 0002-postgres-for-write-model.md
|
||||||
|
└── src/
|
||||||
|
```
|
||||||
|
|
||||||
|
If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
|
||||||
|
|
||||||
|
```
|
||||||
|
/
|
||||||
|
├── CONTEXT-MAP.md
|
||||||
|
├── docs/
|
||||||
|
│ └── adr/ ← system-wide decisions
|
||||||
|
├── src/
|
||||||
|
│ ├── ordering/
|
||||||
|
│ │ ├── CONTEXT.md
|
||||||
|
│ │ └── docs/adr/ ← context-specific decisions
|
||||||
|
│ └── billing/
|
||||||
|
│ ├── CONTEXT.md
|
||||||
|
│ └── docs/adr/
|
||||||
|
```
|
||||||
|
|
||||||
|
Create files lazily: only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
|
||||||
|
|
||||||
|
## During the session
|
||||||
|
|
||||||
|
### Challenge against the glossary
|
||||||
|
|
||||||
|
When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?"
|
||||||
|
|
||||||
|
### Sharpen fuzzy language
|
||||||
|
|
||||||
|
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account': do you mean the Customer or the User? Those are different things."
|
||||||
|
|
||||||
|
### Discuss concrete scenarios
|
||||||
|
|
||||||
|
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
|
||||||
|
|
||||||
|
### Cross-reference with code
|
||||||
|
|
||||||
|
When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?"
|
||||||
|
|
||||||
|
### Update CONTEXT.md inline
|
||||||
|
|
||||||
|
When a term is resolved, update `CONTEXT.md` right there. Don't batch these up: capture them as they happen. Use the format in [CONTEXT-FORMAT.md](./CONTEXT-FORMAT.md).
|
||||||
|
|
||||||
|
`CONTEXT.md` should be totally devoid of implementation details. Do not treat `CONTEXT.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
|
||||||
|
|
||||||
|
### Offer ADRs sparingly
|
||||||
|
|
||||||
|
Only offer to create an ADR when all three are true:
|
||||||
|
|
||||||
|
1. **Hard to reverse**: the cost of changing your mind later is meaningful
|
||||||
|
2. **Surprising without context**: a future reader will wonder "why did they do it this way?"
|
||||||
|
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
||||||
|
|
||||||
|
If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Domain Modeling"
|
||||||
|
short_description: "Build and sharpen a domain model"
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
name: dual-review
|
||||||
|
description: "Run two independent, read-only reviews of a branch diff in parallel — correctness/security and maintainability — then synthesize prioritized findings. Use for a second review axis alongside code-review, a combined deep plus code-quality audit, or when the user asks for dual review. Runs both axes as parallel sub-agents so they do not pollute each other's context."
|
||||||
|
---
|
||||||
|
|
||||||
|
# Dual review
|
||||||
|
|
||||||
|
Two independent, read-only reviews of the diff between `HEAD` and a fixed point, then a synthesis:
|
||||||
|
|
||||||
|
- **Correctness/security** — bugs, breakages, security gaps, devex regressions, and feature-gate leaks in the changed code.
|
||||||
|
- **Maintainability** — structural quality, simplification, boundaries, and codebase health in the changed code.
|
||||||
|
|
||||||
|
Together with `code-review` (spec, standards) these form the four review axes. Both axes run as **parallel sub-agents**, then this skill aggregates their findings.
|
||||||
|
|
||||||
|
The issue tracker should have been provided to you. If `docs/agents/issue-tracker.md` is missing, tell the user to run `setup-skills`.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
### 1. Pin the fixed point
|
||||||
|
|
||||||
|
Whatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they did not specify one, ask for it.
|
||||||
|
|
||||||
|
Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, against the merge-base). Note the commit list via `git log <fixed-point>..HEAD --oneline`.
|
||||||
|
|
||||||
|
Confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty before spawning anything. A bad ref or empty diff fails here, not inside two sub-agents.
|
||||||
|
|
||||||
|
### 2. Gather context
|
||||||
|
|
||||||
|
Gather the diff and the contents of changed files, plus only the surrounding context needed to trace behavior. Read each changed file at its current version. Do not review files outside the diff scope.
|
||||||
|
|
||||||
|
### 3. Spawn both sub-agents in parallel
|
||||||
|
|
||||||
|
Both get the same scoped diff and changed-file context and a distinct task.
|
||||||
|
|
||||||
|
**Correctness/security brief:** "Report, per file/hunk where relevant, every bug, breakage, security gap, devex regression, or feature-gate leak in the added or modified code. Cite the hunk and explain the concrete failure or exposure. Distinguish hard defects from judgement calls. Under 400 words."
|
||||||
|
|
||||||
|
**Maintainability brief:** "Report, per file/hunk where relevant, structural quality problems in the added or modified code: duplication, large or over-generalized units, weak boundaries, primitive obsession, speculative generality, or other smells that will cost to maintain. Name the problem and quote the hunk; flag hard violations from judgement calls. Under 400 words."
|
||||||
|
|
||||||
|
Ask each to report prioritized findings with file/line evidence and to **not** edit files.
|
||||||
|
|
||||||
|
### 4. Synthesize
|
||||||
|
|
||||||
|
Wait for both runs before synthesizing. Deduplicate overlapping findings, resolve disagreements using the evidence, and list the highest-priority findings first. Present them under `## Correctness/security` and `## Maintainability` headings. If there are no findings, say so and note the review scope and its limitations. Do not restate child summaries already visible to the user.
|
||||||
|
|
||||||
|
## Review constraints
|
||||||
|
|
||||||
|
- Report issues only in code added or modified within the review scope.
|
||||||
|
- Do not present uncertain or unfinished research as a finding.
|
||||||
|
- Do not fix reported issues unless the user asks.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Dual Review"
|
||||||
|
short_description: "Parallel correctness, security, and maintainability review"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: feedback-bundle
|
||||||
|
description: Post a Gitea feedback issue linked to the current commit and attach logs or screenshots. Use when the user reports a problem and asks to file it with evidence, open a bug ticket, or says "feedback-bundle" or "attach the log".
|
||||||
|
---
|
||||||
|
|
||||||
|
# Feedback Bundle
|
||||||
|
|
||||||
|
Create a Gitea issue in the current repository, linked to its current `HEAD`, with optional files attached.
|
||||||
|
|
||||||
|
## Run
|
||||||
|
|
||||||
|
Run from the repository the issue should belong to, using `feedback_bundle.py` beside this file:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python3 <skill-dir>/feedback_bundle.py "Describe the problem" @app.log @screenshot.png
|
||||||
|
```
|
||||||
|
|
||||||
|
The script requires Python `requests`. Without `--token`, it reads the matching host token from `~/.config/tea/config.yml` and requires PyYAML. The default repository is read from `git remote get-url origin`.
|
||||||
|
|
||||||
|
Common options:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python3 <skill-dir>/feedback_bundle.py "Description" @log.txt \
|
||||||
|
--title "Short issue title" --label bug --dry-run
|
||||||
|
```
|
||||||
|
|
||||||
|
- `@file` — attach an existing file; paths are resolved from the current working directory. The `@` is optional.
|
||||||
|
- `--title` — override the default title (the description's first line).
|
||||||
|
- `--label` — add a label; repeat to add more. Labels are resolved against the repository's Gitea labels; unknown labels are skipped with a warning.
|
||||||
|
- `--repo` — override the remote URL. Use a full Git remote URL (SSH, SCP-style, or HTTPS), not an `owner/repo` slug.
|
||||||
|
- `--token` — provide a Gitea token instead of reading tea config.
|
||||||
|
- `--dry-run` — print the issue preview without creating an issue or uploading files. Authentication is still loaded; labels require an API request.
|
||||||
|
|
||||||
|
## What happens
|
||||||
|
|
||||||
|
1. The script reads `HEAD`, repository host/owner/name, and authentication.
|
||||||
|
2. It creates an issue whose body includes a link to that exact commit.
|
||||||
|
3. It uploads each attachment to the issue and adds download links to the body.
|
||||||
|
|
||||||
|
Gitea only accepts issue attachments after an issue exists. If uploads fail because attachments are disabled (403/404), the issue already exists without the files; enable attachments on the Gitea instance, then attach the files to that issue manually. The instance setting is `[attachment] ENABLED = true` in `app.ini` (or `ATTACHMENTS_ENABLED`), not a web UI toggle.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Feedback Bundle"
|
||||||
|
short_description: "File Gitea issues with commit links and attached evidence"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Post a feedback ticket to a Gitea repo, linked to the current commit, with
|
||||||
|
files attached to the issue.
|
||||||
|
|
||||||
|
feedback_bundle.py [--title T] [--label L ...] [--repo REMOTE_URL] [--token T]
|
||||||
|
[--dry-run] <description> [@file ...]
|
||||||
|
|
||||||
|
Flow (Gitea attaches files to an existing issue, there is no standalone upload
|
||||||
|
endpoint): create the issue, then POST each file to
|
||||||
|
/repos/{owner}/{repo}/issues/{number}/assets (multipart field "attachment").
|
||||||
|
The ticket body links to `git HEAD` and lists the attached files.
|
||||||
|
|
||||||
|
If the assets endpoint returns 403/404 the instance has attachments disabled
|
||||||
|
(admin `[attachment] ENABLED = true` in app.ini — not a web-UI setting); the
|
||||||
|
script reports this instead of posting a ticket with no attachments.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
import requests
|
||||||
|
except ImportError: # pragma: no cover
|
||||||
|
sys.exit("requests is required: pip install requests")
|
||||||
|
|
||||||
|
|
||||||
|
def run(*args: str) -> str:
|
||||||
|
return subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def parse_remote(remote: str | None) -> tuple[str, str, str]:
|
||||||
|
"""(host, owner, repo) from a git remote URL (scp, ssh, or https forms)."""
|
||||||
|
url = remote or run("git", "remote", "get-url", "origin")
|
||||||
|
u = re.sub(r"^[a-z]+://", "", url.strip(), flags=re.I) # strip scheme
|
||||||
|
u = u.split("@", 1)[-1] # strip user@
|
||||||
|
u = u.replace(".git", "").rstrip("/")
|
||||||
|
host, rest = (u.split(":", 1) if ":" in u else u.split("/", 1))
|
||||||
|
owner, repo = rest.split("/", 1)
|
||||||
|
return host, owner, repo
|
||||||
|
|
||||||
|
|
||||||
|
def load_token(host: str, token: str | None) -> str:
|
||||||
|
if token:
|
||||||
|
return token
|
||||||
|
cfg = os.path.expanduser("~/.config/tea/config.yml")
|
||||||
|
if not os.path.exists(cfg):
|
||||||
|
sys.exit("no --token and no tea config found; cannot authenticate")
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
data = yaml.safe_load(open(cfg).read())
|
||||||
|
for login in data.get("logins", []):
|
||||||
|
if login.get("url").rstrip("/").endswith(host) and login.get("token"):
|
||||||
|
return login["token"]
|
||||||
|
sys.exit(f"no stored token for host {host}; pass --token")
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_labels(host, token, owner, repo, names):
|
||||||
|
"""Gitea's issue API wants label IDs, not names. Map names to IDs; warn on
|
||||||
|
unknown labels and drop them."""
|
||||||
|
if not names:
|
||||||
|
return []
|
||||||
|
url = f"https://{host}/api/v1/repos/{owner}/{repo}/labels"
|
||||||
|
r = requests.get(url, headers={"Authorization": f"token {token}"})
|
||||||
|
if r.status_code >= 400:
|
||||||
|
sys.exit(f"could not list labels ({r.status_code}): {r.text}")
|
||||||
|
by_name = {l["name"]: l["id"] for l in r.json()}
|
||||||
|
ids = []
|
||||||
|
for n in names:
|
||||||
|
if n in by_name:
|
||||||
|
ids.append(by_name[n])
|
||||||
|
else:
|
||||||
|
print(f"warning: unknown label '{n}', skipping", file=sys.stderr)
|
||||||
|
return ids
|
||||||
|
|
||||||
|
|
||||||
|
def create_issue(host, token, owner, repo, title, body, label_ids):
|
||||||
|
url = f"https://{host}/api/v1/repos/{owner}/{repo}/issues"
|
||||||
|
r = requests.post(url, json={"title": title, "body": body, "labels": label_ids},
|
||||||
|
headers={"Authorization": f"token {token}"})
|
||||||
|
if r.status_code >= 400:
|
||||||
|
sys.exit(f"issue create failed ({r.status_code}): {r.text}")
|
||||||
|
return r.json()
|
||||||
|
|
||||||
|
|
||||||
|
def attach(host, token, owner, repo, issue_number, path):
|
||||||
|
"""Attach one file to an issue. Returns the browser_download_url, or None
|
||||||
|
on 403/404 (attachments disabled on this instance)."""
|
||||||
|
url = f"https://{host}/api/v1/repos/{owner}/{repo}/issues/{issue_number}/assets"
|
||||||
|
with open(path, "rb") as f:
|
||||||
|
r = requests.post(url, files={"attachment": f},
|
||||||
|
params={"name": os.path.basename(path)},
|
||||||
|
headers={"Authorization": f"token {token}"})
|
||||||
|
if r.status_code in (403, 404):
|
||||||
|
return None
|
||||||
|
r.raise_for_status()
|
||||||
|
return r.json().get("browser_download_url")
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
ap = argparse.ArgumentParser(description="Post a commit-linked feedback ticket with attachments.")
|
||||||
|
ap.add_argument("description", help="ticket description (text before any @file)")
|
||||||
|
ap.add_argument("files", nargs="*", help="files to attach (@name or name)")
|
||||||
|
ap.add_argument("--title", help="ticket title (default: first line of description)")
|
||||||
|
ap.add_argument("--label", action="append", default=[], help="label to add (repeatable)")
|
||||||
|
ap.add_argument("--repo", help="Git remote URL (default: git remote origin)")
|
||||||
|
ap.add_argument("--token", help="Gitea token (default: tea config for the host)")
|
||||||
|
ap.add_argument("--dry-run", action="store_true", help="print the ticket without posting it")
|
||||||
|
args = ap.parse_args()
|
||||||
|
|
||||||
|
files = [f.lstrip("@") for f in args.files]
|
||||||
|
for p in files:
|
||||||
|
if not os.path.isfile(p):
|
||||||
|
sys.exit(f"not a file: {p}")
|
||||||
|
|
||||||
|
host, owner, repo = parse_remote(args.repo) if args.repo else (None, None, None)
|
||||||
|
if not host:
|
||||||
|
host, owner, repo = parse_remote(None)
|
||||||
|
|
||||||
|
token = load_token(host, args.token)
|
||||||
|
sha = run("git", "rev-parse", "HEAD")
|
||||||
|
short = sha[:7]
|
||||||
|
commit_url = f"https://{host}/{owner}/{repo}/commit/{sha}"
|
||||||
|
|
||||||
|
desc = args.description.strip()
|
||||||
|
title = (args.title or desc).strip().splitlines()[0] if desc else "(no description)"
|
||||||
|
labels = resolve_labels(host, token, owner, repo, [l for l in args.label if l])
|
||||||
|
seed = f"{desc}\n\n**Linked commit:** [{short}]({commit_url}) (`{sha}`)"
|
||||||
|
|
||||||
|
# Preview only: no issue is created and nothing is uploaded.
|
||||||
|
if args.dry_run:
|
||||||
|
att_line = "\n".join(f"- {os.path.basename(p)}" for p in files) or "(none)"
|
||||||
|
body = seed + "\n\n**Attachments:**\n" + att_line
|
||||||
|
print("=== DRY RUN (nothing created) ===")
|
||||||
|
print(f"repo: {owner}/{repo}")
|
||||||
|
print(f"commit: {commit_url}")
|
||||||
|
print(f"title: {title}")
|
||||||
|
print(f"labels: {[l for l in args.label if l] or '(none)'}")
|
||||||
|
print(f"attach: {att_line}")
|
||||||
|
print("=== body ===")
|
||||||
|
print(body)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Create the issue first (Gitea attaches files to an existing issue).
|
||||||
|
issue = create_issue(host, token, owner, repo, title, seed, labels)
|
||||||
|
number = issue["number"]
|
||||||
|
|
||||||
|
attached = []
|
||||||
|
missing = False
|
||||||
|
for p in files:
|
||||||
|
url = attach(host, token, owner, repo, number, p)
|
||||||
|
if url is None:
|
||||||
|
missing = True
|
||||||
|
else:
|
||||||
|
attached.append((os.path.basename(p), url))
|
||||||
|
|
||||||
|
if missing and not attached:
|
||||||
|
print(
|
||||||
|
"ERROR: attachment endpoint returned 403/404 — attachments are disabled on this "
|
||||||
|
"instance (admin setting `[attachment] ENABLED = true` in app.ini; there is no "
|
||||||
|
"web-UI toggle). Enable it and re-run. The issue was created but has no attachments.",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
return 2
|
||||||
|
|
||||||
|
if attached:
|
||||||
|
body = seed + "\n\n**Attachments:**\n" + "\n".join(f"- [{n}]({u})" for n, u in attached)
|
||||||
|
patch_url = f"https://{host}/api/v1/repos/{owner}/{repo}/issues/{number}"
|
||||||
|
requests.patch(patch_url, json={"body": body},
|
||||||
|
headers={"Authorization": f"token {token}"})
|
||||||
|
if missing:
|
||||||
|
print(f"warning: {sum(1 for _ in range(0)) + (len(files) - len(attached))} file(s) could not be attached (instance may have attachments disabled)",
|
||||||
|
file=sys.stderr)
|
||||||
|
|
||||||
|
print(f"Created: {issue.get('html_url', '')}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: forge-cli
|
||||||
|
description: Provides copy-paste, non-interactive tea, gh, and glab commands for issue and pull or merge request work. Use whenever a task needs tracker inspection, assignment, labels, comments, reviews, CI, or merge operations.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Forge CLI
|
||||||
|
|
||||||
|
Use this shared skill instead of reproducing forge CLI syntax in another skill.
|
||||||
|
|
||||||
|
Run the bundled read-only preflight with the target repository as the working directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash <resolved-skill-dir>/scripts/detect-forge.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Resolve `<resolved-skill-dir>` from this `SKILL.md`, not from the target repository.
|
||||||
|
|
||||||
|
It prints one selected CLI: `forge=tea`, `forge=gh`, or `forge=glab`. Read **only** the matching recipe:
|
||||||
|
|
||||||
|
- `forge=tea` → `references/tea.md`
|
||||||
|
- `forge=gh` → `references/gh.md`
|
||||||
|
- `forge=glab` → `references/glab.md`
|
||||||
|
|
||||||
|
Do not load or compare the other recipes. This keeps one forge's syntax in context.
|
||||||
|
|
||||||
|
Commands assume the current checkout identifies the repository. Replace `ID` (issue), `PR` (pull/merge request), `USER`, `OLD`, `NEW`, `BASE`, `HEAD`, `TITLE`, and `BODY_FILE`. Keep bodies in a file to avoid quoting and interactive prompts.
|
||||||
|
|
||||||
|
## Shared safety rules
|
||||||
|
|
||||||
|
1. Use JSON output for reads; inspect the returned object before deciding eligibility, dependencies, or merge readiness.
|
||||||
|
2. Use one mutation per state transition, then re-read and confirm the state/label/comment changed.
|
||||||
|
3. If a recipe returns an unknown command or flag, run that CLI command's `--help`; do not switch forge CLIs or guess.
|
||||||
|
4. Check command exit status. Authentication, repository resolution, missing permissions, unsupported relationships, and unavailable CI are blockers.
|
||||||
|
5. Do not use auto-merge, admin/bypass, or force options. Merge only after every workflow gate passes.
|
||||||
|
|
||||||
|
Honor `DEV_WORKFLOW_FORGE=tea`, `gh`, or `glab` when explicitly configured; otherwise use GitHub → `gh`, GitLab → `glab`, and other Tea-compatible hosts → `tea`.
|
||||||
|
|
||||||
|
Keep these identifiers distinct: tracker issue/ticket ID, PR/MR ID, durable URL, and local branch name. Never use a branch name as ticket identity.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Forge CLI"
|
||||||
|
short_description: "Copy-paste, non-interactive CLI for Forge"
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# GitHub CLI recipe
|
||||||
|
|
||||||
|
Use `gh` commands in the current repository. Use `--json` for reads and `--body-file` for multiline bodies.
|
||||||
|
|
||||||
|
## Read
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue view ID --comments --json number,state,url,title,body,assignees,labels,comments,parent,subIssues,blockedBy
|
||||||
|
gh issue list --state all --limit 100 --json number,state,url,title,body,assignees,labels,parent,subIssues,blockedBy
|
||||||
|
gh pr view PR --comments --json number,state,url,title,body,assignees,labels,baseRefName,headRefName,comments,reviews,reviewDecision,statusCheckRollup,mergeable
|
||||||
|
gh pr checks PR --required --json bucket,name,state,completedAt
|
||||||
|
```
|
||||||
|
|
||||||
|
If an installed version rejects an optional JSON field, remove that field and rerun the same read. Native parent, child, and dependency fields may be unavailable; otherwise use the explicit links documented in the ticket.
|
||||||
|
|
||||||
|
## Issue lifecycle
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue edit ID --add-assignee USER
|
||||||
|
gh issue edit ID --add-label NEW --remove-label OLD
|
||||||
|
gh issue comment ID --body-file BODY_FILE
|
||||||
|
gh issue close ID
|
||||||
|
```
|
||||||
|
|
||||||
|
`@me` means the current authenticated user.
|
||||||
|
|
||||||
|
## Pull request lifecycle
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh pr create --base BASE --head HEAD --title TITLE --body-file BODY_FILE
|
||||||
|
gh pr comment PR --body-file BODY_FILE
|
||||||
|
gh pr review PR --comment --body-file BODY_FILE
|
||||||
|
gh pr review PR --request-changes --body-file BODY_FILE
|
||||||
|
gh pr merge PR --squash --delete-branch
|
||||||
|
```
|
||||||
|
|
||||||
|
Re-read the issue/PR after every mutation. Do not use `--admin` or `--auto`.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# GitLab CLI recipe
|
||||||
|
|
||||||
|
Use `glab` commands in the current repository. Use JSON output for reads and file-backed descriptions for multiline bodies.
|
||||||
|
|
||||||
|
## Read
|
||||||
|
|
||||||
|
```bash
|
||||||
|
glab issue view ID --comments --output json
|
||||||
|
glab issue list --all --per-page 100 --output json
|
||||||
|
glab mr view PR --comments --output json
|
||||||
|
```
|
||||||
|
|
||||||
|
Native parent, child, and dependency fields may be unavailable. If absent, use the explicit links documented in the ticket.
|
||||||
|
|
||||||
|
## Issue lifecycle
|
||||||
|
|
||||||
|
```bash
|
||||||
|
glab issue update ID --assignee USER
|
||||||
|
glab issue update ID --label NEW --unlabel OLD
|
||||||
|
glab issue note ID --message "$(cat BODY_FILE)"
|
||||||
|
glab issue close ID
|
||||||
|
```
|
||||||
|
|
||||||
|
`--assignee USER` replaces existing assignees; prefix with `+` to add without replacing.
|
||||||
|
|
||||||
|
## Merge request lifecycle
|
||||||
|
|
||||||
|
```bash
|
||||||
|
glab mr create --target-branch BASE --source-branch HEAD --title TITLE --description-file BODY_FILE --yes
|
||||||
|
glab mr note create PR --message "$(cat BODY_FILE)"
|
||||||
|
glab mr merge PR --squash --remove-source-branch --auto-merge=false --yes
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `glab mr note create` for review findings or requested changes. Re-read the issue/MR after every mutation. Do not use auto-merge or bypass options.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Tea recipe
|
||||||
|
|
||||||
|
Tea calls the numeric identifier an `index`; it is still the tracker issue/PR ID. Use `--output json` for reads. Tea accepts comma-separated usernames/labels for the plural flags.
|
||||||
|
|
||||||
|
## Read
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tea issues ID --comments --output json --fields index,state,url,title,body,assignees,labels,comments
|
||||||
|
tea issues list --state all --limit 100 --output json --fields index,state,url,title,body,assignees,labels
|
||||||
|
tea pulls PR --comments --output json --fields index,state,url,title,body,assignees,labels,base,head,comments,ci
|
||||||
|
```
|
||||||
|
|
||||||
|
Native parent, child, and dependency fields may be unavailable. If absent, use the explicit links documented in the ticket.
|
||||||
|
|
||||||
|
## Issue lifecycle
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tea issues edit --add-assignees USER ID
|
||||||
|
tea issues edit --add-labels NEW --remove-labels OLD ID
|
||||||
|
tea comments add ID --description "$(cat BODY_FILE)"
|
||||||
|
tea issues close ID
|
||||||
|
```
|
||||||
|
|
||||||
|
Prefer these CLI verbs over hand-rolled REST. If `tea` lacks a verb (check `tea pulls --help` for the current close and merge verbs), and you fall back to the Gitea REST API, note that the issue create/update payload takes label **IDs**, while the `/issues/{id}/labels` sub-resource takes **names**. Keep `curl` output out of the transcript by writing it to a file (`curl -s ... -o FILE`).
|
||||||
|
|
||||||
|
## Pull request lifecycle
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tea pulls create --base BASE --head HEAD --title TITLE --description "$(cat BODY_FILE)"
|
||||||
|
tea comments add PR --description "$(cat BODY_FILE)"
|
||||||
|
tea pulls merge PR --style squash
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `tea comments add` for review findings or requested changes. Re-read the issue/PR after every mutation.
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -u
|
||||||
|
|
||||||
|
remote="$(git remote get-url origin 2>/dev/null || true)"
|
||||||
|
if [[ -z "$remote" ]]; then
|
||||||
|
printf '%s\n' 'No origin remote found; run this inside a checked-out forge repository.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
choice="${DEV_WORKFLOW_FORGE:-}"
|
||||||
|
if [[ -z "$choice" ]]; then
|
||||||
|
case "$remote" in
|
||||||
|
*github.com*) choice=gh ;;
|
||||||
|
*gitlab.com* | *gitlab.*) choice=glab ;;
|
||||||
|
*) choice=tea ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$choice" in
|
||||||
|
tea | gh | glab) ;;
|
||||||
|
*)
|
||||||
|
printf 'Unsupported DEV_WORKFLOW_FORGE=%s (use tea, gh, or glab).\n' "$choice" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if ! command -v "$choice" >/dev/null 2>&1; then
|
||||||
|
printf 'Required forge CLI not found: %s\n' "$choice" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$choice" in
|
||||||
|
tea) "$choice" login list >/dev/null 2>&1 || {
|
||||||
|
printf '%s authentication check failed.\n' "$choice" >&2
|
||||||
|
exit 1
|
||||||
|
} ;;
|
||||||
|
gh) "$choice" auth status >/dev/null 2>&1 || {
|
||||||
|
printf '%s authentication check failed.\n' "$choice" >&2
|
||||||
|
exit 1
|
||||||
|
} ;;
|
||||||
|
glab) "$choice" auth status >/dev/null 2>&1 || {
|
||||||
|
printf '%s authentication check failed.\n' "$choice" >&2
|
||||||
|
exit 1
|
||||||
|
} ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf 'forge=%s\nremote=%s\n' "$choice" "$remote"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
name: grill-with-docs
|
||||||
|
description: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
Call the Skill tool twice, for "grilling" and "domain-modeling".
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Grill with Docs"
|
||||||
|
short_description: "Grill a design and write its docs"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
name: implement-isolation-tmux
|
||||||
|
description: "Dispatch a child agent in an isolated git worktree to implement a piece of work based on a PRD or set of issues."
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
## Invocation
|
||||||
|
|
||||||
|
/skill:implement-isolation-tmux <N> [--base <branch>] [--force]
|
||||||
|
|
||||||
|
- `<N>` — required, the issue number
|
||||||
|
- `--base <branch>` — optional, target base branch (default: repo default branch)
|
||||||
|
- `--force` — optional, remove the existing worktree directory first, then recreate
|
||||||
|
|
||||||
|
Triage labels follow the vocabulary in `docs/agents/triage-labels.md`.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
## 1. Claim and isolate
|
||||||
|
|
||||||
|
Change the issue triage label to `in-progress`, remove all other labels. Derive `<issue-slug>` from the issue title: lowercase, replace spaces with hyphens, strip non-alphanumeric characters (keep hyphens). Then create a git worktree for the ticket as a sibling directory named `../issue-<N>-<issue-slug>`, checked out from the base branch. Switch to the worktree. The branch name matches the directory: `issue-<N>-<issue-slug>`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git worktree add -b issue-<N>-<issue-slug> ../issue-<N>-<issue-slug> <base>
|
||||||
|
```
|
||||||
|
|
||||||
|
Stay in the worktree directory for the rest of the process.
|
||||||
|
|
||||||
|
Completion criterion: The issue label is confirmed as `in-progress` and the worktree exists at `../issue-<N>-<issue-slug>` with branch `issue-<N>-<issue-slug>` checked out.
|
||||||
|
|
||||||
|
### 2. Compose the child prompt
|
||||||
|
|
||||||
|
Assemble a single prompt that the child agent will receive. Include:
|
||||||
|
|
||||||
|
- **Issue body** — the full markdown body of the issue.
|
||||||
|
- **Comments** — all comments, if any
|
||||||
|
- **Standing instruction**: "Implement the work described by the user in the spec or tickets, using tdd skill where possible. Run typechecking regularly, run single test files regularly, and run the full test suite once at the end. Once done, use code-review skill to review the work. Commit your work and push the new branch and create a PR with a link to the issue, one-sentence summary, and short key-changes list. Comment on the issue with the PR link: `PR opened: <url>`. Change the issue triage label to needs-review when done. Remove all other labels"
|
||||||
|
|
||||||
|
- **Failure instruction**: "If any step fails, report where you stopped and what remains for manual recovery. Print the exact commands needed."
|
||||||
|
|
||||||
|
Completion criterion: The prompt is composed with all required sections (issue body, comments, standing instruction, failure instruction).
|
||||||
|
|
||||||
|
### 3. Launch the child via tmux-launch-agent
|
||||||
|
|
||||||
|
Use the `tmux-launch-agent` skill to fork the child agent into a new tmux window. Tmux-launch-agent handles agent detection, config lookup, command building (prompt-file or stdin-pipe), mise/SHELL wrapping, and `tmux new-window` creation.
|
||||||
|
|
||||||
|
Pass these parameters:
|
||||||
|
|
||||||
|
| Parameter | Value |
|
||||||
|
|-----------|-------|
|
||||||
|
| `--name` | `"issue-<N>-<issue-slug>"` — tmux window title |
|
||||||
|
| Remaining args | The full prompt text composed in step 2 |
|
||||||
|
|
||||||
|
Ensure the child agent starts in the worktree. If the current pane's working directory is already inside `<absolute-worktree-path>` (from step 1), tmux-launch-agent's new window inherits it. Otherwise, pass `-c <absolute-worktree-path>` when invoking tmux-launch-agent so the child agent starts in the worktree directory.
|
||||||
|
|
||||||
|
Let tmux-launch-agent handle prompt-file creation — it writes a temp file automatically when the target agent uses prompt-file mode. Pass the prompt text inline.
|
||||||
|
|
||||||
|
The window stays open after the child completes so the user can review the output.
|
||||||
|
|
||||||
|
Completion criterion: `tmux-launch-agent` exits 0 and a new tmux window appears with the child agent session active.
|
||||||
|
|
||||||
|
### 4. Print summary
|
||||||
|
|
||||||
|
After launching, print:
|
||||||
|
|
||||||
|
- Issue number and title
|
||||||
|
- Worktree path
|
||||||
|
- Branch name
|
||||||
|
- Base branch
|
||||||
|
- Agent used (detected by tmux-launch-agent)
|
||||||
|
- Tmux window name (so the user can find it)
|
||||||
|
- Cleanup command: `git worktree remove <worktree-path> && git worktree prune`
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Implement Isolation Tmux"
|
||||||
|
short_description: "Implement isolation using tmux for the agent"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
name: implement-isolation
|
||||||
|
description: "Implement a piece of work based on a spec or set of tickets in isolation."
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
## Invocation
|
||||||
|
|
||||||
|
/skill:implement-isolation <N> [--base <branch>] [--force]
|
||||||
|
|
||||||
|
- `<N>` — required, the ticket/issue number
|
||||||
|
- `--base <branch>` — optional, target base branch (default: repo default branch)
|
||||||
|
- `--force` — optional, remove the existing worktree directory first, then recreate
|
||||||
|
|
||||||
|
Triage labels follow the vocabulary in `docs/agents/triage-labels.md`.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
### 1. Claim and isolate
|
||||||
|
|
||||||
|
Change the issue triage label to `in-progress`, remove all other labels. Derive `<issue-slug>` from the issue title: lowercase, replace spaces with hyphens, strip non-alphanumeric characters (keep hyphens). Then create a git worktree for the ticket as a sibling directory named `../issue-<N>-<issue-slug>`, checked out from the base branch. Switch to the worktree. The branch name matches the directory: `issue-<N>-<issue-slug>`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git worktree add -b issue-<N>-<issue-slug> ../issue-<N>-<issue-slug> <base>
|
||||||
|
```
|
||||||
|
|
||||||
|
Stay in the worktree directory for the rest of the process.
|
||||||
|
|
||||||
|
Completion criterion: The issue label is confirmed as `in-progress` and the worktree exists at `../issue-<N>-<issue-slug>` with branch `issue-<N>-<issue-slug>` checked out.
|
||||||
|
|
||||||
|
### 2. Implement
|
||||||
|
|
||||||
|
Start a subagent to implement the work in isolation. The subagent receives a single prompt that includes:
|
||||||
|
|
||||||
|
- Issue body: the full markdown body of the issue.
|
||||||
|
- Comments: all comments, if any
|
||||||
|
- Implement: the work described by the user in the spec or tickets, using tdd skill where possible. Run typechecking regularly, run single test files regularly, and run the full test suite once at the end.
|
||||||
|
|
||||||
|
Completion criterion: The subagent exits with code 0 and all changes are committed.
|
||||||
|
|
||||||
|
### 3. Review
|
||||||
|
|
||||||
|
Start a reviewer subagent that runs the `code-review` skill against the base branch to identify findings in the diff. Wait for the reviewer to finish.
|
||||||
|
|
||||||
|
Review each finding and fix the code until zero findings remain. Commit fixes as you go.
|
||||||
|
|
||||||
|
Completion criterion: All code-review findings are resolved (zero open findings) and fixes are committed.
|
||||||
|
|
||||||
|
### 4. Ship
|
||||||
|
|
||||||
|
Push the branch, open a PR. The PR description must include a link to the ticket and a key-changes list.
|
||||||
|
|
||||||
|
Comment on the issue: `PR opened: <url>`. Label the issue `needs-review`, remove all other labels.
|
||||||
|
|
||||||
|
Print a cleanup command for the user: `git worktree remove ../issue-<N>-<issue-slug> && git worktree prune`
|
||||||
|
|
||||||
|
### Failure recovery
|
||||||
|
|
||||||
|
If the implement subagent exits non-zero or the review finds issues that cannot be fully resolved, stop. Report to the user: issue number, what was completed, what failed, and the exact commands needed to resume or clean up (including `git worktree remove ...`). Do not push partial work.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Implement Isolation"
|
||||||
|
short_description: "Implement isolation for the agent"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: implement-spec
|
||||||
|
description: "Implement the result of /to-spec and /to-tickets in code."
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
You have been provided a spec. This spec should have tickets associated with it, describing how to implement the spec.
|
||||||
|
|
||||||
|
The issue tracker should have been provided to you. If not, tell the user to run `/setup-skills`.
|
||||||
|
|
||||||
|
The goal is the entire spec implemented on a single **integration branch**, with every ticket resolved the way the issue tracker closes work.
|
||||||
|
|
||||||
|
The tickets are not a list of steps. They are a **task graph** with blocking relationships between them. This means there is always a **frontier** of tickets which are ready to be grabbed.
|
||||||
|
|
||||||
|
Communication to and from subagents should be sparse. Communicate primarily through **context pointers**: to the spec, tickets, research notes, and previous commits. Don't duplicate information already available via pointers.
|
||||||
|
|
||||||
|
**Implementer subagents** should be run in the background where possible for maximum concurrency.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
1. Read the spec and tickets to understand the task graph.
|
||||||
|
|
||||||
|
2. (optional) Use an **exploration subagent** to conduct any exploration required by the tickets - relevant codebase files or external documentation. Ensure the exploration subagent can save files - it should save its markdown notes in a directory outside the repo, accessible by all future subagents. This lets **implementer subagents** focus on implementation rather than exploration.
|
||||||
|
|
||||||
|
3. Create the integration branch. If the issue tracker closes work through PRs, or the user asks for one, open a draft PR after the first merge in step 5 (a branch with no commits ahead of main can't open one), marked as closing the spec and tickets.
|
||||||
|
|
||||||
|
4. Use **implementer subagents** to implement each ticket, each in its own worktree on its own branch. Each implementer subagent:
|
||||||
|
- confirms its worktree is based on the integration branch before starting, and resets onto it if not;
|
||||||
|
- calls the Skill tool with `tdd` to build the ticket;
|
||||||
|
- merges the integration branch tip into its own branch before reporting done
|
||||||
|
|
||||||
|
5. Once an **implementer subagent** completes, merge its work to the integration branch with a **merger subagent**.
|
||||||
|
|
||||||
|
6. If this changes the **frontier** of available tickets, kick off more **implementer subagents** to work on the new tickets. This allows for maximum concurrency.
|
||||||
|
|
||||||
|
7. Once all tickets are complete, call the Skill tool with `code-review` on the integration branch. Fix all issues raised by the code review in a single **implementer subagent**.
|
||||||
|
|
||||||
|
8. If a draft PR exists, mark it ready for review. Otherwise, resolve each ticket the way the issue tracker closes work, and report the integration branch.
|
||||||
|
|
||||||
|
9. Clean up all **implementer subagent** worktrees.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Implement Spec"
|
||||||
|
short_description: "Implement the result of /to-spec and /to-tickets in code."
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
name: implement
|
||||||
|
description: "Implement a piece of work based on a spec or set of tickets."
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
Implement the work described by the user in the spec or tickets.
|
||||||
|
|
||||||
|
Use /tdd where possible, at pre-agreed seams.
|
||||||
|
|
||||||
|
Run typechecking regularly, single test files regularly, and the full test suite once at the end.
|
||||||
|
|
||||||
|
Once done, use /code-review to review the work.
|
||||||
|
|
||||||
|
Commit your work to the current branch.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Implement"
|
||||||
|
short_description: "Build work from a spec or tickets"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
---
|
||||||
|
name: implementation-orchestrator
|
||||||
|
description: Implements ready-for-agent tracker tickets through isolated worktrees, pull requests, review, conflict resolution, and merge. Use after wayfinder and planning have produced tickets, with or without a ticket ID/URL; no ticket ID/URL means process available tickets. Does not create planning tickets.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Implementation orchestrator
|
||||||
|
|
||||||
|
Use this skill only after the human-led wayfinder, plan, spec, and ticket phases. **A tracker ticket ID or URL is optional. Without one, process all eligible open tickets in the current repository.** With an argument, process only that ticket. An ID means the forge's issue/ticket identifier, not a branch, session, or PR ID.
|
||||||
|
|
||||||
|
## Compose before acting
|
||||||
|
|
||||||
|
Read and use these skills for their specialized work:
|
||||||
|
|
||||||
|
- `pi-subagents` for parallel workers and managed worktrees
|
||||||
|
- `worktrees` for worktree conventions and cleanup
|
||||||
|
- `code-review` for independent correctness/spec and standards review
|
||||||
|
- `resolving-merge-conflicts` for conflicts; never abort a merge or rebase
|
||||||
|
- `forge-cli` for forge selection, authentication, and CLI recipes
|
||||||
|
|
||||||
|
Load the shared `forge-cli` skill and run its bundled read-only preflight with the target repository as the working directory. Read only the detected CLI recipe; copy those commands instead of rediscovering syntax. Run `<cli> <command> --help` only when a recipe fails with an unknown command or flag. Do not add an API client or dependency.
|
||||||
|
|
||||||
|
## Durable state
|
||||||
|
|
||||||
|
The tracker is the source of truth. Read the root, every candidate ticket, and their existing comments before acting. Use one active label per ticket:
|
||||||
|
|
||||||
|
- `workflow:ready-for-agent`
|
||||||
|
- `workflow:ready-for-human`
|
||||||
|
- `workflow:implementing`
|
||||||
|
- `workflow:pr-open`
|
||||||
|
- `workflow:review`
|
||||||
|
- `workflow:changes-requested`
|
||||||
|
- `workflow:conflict`
|
||||||
|
- `workflow:blocked`
|
||||||
|
- `workflow:merged`
|
||||||
|
|
||||||
|
Comments are the message board. Record claims, status, evidence, questions, decisions, handoffs, PR URLs, check results, and recovery details there. If a worker has an issue with a ticket, comment on the ticket and wait for the human or another agent rather than guessing. For PR/MR issues, use the PR/MR's native comment/review function and also link the discussion from the ticket. Use `DEV_WORKFLOW_HUMAN_REVIEWER` or repository workflow configuration for the human identity; if none is configured, ask before assigning and do not invent an identity.
|
||||||
|
|
||||||
|
## Run loop
|
||||||
|
|
||||||
|
1. **Scope.** If a ticket ID/URL is supplied, confirm it belongs to the current repository and inspect only that ticket; do not process its siblings, parent, or descendants. If omitted, query all open tickets in the current repository. Use native child/dependency relationships; otherwise require explicit linked URLs or the documented blocker marker. Never infer order from titles.
|
||||||
|
2. **Schedule.** Eligible means open, unassigned, unblocked, and labelled `workflow:ready-for-agent`. Already `workflow:ready-for-human` tickets are skipped and reported. For a supplied ticket, process only that ticket; if it is blocked, report it and do not process its blockers. With no supplied ticket, build the dependency frontier: launch currently unblocked tickets in parallel, up to three workers, and hold dependent tickets until every blocker is merged or otherwise resolved. Re-query after each merge and launch newly unblocked tickets; dependency chains therefore run sequentially while unrelated tickets remain parallel.
|
||||||
|
3. **Claim.** Assign each selected ticket to the current forge identity before work. Replace its state with `workflow:implementing` and comment the claim.
|
||||||
|
4. **Implement.** Launch one worker per ticket with `pi-subagents` in an isolated worktree, maximum three in flight by default. Pass the complete ticket, comments, acceptance criteria, non-goals, linked context, and validation contract. Each worker makes only ticket-scoped changes, commits them, and reports changed files and checks.
|
||||||
|
5. **Escalate.** For missing requirements, unsafe ambiguity, credentials, unrelated scope, or a product/architecture decision, stop. For human review or judgment, assign the ticket to the configured human reviewer, apply `workflow:ready-for-human`, and comment the exact request. If no human identity is configured, ask before assigning and changing the state. Use `workflow:blocked` for non-human blockers. Preserve the worktree on failure.
|
||||||
|
6. **PR.** Run documented local checks. Push the branch and create exactly one PR/MR for the ticket. Link the ticket's tracker ID and title in the PR/MR, set `workflow:pr-open`, and comment the PR/MR URL on the ticket. Keep the worktree.
|
||||||
|
7. **Review.** Set `workflow:review`. Run a fresh-context `code-review` review with correctness/spec and standards axes separate. Then run the `security-audit` and `code-quality-review` both in their own `reviewer` subagent. Post findings through the PR/MR comment/review function. For actionable findings, set `workflow:changes-requested`, send one fix worker, rerun checks, and repeat. Allow at most three rounds.
|
||||||
|
8. **Conflict.** Set `workflow:conflict`, then follow `resolving-merge-conflicts`. Inspect both intents, preserve them where possible, never invent behavior, never abort, rerun local checks, and update the PR/MR. If judgment is needed, assign the PR/MR and ticket to the configured human reviewer, apply `workflow:ready-for-human`, and comment the request in both places. If no human identity is configured, ask before assigning.
|
||||||
|
9. **Merge.** Merge only after independent review is clean, local checks pass, forge CI is green, the target is still the expected default branch, and no human decision or blocker remains. Comment the merge receipt and outcome, close the ticket, apply `workflow:merged` when supported, verify integration, then remove the worktree.
|
||||||
|
10. **Finish.** Report merged tickets and PR/MR URLs, human handoffs, blocked tickets, failed checks, review rounds, and remaining eligible tickets. Report `done` only when no open implementation or human tickets remain in the selected scope. If only human tickets remain, report `waiting-on-human`.
|
||||||
|
|
||||||
|
Never parallel-write a shared checkout. Never silently relabel an existing human ticket. Never merge around a failed check, unresolved review finding, conflict, or missing decision.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Implementation Orchestrator"
|
||||||
|
short_description: "Implements ready-for-agent tracker tickets through isolated worktrees"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
|
||||||
|
skill="$root/skills/engineering/implementation-orchestrator/SKILL.md"
|
||||||
|
shared_skill="$root/skills/engineering/forge-cli/SKILL.md"
|
||||||
|
recipes=(
|
||||||
|
"$root/skills/engineering/forge-cli/references/tea.md"
|
||||||
|
"$root/skills/engineering/forge-cli/references/gh.md"
|
||||||
|
"$root/skills/engineering/forge-cli/references/glab.md"
|
||||||
|
)
|
||||||
|
|
||||||
|
[[ -f "$skill" && -f "$shared_skill" && -f "${recipes[0]}" && -f "${recipes[1]}" && -f "${recipes[2]}" ]] || {
|
||||||
|
echo 'Missing skill or reference file' >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
head -1 "$skill" | grep -qx -- '---'
|
||||||
|
grep -q '^name: implementation-orchestrator$' "$skill"
|
||||||
|
grep -q '^description: ' "$skill"
|
||||||
|
head -1 "$shared_skill" | grep -qx -- '---'
|
||||||
|
grep -q '^name: forge-cli$' "$shared_skill"
|
||||||
|
grep -q '^description: ' "$shared_skill"
|
||||||
|
node -e 'JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"))' "$root/package.json"
|
||||||
|
bash -n "$root/skills/engineering/forge-cli/scripts/detect-forge.sh"
|
||||||
|
|
||||||
|
printf '%s\n' 'implementation-orchestrator skill is valid'
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
# HTML Report Format
|
||||||
|
|
||||||
|
The architectural review is rendered as a single self-contained HTML file in the OS temp directory. Tailwind and Mermaid both come from CDNs. Mermaid handles graph-shaped diagrams reliably; hand-built divs and inline SVG handle the more editorial visuals (mass diagrams, cross-sections). Mix the two: don't lean on Mermaid for everything, it'll start to look generic.
|
||||||
|
|
||||||
|
## Scaffold
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Architecture review for {{repo name}}</title>
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
|
||||||
|
mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
/* small custom layer for things Tailwind doesn't cover cleanly:
|
||||||
|
dashed seam lines, hand-drawn-feeling arrow heads, etc. */
|
||||||
|
.seam { stroke-dasharray: 4 4; }
|
||||||
|
.leak { stroke: #dc2626; }
|
||||||
|
.deep { background: linear-gradient(135deg, #0f172a, #1e293b); }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body class="bg-stone-50 text-slate-900 font-sans">
|
||||||
|
<main class="max-w-5xl mx-auto px-6 py-12 space-y-12">
|
||||||
|
<header>...</header>
|
||||||
|
<section id="candidates" class="space-y-10">...</section>
|
||||||
|
<section id="top-recommendation">...</section>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Header
|
||||||
|
|
||||||
|
Repo name, date, and a compact legend: solid box = module, dashed line = seam, red arrow = leakage, thick dark box = deep module. No introduction paragraph. Straight into the candidates.
|
||||||
|
|
||||||
|
## Candidate card
|
||||||
|
|
||||||
|
The diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.
|
||||||
|
|
||||||
|
Each candidate is one `<article>`:
|
||||||
|
|
||||||
|
- **Title**: short, names the deepening (e.g. "Collapse the Order intake pipeline").
|
||||||
|
- **Badge row**: recommendation strength (`Strong` = emerald, `Worth exploring` = amber, `Speculative` = slate), plus a tag for the dependency category (`in-process`, `local-substitutable`, `ports & adapters`, `mock`).
|
||||||
|
- **Files**: monospaced list, `font-mono text-sm`.
|
||||||
|
- **Before / After diagram**: the centrepiece. Two columns, side by side. See patterns below.
|
||||||
|
- **Problem**: one sentence. What hurts.
|
||||||
|
- **Solution**: one sentence. What changes.
|
||||||
|
- **Wins**: bullets, ≤6 words each. e.g. "Tests hit one interface", "Pricing logic stops leaking", "Delete 4 shallow wrappers".
|
||||||
|
- **ADR callout** (if applicable): one line in an amber-tinted box.
|
||||||
|
|
||||||
|
No paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.
|
||||||
|
|
||||||
|
## Diagram patterns
|
||||||
|
|
||||||
|
Pick the pattern that fits the candidate. Mix them. Don't make every diagram look the same. Variety is part of the point.
|
||||||
|
|
||||||
|
### Mermaid graph (the workhorse for dependencies / call flow)
|
||||||
|
|
||||||
|
Use a Mermaid `flowchart` or `graph` when the point is "X calls Y calls Z, and look at the mess." Wrap it in a Tailwind-styled card so it doesn't feel parachuted in. Style with classDef to colour leakage edges red and the deep module dark. Sequence diagrams work well for "before: 6 round-trips; after: 1."
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div class="rounded-lg border border-slate-200 bg-white p-4">
|
||||||
|
<pre class="mermaid">
|
||||||
|
flowchart LR
|
||||||
|
A[OrderHandler] --> B[OrderValidator]
|
||||||
|
B --> C[OrderRepo]
|
||||||
|
C -.leak.-> D[PricingClient]
|
||||||
|
classDef leak stroke:#dc2626,stroke-width:2px;
|
||||||
|
class C,D leak
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Hand-built boxes-and-arrows (when Mermaid's layout fights you)
|
||||||
|
|
||||||
|
Modules as `<div>`s with borders and labels. Arrows as inline SVG `<line>` or `<path>` elements positioned absolutely over a relative container. Reach for this when you want the "after" diagram to feel like one thick-bordered deep module with greyed-out internals, since Mermaid won't render that with the right weight.
|
||||||
|
|
||||||
|
### Cross-section (good for layered shallowness)
|
||||||
|
|
||||||
|
Stack horizontal bands (`h-12 border-l-4`) to show layers a call passes through. Before: 6 thin layers each doing nothing. After: 1 thick band labelled with the consolidated responsibility.
|
||||||
|
|
||||||
|
### Mass diagram (good for "interface as wide as implementation")
|
||||||
|
|
||||||
|
Two rectangles per module: one for interface surface area, one for implementation. Before: interface rectangle is nearly as tall as the implementation rectangle (shallow). After: interface rectangle is short, implementation rectangle is tall (deep).
|
||||||
|
|
||||||
|
### Call-graph collapse
|
||||||
|
|
||||||
|
Before: a tree of function calls rendered as nested boxes. After: the same tree collapsed into one box, with the now-internal calls shown faded inside it.
|
||||||
|
|
||||||
|
## Style guidance
|
||||||
|
|
||||||
|
- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).
|
||||||
|
- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.
|
||||||
|
- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.
|
||||||
|
- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.
|
||||||
|
- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.
|
||||||
|
|
||||||
|
## Top recommendation section
|
||||||
|
|
||||||
|
One larger card. Candidate name, one sentence on why, anchor link to its card. That's it.
|
||||||
|
|
||||||
|
## Tone
|
||||||
|
|
||||||
|
Plain English, concise, but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.
|
||||||
|
|
||||||
|
**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.
|
||||||
|
|
||||||
|
**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).
|
||||||
|
|
||||||
|
**Phrasings that fit the style:**
|
||||||
|
|
||||||
|
- "Order intake module is shallow: interface nearly matches the implementation."
|
||||||
|
- "Pricing leaks across the seam."
|
||||||
|
- "Deepen: one interface, one place to test."
|
||||||
|
- "Two adapters justify the seam: HTTP in prod, in-memory in tests."
|
||||||
|
|
||||||
|
**Wins bullets** name the gain in glossary terms: *"locality: bugs concentrate in one module"*, *"leverage: one interface, N call sites"*, *"interface shrinks; implementation absorbs the wrappers"*. Don't write *"easier to maintain"* or *"cleaner code"*, because those terms aren't in the glossary and don't earn their place.
|
||||||
|
|
||||||
|
No hedging, no throat-clearing, no "it's worth noting that…". If a sentence could be a bullet, make it a bullet. If a bullet could be cut, cut it. If a term isn't in the `/codebase-design` glossary, reach for one that is before inventing a new one.
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
---
|
||||||
|
name: improve-codebase-architecture
|
||||||
|
description: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Improve Codebase Architecture
|
||||||
|
|
||||||
|
Surface architectural friction and propose **deepening opportunities**: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.
|
||||||
|
|
||||||
|
This command is _informed_ by the project's domain model and built on a shared design vocabulary:
|
||||||
|
|
||||||
|
- Call the Skill tool with "codebase-design" for the architecture vocabulary (**module**, **interface**, **depth**, **seam**, **adapter**, **leverage**, **locality**) and its principles (the deletion test, "the interface is the test surface", "one adapter = hypothetical seam, two = real"). Use these terms exactly in every suggestion, and don't drift into "component," "service," "API," or "boundary."
|
||||||
|
- The domain language in `CONTEXT.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
### 1. Explore
|
||||||
|
|
||||||
|
**Scope before you scan: YAGNI.** Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide *where* to look before you look:
|
||||||
|
|
||||||
|
- If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.
|
||||||
|
- Otherwise, walk back a good stretch of the commit history (`git log --oneline`) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.
|
||||||
|
|
||||||
|
Read the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.
|
||||||
|
|
||||||
|
Then spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:
|
||||||
|
|
||||||
|
- Where does understanding one concept require bouncing between many small modules?
|
||||||
|
- Where are modules **shallow**, with an interface nearly as complex as the implementation?
|
||||||
|
- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?
|
||||||
|
- Where do tightly-coupled modules leak across their seams?
|
||||||
|
- Which parts of the codebase are untested, or hard to test through their current interface?
|
||||||
|
|
||||||
|
Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.
|
||||||
|
|
||||||
|
### 2. Present candidates as an HTML report
|
||||||
|
|
||||||
|
Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user (`xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows) and tell them the absolute path.
|
||||||
|
|
||||||
|
The report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.
|
||||||
|
|
||||||
|
For each candidate, render a card with:
|
||||||
|
|
||||||
|
- **Files**: which files/modules are involved
|
||||||
|
- **Problem**: why the current architecture is causing friction
|
||||||
|
- **Solution**: plain English description of what would change
|
||||||
|
- **Benefits**: explained in terms of locality and leverage, and how tests would improve
|
||||||
|
- **Before / After diagram**: side-by-side, custom-drawn, illustrating the shallowness and the deepening
|
||||||
|
- **Recommendation strength**: one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge
|
||||||
|
|
||||||
|
End the report with a **Top recommendation** section: which candidate you'd tackle first and why.
|
||||||
|
|
||||||
|
**Use CONTEXT.md vocabulary for the domain, and the `/codebase-design` vocabulary for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module," not "the FooBarHandler," and not "the Order service."
|
||||||
|
|
||||||
|
**ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: _"contradicts ADR-0007, but worth reopening because…"_). Don't list every theoretical refactor an ADR forbids.
|
||||||
|
|
||||||
|
See [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.
|
||||||
|
|
||||||
|
Do NOT propose interfaces yet. After the file is written, ask the user: "Which of these would you like to explore?"
|
||||||
|
|
||||||
|
### 3. Grilling loop
|
||||||
|
|
||||||
|
Once the user picks a candidate, call the Skill tool with "grilling" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
|
||||||
|
|
||||||
|
Side effects happen inline as decisions crystallize; call the Skill tool with "domain-modeling" to keep the domain model current as you go:
|
||||||
|
|
||||||
|
- **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md`. Create the file lazily if it doesn't exist.
|
||||||
|
- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.
|
||||||
|
- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons ("not worth it right now") and self-evident ones.
|
||||||
|
- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with "codebase-design" and use its design-it-twice parallel sub-agent pattern.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Improve Codebase Architecture"
|
||||||
|
short_description: "Find and grill architecture improvements"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,334 @@
|
|||||||
|
---
|
||||||
|
name: lsp-code-analysis
|
||||||
|
description: Semantic code analysis via LSP. Navigate code (definitions, references, implementations), search symbols, preview refactorings, and get file outlines. Use for exploring unfamiliar codebases or performing safe refactoring.
|
||||||
|
license: LICENSE
|
||||||
|
---
|
||||||
|
|
||||||
|
# LSP Code Analysis
|
||||||
|
|
||||||
|
## IMPORTANT: PREREQUISITE
|
||||||
|
|
||||||
|
To use this skill, you **MUST** follow these steps:
|
||||||
|
|
||||||
|
1. **Check for updates**: Run the [update script](scripts/update.sh) to ensure you are using the latest version of the tool.
|
||||||
|
2. **Verify project support**: Run `lsp server start <project_path>` to start the LSP server and confirm the project is supported.
|
||||||
|
|
||||||
|
**IF YOU DO NOT PERFORM THESE STEPS, YOU ARE NOT ALLOWED TO USE THIS SKILL.**
|
||||||
|
|
||||||
|
## Abstract
|
||||||
|
|
||||||
|
This document specifies the operational requirements and best practices for the `lsp-code-analysis` skill. It provides a semantic interface to codebase navigation, analysis and refactoring via the Language Server Protocol (LSP).
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
You are provided with `lsp` CLI tool for semantic code navigation and analysis. It SHOULD be preferred over `read` or `grep` for most code understanding tasks.
|
||||||
|
|
||||||
|
Usages:
|
||||||
|
|
||||||
|
- **Semantic navigation**: Jump to definitions, find references, locate implementations - understands code structure, not just text patterns.
|
||||||
|
- **Language-aware**: Distinguishes between variables, functions, classes, types - eliminates false positives from text search.
|
||||||
|
- **Cross-file intelligence**: Trace dependencies, refactor safely across entire codebase - knows what imports what.
|
||||||
|
- **Type-aware**: Get precise type information, signatures, documentation - without reading implementation code.
|
||||||
|
|
||||||
|
### Tool Selection
|
||||||
|
|
||||||
|
**Guideline**: You SHOULD prioritize LSP commands for code navigation and analysis. Agents MAY use `read` or `rg` ONLY when semantic analysis is not applicable (e.g., searching for comments or literal strings).
|
||||||
|
|
||||||
|
| Task | Traditional Tool | Recommended LSP Command |
|
||||||
|
| ------------------- | ---------------- | ----------------------------------------------- |
|
||||||
|
| **Find Definition** | `rg`, `read` | [`definition`](#definition-navigate-to-source)|
|
||||||
|
| **Find Usages** | `rg` | [`reference`](#reference-find-all-usages) |
|
||||||
|
| **Understand File** | `read` | [`outline`](#outline-file-structure) |
|
||||||
|
| **View Docs/Types** | `read` | [`doc`](#doc-get-documentation) |
|
||||||
|
| **Refactor** | `sed` | See [Refactoring Guide](references/refactor.md) |
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
All commands support `-h` or `--help`.
|
||||||
|
|
||||||
|
### Locating Symbols
|
||||||
|
|
||||||
|
Most commands use a unified locating syntax via the `--scope` and `--find` options.
|
||||||
|
|
||||||
|
**Arguments**: `<file_path>`
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
|
||||||
|
- `--scope`: Narrow search to a symbol body or line range.
|
||||||
|
- `--find`: Text pattern to find within the scope.
|
||||||
|
|
||||||
|
**Scope Formats**:
|
||||||
|
|
||||||
|
- `<line>`: Single line number (e.g., `42`).
|
||||||
|
- `<start>,<end>`: Line range (e.g., `10,20`). Use `0` for end to mean till EOF (e.g., `10,0`).
|
||||||
|
- `<symbol_path>`: Symbol path with dots (e.g., `MyClass.my_method`).
|
||||||
|
|
||||||
|
**Find Pattern (`--find`)**:
|
||||||
|
|
||||||
|
The `--find` option narrows the target to a **text pattern within the selected scope**:
|
||||||
|
|
||||||
|
- The scope is determined by `--scope` (line/range/symbol). If no `--scope` is given, the entire file is the scope.
|
||||||
|
- Pattern matching is **whitespace-insensitive**: differences in spaces, tabs, and newlines are ignored.
|
||||||
|
- You MAY include the cursor marker `<|>` inside the pattern to specify the **exact position of interest** within the match (for example, on a variable name, keyword, or operator).
|
||||||
|
- If `--find` is omitted, the command uses the start of the scope (or a tool-specific default) as the navigation target.
|
||||||
|
|
||||||
|
**Cursor Marker (`<|>`)**:
|
||||||
|
|
||||||
|
The `<|>` marker indicates the exact position for symbol resolution. It represents the character immediately to its right. Use it within the find pattern to point to a specific element (e.g., `user.<|>name` to target the `name` property).
|
||||||
|
|
||||||
|
**Examples**:
|
||||||
|
|
||||||
|
- `lsp doc foo.py --find "self.<|>"` - Find `self.` in entire file, position at the character after the dot (typically for completion or member access)
|
||||||
|
- `lsp doc foo.py --scope 42 --find "return <|>result"` - Find `return result` on line 42, position at `r` of `result`
|
||||||
|
- `lsp doc foo.py --scope 10,20 --find "if <|>condition"` - Find `if condition` in lines 10-20, position at `c` of `condition`
|
||||||
|
- `lsp doc foo.py --scope MyClass.my_method --find "self.<|>"` - Find `self.` within `MyClass.my_method`, position after the dot
|
||||||
|
- `lsp doc foo.py --scope MyClass` - Target the `MyClass` symbol directly
|
||||||
|
|
||||||
|
**Guideline for Scope vs. Find**:
|
||||||
|
|
||||||
|
- Use `--scope <symbol_path>` (e.g., `--scope MyClass`, `--scope MyClass.my_method`) to target **classes, functions, or methods**. This is the most robust and preferred way to target symbol.
|
||||||
|
- Use `--find` (often combined with `--scope`) to target variables or specific positions. Use this when the target is not a uniquely named symbol or when you need to pinpoint a specific usage within a code block.
|
||||||
|
|
||||||
|
Agents MAY use `lsp locate <file_path> --scope <scope> --find <find>` to verify if the target exists in the file and view its context before running other commands.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verify location exists
|
||||||
|
lsp locate main.py --scope 42 --find "<|>process_data"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pagination
|
||||||
|
|
||||||
|
Use pagination for large result sets like `reference` or `search`.
|
||||||
|
|
||||||
|
- `--pagination-id <ID>`: (Required) Unique session ID for consistent paging.
|
||||||
|
- `--max-items <N>`: Page size.
|
||||||
|
- `--start-index <N>`: Offset (0-based).
|
||||||
|
|
||||||
|
**Example**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Page 1
|
||||||
|
lsp search "User" --max-items 20 --pagination-id "task_123"
|
||||||
|
|
||||||
|
# Page 2
|
||||||
|
lsp search "User" --max-items 20 --start-index 20 --pagination-id "task_123"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Guideline**: Use pagination with a unique ID for common symbols to fetch results in manageable chunks. Increment `--start-index` using the same ID to browse.
|
||||||
|
|
||||||
|
### Outline: File Structure
|
||||||
|
|
||||||
|
Get hierarchical symbol structure without reading implementation.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Get main symbols (classes, functions, methods)
|
||||||
|
lsp outline <file_path>
|
||||||
|
|
||||||
|
# Get all symbols including variables and parameters
|
||||||
|
lsp outline <file_path> --all
|
||||||
|
```
|
||||||
|
|
||||||
|
Agents SHOULD use `outline` before reading files to avoid unnecessary context consumption.
|
||||||
|
|
||||||
|
### Definition: Navigate to Source
|
||||||
|
|
||||||
|
Navigate to where symbols are defined.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Jump to where User.get_id is defined
|
||||||
|
lsp definition models.py --scope User.get_id
|
||||||
|
|
||||||
|
# Find where an imported variable comes from
|
||||||
|
lsp definition main.py --scope 42 --find "<|>config"
|
||||||
|
|
||||||
|
# Find declaration (e.g., header files, interface declarations)
|
||||||
|
lsp definition models.py --scope 25 --mode declaration --find "<|>provider"
|
||||||
|
|
||||||
|
# Find the class definition of a variable's type
|
||||||
|
lsp definition models.py --scope 30 --find "<|>user" --mode type_definition
|
||||||
|
```
|
||||||
|
|
||||||
|
### Reference: Find All Usages
|
||||||
|
|
||||||
|
Find where symbols are used or implemented.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Find all places where logger is referenced
|
||||||
|
lsp reference main.py --scope MyClass.run --find "<|>logger"
|
||||||
|
|
||||||
|
# Find all concrete implementations of an interface/abstract class
|
||||||
|
lsp reference api.py --scope "IDataProvider" --mode implementations
|
||||||
|
|
||||||
|
# Get more surrounding code context for each reference
|
||||||
|
lsp reference app.py --scope 10 --find "<|>my_var" --context-lines 5
|
||||||
|
|
||||||
|
# Limit results for large codebases
|
||||||
|
lsp reference utils.py --find "<|>helper" --max-items 50 --start-index 0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Doc: Get Documentation
|
||||||
|
|
||||||
|
Get documentation and type information without navigating to source.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Get docstring and type info for symbol at line 42
|
||||||
|
lsp doc main.py --scope 42
|
||||||
|
|
||||||
|
# Get API documentation for process_data function
|
||||||
|
lsp doc models.py --scope process_data
|
||||||
|
```
|
||||||
|
|
||||||
|
Agents SHOULD prefer `doc` over `read` when only documentation or type information is needed.
|
||||||
|
|
||||||
|
### Search: Global Symbol Search
|
||||||
|
|
||||||
|
Search for symbols across the workspace when location is unknown.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Search by name (defaults to current directory)
|
||||||
|
lsp search "MyClassName"
|
||||||
|
|
||||||
|
# Search in specific project
|
||||||
|
lsp search "UserModel" --project /path/to/project
|
||||||
|
|
||||||
|
# Filter by symbol kind (can specify multiple times)
|
||||||
|
lsp search "init" --kinds function --kinds method
|
||||||
|
|
||||||
|
# Limit and paginate results for large codebases
|
||||||
|
lsp search "Config" --max-items 10
|
||||||
|
lsp search "User" --max-items 20 --start-index 0
|
||||||
|
```
|
||||||
|
|
||||||
|
Agents SHOULD use `--kinds` to filter results and reduce noise.
|
||||||
|
|
||||||
|
### Symbol: Get Complete Symbol Code
|
||||||
|
|
||||||
|
Get the full source code of the symbol containing a location.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Get complete code of the function/class at line 15
|
||||||
|
lsp symbol main.py --scope 15
|
||||||
|
|
||||||
|
# Get full UserClass implementation
|
||||||
|
lsp symbol utils.py --scope UserClass
|
||||||
|
|
||||||
|
# Get complete method implementation
|
||||||
|
lsp symbol models.py --scope User.validate
|
||||||
|
```
|
||||||
|
|
||||||
|
Response includes: symbol name, kind (class/function/method), range, and **complete source code**.
|
||||||
|
|
||||||
|
Agents SHOULD use `symbol` to read targeted code blocks instead of using `read` on entire files.
|
||||||
|
|
||||||
|
### Refactoring Operations
|
||||||
|
|
||||||
|
Read [Refactoring Guide](references/refactor.md) for rename, extract, and other safe refactoring operations.
|
||||||
|
|
||||||
|
### Server: Manage Background Servers
|
||||||
|
|
||||||
|
The background manager starts automatically. Manual control is OPTIONAL.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List running servers
|
||||||
|
lsp server list
|
||||||
|
|
||||||
|
# Start server for a project
|
||||||
|
lsp server start <path>
|
||||||
|
|
||||||
|
# Stop server for a project
|
||||||
|
lsp server stop <path>
|
||||||
|
|
||||||
|
# Shutdown the background manager
|
||||||
|
lsp server shutdown
|
||||||
|
```
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
### General Workflows
|
||||||
|
|
||||||
|
#### Understanding Unfamiliar Code
|
||||||
|
|
||||||
|
The RECOMMENDED sequence for exploring new codebases:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Step 1: Start with outline - Get file structure without reading implementation
|
||||||
|
lsp outline <file_path>
|
||||||
|
|
||||||
|
# Step 2: Inspect signatures - Use doc to understand API contracts
|
||||||
|
lsp doc <file_path> --scope <symbol_name>
|
||||||
|
|
||||||
|
# Step 3: Navigate dependencies - Follow definition chains
|
||||||
|
lsp definition <file_path> --scope <symbol_name>
|
||||||
|
|
||||||
|
# Step 4: Map usage - Find where code is called with reference
|
||||||
|
lsp reference <file_path> --scope <symbol_name>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Debugging Unknown Behavior
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Step 1: Locate symbol definition workspace-wide
|
||||||
|
lsp search "<symbol_name>"
|
||||||
|
|
||||||
|
# Step 2: Verify implementation details
|
||||||
|
lsp definition <file_path> --scope <symbol_name>
|
||||||
|
|
||||||
|
# Step 3: Trace all callers to understand invocation context
|
||||||
|
lsp reference <file_path> --scope <symbol_name>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Finding Interface Implementations
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Step 1: Locate interface definition
|
||||||
|
lsp search "IUserService" --kinds interface
|
||||||
|
|
||||||
|
# Step 2: Find all implementations
|
||||||
|
lsp reference src/interfaces.py --scope IUserService --mode implementations
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tracing Data Flow
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Step 1: Find where data is created
|
||||||
|
lsp search UserDTO --kinds class
|
||||||
|
|
||||||
|
# Step 2: Find where it's used
|
||||||
|
lsp reference models.py --scope UserDTO
|
||||||
|
|
||||||
|
# Step 3: Check transformations
|
||||||
|
lsp doc transform.py --scope map_to_dto
|
||||||
|
```
|
||||||
|
|
||||||
|
### Understanding Type Hierarchies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Step 1: Get class outline
|
||||||
|
lsp outline models.py
|
||||||
|
|
||||||
|
# Step 2: Find subclasses (references to base)
|
||||||
|
lsp reference models.py --scope BaseModel
|
||||||
|
|
||||||
|
# Step 3: Check type definitions
|
||||||
|
lsp definition models.py --scope BaseModel --mode type_definition
|
||||||
|
```
|
||||||
|
|
||||||
|
### Performance Tips
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Use outline instead of reading entire files
|
||||||
|
lsp outline large_file.py # Better than: read large_file.py
|
||||||
|
|
||||||
|
# Use symbol paths for nested structures (more precise than line numbers)
|
||||||
|
lsp definition models.py --scope User.Profile.validate
|
||||||
|
|
||||||
|
# Limit results in large codebases
|
||||||
|
lsp search "User" --max-items 20
|
||||||
|
|
||||||
|
# Use doc to understand APIs without navigating to source
|
||||||
|
lsp doc api.py --scope fetch_data # Get docs/types without jumping to definition
|
||||||
|
|
||||||
|
# Verify locate strings if commands fail
|
||||||
|
lsp locate main.py --scope 42 --find "<|>my_var"
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "LSP Code Analysis"
|
||||||
|
short_description: "Analyze code using LSP"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: true
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: orchestrate-herdr
|
||||||
|
description: "Start a Herdr/Pi planner for a published spec ticket. Invocation: /skill:orchestrate-herdr ISSUE [WORKER]; omitted worker uses the current local worker."
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Orchestrate a spec with Herdr
|
||||||
|
|
||||||
|
This skill takes a tracker issue number and optional Herdr worker node. It checks whether a planner is already running for that spec; if so, it reports that and exits. Otherwise it starts a planner and exits after confirming startup. The planner runs independently; there is no need to monitor it.
|
||||||
|
|
||||||
|
The **planner** runs on the worker node and coordinates the spec workflow. It delegates implementation, review, and merge work to subagents—not separate CLI agents or Herdr-launched agents. Never attach to, prompt, or resume an existing agent.
|
||||||
|
|
||||||
|
When the invoking session is itself the planner — the local worker started the planner in this session, or no saved or matching machine and pane exists — the two identities collapse. Do not go looking for a planner to monitor: run the run-loop directly in this session, skip the launch-claim and monitor ceremony, and record the session as both orchestrator and planner in `run.json`.
|
||||||
|
|
||||||
|
Read these references before acting:
|
||||||
|
|
||||||
|
- `references/dispatcher.md` — discover an existing run or safely start a planner.
|
||||||
|
- `references/run-loop.md` — implement and close the spec.
|
||||||
|
- `references/state.md` — worker-side run metadata, event log, claims, and recovery.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
The selected worker must have Herdr, Git, the target repository and credentials, this skill, and an authenticated forge CLI (`tea`, `gh`, or `glab`). Run the `forge-cli` preflight there. If a prerequisite, machine, or run identity is missing or ambiguous, stop with actionable guidance; do not guess or dispatch.
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
1. Validate the spec issue and worker, then follow `references/dispatcher.md` to find or start its planner.
|
||||||
|
2. If a planner is already active for the spec, report that and exit. Do not attach, prompt, resume, or monitor it.
|
||||||
|
3. If starting a planner, confirm it reaches `working`, then report the run identity and exit. The planner owns the workflow from there; retain run metadata and logs unless the user explicitly asks to delete them.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Start a spec with Herdr"
|
||||||
|
short_description: "Start its planner and exit after startup confirmation"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# Dispatcher: find or start the planner
|
||||||
|
|
||||||
|
Invocation is `/skill:orchestrate-herdr <spec-ticket> [worker]` (for example, `/skill:orchestrate-herdr 34 obelix`). The spec issue is required. A named worker is the preferred node for a new planner; if omitted or blank, use the current local worker. Never silently select a different machine.
|
||||||
|
|
||||||
|
## Find an existing run first
|
||||||
|
|
||||||
|
1. Confirm the issue exists, is the parent/spec ticket, and is open. If closed, report completion and do not launch anything.
|
||||||
|
2. Resolve the named worker with `herdr machine list`; it is the target for a new run. To find an existing run, inspect enabled saved machines using their exact labels/IDs and `herdr --machine <machine> agent list`.
|
||||||
|
3. Read the issue's `in-progress` label and locate its `.orchestrate/<slug>/run.json` on candidate worker checkouts. Match exact recorded Herdr workspace/pane/agent IDs. Agent listings show runtime identity and status, not the spec issue; use a working directory only to locate a candidate checkout, never as proof of ownership. If the recorded pane no longer exists, match the live `herdr agent list` entry and rewrite `run.json` to it, logging the reconciliation; a stale ID is a reconciliation event, not a mismatch. `herdr machine list` reporting no saved machines means the local session is the worker.
|
||||||
|
4. If a matching planner is active, monitor it; do not start another. If that planner is this session, the identities have collapsed: continue the run loop here instead of monitoring. If the matching run exists but the label is missing, verify the run identity, add `in-progress`, comment on the reconciliation, and monitor.
|
||||||
|
5. If `in-progress` is set but no matching agent can be found, do not start a planner. Refresh Herdr and run state to account for propagation delay; if still unmatched, comment on the parent issue with the mismatch and evidence, then stop for human direction. Do not clear the label automatically.
|
||||||
|
6. If there is no matching agent and no `in-progress` label, reconcile any existing run metadata, issue comments, and Git state. If there is no active or ambiguous work, proceed to start a planner. If anything is uncertain, stop rather than risk duplicate work.
|
||||||
|
|
||||||
|
For an untracked agent, do not attach to it or assume it belongs to this spec. Flag it for human review if it appears relevant; otherwise leave it untouched.
|
||||||
|
|
||||||
|
## Start a new planner
|
||||||
|
|
||||||
|
1. On the selected worker, acquire a per-spec launch claim using an atomic exclusive create under `.orchestrate/`. If another invocation holds the claim, reconcile its owner and run state; never steal an uncertain claim.
|
||||||
|
2. Create a new sibling pane in the confirmed repository checkout and start a fresh Pi planner agent there. Never use an existing agent pane as the planner. Give the planner the issue number, worker identity, repository path, and references to `run-loop.md` and `state.md`.
|
||||||
|
3. The planner's first action is to set/verify the spec's `in-progress` label, before reading tickets or dispatching agents. It then records its Herdr IDs in `run.json` and begins the run loop.
|
||||||
|
4. Confirm the planner reaches `working` and the label is set. Release the launch claim only after confirmed startup. If startup failure is confirmed, release the claim and report the failure. If the outcome is uncertain, retain the claim and stop; do not retry blindly.
|
||||||
|
|
||||||
|
## Start confirmation and failures
|
||||||
|
|
||||||
|
After launching, confirm the planner reaches `working` and the `in-progress` label is set. Then report its run identity and exit; do not wait for later state changes or monitor its agents. If the machine is unreachable, check it with `herdr machine status`; when authentication is needed, run `herdr machine reconnect <label-or-id>` and verify connectivity. Retry transient connection failures at most twice after the first attempt. If the run cannot be safely identified, comment with the blocker and stop; do not dispatch to a different worker.
|
||||||
|
|
||||||
|
Herdr machine commands require an enabled saved machine and reachable, API-compatible Herdr server. A failed connection does not prove a mutation failed; reconcile remote state before retrying.
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# Run loop: implement a spec ticket
|
||||||
|
|
||||||
|
The spec and linked tickets define scope; the tracker is the source of truth. The planner's first action is to set/verify the parent issue's `in-progress` label. Then read the spec, every associated ticket, blockers, and relevant comments. If the spec has no linked implementation tickets forming an actionable frontier, invoke `/to-tickets` and follow its approval and publishing process before implementation. If tickets are blocked, don't invent extra work.
|
||||||
|
|
||||||
|
The issue tracker should have been provided. If not, tell the user to run `/setup-skills`.
|
||||||
|
|
||||||
|
The goal is the entire spec implemented on one **integration branch**, with each ticket resolved according to tracker semantics. Treat tickets as a dependency graph; re-query the tracker as the ready frontier changes. If no ticket is actionable, report the blocker rather than guessing.
|
||||||
|
|
||||||
|
## Communication
|
||||||
|
|
||||||
|
All agent communication and handoffs go through tracker or PR comments; `.orchestrate/<slug>/events.jsonl` is only the operational event log. Keep comments concise and link to context rather than copying ticket bodies or pane output.
|
||||||
|
|
||||||
|
- Implementers post their completion handoff or blocker on the task issue, including branch/commit, changed files, acceptance evidence, checks, and concerns.
|
||||||
|
- Reviewers put review discussion on the PR. Record the review outcome on the task issue.
|
||||||
|
- The planner posts parent-spec comments at meaningful milestones: implementation ready, review outcome, merge, actionable blocker, and completion. Don't repeat comments already posted by a worker.
|
||||||
|
|
||||||
|
## 1. Read and establish the integration branch
|
||||||
|
|
||||||
|
- Confirm the supplied issue is the parent/spec ticket and identify linked implementation tickets.
|
||||||
|
- Understand the task graph and current frontier. Re-query tracker state as work advances.
|
||||||
|
- When tickets require codebase or external-documentation exploration, use a subagent and put concise findings in the relevant tracker comment for later subagents to reference.
|
||||||
|
- Create one integration branch from the intended target branch. If a PR is required, open a draft after the first implementation merge and link it to close the spec and tickets.
|
||||||
|
- If a ticket or its dependencies are ambiguous, stop and ask rather than infer.
|
||||||
|
|
||||||
|
## 2. Implement the frontier
|
||||||
|
|
||||||
|
Use the `subagents` skill and native subagent workflow for every child role. Do not use Herdr agent commands or launch separate CLI processes for implementers, reviewers, fixers, or mergers.
|
||||||
|
|
||||||
|
For each open, unblocked ticket, start a **worker subagent** from the planner using the native subagent workflow, with its own worktree and branch. Independent frontier tickets may run concurrently; never parallel-write a shared checkout. Do not launch implementers, reviewers, fixers, or mergers as separate CLI or Herdr agents; the planner is the only full CLI agent. Start a fresh worker subagent for each merge.
|
||||||
|
|
||||||
|
Start each implementer with its role, task-issue URL, worktree path, and starting branch; the issue itself holds scope and acceptance criteria. Put any later clarification or handoff in tracker/PR comments, not agent-to-agent chat. Require the implementer to:
|
||||||
|
|
||||||
|
- confirm its worktree starts from the current integration branch (reset/rebase onto it if needed);
|
||||||
|
- use the `tdd` skill and run focused checks;
|
||||||
|
- commit its ticket work on its task branch;
|
||||||
|
- merge the latest integration branch into its task branch before reporting done;
|
||||||
|
- post its handoff on the task issue; do not merge to the integration branch or open a PR.
|
||||||
|
|
||||||
|
When an implementer finishes, have a **new independent reviewer subagent** run the `code-review`, `security-audit`, and `code-quality-review` skills against that task branch, using the current integration branch as the base. Put review discussion on the PR and summarize its outcome on the task issue. Resolve actionable findings in a fresh scoped worker subagent and rerun review until clear. Only then use a fresh worker subagent to merge the task branch into the integration branch. Before dispatching the merger, confirm the task worktree is clean (`git status --porcelain` empty) and the task branch is fully pushed; recover unpushed or uncommitted work rather than merging around it. Verify the merge and update tracker state before dispatching newly unblocked tickets. Reconcile uncertain Git or tracker outcomes before retrying.
|
||||||
|
|
||||||
|
When a check spans tickets — for example one coverage threshold covering several modules — an individual task branch can be red because it owns only part of the check, not because of a defect. Review still runs against the task branch, but assert the shared check after merge, on the integration branch; merge-then-fix is the allowed order in that case. Before deviating from green-before-merge, decide whether the check or the branch is mis-scoped, and record that decision.
|
||||||
|
|
||||||
|
## 3. Final review and completion
|
||||||
|
|
||||||
|
After all tickets are implemented and merged, have a **reviewer subagent** run `code-review` against the entire integration branch as a final integration review. Have a fresh worker subagent fix actionable findings in a scoped worktree; merge the fixes and rerun review until clear. Do not report completion until this review is clear and final checks pass; do not merge around unresolved findings or failed checks.
|
||||||
|
|
||||||
|
If a draft PR exists, mark it `needs-review` after final checks. Otherwise, resolve each ticket according to tracker close semantics and report the integration branch. Close the parent spec ticket only when all work is complete, verified, and merged. As part of closing it, remove the `in-progress` label. Clean only confirmed-clean implementer worktrees and issue branch that have been merged successfully in draft PR; retain unresolved work and the worker-side run log.
|
||||||
|
|
||||||
|
## Retry and escalation rules
|
||||||
|
|
||||||
|
- Retry transient infrastructure failures at most twice after the first attempt. Never blindly retry semantic failures, failed checks, or rejected reviews.
|
||||||
|
- If an operation's outcome is uncertain, reconcile tracker, Git, worker, and Herdr state before repeating it.
|
||||||
|
- Stop and preserve state/evidence for auth or permission failures, unresolved state mismatches, exhausted retries, ambiguity, or decisions requiring human judgment.
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Worker-side run state and recovery
|
||||||
|
|
||||||
|
The worker node is the source of truth. Keep state under `.orchestrate/<slug>/` in the target repository checkout, outside product commits and PRs. Use a stable issue-derived slug such as `spec-34`; do not mirror state on the orchestrator node.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- `run.json` — minimal recovery metadata: spec issue ID/URL, repository identity, worker label/ID, planner's Herdr agent/pane/workspace IDs, and each tracked child subagent's role, issue ID, subagent run ID, branch, and worktree.
|
||||||
|
- `events.jsonl` — append-only structured operational events: timestamp, actor/task, action, outcome, and relevant Herdr/Git/tracker IDs. No pane transcripts, copied ticket bodies, plans, or handoff prose. Record a start and finish event for every phase (worktree created, implementer handoff, review dispatched, review completed, merge completed); a phase with only one of the pair is a detectable gap, whereas a silent absence is not.
|
||||||
|
|
||||||
|
The issue tracker is canonical for ticket status, acceptance criteria, decisions, and communication. Keep agent handoffs and blockers in comments on the relevant task issue; use PR comments for review discussion; use parent-spec comments for milestone rollups. Do not create local handoff files or duplicate tracker content in `run.json`.
|
||||||
|
|
||||||
|
## Claim and label
|
||||||
|
|
||||||
|
Before creating a planner, acquire a per-spec launch claim under `.orchestrate/` with an atomic exclusive create. The claim only serializes startup; it is not a second progress record. Record its owner and issue ID. Never steal an uncertain claim.
|
||||||
|
|
||||||
|
The new planner's first action is to set/verify the parent's `in-progress` label, before reading tickets or dispatching work. After confirmed startup and recording the planner's Herdr IDs, release the launch claim. Release a claim after startup failure only when failure and absence of a running planner are confirmed. Keep it and escalate when the result is uncertain.
|
||||||
|
|
||||||
|
If the parent has `in-progress` but no matching agent is found, do not start a replacement or clear the label. Comment with the mismatch and wait for the user's explicit retry decision. If a matching agent exists but the label is missing, verify the run record, add the label, and comment on the repair.
|
||||||
|
|
||||||
|
## Persist and recover
|
||||||
|
|
||||||
|
Append a structured event after each consequential side effect and enough identity data to match the run to Herdr. The worker log records activity while the orchestrator is unavailable; agents continue posting comments to the tracker.
|
||||||
|
|
||||||
|
On every invocation or restart:
|
||||||
|
|
||||||
|
1. Read the parent issue, labels, and relevant comments.
|
||||||
|
2. Inspect the worker's `run.json` and event log.
|
||||||
|
3. Query Herdr agent state and match exact recorded IDs; do not infer ownership from a matching working directory. If the recorded pane was recreated or removed between sessions, match the live entry, rewrite `run.json` to it, and log the reconciliation.
|
||||||
|
4. Reconcile tracker and Git state before deciding to start a planner. If the worker is unreachable or identities/state disagree, report the blocker and stop rather than guessing.
|
||||||
|
|
||||||
|
If a matching live planner exists, report that it is already running and exit; do not attach to, prompt, or resume it. The planner manages its own subagents. If there is no matching agent and no `in-progress` label, reconcile any stale run record; start a fresh planner only when no active or ambiguous work remains and a new atomic claim is acquired.
|
||||||
|
|
||||||
|
Retain `run.json` and `events.jsonl` after completion. The planner removes `in-progress` while closing the parent spec only after all tickets are complete, verified, and merged. Delete retained run state only at the user's explicit request.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Credits
|
||||||
|
|
||||||
|
The **Summary** section's menu of visuals (pseudocode, call trees, component trees, file trees, Mermaid, diffs) and its placement guidance come from [Dex Horthy](https://github.com/dexhorthy)'s [`show-me`](https://github.com/humanlayer/humanlayer) skill, reproduced almost word for word and aimed at a diff instead of a live conversation. `pr` does not depend on `show-me` as a skill (it isn't part of this repo, and a hard dependency would break standalone installs), so the content is copied in rather than pointed at; this file is the attribution a dependency would otherwise have carried.
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
---
|
||||||
|
name: pr
|
||||||
|
description: "Use when writing a PR body."
|
||||||
|
metadata:
|
||||||
|
credits:
|
||||||
|
skill: show-me
|
||||||
|
author: Dex Horthy
|
||||||
|
organisation: Humanlayer
|
||||||
|
url: "https://github.com/humanlayer/skills/blob/main/plugins/show-me/skills/show-me/SKILL.md"
|
||||||
|
---
|
||||||
|
|
||||||
|
Use this template for writing the PR body:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
<diagram, diff-sketch, or tree>
|
||||||
|
|
||||||
|
## Evidence
|
||||||
|
|
||||||
|
- **Before:** <screenshot/output/failing test run>
|
||||||
|
**After:** <screenshot/output/passing test run>
|
||||||
|
|
||||||
|
## Merge Danger
|
||||||
|
|
||||||
|
**Door:** <one-way or two-way>
|
||||||
|
|
||||||
|
<optional: description>
|
||||||
|
|
||||||
|
**Blast Radius:** <one-word description>
|
||||||
|
|
||||||
|
<optional: potential ramifications of merge>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sections
|
||||||
|
|
||||||
|
Skip all preambles and keep prose brief. Use the user's domain language from `GLOSSARY.md`.
|
||||||
|
|
||||||
|
### Summary
|
||||||
|
|
||||||
|
Pick the smallest view that makes the key point clear.
|
||||||
|
|
||||||
|
- Show logic or an algorithm as pseudocode:
|
||||||
|
|
||||||
|
```text
|
||||||
|
on(save)
|
||||||
|
if content is unchanged
|
||||||
|
return cached result
|
||||||
|
write new content
|
||||||
|
return fresh result
|
||||||
|
```
|
||||||
|
|
||||||
|
- Show runtime control flow as a call tree:
|
||||||
|
|
||||||
|
```text
|
||||||
|
submitForm
|
||||||
|
createSession
|
||||||
|
persistPrompt
|
||||||
|
launchAgent
|
||||||
|
navigateToSession
|
||||||
|
```
|
||||||
|
|
||||||
|
- Show UI structure as a component tree, including state and module boundaries that matter:
|
||||||
|
|
||||||
|
```text
|
||||||
|
<SessionPage> (apps/example/src/routes/session.tsx)
|
||||||
|
useSessionEvents()
|
||||||
|
<SessionToolbar>
|
||||||
|
<RunSkillButton> (packages/ui)
|
||||||
|
```
|
||||||
|
|
||||||
|
- Show file responsibility or a broad refactor as a shallow file tree:
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/
|
||||||
|
├── commands/ # parses user actions
|
||||||
|
├── sessions/ # owns session state
|
||||||
|
└── transport/ # sends API requests
|
||||||
|
```
|
||||||
|
|
||||||
|
- Show component interaction, control flow, or data flow with Mermaid:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sequenceDiagram
|
||||||
|
participant User
|
||||||
|
participant UI
|
||||||
|
participant Daemon
|
||||||
|
User->>UI: choose command
|
||||||
|
UI->>Daemon: send expanded prompt
|
||||||
|
Daemon-->>UI: stream result
|
||||||
|
```
|
||||||
|
|
||||||
|
- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.
|
||||||
|
|
||||||
|
For a component change:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
<SessionPage>
|
||||||
|
useSessionEvents()
|
||||||
|
<SessionToolbar>
|
||||||
|
+ <RunSkillButton />
|
||||||
|
<SessionTimeline>
|
||||||
|
+ <SkillResultCard />
|
||||||
|
```
|
||||||
|
|
||||||
|
For a file-layout change:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
src/
|
||||||
|
├── commands/
|
||||||
|
+│ └── show-me.ts # expands the slash command
|
||||||
|
├── sessions/
|
||||||
|
-└── transport.ts
|
||||||
|
+└── transport/
|
||||||
|
+ ├── client.ts
|
||||||
|
+ └── stream.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
For a call-tree or call-stack change:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
submitForm
|
||||||
|
createSession
|
||||||
|
persistPrompt
|
||||||
|
+ expandSkillMention
|
||||||
|
launchAgent
|
||||||
|
- navigateToSession
|
||||||
|
+ navigateToSession
|
||||||
|
+ subscribeToEvents
|
||||||
|
```
|
||||||
|
|
||||||
|
For a state or control-flow change:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
on(save)
|
||||||
|
- write content
|
||||||
|
+ if content is unchanged
|
||||||
|
+ return cached result
|
||||||
|
+ write new content
|
||||||
|
+ invalidate cache
|
||||||
|
```
|
||||||
|
|
||||||
|
- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
function expandSkill(command: string): string {
|
||||||
|
const skillName = command.slice(1);
|
||||||
|
return `use the ${skillName} skill`;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Guidance
|
||||||
|
|
||||||
|
Place each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.
|
||||||
|
|
||||||
|
You may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.
|
||||||
|
|
||||||
|
### Evidence
|
||||||
|
|
||||||
|
Concrete evidence that the change works. Show a before and after.
|
||||||
|
|
||||||
|
Screenshots are S-tier - when the environment is set up for it and the change is visual.
|
||||||
|
|
||||||
|
Execution-based evidence is A-tier. Test results, console output. Show the exact test that now fails and passes, using pseudocode.
|
||||||
|
|
||||||
|
### Merge Danger
|
||||||
|
|
||||||
|
Describe whether it's a one-way or two-way door. You can walk back through two-way doors, but not one-way doors. A PR that is cheap to roll back is lower risk. Changes that involve destructive actions or hard-to-reverse decisions are one-way doors.
|
||||||
|
|
||||||
|
The blast radius is the potential impact or scope of the changes introduced by this PR. Consider all possibilities. Examples are layout shift, breakages for consumers, mobile responsiveness, etc.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "PR"
|
||||||
|
short_description: "Write a PR body that's fast to review"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Project Context Pack"
|
||||||
|
short_description: "Provides context about the project to the agent"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
# Logic Prototype
|
||||||
|
|
||||||
|
A single, self-contained HTML file (a **shareable demo**) that lets anyone drive a state model by clicking buttons. Use this when the question is about **business logic, state transitions, or data shape**: the kind of thing that looks reasonable on paper but only feels wrong once you push it through real cases.
|
||||||
|
|
||||||
|
Because it's one file with nothing to install, you can hand it to a non-developer (a designer, a PM, a domain expert) and let them feel the model for themselves. So it speaks their language, not the code's.
|
||||||
|
|
||||||
|
## When this is the right shape
|
||||||
|
|
||||||
|
- "I'm not sure if this state machine handles the edge case where X then Y."
|
||||||
|
- "Does this data model actually let me represent the case where..."
|
||||||
|
- "I want to feel out what the API should look like before writing it."
|
||||||
|
- Anything where someone wants to **press buttons and watch state change**.
|
||||||
|
|
||||||
|
If the question is "what should this look like," this is the wrong branch. Use [UI.md](UI.md).
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
### 1. State the question
|
||||||
|
|
||||||
|
Before writing code, write down what state model and what question you're prototyping. One paragraph, at the top of the demo (in a visible intro, not just a comment). A logic prototype that answers the wrong question is pure waste, so make the question explicit so it can be checked later, whether the user is watching now or returning to it AFK.
|
||||||
|
|
||||||
|
### 2. Isolate the logic in a portable module
|
||||||
|
|
||||||
|
Put the actual logic (the bit that's answering the question) in a single `<script>` block written as a small, pure module that could be lifted out and dropped into the real codebase later. The page around it is throwaway; this module isn't.
|
||||||
|
|
||||||
|
The right shape depends on the question:
|
||||||
|
|
||||||
|
- **A pure reducer**: `(state, action) => state`. Good when actions are discrete events and state is a single value.
|
||||||
|
- **A state machine**: explicit states and transitions. Good when "which actions are even legal right now" is part of the question.
|
||||||
|
- **A small set of pure functions** over a plain data type. Good when there's no implicit current state, just transformations.
|
||||||
|
- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.
|
||||||
|
|
||||||
|
Pick whichever shape best fits the question being asked, *not* whichever is easiest to wire to a page. Keep it pure: no DOM, no `document`, no button handlers reaching inside it. The page calls into it; nothing flows the other direction. This is what makes the prototype useful past its own lifetime: once the question's answered, the validated reducer / machine / function set lifts into the real module on its own.
|
||||||
|
|
||||||
|
### 3. Build the shareable HTML file
|
||||||
|
|
||||||
|
One file, plain HTML/CSS/JS: no framework, no bundler, no server, everything inline so it opens by double-click and survives being emailed around. Anyone should be able to run it by opening it.
|
||||||
|
|
||||||
|
Write it for a non-developer. Every label is in **domain language**, not code: buttons and state read like the business, not the reducer. Explain in plain words what's happening.
|
||||||
|
|
||||||
|
Lay it out with a clean hierarchy, top to bottom:
|
||||||
|
|
||||||
|
1. **Title and one-line explanation** of what this demo lets you explore (the question from step 1).
|
||||||
|
2. **Current state**: the full relevant state, rendered as a readable panel (labelled fields, not a raw JSON dump), re-rendered after every click so the change is visible. Where it helps a non-developer follow, call out what just changed.
|
||||||
|
3. **Free-play buttons**: one button per action, always available, so anyone can poke at the model in any order. Each click dispatches its action and re-renders the state.
|
||||||
|
4. **Guided walkthroughs**: a set of **scenarios**, one per tab. Each tab holds a short plain-language description of the scenario (the situation it sets up and what to watch for) and underneath it, the ordered **buttons to press** for that scenario. Each step is a real button: clicking it performs that action and moves to the next step. Starting a walkthrough resets to a known initial state so the scenario runs the same way every time.
|
||||||
|
|
||||||
|
Choose scenarios that demonstrate the awkward cases, the ones hard to reason about on paper: the happy path, a tricky edge case, an attempt at something that should be illegal.
|
||||||
|
|
||||||
|
Keep it beautiful but restrained: clean typography, generous spacing, one accent colour. No animations, no gimmicks: nothing that competes with the state and the buttons.
|
||||||
|
|
||||||
|
### 4. Hand it over
|
||||||
|
|
||||||
|
Send them the file, or open it for them. They'll click through the walkthroughs and free-play whenever they get to it; the interesting moments are when they say "wait, that shouldn't be possible" or "huh, I assumed X would be different"; those are the bugs in the _idea_, which is the whole point. If they want new actions or a new scenario, add them. Prototypes evolve.
|
||||||
|
|
||||||
|
### 5. Capture the answer and the prototype
|
||||||
|
|
||||||
|
Once the prototype has answered its question, capture the answer, then capture the prototype the way the [SKILL](SKILL.md) describes. The logic-specific mapping: the validated reducer / machine / function set lifts into the real module (the decision, absorbed); the HTML shell rides along to the throwaway branch that keeps the prototype as a primary source, and being one self-contained file, it stays trivially re-runnable there.
|
||||||
|
|
||||||
|
## Anti-patterns
|
||||||
|
|
||||||
|
- **Don't add tests.** A prototype that needs tests is no longer a prototype.
|
||||||
|
- **Don't wire it to the real database.** Use in-memory state unless the question is specifically about persistence.
|
||||||
|
- **Don't generalise.** No "what if we wanted to support X later." The prototype answers one question.
|
||||||
|
- **Don't blur the logic and the page together.** If the pure module references the DOM, `document`, or button handlers, it's no longer liftable. Keep the page as a thin shell over a pure module.
|
||||||
|
- **Don't reach for a framework, bundler, or server.** One file the recipient double-clicks; a React app or a dev server defeats "shareable".
|
||||||
|
- **Don't ship the HTML shell into production.** The page is optimised for being clicked through by hand. The logic module behind it is the bit worth keeping.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
name: prototype
|
||||||
|
description: Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Prototype
|
||||||
|
|
||||||
|
A prototype is **throwaway code that answers a question**. The question decides the shape.
|
||||||
|
|
||||||
|
## Pick a branch
|
||||||
|
|
||||||
|
Identify which question is being answered, using the user's prompt, the surrounding code, or by asking if the user is around:
|
||||||
|
|
||||||
|
- **"Does this logic / state model feel right?"** → [LOGIC.md](LOGIC.md). Build a single shareable HTML file (free-play buttons plus tabbed guided walkthroughs) that pushes the state machine through cases that are hard to reason about on paper, and that a non-developer can drive.
|
||||||
|
- **"What should this look like?"** → [UI.md](UI.md). Generate several radically different UI variations on a single route, switchable via a URL search param and a floating bottom bar.
|
||||||
|
|
||||||
|
The two branches produce very different artifacts, so getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module → logic; a page or component → UI) and state the assumption at the top of the prototype.
|
||||||
|
|
||||||
|
## Rules that apply to both
|
||||||
|
|
||||||
|
1. **Throwaway from day one, and clearly marked as such.** Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious, but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.
|
||||||
|
2. **Trivial to run.** A UI prototype starts from one command in the project's task runner: `pnpm <name>`, `python <path>`, `bun <path>`, etc. A logic demo is a single HTML file the user double-clicks. Either way, no thinking required to start it.
|
||||||
|
3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is _checking_, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear "PROTOTYPE, wipe me" name.
|
||||||
|
4. **Skip the polish.** No tests, no error handling beyond what makes the prototype _runnable_, no abstractions. The point is to learn something fast.
|
||||||
|
5. **Surface the state.** After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.
|
||||||
|
6. **Capture it when done.** Fold any validated decision into the real code, then capture the prototype itself as a **primary source**: commit it to a throwaway branch, out of main, and leave a context pointer to that branch on the implementation issue. Capture the answer too (the verdict and the question it settled) in the issue or a commit. The main branch keeps only the validated decision.
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
# UI Prototype
|
||||||
|
|
||||||
|
Generate **several radically different UI variations** on a single route, switchable from a floating bottom bar. The user flips between variants in the browser, picks one (or steals bits from each), then throws the rest away.
|
||||||
|
|
||||||
|
If the question is about logic/state rather than what something looks like, this is the wrong branch. Use [LOGIC.md](LOGIC.md).
|
||||||
|
|
||||||
|
## When this is the right shape
|
||||||
|
|
||||||
|
- "What should this page look like?"
|
||||||
|
- "I want to see a few options for this dashboard before committing."
|
||||||
|
- "Try a different layout for the settings screen."
|
||||||
|
- Any time the user would otherwise spend a day picking between three vague mockups in their head.
|
||||||
|
|
||||||
|
## Two sub-shapes: strongly prefer sub-shape A
|
||||||
|
|
||||||
|
A UI prototype is much easier to judge when it's **butting up against the rest of the app**: real header, real sidebar, real data, real density. A throwaway route on its own is a vacuum: every variant looks fine in isolation. Default to sub-shape A whenever there's a plausible existing page to host the variants. Only reach for sub-shape B if the prototype genuinely has no nearby home.
|
||||||
|
|
||||||
|
### Sub-shape A: adjustment to an existing page (preferred)
|
||||||
|
|
||||||
|
The route already exists. Variants are rendered **on the same route**, gated by a `?variant=` URL search param. The existing data fetching, params, and auth all stay. Only the rendering swaps. This is the default; pick it unless there's a specific reason not to.
|
||||||
|
|
||||||
|
If the prototype is for something that doesn't yet have a page but *would naturally live inside one* (a new section of the dashboard, a new card on the settings screen, a new step in an existing flow), it's still sub-shape A. Mount the variants inside the host page.
|
||||||
|
|
||||||
|
### Sub-shape B: a new page (last resort)
|
||||||
|
|
||||||
|
Only use this when the thing being prototyped genuinely has no existing page to live inside (e.g. an entirely new top-level surface, or a flow that can't be embedded anywhere sensible).
|
||||||
|
|
||||||
|
Create a **throwaway route** following whatever routing convention the project already uses. Don't invent a new top-level structure. Name it so it's obviously a prototype (e.g. include the word `prototype` in the path or filename). Same `?variant=` pattern.
|
||||||
|
|
||||||
|
Before committing to sub-shape B, sanity-check: is there really no existing page this could be embedded in? An empty route hides design problems that a populated one would expose.
|
||||||
|
|
||||||
|
In both sub-shapes the floating bottom bar is identical.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
### 1. State the question and pick N
|
||||||
|
|
||||||
|
Default to **3 variants**. More than 5 stops being radically different and starts being noise, so cap there.
|
||||||
|
|
||||||
|
Write down the plan in one line, in the prototype's location or a top-of-file comment:
|
||||||
|
|
||||||
|
> "Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route."
|
||||||
|
|
||||||
|
This works whether the user is here to push back or not.
|
||||||
|
|
||||||
|
### 2. Generate radically different variants
|
||||||
|
|
||||||
|
Draft each variant. Hold each one to:
|
||||||
|
|
||||||
|
- The page's purpose and the data it has access to.
|
||||||
|
- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).
|
||||||
|
- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.
|
||||||
|
|
||||||
|
Variants must be **structurally different**: different layout, different information hierarchy, different primary affordance, not just different colours. Three slightly-tweaked card grids isn't a UI prototype, it's wallpaper. If two drafts come out too similar, redo one with explicit "do not use a card grid" guidance.
|
||||||
|
|
||||||
|
### 3. Wire them together
|
||||||
|
|
||||||
|
Create a single switcher component on the route:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// pseudo-code, adapt to the project's framework
|
||||||
|
const variant = searchParams.get('variant') ?? 'A';
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{variant === 'A' && <VariantA {...data} />}
|
||||||
|
{variant === 'B' && <VariantB {...data} />}
|
||||||
|
{variant === 'C' && <VariantC {...data} />}
|
||||||
|
<PrototypeSwitcher variants={['A','B','C']} current={variant} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
For sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.
|
||||||
|
|
||||||
|
For sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.
|
||||||
|
|
||||||
|
### 4. Build the floating switcher
|
||||||
|
|
||||||
|
A small fixed-position bar at the bottom-centre of the screen with three pieces:
|
||||||
|
|
||||||
|
- **Left arrow**: cycles to the previous variant (wraps around).
|
||||||
|
- **Variant label**: shows the current variant key and, if the variant exports a name, that name too. e.g. `B (Sidebar layout)`.
|
||||||
|
- **Right arrow**: cycles forward (wraps around).
|
||||||
|
|
||||||
|
Behaviour:
|
||||||
|
|
||||||
|
- Clicking an arrow updates the URL search param (use the framework's router, e.g. `router.replace` on Next, `navigate` on React Router, etc) so the variant is shareable and reload-stable.
|
||||||
|
- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.
|
||||||
|
- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.
|
||||||
|
- Hidden in production builds: gate on `process.env.NODE_ENV !== 'production'` or an equivalent check, so a stray prototype merge can't ship the bar to users.
|
||||||
|
|
||||||
|
Put the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.
|
||||||
|
|
||||||
|
### 5. Hand it over
|
||||||
|
|
||||||
|
Surface the URL (and the `?variant=` keys). The user will flip through whenever they get to it. The interesting feedback is usually **"I want the header from B with the sidebar from C"**, which is the actual design they want.
|
||||||
|
|
||||||
|
### 6. Capture the answer and clean up
|
||||||
|
|
||||||
|
Once a variant has won, capture the answer (which variant and why), then capture the prototype the way the [SKILL](SKILL.md) describes. Fold the winner into the real code and move the rest onto the throwaway branch, not into main:
|
||||||
|
|
||||||
|
- **Sub-shape A**: fold the winner into the existing page; drop the losing variants and the switcher from main.
|
||||||
|
- **Sub-shape B**: promote the winning variant to a real route; drop the throwaway route and the switcher from main.
|
||||||
|
|
||||||
|
The full set of variants is the primary source, so it lands on the throwaway branch, not the bin, since variant components and the switcher left in the main branch rot fast and confuse the next reader.
|
||||||
|
|
||||||
|
## Anti-patterns
|
||||||
|
|
||||||
|
- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.
|
||||||
|
- **Sharing too much code between variants.** A shared `<Header>` is fine; a shared `<Layout>` defeats the point. Each variant should be free to throw out the layout.
|
||||||
|
- **Wiring variants to real mutations.** Read-only prototypes are fine. If a variant needs to mutate, point it at a stub: the question is "what should this look like", not "does the backend work".
|
||||||
|
- **Promoting the prototype directly to production.** The variant code was written under prototype constraints (no tests, minimal error handling). Rewrite it properly when you fold it in.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Prototype"
|
||||||
|
short_description: "Prototype to answer a design question"
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
name: recipe-diagrams
|
||||||
|
description: "Recipe diagrams: convert any recipe into a high-resolution Cooking for Engineers-style PNG process-flow table with aligned ingredient streams, preparation branches, joins, temperatures, timings, and finish steps. Use when the user asks for a recipe diagram."
|
||||||
|
compatibility: Requires Python 3 and ImageMagick.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Recipe diagrams
|
||||||
|
|
||||||
|
Convert the recipe into a dependency graph, then render that graph as a high-resolution Cooking for Engineers-style PNG table. Read the table left to right: ingredient rows are streams, columns are stages, and vertically merged action cells are joins.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
1. **Normalize the source.** Read the complete recipe, including yield, ingredient headings, ingredient preparation, numbered method, notes that alter execution, and any linked source the user supplied. Preserve quantities, equipment, temperatures, times, sensory completion cues, resting/cooling, and serving steps. The source is normalized when every execution-relevant source statement has one prospective home in the diagram.
|
||||||
|
|
||||||
|
2. **Build the dependency graph.** Separate global setup from ingredient streams and operations. Treat an ingredient's inline preparation (for example, `onion, diced`) as an operation unless it is purchased in that state. Split an ingredient into labeled portions when the source uses it at different stages. Keep independent preparations in the same column when order does not matter; place dependent operations in later columns. The graph is complete when every ingredient reaches every operation that consumes it and all operations lead to the finished result.
|
||||||
|
|
||||||
|
3. **Make the graph planar.** Order ingredient rows so every operation consumes one contiguous row range. Each later join spans the complete ranges of the intermediates it combines. Add columns until actions in one column have disjoint row ranges. The layout is complete when no action range is discontinuous and no two action ranges overlap within a column.
|
||||||
|
|
||||||
|
4. **Encode the layout.** Write a temporary JSON file using the schema below. Keep labels imperative and compact, but retain execution details. Use plain strings; the renderer transliterates symbols to ASCII.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"title": "Recipe name",
|
||||||
|
"yield": "about 10 servings",
|
||||||
|
"setup": [
|
||||||
|
"Butter and flour a loaf pan",
|
||||||
|
"Preheat oven to 350 deg F (170 deg C)"
|
||||||
|
],
|
||||||
|
"ingredients": [
|
||||||
|
"2 large (250 g) ripe bananas",
|
||||||
|
"6 Tbsp (90 mL) butter"
|
||||||
|
],
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{ "rows": [0, 0], "label": "mash" },
|
||||||
|
{ "rows": [1, 1], "label": "melt" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{ "rows": [0, 1], "label": "mix until smooth" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`rows` is an inclusive, zero-based ingredient-row range. A blank stage cell means that stream carries forward unchanged. A cell spanning several rows consumes those ingredients or the intermediates already produced from them. Put pan preparation, preheating, and other recipe-wide prerequisites in `setup`; put cooking, cooling, garnishing, and serving in action columns at their actual dependency point.
|
||||||
|
|
||||||
|
5. **Audit before rendering.** Compare the JSON against the source. Verify every ingredient and portion, every operation, all ordering constraints, and all execution details exactly once. Preserve genuine alternatives in the relevant label. Mark source uncertainty with `[?]` and explain it after the diagram rather than inventing a resolution. The audit is complete only when every source item is accounted for.
|
||||||
|
|
||||||
|
6. **Render, inspect, and return.** Resolve `scripts/render_recipe_diagram_png.py` relative to this `SKILL.md`, then run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 scripts/render_recipe_diagram_png.py /tmp/recipe-diagram.json /tmp/recipe-diagram.png --width 3840
|
||||||
|
```
|
||||||
|
|
||||||
|
The renderer creates a 4K-wide PNG with an adaptive height, a local monospaced font, graphical borders, wrapped labels, and true vertically merged action cells. Set `RECIPE_DIAGRAM_FONT` to a `.ttf` or `.ttc` file to override the detected font. If the table is unusually dense, increase `--width`; do not alter the dependency graph merely to fit a chat viewport.
|
||||||
|
|
||||||
|
Open the generated PNG and inspect it before returning. Verify that the complete outer border is visible, text stays inside its cells, no labels overlap or clip, joins and row boundaries are unambiguous, and the image remains legible when scaled down. Return the PNG as an image attachment or clear file link rather than pasting an ASCII table. If `[?]` appears, follow the image with a short `Uncertainties` list. The output is complete when rasterization succeeds, the image is at least 3840 pixels wide, and visual inspection confirms crisp text and borders.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Recipe Diagrams"
|
||||||
|
short_description: "Turn recipes into process-flow diagrams"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,406 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Render a Cooking for Engineers-style recipe dependency graph as aligned ASCII."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import textwrap
|
||||||
|
import unicodedata
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
|
ASCII_REPLACEMENTS = {
|
||||||
|
"°": " deg ",
|
||||||
|
"×": "x",
|
||||||
|
"–": "-",
|
||||||
|
"—": "-",
|
||||||
|
"−": "-",
|
||||||
|
"’": "'",
|
||||||
|
"‘": "'",
|
||||||
|
"“": '"',
|
||||||
|
"”": '"',
|
||||||
|
"¼": "1/4",
|
||||||
|
"½": "1/2",
|
||||||
|
"¾": "3/4",
|
||||||
|
"⅓": "1/3",
|
||||||
|
"⅔": "2/3",
|
||||||
|
"⅛": "1/8",
|
||||||
|
"⅜": "3/8",
|
||||||
|
"⅝": "5/8",
|
||||||
|
"⅞": "7/8",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class RecipeDiagramInputError(ValueError):
|
||||||
|
"""Reports malformed recipe diagram JSON with a searchable error prefix."""
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class RecipeAction:
|
||||||
|
"""An operation consuming one inclusive, contiguous range of ingredient rows."""
|
||||||
|
|
||||||
|
start_row: int
|
||||||
|
end_row: int
|
||||||
|
label: str
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class RecipeDiagram:
|
||||||
|
"""The validated recipe process-flow table consumed by the ASCII renderer."""
|
||||||
|
|
||||||
|
title: str
|
||||||
|
recipe_yield: str
|
||||||
|
setup: tuple[str, ...]
|
||||||
|
ingredients: tuple[str, ...]
|
||||||
|
columns: tuple[tuple[RecipeAction, ...], ...]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class RecipeDiagramLayout:
|
||||||
|
"""Wrapped labels, row heights, and fixed column widths for one rendering."""
|
||||||
|
|
||||||
|
column_widths: tuple[int, ...]
|
||||||
|
row_heights: tuple[int, ...]
|
||||||
|
ingredient_lines: tuple[tuple[str, ...], ...]
|
||||||
|
action_lines: tuple[dict[RecipeAction, tuple[str, ...]], ...]
|
||||||
|
|
||||||
|
|
||||||
|
def ascii_recipe_text(value: str) -> str:
|
||||||
|
"""Transliterate recipe text so every rendered character is seven-bit ASCII."""
|
||||||
|
|
||||||
|
replaced = "".join(ASCII_REPLACEMENTS.get(character, character) for character in value)
|
||||||
|
normalized = unicodedata.normalize("NFKD", replaced)
|
||||||
|
ascii_text = normalized.encode("ascii", "ignore").decode("ascii")
|
||||||
|
return " ".join(ascii_text.split())
|
||||||
|
|
||||||
|
|
||||||
|
def require_recipe_string(value: Any, field_name: str, allow_empty: bool = False) -> str:
|
||||||
|
"""Validate and normalize one string field from recipe diagram JSON."""
|
||||||
|
|
||||||
|
if not isinstance(value, str):
|
||||||
|
raise RecipeDiagramInputError(f"{field_name} must be a string")
|
||||||
|
normalized = ascii_recipe_text(value)
|
||||||
|
if not allow_empty and not normalized:
|
||||||
|
raise RecipeDiagramInputError(f"{field_name} must not be empty")
|
||||||
|
return normalized
|
||||||
|
|
||||||
|
|
||||||
|
def parse_recipe_diagram(document: Any) -> RecipeDiagram:
|
||||||
|
"""Parse and validate the complete recipe diagram JSON document."""
|
||||||
|
|
||||||
|
if not isinstance(document, dict):
|
||||||
|
raise RecipeDiagramInputError("top-level JSON value must be an object")
|
||||||
|
|
||||||
|
title = require_recipe_string(document.get("title"), "title")
|
||||||
|
recipe_yield = require_recipe_string(document.get("yield", ""), "yield", allow_empty=True)
|
||||||
|
|
||||||
|
setup_value = document.get("setup", [])
|
||||||
|
if not isinstance(setup_value, list):
|
||||||
|
raise RecipeDiagramInputError("setup must be an array of strings")
|
||||||
|
setup = tuple(
|
||||||
|
require_recipe_string(item, f"setup[{index}]")
|
||||||
|
for index, item in enumerate(setup_value)
|
||||||
|
)
|
||||||
|
|
||||||
|
ingredients_value = document.get("ingredients")
|
||||||
|
if not isinstance(ingredients_value, list) or not ingredients_value:
|
||||||
|
raise RecipeDiagramInputError("ingredients must be a non-empty array of strings")
|
||||||
|
ingredients = tuple(
|
||||||
|
require_recipe_string(item, f"ingredients[{index}]")
|
||||||
|
for index, item in enumerate(ingredients_value)
|
||||||
|
)
|
||||||
|
|
||||||
|
columns_value = document.get("columns")
|
||||||
|
if not isinstance(columns_value, list) or not columns_value:
|
||||||
|
raise RecipeDiagramInputError("columns must be a non-empty array")
|
||||||
|
|
||||||
|
columns: list[tuple[RecipeAction, ...]] = []
|
||||||
|
for column_index, column_value in enumerate(columns_value):
|
||||||
|
if not isinstance(column_value, dict):
|
||||||
|
raise RecipeDiagramInputError(f"columns[{column_index}] must be an object")
|
||||||
|
actions_value = column_value.get("actions", [])
|
||||||
|
if not isinstance(actions_value, list):
|
||||||
|
raise RecipeDiagramInputError(f"columns[{column_index}].actions must be an array")
|
||||||
|
|
||||||
|
actions: list[RecipeAction] = []
|
||||||
|
occupied_rows: set[int] = set()
|
||||||
|
for action_index, action_value in enumerate(actions_value):
|
||||||
|
action_field = f"columns[{column_index}].actions[{action_index}]"
|
||||||
|
if not isinstance(action_value, dict):
|
||||||
|
raise RecipeDiagramInputError(f"{action_field} must be an object")
|
||||||
|
rows_value = action_value.get("rows")
|
||||||
|
if (
|
||||||
|
not isinstance(rows_value, list)
|
||||||
|
or len(rows_value) != 2
|
||||||
|
or any(isinstance(row, bool) or not isinstance(row, int) for row in rows_value)
|
||||||
|
):
|
||||||
|
raise RecipeDiagramInputError(f"{action_field}.rows must contain two integers")
|
||||||
|
start_row, end_row = rows_value
|
||||||
|
if start_row < 0 or end_row < start_row or end_row >= len(ingredients):
|
||||||
|
raise RecipeDiagramInputError(
|
||||||
|
f"{action_field}.rows must be an inclusive range within 0..{len(ingredients) - 1}"
|
||||||
|
)
|
||||||
|
action_rows = set(range(start_row, end_row + 1))
|
||||||
|
if occupied_rows.intersection(action_rows):
|
||||||
|
raise RecipeDiagramInputError(
|
||||||
|
f"{action_field}.rows overlaps another action in column {column_index}"
|
||||||
|
)
|
||||||
|
occupied_rows.update(action_rows)
|
||||||
|
actions.append(
|
||||||
|
RecipeAction(
|
||||||
|
start_row=start_row,
|
||||||
|
end_row=end_row,
|
||||||
|
label=require_recipe_string(action_value.get("label"), f"{action_field}.label"),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
columns.append(tuple(sorted(actions, key=lambda action: action.start_row)))
|
||||||
|
|
||||||
|
return RecipeDiagram(
|
||||||
|
title=title,
|
||||||
|
recipe_yield=recipe_yield,
|
||||||
|
setup=setup,
|
||||||
|
ingredients=ingredients,
|
||||||
|
columns=tuple(columns),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_column_widths(total_width: int, process_column_count: int) -> tuple[int, ...]:
|
||||||
|
"""Allocate one ingredient width and equal process widths within total output width."""
|
||||||
|
|
||||||
|
table_column_count = process_column_count + 1
|
||||||
|
content_width = total_width - table_column_count - 1
|
||||||
|
minimum_ingredient_width = 24
|
||||||
|
minimum_process_width = 10
|
||||||
|
minimum_content_width = minimum_ingredient_width + minimum_process_width * process_column_count
|
||||||
|
if content_width < minimum_content_width:
|
||||||
|
minimum_total_width = minimum_content_width + table_column_count + 1
|
||||||
|
raise RecipeDiagramInputError(
|
||||||
|
f"diagram width {total_width} is too narrow; use --width {minimum_total_width} or greater"
|
||||||
|
)
|
||||||
|
|
||||||
|
ingredient_width = min(44, max(minimum_ingredient_width, int(content_width * 0.38)))
|
||||||
|
remaining_width = content_width - ingredient_width
|
||||||
|
process_width, extra_width = divmod(remaining_width, process_column_count)
|
||||||
|
widths = [ingredient_width]
|
||||||
|
widths.extend(
|
||||||
|
process_width + (1 if index < extra_width else 0)
|
||||||
|
for index in range(process_column_count)
|
||||||
|
)
|
||||||
|
return tuple(widths)
|
||||||
|
|
||||||
|
|
||||||
|
def wrap_recipe_label(label: str, width: int) -> tuple[str, ...]:
|
||||||
|
"""Wrap one ASCII label without breaking words unless a word exceeds the cell width."""
|
||||||
|
|
||||||
|
wrapped = textwrap.wrap(
|
||||||
|
label,
|
||||||
|
width=width,
|
||||||
|
break_long_words=True,
|
||||||
|
break_on_hyphens=False,
|
||||||
|
replace_whitespace=True,
|
||||||
|
drop_whitespace=True,
|
||||||
|
)
|
||||||
|
return tuple(wrapped or [""])
|
||||||
|
|
||||||
|
|
||||||
|
def build_recipe_layout(diagram: RecipeDiagram, total_width: int) -> RecipeDiagramLayout:
|
||||||
|
"""Compute wrapped cell content and enough row height for every merged action."""
|
||||||
|
|
||||||
|
column_widths = calculate_column_widths(total_width, len(diagram.columns))
|
||||||
|
ingredient_lines = tuple(
|
||||||
|
wrap_recipe_label(ingredient, column_widths[0]) for ingredient in diagram.ingredients
|
||||||
|
)
|
||||||
|
row_heights = [len(lines) for lines in ingredient_lines]
|
||||||
|
|
||||||
|
action_lines: list[dict[RecipeAction, tuple[str, ...]]] = []
|
||||||
|
for column_index, actions in enumerate(diagram.columns):
|
||||||
|
process_width = column_widths[column_index + 1]
|
||||||
|
wrapped_actions: dict[RecipeAction, tuple[str, ...]] = {}
|
||||||
|
for action in actions:
|
||||||
|
lines = wrap_recipe_label(action.label, process_width)
|
||||||
|
wrapped_actions[action] = lines
|
||||||
|
available_height = sum(row_heights[action.start_row : action.end_row + 1])
|
||||||
|
if len(lines) > available_height:
|
||||||
|
row_heights[action.end_row] += len(lines) - available_height
|
||||||
|
action_lines.append(wrapped_actions)
|
||||||
|
|
||||||
|
return RecipeDiagramLayout(
|
||||||
|
column_widths=column_widths,
|
||||||
|
row_heights=tuple(row_heights),
|
||||||
|
ingredient_lines=ingredient_lines,
|
||||||
|
action_lines=tuple(action_lines),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def find_row_action(actions: tuple[RecipeAction, ...], row_index: int) -> RecipeAction | None:
|
||||||
|
"""Find the merged action occupying one process-column row, if present."""
|
||||||
|
|
||||||
|
for action in actions:
|
||||||
|
if action.start_row <= row_index <= action.end_row:
|
||||||
|
return action
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def center_cell_text(text: str, width: int) -> str:
|
||||||
|
"""Center text in one fixed-width ASCII table cell."""
|
||||||
|
|
||||||
|
return text.center(width)
|
||||||
|
|
||||||
|
|
||||||
|
def render_horizontal_border(widths: tuple[int, ...], fill: str = "-") -> str:
|
||||||
|
"""Render a full table border using one ASCII fill character."""
|
||||||
|
|
||||||
|
return "+" + "+".join(fill * width for width in widths) + "+"
|
||||||
|
|
||||||
|
|
||||||
|
def render_merged_separator(
|
||||||
|
diagram: RecipeDiagram,
|
||||||
|
layout: RecipeDiagramLayout,
|
||||||
|
boundary_row: int,
|
||||||
|
) -> str:
|
||||||
|
"""Render a row boundary while leaving active row-spanning action cells open."""
|
||||||
|
|
||||||
|
segments = ["-" * layout.column_widths[0]]
|
||||||
|
for column_index, actions in enumerate(diagram.columns):
|
||||||
|
spanning_boundary = any(
|
||||||
|
action.start_row < boundary_row <= action.end_row for action in actions
|
||||||
|
)
|
||||||
|
fill = " " if spanning_boundary else "-"
|
||||||
|
segments.append(fill * layout.column_widths[column_index + 1])
|
||||||
|
return "+" + "+".join(segments) + "+"
|
||||||
|
|
||||||
|
|
||||||
|
def action_line_for_row(
|
||||||
|
action: RecipeAction,
|
||||||
|
wrapped_lines: tuple[str, ...],
|
||||||
|
row_index: int,
|
||||||
|
line_index: int,
|
||||||
|
row_heights: tuple[int, ...],
|
||||||
|
) -> str:
|
||||||
|
"""Place a merged action label at the vertical center of its complete row range."""
|
||||||
|
|
||||||
|
total_height = sum(row_heights[action.start_row : action.end_row + 1])
|
||||||
|
top_padding = (total_height - len(wrapped_lines)) // 2
|
||||||
|
lines_before_row = sum(row_heights[action.start_row:row_index])
|
||||||
|
merged_line_index = lines_before_row + line_index
|
||||||
|
label_line_index = merged_line_index - top_padding
|
||||||
|
if 0 <= label_line_index < len(wrapped_lines):
|
||||||
|
return wrapped_lines[label_line_index]
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def render_recipe_diagram(diagram: RecipeDiagram, total_width: int) -> str:
|
||||||
|
"""Render and internally verify one complete aligned ASCII recipe diagram."""
|
||||||
|
|
||||||
|
layout = build_recipe_layout(diagram, total_width)
|
||||||
|
widths = layout.column_widths
|
||||||
|
lines: list[str] = []
|
||||||
|
|
||||||
|
title = diagram.title
|
||||||
|
if diagram.recipe_yield:
|
||||||
|
title = f"{title} ({diagram.recipe_yield})"
|
||||||
|
title_lines = wrap_recipe_label(title, total_width - 2)
|
||||||
|
|
||||||
|
lines.append(render_horizontal_border(widths))
|
||||||
|
for title_line in title_lines:
|
||||||
|
lines.append("|" + center_cell_text(title_line, total_width - 2) + "|")
|
||||||
|
lines.append(render_horizontal_border(widths))
|
||||||
|
|
||||||
|
for setup_line in diagram.setup:
|
||||||
|
for wrapped_setup_line in wrap_recipe_label(setup_line, total_width - 2):
|
||||||
|
lines.append("|" + center_cell_text(wrapped_setup_line, total_width - 2) + "|")
|
||||||
|
lines.append(render_horizontal_border(widths))
|
||||||
|
|
||||||
|
for row_index in range(len(diagram.ingredients)):
|
||||||
|
ingredient_row_lines = layout.ingredient_lines[row_index]
|
||||||
|
for line_index in range(layout.row_heights[row_index]):
|
||||||
|
ingredient_text = (
|
||||||
|
ingredient_row_lines[line_index]
|
||||||
|
if line_index < len(ingredient_row_lines)
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
cells = [ingredient_text.ljust(widths[0])]
|
||||||
|
for column_index, actions in enumerate(diagram.columns):
|
||||||
|
action = find_row_action(actions, row_index)
|
||||||
|
action_text = ""
|
||||||
|
if action is not None:
|
||||||
|
action_text = action_line_for_row(
|
||||||
|
action,
|
||||||
|
layout.action_lines[column_index][action],
|
||||||
|
row_index,
|
||||||
|
line_index,
|
||||||
|
layout.row_heights,
|
||||||
|
)
|
||||||
|
cells.append(center_cell_text(action_text, widths[column_index + 1]))
|
||||||
|
lines.append("|" + "|".join(cells) + "|")
|
||||||
|
|
||||||
|
if row_index < len(diagram.ingredients) - 1:
|
||||||
|
lines.append(render_merged_separator(diagram, layout, row_index + 1))
|
||||||
|
|
||||||
|
lines.append(render_horizontal_border(widths))
|
||||||
|
validate_rendered_diagram(lines, total_width)
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_rendered_diagram(lines: list[str], expected_width: int) -> None:
|
||||||
|
"""Reject renderer output containing non-ASCII characters or misaligned lines."""
|
||||||
|
|
||||||
|
for line_number, line in enumerate(lines, start=1):
|
||||||
|
if len(line) != expected_width:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Recipe diagram renderer error: line {line_number} has width {len(line)}, expected {expected_width}"
|
||||||
|
)
|
||||||
|
if not line.isascii():
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Recipe diagram renderer error: line {line_number} contains a non-ASCII character"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def load_recipe_document(input_path: Path) -> Any:
|
||||||
|
"""Load recipe diagram JSON from a named file or standard input."""
|
||||||
|
|
||||||
|
try:
|
||||||
|
if str(input_path) == "-":
|
||||||
|
return json.load(sys.stdin)
|
||||||
|
with input_path.open("r", encoding="utf-8") as input_file:
|
||||||
|
return json.load(input_file)
|
||||||
|
except (OSError, json.JSONDecodeError) as error:
|
||||||
|
raise RecipeDiagramInputError(f"cannot read {input_path}: {error}") from error
|
||||||
|
|
||||||
|
|
||||||
|
def parse_command_line() -> argparse.Namespace:
|
||||||
|
"""Parse the recipe diagram renderer command-line arguments."""
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Render recipe dependency JSON as an aligned ASCII process-flow table."
|
||||||
|
)
|
||||||
|
parser.add_argument("input", type=Path, help="JSON input file, or - for standard input")
|
||||||
|
parser.add_argument(
|
||||||
|
"--width",
|
||||||
|
type=int,
|
||||||
|
default=120,
|
||||||
|
help="exact output width in ASCII characters (default: 120)",
|
||||||
|
)
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
"""Run the recipe diagram ASCII renderer command-line program."""
|
||||||
|
|
||||||
|
arguments = parse_command_line()
|
||||||
|
try:
|
||||||
|
document = load_recipe_document(arguments.input)
|
||||||
|
diagram = parse_recipe_diagram(document)
|
||||||
|
print(render_recipe_diagram(diagram, arguments.width))
|
||||||
|
except RecipeDiagramInputError as error:
|
||||||
|
print(f"Recipe diagram input error: {error}", file=sys.stderr)
|
||||||
|
return 2
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1,390 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Render recipe dependency JSON as a high-resolution PNG table."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import html
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import textwrap
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from render_recipe_diagram import (
|
||||||
|
RecipeAction,
|
||||||
|
RecipeDiagram,
|
||||||
|
RecipeDiagramInputError,
|
||||||
|
ascii_recipe_text,
|
||||||
|
load_recipe_document,
|
||||||
|
parse_recipe_diagram,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class PngLayout:
|
||||||
|
width: int
|
||||||
|
height: int
|
||||||
|
margin: int
|
||||||
|
table_x: int
|
||||||
|
table_width: int
|
||||||
|
column_widths: tuple[int, ...]
|
||||||
|
title_height: int
|
||||||
|
setup_heights: tuple[int, ...]
|
||||||
|
row_heights: tuple[int, ...]
|
||||||
|
ingredient_lines: tuple[tuple[str, ...], ...]
|
||||||
|
setup_lines: tuple[tuple[str, ...], ...]
|
||||||
|
action_lines: tuple[dict[RecipeAction, tuple[str, ...]], ...]
|
||||||
|
font_size: int
|
||||||
|
title_font_size: int
|
||||||
|
line_height: int
|
||||||
|
padding: int
|
||||||
|
|
||||||
|
|
||||||
|
def wrap_for_pixels(text: str, pixel_width: int, font_size: int, padding: int) -> tuple[str, ...]:
|
||||||
|
"""Wrap monospaced text using a conservative character-width estimate."""
|
||||||
|
|
||||||
|
usable_width = max(1, pixel_width - 2 * padding)
|
||||||
|
character_width = font_size * 0.62
|
||||||
|
character_count = max(1, int(usable_width / character_width))
|
||||||
|
lines = textwrap.wrap(
|
||||||
|
ascii_recipe_text(text),
|
||||||
|
width=character_count,
|
||||||
|
break_long_words=True,
|
||||||
|
break_on_hyphens=False,
|
||||||
|
replace_whitespace=True,
|
||||||
|
drop_whitespace=True,
|
||||||
|
)
|
||||||
|
return tuple(lines or [""])
|
||||||
|
|
||||||
|
|
||||||
|
def build_png_layout(diagram: RecipeDiagram, width: int) -> PngLayout:
|
||||||
|
"""Calculate a high-density table layout with readable wrapped text."""
|
||||||
|
|
||||||
|
if width < 1920:
|
||||||
|
raise RecipeDiagramInputError("PNG width must be at least 1920 pixels")
|
||||||
|
|
||||||
|
scale = width / 3840
|
||||||
|
margin = round(72 * scale)
|
||||||
|
padding = max(12, round(18 * scale))
|
||||||
|
font_size = max(20, round(34 * scale))
|
||||||
|
title_font_size = max(30, round(50 * scale))
|
||||||
|
line_height = max(29, round(47 * scale))
|
||||||
|
|
||||||
|
table_width = width - 2 * margin
|
||||||
|
process_count = len(diagram.columns)
|
||||||
|
ingredient_width = round(table_width * (0.24 if process_count >= 6 else 0.30))
|
||||||
|
remaining_width = table_width - ingredient_width
|
||||||
|
process_width, extra = divmod(remaining_width, process_count)
|
||||||
|
column_widths = (ingredient_width,) + tuple(
|
||||||
|
process_width + (1 if index < extra else 0) for index in range(process_count)
|
||||||
|
)
|
||||||
|
|
||||||
|
ingredient_lines = tuple(
|
||||||
|
wrap_for_pixels(ingredient, ingredient_width, font_size, padding)
|
||||||
|
for ingredient in diagram.ingredients
|
||||||
|
)
|
||||||
|
minimum_row_height = max(round(62 * scale), line_height + 2 * padding)
|
||||||
|
row_heights = [
|
||||||
|
max(minimum_row_height, len(lines) * line_height + 2 * padding)
|
||||||
|
for lines in ingredient_lines
|
||||||
|
]
|
||||||
|
|
||||||
|
action_lines: list[dict[RecipeAction, tuple[str, ...]]] = []
|
||||||
|
for column_index, actions in enumerate(diagram.columns):
|
||||||
|
wrapped_actions: dict[RecipeAction, tuple[str, ...]] = {}
|
||||||
|
cell_width = column_widths[column_index + 1]
|
||||||
|
for action in actions:
|
||||||
|
lines = wrap_for_pixels(action.label, cell_width, font_size, padding)
|
||||||
|
wrapped_actions[action] = lines
|
||||||
|
required_height = len(lines) * line_height + 2 * padding
|
||||||
|
available_height = sum(row_heights[action.start_row : action.end_row + 1])
|
||||||
|
if required_height > available_height:
|
||||||
|
row_heights[action.end_row] += required_height - available_height
|
||||||
|
action_lines.append(wrapped_actions)
|
||||||
|
|
||||||
|
setup_lines = tuple(
|
||||||
|
wrap_for_pixels(item, table_width, font_size, padding) for item in diagram.setup
|
||||||
|
)
|
||||||
|
setup_heights = tuple(len(lines) * line_height + 2 * padding for lines in setup_lines)
|
||||||
|
title_height = max(round(104 * scale), title_font_size + 2 * padding)
|
||||||
|
height = 2 * margin + title_height + sum(setup_heights) + sum(row_heights)
|
||||||
|
|
||||||
|
return PngLayout(
|
||||||
|
width=width,
|
||||||
|
height=height,
|
||||||
|
margin=margin,
|
||||||
|
table_x=margin,
|
||||||
|
table_width=table_width,
|
||||||
|
column_widths=column_widths,
|
||||||
|
title_height=title_height,
|
||||||
|
setup_heights=setup_heights,
|
||||||
|
row_heights=tuple(row_heights),
|
||||||
|
ingredient_lines=ingredient_lines,
|
||||||
|
setup_lines=setup_lines,
|
||||||
|
action_lines=tuple(action_lines),
|
||||||
|
font_size=font_size,
|
||||||
|
title_font_size=title_font_size,
|
||||||
|
line_height=line_height,
|
||||||
|
padding=padding,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def svg_text_lines(
|
||||||
|
lines: tuple[str, ...],
|
||||||
|
x: float,
|
||||||
|
center_y: float,
|
||||||
|
font_size: int,
|
||||||
|
line_height: int,
|
||||||
|
anchor: str,
|
||||||
|
weight: int = 500,
|
||||||
|
color: str = "#303446",
|
||||||
|
) -> str:
|
||||||
|
"""Create vertically centered SVG text elements for wrapped lines."""
|
||||||
|
|
||||||
|
first_baseline = center_y - ((len(lines) - 1) * line_height) / 2 + font_size * 0.35
|
||||||
|
escaped_anchor = html.escape(anchor, quote=True)
|
||||||
|
elements = []
|
||||||
|
for index, line in enumerate(lines):
|
||||||
|
elements.append(
|
||||||
|
f'<text x="{x:.1f}" y="{first_baseline + index * line_height:.1f}" '
|
||||||
|
f'text-anchor="{escaped_anchor}" font-size="{font_size}" font-weight="{weight}" '
|
||||||
|
f'fill="{color}">{html.escape(line)}</text>'
|
||||||
|
)
|
||||||
|
return "\n".join(elements)
|
||||||
|
|
||||||
|
|
||||||
|
def action_spans_boundary(actions: tuple[RecipeAction, ...], boundary_row: int) -> bool:
|
||||||
|
return any(action.start_row < boundary_row <= action.end_row for action in actions)
|
||||||
|
|
||||||
|
|
||||||
|
def render_svg(diagram: RecipeDiagram, layout: PngLayout) -> str:
|
||||||
|
"""Render the table as SVG so rasterization retains crisp geometry and text."""
|
||||||
|
|
||||||
|
scale = layout.width / 3840
|
||||||
|
border = max(2, round(3 * scale))
|
||||||
|
outer_border = max(6, round(10 * scale))
|
||||||
|
radius = max(8, round(14 * scale))
|
||||||
|
x_positions = [layout.table_x]
|
||||||
|
for cell_width in layout.column_widths:
|
||||||
|
x_positions.append(x_positions[-1] + cell_width)
|
||||||
|
|
||||||
|
parts = [
|
||||||
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
||||||
|
f'<svg xmlns="http://www.w3.org/2000/svg" width="{layout.width}" height="{layout.height}" '
|
||||||
|
f'viewBox="0 0 {layout.width} {layout.height}">',
|
||||||
|
"<style>",
|
||||||
|
"text { font-family: monospace; }",
|
||||||
|
".rule { stroke: #51576d; stroke-linecap: square; shape-rendering: geometricPrecision; }",
|
||||||
|
"</style>",
|
||||||
|
f'<rect width="{layout.width}" height="{layout.height}" fill="#f7f7fb"/>',
|
||||||
|
f'<rect x="{layout.table_x}" y="{layout.margin}" width="{layout.table_width}" '
|
||||||
|
f'height="{layout.height - 2 * layout.margin}" rx="{radius}" fill="#ffffff" stroke="#51576d" stroke-width="{border}"/>',
|
||||||
|
]
|
||||||
|
|
||||||
|
y = layout.margin
|
||||||
|
title = diagram.title
|
||||||
|
if diagram.recipe_yield:
|
||||||
|
title = f"{title} ({diagram.recipe_yield})"
|
||||||
|
parts.append(
|
||||||
|
f'<path d="M {layout.table_x + radius} {y} H {layout.table_x + layout.table_width - radius} '
|
||||||
|
f'Q {layout.table_x + layout.table_width} {y} {layout.table_x + layout.table_width} {y + radius} '
|
||||||
|
f'V {y + layout.title_height} H {layout.table_x} V {y + radius} '
|
||||||
|
f'Q {layout.table_x} {y} {layout.table_x + radius} {y} Z" fill="#303446"/>'
|
||||||
|
)
|
||||||
|
title_lines = wrap_for_pixels(title, layout.table_width, layout.title_font_size, layout.padding)
|
||||||
|
parts.append(
|
||||||
|
svg_text_lines(
|
||||||
|
title_lines,
|
||||||
|
layout.table_x + layout.table_width / 2,
|
||||||
|
y + layout.title_height / 2,
|
||||||
|
layout.title_font_size,
|
||||||
|
round(layout.title_font_size * 1.3),
|
||||||
|
"middle",
|
||||||
|
weight=700,
|
||||||
|
color="#ffffff",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
y += layout.title_height
|
||||||
|
parts.append(
|
||||||
|
f'<line class="rule" x1="{layout.table_x}" y1="{y}" x2="{layout.table_x + layout.table_width}" y2="{y}" stroke-width="{border}"/>'
|
||||||
|
)
|
||||||
|
|
||||||
|
for lines, setup_height in zip(layout.setup_lines, layout.setup_heights, strict=True):
|
||||||
|
parts.append(
|
||||||
|
f'<rect x="{layout.table_x}" y="{y}" width="{layout.table_width}" height="{setup_height}" fill="#e9eaf2"/>'
|
||||||
|
)
|
||||||
|
parts.append(
|
||||||
|
svg_text_lines(
|
||||||
|
lines,
|
||||||
|
layout.table_x + layout.table_width / 2,
|
||||||
|
y + setup_height / 2,
|
||||||
|
layout.font_size,
|
||||||
|
layout.line_height,
|
||||||
|
"middle",
|
||||||
|
weight=600,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
y += setup_height
|
||||||
|
parts.append(
|
||||||
|
f'<line class="rule" x1="{layout.table_x}" y1="{y}" x2="{layout.table_x + layout.table_width}" y2="{y}" stroke-width="{border}"/>'
|
||||||
|
)
|
||||||
|
|
||||||
|
body_y = y
|
||||||
|
row_tops = [body_y]
|
||||||
|
for row_height in layout.row_heights:
|
||||||
|
row_tops.append(row_tops[-1] + row_height)
|
||||||
|
|
||||||
|
for row_index, row_height in enumerate(layout.row_heights):
|
||||||
|
fill = "#fbfbfd" if row_index % 2 == 0 else "#f4f5f9"
|
||||||
|
parts.append(
|
||||||
|
f'<rect x="{x_positions[0]}" y="{row_tops[row_index]}" width="{layout.column_widths[0]}" height="{row_height}" fill="{fill}"/>'
|
||||||
|
)
|
||||||
|
|
||||||
|
for column_index, actions in enumerate(diagram.columns):
|
||||||
|
for action in actions:
|
||||||
|
action_y = row_tops[action.start_row]
|
||||||
|
action_height = row_tops[action.end_row + 1] - action_y
|
||||||
|
parts.append(
|
||||||
|
f'<rect x="{x_positions[column_index + 1]}" y="{action_y}" '
|
||||||
|
f'width="{layout.column_widths[column_index + 1]}" height="{action_height}" fill="#f0eef8"/>'
|
||||||
|
)
|
||||||
|
|
||||||
|
for x in x_positions[1:-1]:
|
||||||
|
parts.append(
|
||||||
|
f'<line class="rule" x1="{x}" y1="{body_y}" x2="{x}" y2="{row_tops[-1]}" stroke-width="{border}"/>'
|
||||||
|
)
|
||||||
|
|
||||||
|
for boundary_row in range(1, len(diagram.ingredients)):
|
||||||
|
boundary_y = row_tops[boundary_row]
|
||||||
|
parts.append(
|
||||||
|
f'<line class="rule" x1="{x_positions[0]}" y1="{boundary_y}" x2="{x_positions[1]}" y2="{boundary_y}" stroke-width="{border}"/>'
|
||||||
|
)
|
||||||
|
for column_index, actions in enumerate(diagram.columns):
|
||||||
|
if not action_spans_boundary(actions, boundary_row):
|
||||||
|
parts.append(
|
||||||
|
f'<line class="rule" x1="{x_positions[column_index + 1]}" y1="{boundary_y}" '
|
||||||
|
f'x2="{x_positions[column_index + 2]}" y2="{boundary_y}" stroke-width="{border}"/>'
|
||||||
|
)
|
||||||
|
|
||||||
|
for row_index, lines in enumerate(layout.ingredient_lines):
|
||||||
|
parts.append(
|
||||||
|
svg_text_lines(
|
||||||
|
lines,
|
||||||
|
x_positions[0] + layout.padding,
|
||||||
|
(row_tops[row_index] + row_tops[row_index + 1]) / 2,
|
||||||
|
layout.font_size,
|
||||||
|
layout.line_height,
|
||||||
|
"start",
|
||||||
|
weight=600,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for column_index, actions in enumerate(diagram.columns):
|
||||||
|
for action in actions:
|
||||||
|
parts.append(
|
||||||
|
svg_text_lines(
|
||||||
|
layout.action_lines[column_index][action],
|
||||||
|
(x_positions[column_index + 1] + x_positions[column_index + 2]) / 2,
|
||||||
|
(row_tops[action.start_row] + row_tops[action.end_row + 1]) / 2,
|
||||||
|
layout.font_size,
|
||||||
|
layout.line_height,
|
||||||
|
"middle",
|
||||||
|
weight=500,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
table_bottom = layout.height - layout.margin
|
||||||
|
table_right = layout.table_x + layout.table_width
|
||||||
|
parts.extend(
|
||||||
|
[
|
||||||
|
f'<rect x="{layout.table_x}" y="{layout.margin}" width="{layout.table_width}" height="{outer_border}" fill="#303446"/>',
|
||||||
|
f'<rect x="{layout.table_x}" y="{table_bottom - outer_border}" width="{layout.table_width}" height="{outer_border}" fill="#303446"/>',
|
||||||
|
f'<rect x="{layout.table_x}" y="{layout.margin}" width="{outer_border}" height="{table_bottom - layout.margin}" fill="#303446"/>',
|
||||||
|
f'<rect x="{table_right - outer_border}" y="{layout.margin}" width="{outer_border}" height="{table_bottom - layout.margin}" fill="#303446"/>',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
parts.append("</svg>")
|
||||||
|
return "\n".join(parts)
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_monospace_font() -> Path:
|
||||||
|
"""Find a crisp local monospace font for ImageMagick's SVG renderer."""
|
||||||
|
|
||||||
|
configured_font = os.environ.get("RECIPE_DIAGRAM_FONT")
|
||||||
|
candidates = [
|
||||||
|
configured_font,
|
||||||
|
"/System/Library/Fonts/SFNSMono.ttf",
|
||||||
|
"/System/Library/Fonts/Menlo.ttc",
|
||||||
|
"/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf",
|
||||||
|
"/usr/share/fonts/truetype/liberation2/LiberationMono-Regular.ttf",
|
||||||
|
]
|
||||||
|
for candidate in candidates:
|
||||||
|
if candidate and Path(candidate).is_file():
|
||||||
|
return Path(candidate)
|
||||||
|
raise RecipeDiagramInputError(
|
||||||
|
"no monospace font found; set RECIPE_DIAGRAM_FONT to a .ttf or .ttc file"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def rasterize_svg(svg: str, output_path: Path) -> None:
|
||||||
|
"""Rasterize SVG to PNG with ImageMagick."""
|
||||||
|
|
||||||
|
magick = shutil.which("magick")
|
||||||
|
if magick is None:
|
||||||
|
raise RecipeDiagramInputError("ImageMagick is required; install the `imagemagick` package")
|
||||||
|
font_path = resolve_monospace_font()
|
||||||
|
|
||||||
|
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with tempfile.NamedTemporaryFile("w", suffix=".svg", encoding="utf-8", delete=False) as svg_file:
|
||||||
|
svg_file.write(svg)
|
||||||
|
svg_path = Path(svg_file.name)
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
[
|
||||||
|
magick,
|
||||||
|
"-font",
|
||||||
|
str(font_path),
|
||||||
|
str(svg_path),
|
||||||
|
"-strip",
|
||||||
|
"-define",
|
||||||
|
"png:color-type=6",
|
||||||
|
str(output_path),
|
||||||
|
],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
if result.returncode != 0:
|
||||||
|
message = result.stderr.strip() or result.stdout.strip() or "unknown ImageMagick error"
|
||||||
|
raise RecipeDiagramInputError(f"cannot rasterize PNG: {message}")
|
||||||
|
finally:
|
||||||
|
svg_path.unlink(missing_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_command_line() -> argparse.Namespace:
|
||||||
|
parser = argparse.ArgumentParser(description="Render recipe dependency JSON as a high-resolution PNG")
|
||||||
|
parser.add_argument("input", type=Path, help="JSON input file")
|
||||||
|
parser.add_argument("output", type=Path, help="PNG output path")
|
||||||
|
parser.add_argument("--width", type=int, default=3840, help="PNG width in pixels (default: 3840)")
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
arguments = parse_command_line()
|
||||||
|
try:
|
||||||
|
diagram = parse_recipe_diagram(load_recipe_document(arguments.input))
|
||||||
|
layout = build_png_layout(diagram, arguments.width)
|
||||||
|
rasterize_svg(render_svg(diagram, layout), arguments.output)
|
||||||
|
print(f"Rendered {arguments.output} ({layout.width}x{layout.height})")
|
||||||
|
except RecipeDiagramInputError as error:
|
||||||
|
print(f"Recipe diagram PNG input error: {error}", file=sys.stderr)
|
||||||
|
return 2
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
name: research
|
||||||
|
description: Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.
|
||||||
|
---
|
||||||
|
|
||||||
|
Spin up a **background agent** to do the research, so you keep working while it reads.
|
||||||
|
|
||||||
|
Its job:
|
||||||
|
|
||||||
|
1. Investigate the question against **primary sources** (official docs, source code, specs, first-party APIs), not a secondary write-up of them. Follow every claim back to the source that owns it.
|
||||||
|
2. Write the findings to a single Markdown file, citing each claim's source.
|
||||||
|
3. Save it where the repo already keeps such notes; match the existing convention, and if there is none, put it somewhere sensible and say where.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Research"
|
||||||
|
short_description: "Research from high-trust sources"
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
name: resolving-merge-conflicts
|
||||||
|
description: "Use when you need to resolve an in-progress git merge/rebase conflict."
|
||||||
|
---
|
||||||
|
|
||||||
|
1. **See the current state** of the merge/rebase. Check git history, and the conflicting files.
|
||||||
|
|
||||||
|
2. **Find the primary sources** for each conflict. Understand deeply why each change was made, and what the original intent was. Read the commit messages, check the PRs, check original issues/tickets.
|
||||||
|
|
||||||
|
3. **Resolve each hunk.** Preserve both intents where possible. Where incompatible, pick the one matching the merge's stated goal and note the trade-off. Do **not** invent new behaviour. Always resolve; never `--abort`.
|
||||||
|
|
||||||
|
4. Discover the project's **automated checks** and run them, typically typecheck, then tests, then format. Fix anything the merge broke.
|
||||||
|
|
||||||
|
5. **Finish the merge/rebase.** Stage everything and commit. If rebasing, continue the rebase process until all commits are rebased.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Resolving Merge Conflicts"
|
||||||
|
short_description: "Resolve merge and rebase conflicts"
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
name: security-audit
|
||||||
|
description: Comprehensive security and correctness audit of a branch's changes. Use for deep review requests, or branch/PR diff audits focused on bugs, breaking changes, security issues, devex regressions, and feature-gate leaks.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Security Audit Skill
|
||||||
|
|
||||||
|
Use this skill for a comprehensive security and correctness audit of a checked-out branch.
|
||||||
|
|
||||||
|
## Prompt
|
||||||
|
|
||||||
|
You are a security expert performing a comprehensive review of a checked out branch. Audit this branch and its changes extremely thoroughly for bugs, changes that break existing features/functionality, and security vulnerabilities. Be EXTREMELY thorough, rigorous, careful, ambitious, and attentive. NOTHING can slip through.
|
||||||
|
|
||||||
|
# Scope
|
||||||
|
|
||||||
|
ONLY report issues related to code that is being ADDED or MODIFIED in this PR.
|
||||||
|
Focus on changes in the diff.
|
||||||
|
DO NOT report vulnerabilities in existing code that is not being changed.
|
||||||
|
|
||||||
|
# Guidelines
|
||||||
|
|
||||||
|
## Breaking Functionality Guidelines
|
||||||
|
This is a complex codebase, with many cross-package/module dependencies. Often simple code changes in one place have subtle interactions that break functionality elsewhere. You MUST be extremely thorough in tracing through possible side effects of the changes.
|
||||||
|
|
||||||
|
## Breaking Devex Guidelines
|
||||||
|
It can be easy to break developers' ability to run / build the code locally. You MUST catch changes that will impact users' developer experience. Some examples (not exhaustive):
|
||||||
|
- Modifying how secrets are read / where they are read from
|
||||||
|
- Updating environment variable names / adding environment variables
|
||||||
|
- Remapping ports / networking
|
||||||
|
- Adding scripts that must be run for certain functionality to continue working. Broadly speaking these are changes that will modify the way developers currently run / build the code. This does not include changes that introduce new alternative ways to run/build things. Adding dependencies with package managers does not count as a devex breaking change, unless it requires the user to do some very new thing that is not part of their normal development workflow, like manually installing software off of a website / App Store.
|
||||||
|
|
||||||
|
## Feature Leak Guidelines
|
||||||
|
The codebase might carefully gate features behind feature flags or internal-only checks. You MUST NOT allow any features that are meant to be behind a feature gate leak. These leaks are often subtle. Be VERY careful and thorough.
|
||||||
|
|
||||||
|
## Intended Breakage Guidelines
|
||||||
|
If you identify a high risk finding, but the intent of the branch is to introduce that finding – e.g. break some functionality, remove a feature flag, remove a safeguard – AND the scope of the change is well constrained, you SHOULD NOT waste the author's time by reporting the issue to them. However, if you believe it is likely that they are not aware of the full implications of their change, or you are worried that they are under-weighting the negative impacts (extreme example: a developer pushes a PR titled "Delete the database"), or you are worried that the change is actually malicious, you should still report the finding.
|
||||||
|
|
||||||
|
## Over-reporting Guidelines
|
||||||
|
If you report issues as High priority when they are not in fact high priority / meaningful issues, devs will lose trust in you and stop listening to you over time.
|
||||||
|
NEVER misreport the priority / importance of issues. Be extremely thorough in tracing issues end-to-end to gain complete, and total confidence before reporting.
|
||||||
|
|
||||||
|
# Final Response
|
||||||
|
IF you have medium-to-high priority / risk findings, and there is a PR for this branch, then check the PR/MR discussion using gh/glab cli to see if there are comments from BugBot or others present.
|
||||||
|
If so, take their findings into account. If they found issues you missed, evaluate them to determine if they are valid and include them in your report. If they found some of the same issues you did, see if there is anything from their findings that are worth incorporating into your response.
|
||||||
|
Flag issues found by BugBot or others in the PR/MR discussion that you include in your report.
|
||||||
|
|
||||||
|
|
||||||
|
# Critical Rules
|
||||||
|
- NEVER present issues with unfinished research. E.g. Never say something like, "The client has issue X, but if handled in the backend then this is ok." if you have access to the backend code and can check for yourself.
|
||||||
|
- You MUST wait to check the PR/MR discussion until AFTER you have performed your audit. This way you have fresh eyes while you review.
|
||||||
|
- Be EXTREMELY thorough, rigorous, careful, ambitious, and attentive. NOTHING can slip through.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Security Audit Skill"
|
||||||
|
short_description: "Audit diffs for security and correctness risks"
|
||||||
|
policy:
|
||||||
|
allow_implicit_invocation: false
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: tdd
|
||||||
|
description: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Test-Driven Development
|
||||||
|
|
||||||
|
TDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.
|
||||||
|
|
||||||
|
When exploring the codebase, read `CONTEXT.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
|
||||||
|
|
||||||
|
## What a good test is
|
||||||
|
|
||||||
|
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: "user can checkout with valid cart" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.
|
||||||
|
|
||||||
|
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
||||||
|
|
||||||
|
## Seams: where tests go
|
||||||
|
|
||||||
|
A **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.
|
||||||
|
|
||||||
|
**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.
|
||||||
|
|
||||||
|
Ask: "What's the public interface, and which seams should we test?"
|
||||||
|
|
||||||
|
When the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with "codebase-design" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.
|
||||||
|
|
||||||
|
## Anti-patterns
|
||||||
|
|
||||||
|
- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
|
||||||
|
- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.
|
||||||
|
- **Horizontal slicing**: writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead: one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.
|
||||||
|
|
||||||
|
## Rules of the loop
|
||||||
|
|
||||||
|
- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
|
||||||
|
- **One slice at a time.** One seam, one test, one minimal implementation per cycle.
|
||||||
|
- **Refactoring is not part of the loop.** It belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "TDD"
|
||||||
|
short_description: "Test-driven red-green-refactor"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user