diff --git a/.claude/skills/cleanup-branch/SKILL.md b/.claude/skills/cleanup-branch/SKILL.md index 543fa3b..01b0800 100644 --- a/.claude/skills/cleanup-branch/SKILL.md +++ b/.claude/skills/cleanup-branch/SKILL.md @@ -12,7 +12,8 @@ Run the following commands in order: BRANCH=$(git rev-parse --abbrev-ref HEAD) # Switch to master and pull -git checkout master && git pull +git fetch --all --prune --jobs=10 +git switch master && git pull # Delete the feature branch (-D handles branches already merged via remote) [ "$BRANCH" != "master" ] && git branch -D "$BRANCH" && echo "Deleted branch: $BRANCH" diff --git a/.claude/skills/implement-spec/SKILL.md b/.claude/skills/implement-spec/SKILL.md index 0e4192d..9b35d37 100644 --- a/.claude/skills/implement-spec/SKILL.md +++ b/.claude/skills/implement-spec/SKILL.md @@ -1,19 +1,19 @@ --- name: implement-spec -description: Implements a spec end-to-end from a spec file. Creates a GitHub issue, a kebab-case feature branch, writes all required files, commits, and opens a PR via create-pr.sh. Works for new faker providers as well as general workflow or tooling specs. Invoke manually with the path to a spec file. -argument-hint: +description: Implements a spec end-to-end from a spec file. Creates a GitHub issue, a kebab-case feature branch, writes all required files, commits, and opens a PR via create-pr.sh. Works for new faker providers as well as general workflow or tooling specs. Invoke manually with the path to a spec file, or with no argument to implement from current git changes. +argument-hint: [path/to/SPEC.md] disable-model-invocation: true allowed-tools: Bash, Read, Write, Edit, Glob, Grep --- -Implement the feature described in the spec file below. +Implement the feature described below. --- -## Spec file: $ARGUMENTS +## Spec content ``` -!`cat "$ARGUMENTS"` +!`if [ -n "$ARGUMENTS" ]; then cat "$ARGUMENTS"; else git diff HEAD; git status --short; fi` ``` --- @@ -48,20 +48,20 @@ Apply every relevant lesson during implementation in Step 4. These are hard-won ### Step 2 — Create a GitHub issue -Create an issue in the `TheJavaGuy/java-faker` repository. Derive the title from the spec's **Overview** section (one concise sentence). Use the full spec content as the body. +Create an issue in the `TheJavaGuy/java-faker` repository. Derive the title from the spec's **Overview** section (one concise sentence). -```bash -gh issue create \ - --repo TheJavaGuy/java-faker \ - --title "" \ - --body "$(cat '$ARGUMENTS')" -``` +- If a spec file was provided (`$ARGUMENTS` is non-empty): write the body to a temp file and use `--body-file` (required to avoid backtick/shell parsing issues — see LEARNINGS.md #6): + ```bash + cat '$ARGUMENTS' > /tmp/issue-body.md + gh issue create --repo TheJavaGuy/java-faker --title "" --body-file /tmp/issue-body.md + ``` +- If no spec file was provided: derive the body from the git diff summary you read in Step 1, write it to `/tmp/issue-body.md`, then use `--body-file`. Record the issue number printed (e.g., `#42`). You will reference it in the commit message. ### Step 3 — Create a feature branch -Derive a descriptive kebab-case branch name from the spec's content: +Derive a descriptive kebab-case branch name from the feature being implemented: - **New faker spec**: `add-<feature-name>-faker` (e.g., `add-credit-card-faker`, `add-markdown-faker`) - **General spec**: a name that reflects the nature of the change (e.g., `add-pre-commit-hooks`, `update-build-config`, `fix-yaml-quoting`) diff --git a/LEARNINGS.md b/LEARNINGS.md index 1004796..3f21178 100644 --- a/LEARNINGS.md +++ b/LEARNINGS.md @@ -87,6 +87,12 @@ return faker.bothify(pattern, true); **Solution**: Follow the SKILL.md instructions manually, step by step. The `disable-model-invocation` flag means the skill is a pure prompt template — not a model-callable tool. +### 8. `git pull` fails when there are unstaged changes on master + +**Problem**: When invoking `implement-spec` with no argument, the changes are already present as unstaged modifications. Running `git checkout master && git pull` fails with `error: cannot pull with rebase: You have unstaged changes`. + +**Solution**: When already on `master` with the target changes present, skip `git pull` and just create the feature branch directly with `git checkout -b <branch>`. The unstaged changes carry over to the new branch automatically. + --- -*Last updated: 2026-03-01* +*Last updated: 2026-03-02*