spec-workflow-init
npx skills add https://github.com/anyoneanderson/agent-skills --skill spec-workflow-init
Agent 安装分布
Skill 文档
spec-workflow-init â Development Workflow Generator
Generate a project-specific issue-to-pr-workflow.md through interactive dialogue. The workflow serves as a playbook for spec-implement and development agents.
Language Rules
- Auto-detect input language â output in the same language
- Japanese input â Japanese output, use
references/workflow-template.ja.md - English input â English output, use
references/workflow-template.md - Explicit override takes priority (e.g., “in English”, “æ¥æ¬èªã§”)
Sub-agent template selection (when generating agent definitions):
- English â
references/agents/claude/workflow-*.md - Japanese â
references/agents/claude/workflow-*.ja.md - Codex templates: English â
references/agents/codex/workflow-*.toml, Japanese âreferences/agents/codex/workflow-*.ja.toml
Execution Flow
Step 1: Initial Checks
-
Verify Git repository:
git rev-parse --is-inside-work-tree 2>/dev/nullIf not a Git repo, warn and skip branch detection. Continue with other checks.
-
Check current directory:
pwd ls -la -
Detect existing workflow file:
find . -name "issue-to-pr-workflow.md" -maxdepth 3 2>/dev/nullIf found and
--forceis not set, show the existing file path and proceed to Step 7 (idempotency handling).
Step 2: Environment Detection
Run the following checks to auto-detect the project environment:
Package manager:
ls pnpm-lock.yaml yarn.lock package-lock.json bun.lockb 2>/dev/null
Container usage:
ls docker-compose.yml docker-compose.yaml Dockerfile 2>/dev/null
CI/CD service:
ls -d .github/workflows .gitlab-ci.yml .circleci 2>/dev/null
Branch information:
git branch -r 2>/dev/null | head -10
Language, framework, and scripts:
cat package.json 2>/dev/null | grep -A 50 '"scripts"'
cat package.json 2>/dev/null | grep -A 30 '"dependencies"'
ls go.mod requirements.txt pyproject.toml 2>/dev/null
Database:
ls prisma/schema.prisma 2>/dev/null
grep -l "postgres\|mysql\|mongo" docker-compose.yml 2>/dev/null
Lint tools:
ls .eslintrc* biome.json 2>/dev/null
Coding rules file:
find . -name "coding-rules.md" -maxdepth 3 2>/dev/null
Present the detection results to the user in a summary table:
Detected project environment:
Language/FW: {detected}
Package Manager: {detected}
Container: {detected}
Test: {detected}
CI/CD: {detected}
Branch: {detected}
Database: {detected}
Lint: {detected}
Coding Rules: {detected or "Not found"}
Ask the user to confirm or correct the detection results before proceeding.
Step 3: Interactive Dialogue
Gather workflow configuration through AskUserQuestion rounds.
Round 1: Output Path
question: "Where to save issue-to-pr-workflow.md?" / "issue-to-pr-workflow.md ã®åºåå
ã¯ï¼"
header: "Output"
options:
- "docs/issue-to-pr-workflow.md (Recommended)" / "docs ãã£ã¬ã¯ããªç´ä¸ï¼æ¨å¥¨ï¼"
- "docs/development/issue-to-pr-workflow.md" / "docs/development é
ä¸"
Round 2: Branch Strategy
Q1:
question: "Base branch (PR target)?" / "ãã¼ã¹ãã©ã³ãï¼PRã¿ã¼ã²ããï¼ã¯ï¼"
header: "Branch"
options:
- "develop (Recommended)" / "feature â develop â mainï¼Git Flowï¼"
- "main" / "feature â mainï¼GitHub Flowï¼"
- "trunk" / "Short-lived branches â mainï¼Trunk-basedï¼"
Q2:
question: "Feature branch naming convention?" / "featureãã©ã³ãã®å½åè¦åã¯ï¼"
header: "Naming"
options:
- "feature/{issue}-{slug} (Recommended)" / "e.g. feature/42-add-auth"
- "{issue}-{slug}" / "e.g. 42-add-auth"
- "{type}/{issue}-{slug}" / "e.g. fix/42-login-bug, feat/43-dashboard"
Round 3: Quality Gates
question: "Quality gates before PR creation?" / "PR使åã®å質ã²ã¼ãã¯ï¼"
header: "Gates"
multiSelect: true
options:
- "All tests must pass (Recommended)" / "ãã¹ãå
¨ãã¹ï¼æ¨å¥¨ï¼"
- "Lint and type check must pass" / "Lint / Typecheckãã¹"
- "Coverage threshold" / "ã«ãã¬ãã¸åºæº"
Round 4: Development Style
question: "Select your development style" / "éçºã¹ã¿ã¤ã«ã鏿ãã¦ãã ãã"
header: "Style"
options:
- "Implementation First (Recommended)" / "å®è£
â ã¬ãã¥ã¼ â ãã¹ã â ãã¹ãã¬ãã¥ã¼ â å質ã²ã¼ã â PR"
- "TDD" / "ãã¹ã(RED) â å®è£
(GREEN) â ãªãã¡ã¯ã¿ â ã¬ãã¥ã¼ â å質ã²ã¼ã â PR"
- "BDD" / "E2Eã·ããªãª â ãã¹ã(RED) â å®è£
(GREEN) â ã¬ãã¥ã¼ â å質ã²ã¼ã â PR"
Round 5: E2E Test Level
question: "E2E test scope?" / "E2Eãã¹ãã®ç¯å²ã¯ï¼"
header: "E2E"
options:
- "API level only (Recommended)" / "supertestçã§ãªã¯ã¨ã¹ãâã¬ã¹ãã³ã¹ãæ¤è¨¼"
- "API + Browser E2E" / "ä¸è¨ + Playwrightã§ã¯ãªãã£ã«ã«ãã¹ãæ¤è¨¼"
Round 6: Parallel Execution
question: "Use parallel execution for implementation and tests?" / "å®è£
ã¨ãã¹ãã®ä¸¦åå®è¡ã使ãã¾ããï¼"
header: "Parallel"
options:
- "Sequential (Recommended)" / "ã¡ã¤ã³ã¨ã¼ã¸ã§ã³ããå
¨å·¥ç¨ãé çªã«å®è¡ï¼å®å
¨ã»ã·ã³ãã«ï¼"
- "Parallel" / "å®è£
ã¨ãã¹ãã³ã¼ãçæã並è¡ãã¦å®è¡ï¼é«éã»è¦ã¨ã¼ã¸ã§ã³ãåé¢ï¼"
Round 7: Agent Targets (only if Parallel selected)
Ask which agent definitions to generate. Do NOT decide targets based on .claude/ / .codex/ directory detection.
question: "Which agent definitions should be generated?" / "ã©ã®ã¨ã¼ã¸ã§ã³ãå®ç¾©ãçæãã¾ããï¼"
header: "Agents"
options:
- "Both Claude + Codex (Recommended)" / "Claude 㨠Codex ã®ä¸¡æ¹ãçæ"
- "Claude only" / "Claude ã®ã¿çæ"
- "Codex only" / "Codex ã®ã¿çæ"
- "Skip generation" / "çæããªã"
Additional Questions (project-type specific):
- Docker project: “Run all commands inside Docker?” / “Dockerå ã§å ¨ã³ãã³ããå®è¡ãã¾ããï¼”
- Next.js project: “Include build check in workflow?” / “ãã«ã確èªãã¯ã¼ã¯ããã¼ã«å«ãã¾ããï¼”
Step 4: Workflow Generation
-
Select template based on Language Rules:
- English â
references/workflow-template.md - Japanese â
references/workflow-template.ja.md
- English â
-
Read the template and replace placeholders with collected values:
{package_manager},{container_tool},{database},{test_framework}, etc.{pr_target},{branch_naming},{dev_style}{test_command},{lint_command},{typecheck_command},{build_command}{e2e_test_command},{browser_e2e_command},{coverage_command}{timestamp}â current date/time
-
Select development style sections:
- Implementation First â keep
{if_implementation_first}...{end_implementation_first}, remove TDD/BDD blocks - TDD â keep
{if_tdd}...{end_tdd}, remove others - BDD â keep
{if_bdd}...{end_bdd}, remove others
- Implementation First â keep
-
Handle conditional sections:
- Browser E2E not selected â remove
{if_browser_e2e}...{end_browser_e2e}blocks - Parallel not selected â remove
{if_parallel}...{end_parallel}blocks - If agent targets include Claude â keep
{if_claude_agents}...{end_claude_agents}, otherwise remove - If agent targets include Codex â keep
{if_codex_agents}...{end_codex_agents}, otherwise remove - If agent generation is skipped â keep
{if_no_agent_files}...{end_no_agent_files}, otherwise remove - No typecheck command â remove
{if_typecheck}...{end_typecheck} - No build command â remove
{if_build}...{end_build}
- Browser E2E not selected â remove
-
Clean up remaining placeholders and conditional markers
-
Create output directory if needed:
mkdir -p {output_directory} -
Write the file to the specified output path
Step 5: Idempotency Handling
If an existing workflow file is detected (from Step 1 or during generation):
-
Without
--force: Show a warning with the existing file pathquestion: "Existing workflow found at {path}. Overwrite?" / "æ¢åã®ã¯ã¼ã¯ããã¼ã {path} ã«è¦ã¤ããã¾ããã䏿¸ããã¾ããï¼" header: "Overwrite" options: - "Yes, overwrite" / "ã¯ãã䏿¸ããã" - "No, cancel" / "ãããããã£ã³ã»ã«" -
With
--force: Overwrite without confirmation
Step 6: Sub-Agent Generation
Skip this step if the user did not select parallel execution or selected “Skip generation” in Round 7.
Step 6a: Claude Code agents (when Round 7 selection includes Claude):
-
Select template language based on Language Rules:
- English â
references/agents/claude/workflow-*.md - Japanese â
references/agents/claude/workflow-*.ja.md
- English â
-
Read each template and replace placeholders:
{coding_rules_path}â detected path (e.g.,docs/coding-rules.md){workflow_path}â output path from Step 3 (e.g.,docs/issue-to-pr-workflow.md){test_command},{lint_command},{typecheck_command},{build_command}{e2e_test_command},{browser_e2e_command},{coverage_command}{dev_style}â selected development style{branch_naming}â selected naming convention
-
Create directory and write files:
mkdir -p .claude/agents.claude/agents/workflow-implementer.md.claude/agents/workflow-reviewer.md.claude/agents/workflow-tester.md
-
If files already exist, ask for overwrite confirmation (same as Step 5)
Step 6b: Codex agents (when Round 7 selection includes Codex):
-
Select template language based on Language Rules:
- English â
references/agents/codex/workflow-*.toml - Japanese â
references/agents/codex/workflow-*.ja.toml
- English â
-
Read each TOML template and replace placeholders in
developer_instructions:- Same variables as Claude Code agents
-
Create directory and write files:
mkdir -p .codex/agents.codex/agents/workflow-implementer.toml.codex/agents/workflow-reviewer.toml.codex/agents/workflow-tester.toml
-
Update
.codex/config.toml:- Create file if it doesn’t exist
- Add or update agent sections in config.toml:
[agents.workflow-implementer] config_file = "agents/workflow-implementer.toml" [agents.workflow-reviewer] config_file = "agents/workflow-reviewer.toml" [agents.workflow-tester] config_file = "agents/workflow-tester.toml" - Add
[features] multi_agent = trueif not present
-
If files already exist, ask for overwrite confirmation
Step 7: AGENTS.md / CLAUDE.md Reference Update
-
Check for convention files:
ls AGENTS.md CLAUDE.md 2>/dev/null -
If CLAUDE.md is a symlink to AGENTS.md, update only AGENTS.md:
readlink CLAUDE.md 2>/dev/null -
If at least one file exists, ask for confirmation:
question: "Add workflow reference to AGENTS.md / CLAUDE.md?" / "AGENTS.md / CLAUDE.md ã«ã¯ã¼ã¯ããã¼ã®åç §ã追è¨ãã¾ããï¼" header: "Update" options: - "Yes, add reference (Recommended)" / "ã¯ããåç §ã追è¨ããï¼æ¨å¥¨ï¼" - "No, skip" / "ããããã¹ããã" -
If approved, append the following section (adapt language to match output):
English:
## Development Workflow Follow the development workflow for Issue â Implementation â PR: - [{workflow_path}]({workflow_path}) â Development workflow generated by spec-workflow-initJapanese:
## Development Workflow éçºããã¼ï¼Issue â å®è£ â PRï¼ã¯ä»¥ä¸ã®ãã¡ã¤ã«ã«å¾ã£ã¦ãã ãã: - [{workflow_path}]({workflow_path}) â spec-workflow-init ã§çæãããéçºã¯ã¼ã¯ããã¼ -
If neither file exists, output a warning:
"Warning: Neither AGENTS.md nor CLAUDE.md found. Skipping reference update." / "è¦å: AGENTS.md ã CLAUDE.md ãè¦ã¤ããã¾ãããåç §è¿½è¨ãã¹ããããã¾ãã"
Options
| Option | Description |
|---|---|
--force |
Overwrite existing files without confirmation |
Error Handling
| Error | Detection | Response |
|---|---|---|
| Not a Git repository | git rev-parse fails |
Warn and skip branch detection. Continue with other checks |
| No package.json | ls package.json fails |
Skip package manager / test / lint detection. Gather via dialogue |
| Write permission error | mkdir -p or file write fails |
Show error and re-ask output path via AskUserQuestion |
| Network error (git branch -r) | Command timeout or non-zero exit | Skip remote branches. Use local branches only. Gather via dialogue |
| Existing file conflict | File found at output path | Without --force: show warning and ask to overwrite. With --force: overwrite |
Usage Examples
# Generate workflow with dialogue
"Generate development workflow"
ãéçºã¯ã¼ã¯ããã¼ãçæã
# Generate with force overwrite
"Create workflow --force"
ãã¯ã¼ã¯ããã¼çæ --forceã
# After spec-rules-init
"Now create the development workflow"
ãæ¬¡ã«éçºããã¼ãä½ã£ã¦ã
Post-Completion Actions
After generating the workflow:
question: "Workflow generated. What's next?" / "ã¯ã¼ã¯ããã¼ãçæãã¾ãããæ¬¡ã®ã¢ã¯ã·ã§ã³ã¯ï¼"
options:
- "Run spec-implement" / "spec-implement ãå®è¡ãã"
description: "Start implementing with the generated workflow" / "çæããã¯ã¼ã¯ããã¼ã§å®è£
ãéå§"
- "Review and customize" / "ã¬ãã¥ã¼ãã¦ã«ã¹ã¿ãã¤ãº"
description: "Open the generated file and make adjustments" / "çæããããã¡ã¤ã«ãéãã¦èª¿æ´"
- "Done for now" / "å®äº"
description: "Finish without further action" / "追å ã¢ã¯ã·ã§ã³ãªãã§å®äº"