agentleFS
pgplexpgplex/pgschema/.claude/skills/fix_bug/SKILL.md

fix_bug

Skill1.1k starsChanged 9 months agoApache-2.0View on GitHub

Fix a bug from a GitHub issue using TDD. Analyzes the issue, creates a reproducing test case, implements the fix, verifies it, and creates a PR. Use this skill whenever working on a GitHub issue, bug report, or regression — even if the user just provides an issue number or URL.

  • Commits and pushes

1 other project uses a version of this.

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 2 mentionsMay 2026: 0 mentionsJun 2026: 1 mentionJul 2026: 0 mentionsAug 2026: 2 mentionsSep 2026: 3 mentionsOct 2026: 8 mentionsNov 2026: 4 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the pgplex/pgschema repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about pgplex/pgschema

The biggest 5 of 22 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 22

Talked about on GitHub (22 times).

On GitHub · 22

17 more on GitHub
  • Other versions1 project uses a version of this.

    Word for word · 1

    1. pgschema/pgschema★ 1.1k100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Both: start with dump; if dump is correct, it's a diff bug

    line 21
  2. Very specific:

    Verify it fails: go test -v ./cmd/dump -run TestDumpCommand_Issue<N>

    line 41
  3. Very specific:

    Verify it fails (use the case name you folded into, or the new issue_<N>_<description>):

    line 52
  4. Distinctive:

    Run only the impacted tests (not the full suite — CI runs that on the PR).

    line 73
  5. Very specific:

    Only widen the filter to the whole category (PGSCHEMA_TEST_FILTER="<category>/") if the fix touched shared diff logic that could affect …

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Fix Bug

TDD workflow for fixing bugs from GitHub issues: reproduce first, then fix, then verify.

Two principles to keep turnaround fast:

  1. Run only the impacted/relevant tests locally — never the full suite. CI runs the full suite on the PR; locally you only need to confirm the reproducing test and its immediate neighbors. Narrow PGSCHEMA_TEST_FILTER to the specific case (or category) you touched.
  2. Prefer folding testdata/diff cases into existing ones — each test case is its own embedded-postgres apply cycle, so every new directory adds to total test time. By default, consider adding the scenario to a related existing case. Only create a new case when that's more reasonable or consistent with the existing layout (see Phase 2).

Phase 1: Analyze

  1. Fetch the issue: gh issue view <number>
  2. Classify the bug:
    • Dump bug: pgschema dump produces wrong output → test in testdata/dump/
    • Diff/Plan bug: dump is correct but plan generates wrong DDL → test in testdata/diff/
    • Both: start with dump; if dump is correct, it's a diff bug

Phase 2: Create Test Case (Red)

Dump Bugs

Create testdata/dump/issue_<N>_<description>/ with:

  • manifest.json — metadata with name, description, source URL, notes
  • raw.sql — original DDL
  • pgdump.sql — what pg_dump produces (input to test)
  • pgschema.sql — expected correct output

Register in cmd/dump/dump_integration_test.go:

func TestDumpCommand_Issue<N><Description>(t *testing.T) {
    if testing.Short() { t.Skip("Skipping integration test in short mode") }
    runExactMatchTest(t, "issue_<N>_<description>")
}

Verify it fails: go test -v ./cmd/dump -run TestDumpCommand_Issue<N>

Diff/Plan Bugs

Categories: create_table, create_index, create_trigger, create_view, create_function, create_procedure, create_sequence, create_type, create_domain, create_policy, create_materialized_view, comment, privilege, default_privilege, dependency, online, migrate.

Decide: fold or create new (default: consider folding). Each case directory is a separate embedded-postgres apply cycle, so folding keeps the suite fast.

  • Fold when the bug is a natural variation of an existing case (same object type/category) and adding the DDL doesn't obscure that case's intent. Add the reproducing statements to the existing old.sql/new.sql, then regenerate its expected outputs. Browse the category first (ls testdata/diff/<category>/) to find the best home.
  • Create new (testdata/diff/<category>/issue_<N>_<description>/ with old.sql and new.sql) when the scenario is distinct, or when a standalone issue_<N> case is more consistent with how the category is organized.

Verify it fails (use the case name you folded into, or the new issue_<N>_<description>):

PGSCHEMA_TEST_FILTER="<category>/<case>" go test -v ./internal/diff -run TestDiffFromFiles

Generate expected outputs once you know correct behavior:

PGSCHEMA_TEST_FILTER="<category>/<case>" go test -v ./cmd -run TestPlanAndApply --generate

Phase 3: Fix (Green)

Common locations:

  • Dump: ir/inspector.go, ir/normalize.go, internal/dump/
  • Diff: internal/diff/ (table.go, column.go, index.go, trigger.go, view.go, function.go, procedure.go, sequence.go, type.go, policy.go, constraint.go)
  • IR: ir/ir.go, ir/quote.go

Make the minimal fix. Use pg_dump and postgres_syntax skills as needed.

Phase 4: Verify

Run only the impacted tests (not the full suite — CI runs that on the PR). Keep the filter as narrow as possible:

# Dump bugs
go test -v ./cmd/dump -run TestDumpCommand_Issue<N>

# Diff bugs — start with the specific case
PGSCHEMA_TEST_FILTER="<category>/<case>" go test -v ./internal/diff -run TestDiffFromFiles
PGSCHEMA_TEST_FILTER="<category>/<case>" go test -v ./cmd -run TestPlanAndApply

Only widen the filter to the whole category (PGSCHEMA_TEST_FILTER="<category>/") if the fix touched shared diff logic that could affect sibling cases.

Phase 5: Create PR

git checkout -b fix/issue-<N>-<description>
git add <files>
git commit -m "fix: <description> (#<N>)"
git push -u origin fix/issue-<N>-<description>
gh pr create --title "fix: <description> (#<N>)" --body "## Summary
<what was broken and how it was fixed>

Fixes #<N>

## Test plan
<what test was added and how to run it>"

Checklist

  • Bug classified (dump vs diff)
  • Test case folded into an existing case, or new issue_<N>_<description> created when more reasonable
  • Test fails before fix (red)
  • Minimal fix implemented
  • Test passes after fix (green)
  • Impacted tests pass locally (narrow filter — full suite left to CI)
  • PR created and linked to issue

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.