From 7f686ce8d99a67847c8aa345ce437d0cfe9f1e91 Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Sat, 27 Jun 2026 19:40:44 +0000 Subject: [PATCH] feat(skills): add dev-pr workflow skill --- .../cli/src/__tests__/commands/skill.test.ts | 4 ++ packages/cli/src/constants.ts | 1 + skills/dev-pr/SKILL.md | 46 +++++++++++++++++++ skills/dev-pr/agents/openai.yaml | 4 ++ skills/index.json | 7 +++ web/content/docs/1-getting-started.md | 2 +- web/content/docs/7-skills.md | 2 +- web/lib/skills/built-in.ts | 14 ++++++ 8 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 skills/dev-pr/SKILL.md create mode 100644 skills/dev-pr/agents/openai.yaml diff --git a/packages/cli/src/__tests__/commands/skill.test.ts b/packages/cli/src/__tests__/commands/skill.test.ts index a5dc453b..0c8da5f2 100644 --- a/packages/cli/src/__tests__/commands/skill.test.ts +++ b/packages/cli/src/__tests__/commands/skill.test.ts @@ -107,6 +107,10 @@ describe('skill command', () => { global: undefined, environments: undefined, }); + expect(mockAddSkill).toHaveBeenCalledWith('codeaholicguy/ai-devkit', 'dev-pr', { + global: undefined, + environments: undefined, + }); }); it('exits when skill add has neither registry nor --built-in', async () => { diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts index c8f4736e..8bb34d42 100644 --- a/packages/cli/src/constants.ts +++ b/packages/cli/src/constants.ts @@ -22,6 +22,7 @@ export const BUILTIN_SKILL_NAMES = [ 'dev-implementation', 'dev-testing', 'dev-review', + 'dev-pr', 'structured-debug', 'document-code', 'memory', diff --git a/skills/dev-pr/SKILL.md b/skills/dev-pr/SKILL.md new file mode 100644 index 00000000..3e6930c8 --- /dev/null +++ b/skills/dev-pr/SKILL.md @@ -0,0 +1,46 @@ +--- +name: dev-pr +description: AI DevKit · Publish a ready feature branch for review. Use when the user wants to sync, push, and open or update a code review request on GitHub, GitLab, or another Git host. +--- + +# Dev PR + +Publish an already-reviewed branch for code review. Keep this separate from commit creation: if the branch has uncommitted changes, stop and ask the user to run the commit workflow first. + +## Contract + +1. Verify repository context with `git status -sb`, `git branch --show-current`, and `git remote -v`. +2. Confirm the branch is not the base branch and has committed changes to publish. +3. Fetch the remote before comparing or rebasing. +4. Rebase the feature branch onto the latest remote base branch before push/review. +5. Resolve conflicts carefully, preserving intended behavior, then rerun relevant validation. +6. Push safely. Use `--force-with-lease` only when a rebase rewrote an already-pushed branch. +7. Open or update the host's review request: PR, merge request, or equivalent. +8. Report review URL, branch, HEAD SHA, validation results, push mode, and risks. + +## Publish Workflow + +1. Inspect local context: + - `git status -sb` + - `git branch --show-current` + - `git remote -v` +2. If uncommitted changes exist, stop. Do not stage, amend, squash, or commit in this skill. +3. Identify the remote and base branch from repo conventions, upstream config, or user instruction; default to `origin/main` only when that matches the repo. +4. Fetch the remote, inspect the delta, and rebase onto the remote base branch. +5. If conflicts occur, inspect conflicted files and `git diff`, resolve minimally, validate when useful, `git add`, then continue the rebase. Stop if the correct resolution is unclear. +6. Run relevant validation for the changed surface. +7. Push: + - First push: set upstream. + - Normal update: plain push. + - Rebased already-pushed branch: `--force-with-lease`. +8. Open or update the review request using the host's tool/API/UI (`gh`, `glab`, forge CLI, web UI, or project-specific workflow). +9. Write a concise review description. Include enough for reviewers to understand: + - Summary: what changed, why, and how. + - Validation: how it was verified. + - Risks: notable risks or "none known". +10. Report: + - Review URL and state + - Branch and HEAD SHA + - Validation commands and exit codes + - Push mode, including whether `--force-with-lease` was used + - Risks, follow-ups, or blockers diff --git a/skills/dev-pr/agents/openai.yaml b/skills/dev-pr/agents/openai.yaml new file mode 100644 index 00000000..38b9ebd7 --- /dev/null +++ b/skills/dev-pr/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Dev PR" + short_description: "AI DevKit · Publish a ready branch for code review" + default_prompt: "Use $dev-pr to sync this ready branch, push safely, and open or update the review request." diff --git a/skills/index.json b/skills/index.json index fc4954da..54a5ee37 100644 --- a/skills/index.json +++ b/skills/index.json @@ -759,6 +759,13 @@ "description": "AI DevKit · Final code review phase guidance for holistic pre-push review. Use when the user wants code review, final lifecycle review, design alignment checks, integration risk review, or dev-lifecycle phase 9.", "lastIndexed": 1782001853267 }, + { + "name": "dev-pr", + "registry": "codeaholicguy/ai-devkit", + "path": "skills/dev-pr", + "description": "AI DevKit · Publish a ready feature branch for review. Use when the user wants to sync, push, and open or update a code review request on GitHub, GitLab, or another Git host.", + "lastIndexed": 1782001853267 + }, { "name": "dev-testing", "registry": "codeaholicguy/ai-devkit", diff --git a/web/content/docs/1-getting-started.md b/web/content/docs/1-getting-started.md index 871cbd57..c703b34b 100644 --- a/web/content/docs/1-getting-started.md +++ b/web/content/docs/1-getting-started.md @@ -112,7 +112,7 @@ Terminal commands still start with `ai-devkit`; skills are used by the agent ins | Skill | Purpose | |---------|---------| | `dev-lifecycle` | Orchestrate worktree setup, requirements, design, planning, implementation, testing, and review | -| `dev-worktree`, `dev-requirements`, `dev-design`, `dev-planning`, `dev-implementation`, `dev-testing`, `dev-review` | Run focused lifecycle phases directly | +| `dev-worktree`, `dev-requirements`, `dev-design`, `dev-planning`, `dev-implementation`, `dev-testing`, `dev-review`, `dev-pr` | Run focused lifecycle and publish-for-review phases directly | | `dev-commit` | Commit only intended, verified changes with a conventional message | | `tdd` | Add or change behavior test-first | | `verify` | Require fresh command output before completion claims | diff --git a/web/content/docs/7-skills.md b/web/content/docs/7-skills.md index 25bf0a8c..2c4560b9 100644 --- a/web/content/docs/7-skills.md +++ b/web/content/docs/7-skills.md @@ -29,7 +29,7 @@ AI DevKit ships with a core set of skills in its default registry: | `document-code` | Document code entry points with structured analysis and dependency mapping | | `dev-commit` | Commit only intended, verified changes with a conventional message | | `dev-lifecycle` | Orchestrate the SDLC workflow and route to phase skills | -| `dev-worktree`, `dev-requirements`, `dev-design`, `dev-planning`, `dev-implementation`, `dev-testing`, `dev-review` | Run focused SDLC phases directly | +| `dev-worktree`, `dev-requirements`, `dev-design`, `dev-planning`, `dev-implementation`, `dev-testing`, `dev-review`, `dev-pr` | Run focused SDLC and publish-for-review phases directly | | `structured-debug` | Follow a disciplined debugging and RCA process before implementing fixes | | `memory` | Use AI DevKit memory operations via CLI patterns when needed | | `simplify-implementation` | Simplify and refactor complex code paths for maintainability | diff --git a/web/lib/skills/built-in.ts b/web/lib/skills/built-in.ts index f6ee3a28..d4c992c8 100644 --- a/web/lib/skills/built-in.ts +++ b/web/lib/skills/built-in.ts @@ -289,6 +289,20 @@ export const builtInSkills: BuiltInSkill[] = [ ], relatedAgents: ["Claude Code", "Codex", "Cursor", "opencode"], }, + { + name: "dev-pr", + title: "Dev PR", + category: "Workflow", + summary: "Publish a reviewed feature branch for code review.", + description: + "Use dev-pr after implementation, testing, and final review are complete. It syncs with the remote base branch, handles rebase conflicts carefully, reruns validation, pushes safely, and opens or updates the host review request.", + useCases: [ + "Rebase a ready feature branch before review", + "Push safely after validation", + "Open or update a PR, merge request, or equivalent with clear status and risks", + ], + relatedAgents: ["Claude Code", "Codex", "Cursor", "opencode"], + }, ]; export function getBuiltInSkill(name: string): BuiltInSkill | undefined {