mcpField
F
flutter-finishing

flutter-finishing

github.com/vp-k开发1437 次安装11 周前更新
代码仓库

关于 flutter-finishing

flutter-finishing 是用于完成 Flutter 开发分支的工作流技能。它先检查静态分析与测试,再提供四种处理选项,并按选择执行合并、创建 PR、保留或丢弃及工作树清理。

主要功能

  1. 01检查 flutter analyze 和 flutter test
  2. 02提供四种分支处理选项
  3. 03执行合并、PR、保留或丢弃
  4. 04丢弃前要求确认
  5. 05按规则清理工作树

适用场景

  1. 01完成前验证 Flutter 分支
  2. 02选择本地合并或创建 PR
  3. 03安全保留分支或丢弃分支

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/vp-k/flutter-craft --skill flutter-finishing

安装后在 Claude Code 中输入/flutter-finishing确认已加载。

详细介绍

完成 Flutter 开发分支

概述

通过提供清晰的选项并执行所选工作流,指导完成 Flutter 开发工作。

核心原则: 验证测试 → 提供选项 → 执行选择 → 清理

开始时宣布:“我正在使用 flutter-finishing skill 来完成这项工作。”

流程

第 1 步:验证测试和分析

提供选项之前,先验证一切都通过:

# Static analysis
flutter analyze
# Expected: No issues found!

# All tests
flutter test
# Expected: All tests passed!

# Build check — required once here, against the project's target platform
# (apk / ios / web / windows / macos / linux). Skip only if the platform
# toolchain is unavailable in this environment, and say so in the report.
flutter build <target> --debug
# Expected: Built successfully

如果测试失败:

Flutter tests failing (N failures). Must fix before completing:

[Show failures]

Cannot proceed with merge/PR until tests pass.

停止。不要继续第 2 步。

**如果测试通过:**继续第 2 步。

第 2 步:确定基准分支
# Find merge base
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null

# Or ask: "This branch split from main - is that correct?"
第 3 步:提供选项

准确提供以下 4 个选项:

Implementation complete. All tests passing. What would you like to do?

1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is (I'll handle it later)
4. Discard this work

Which option?

不要添加说明——保持选项简洁。

第 4 步:执行选择
选项 1:在本地合并
# Switch to base branch
git checkout <base-branch>

# Pull latest
git pull

# Merge feature branch
git merge <feature-branch>

# Verify tests on merged result
flutter analyze
flutter test

# If tests pass, delete feature branch
git branch -d <feature-branch>

**然后:**清理工作树(第 5 步)

选项 2:推送并创建 PR
# Push branch
git push -u origin <feature-branch>

# Create PR
gh pr create --title "<feature-title>" --body "$(cat <<'EOF'
## Summary
- Implemented [feature] following Clean Architecture
- Added [Layer] layer components
- [Test coverage details]

## Test Plan
- [ ] flutter analyze passes
- [ ] flutter test passes
- [ ] Manual testing of [scenarios]

## Flutter Version
- Flutter: X.X.X
- Dart: X.X.X

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

不要清理工作树——可能需要它来修复 PR 审查中发现的问题。

选项 3:保持现状

报告:“保留分支 <name>。工作树保留在 <path>。”

不要清理工作树。

选项 4:丢弃

先确认:

This will permanently delete:
- Branch: <name>
- All commits: <commit-list>
- Worktree at: <path>

Type 'discard' to confirm.

等待收到完全一致的确认。

如果确认:

git checkout <base-branch>
git branch -D <feature-branch>

**然后:**清理工作树(第 5 步)

第 5 步:清理工作树

适用于选项 1、2、4:

检查当前是否位于工作树中:

git worktree list | grep $(git branch --show-current)

如果是:

# Navigate to main repo
cd <main-repo-path>

# Remove worktree
git worktree remove <worktree-path>

**对于选项 3:**保留工作树。

快速参考

选项合并推送保留工作树清理分支
1. 在本地合并✓--✓
2. 创建 PR-✓✓-
3. 保持现状--✓-
4. 丢弃---✓(强制)

Flutter 专项验证

允许完成之前:

# 1. Analysis must pass
flutter analyze
# Must show: No issues found!

# 2. Tests must pass
flutter test
# Must show: All tests passed!

# 3. Build verification — once, per project target platform (see Step 1)
flutter build <target> --debug
# Must show: Built successfully

常见错误

跳过测试验证

  • 问题:合并有问题的代码,创建未通过检查的 PR
  • 修正:提供选项之前,始终验证测试

开放式问题

  • 问题:“接下来该怎么做?”→ 含义不明确
  • 修正:准确提供 4 个结构化选项

自动清理工作树

  • 问题:在可能还需要工作树时将其移除(选项 2、3)
  • 修正:仅在选项 1 和 4 中清理

丢弃前未确认

  • 问题:意外删除工作成果
  • 修正:要求输入“discard”进行确认

危险信号

绝不:

  • 在测试失败时继续
  • 未验证结果中的测试就合并
  • 未经确认就删除工作成果
  • 未经明确请求就强制推送
  • 跳过 flutter analyze

始终:

  • 提供选项之前验证测试
  • 准确提供 4 个选项
  • 要求输入确认以执行选项 4
  • 仅为选项 1 和 4 清理工作树

集成

由以下技能调用:

  • flutter-subagent-dev(所有任务完成后)
  • flutter-executing(所有批次完成后)

配合使用:

  • flutter-worktrees——清理由该技能创建的工作树

评论

支持 Markdown