Skip to content

Module 04 · Lesson 4.4

Small, Reversible Refactorings

45 minUpdated 19 Nov 2026Part of Characterization Tests and Safe Refactoring · Existing Project Engineering
On this page
  1. What you will learn
  2. What refactoring is, and why small steps matter
  3. Worked scenario: four commits that tidy price_order
  4. Step-by-step workflow: one refactoring, one commit
  5. Evidence: history, tests after each step, and the new structure
  6. Undoing a step with git revert
  7. Using an AI assistant for one refactoring at a time
  8. Conclusion and your next step
  9. Reusable prompt
  10. Expected output
  11. Common errors and fixes
  12. Validation checklist
  13. Hands-on exercise
  14. Knowledge check
  15. Frequently asked questions
  16. References

Think of tidying a kitchen while the restaurant is open. If you empty every cupboard at once, nobody can cook. If you move one shelf at a time and check that the chefs can still find the salt, service goes on.

Refactoring is tidying code in that careful way. In this lesson you will refactor the Tidewell Wholesale price_order function in four small commits, with tests after each one. The company and data are invented.

What you will learn

  • Explain what refactoring is, and what it is not.
  • Apply three named refactorings: extract a function, introduce a named constant and rename a variable.
  • Keep each commit to one kind of change, with tests green after it.
  • Undo a step with git, and say why small steps are easier to undo.

Before you start

  • You have read Golden Master and Approval Tests, and have characterization tests that pass.
  • You can use git add, git commit and git log.
  • A function in your repository with tests around it, and permission to change it.

What refactoring is, and why small steps matter

Refactoring means changing how code is built without changing what it does. The menu stays the same. Only the kitchen is better organised.

This has one strict rule: behaviour must not change. If you fix a bug or add a feature, that is not refactoring. It may be a good change, but it belongs in its own commit.

Extract function
Move a block of code into a function with a clear name, and call it from the old place. Like moving a recipe step onto its own card.
Introduce named constant
Replace a bare number or text, such as 7.50, with a name, such as DELIVERY_CHARGE. A magic number is a number whose meaning is not clear from the code.
Rename
Give a variable or function a clearer name. g becomes goods.
Reversible
Easy to undo. A change is reversible when it is small, and sits alone in its own commit.

Why small? A small step is easy to check, easy to review and easy to undo. If tests go red after one tiny change, you know exactly what caused it. After a big change, you must search.

RuleWhy
One kind of change per commitA reader can check one idea at a time.
Tests green before you startOtherwise you cannot tell what you broke.
Run the tests after every stepA failure points to the step you just did.
Do not mix in a behaviour changeA fix hidden in a cleanup cannot be reviewed or undone on its own.
The refactoring rules for this lesson.

The names of the refactorings used here come from the public Refactoring Catalog (opens in a new tab). It lists many more.

Worked scenario: four commits that tidy price_order

You start from the state at the end of the last lesson: price_order works, the characterization tests pass, and a golden master covers 60 orders. The function is one block of 15 lines, with one-letter names and bare numbers.

Pythoninvoicing/totals.py (before)
from decimal import Decimal, ROUND_HALF_UP

from catalogue.prices import contract_discount, list_price
from legacy.pricing_v1 import contract_unit_price


def price_order(lines, band, account="", get_list_price=list_price, get_discount=contract_discount):
    g = Decimal("0.00")
    for sku, q in lines:
        p = get_list_price(sku)
        if band == "Contract":
            p = contract_unit_price(p, get_discount(account))
        t = p * q
        if band == "Volume" and q >= 20:
            t = (t * Decimal("0.95")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
        g = g + t
    d = Decimal("0.00")
    if band == "Standard" and g < Decimal("50.00"):
        d = Decimal("7.50")
    v = ((g + d) * Decimal("0.20")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
    return {"goods": g, "delivery": d, "vat": v, "total": g + d + v}

Your plan is four commits. Each has one kind of change.

CommitRefactoringWhat changes
1Extract functionThe delivery rule moves into delivery_charge(goods, band).
2Extract functionThe price of one line moves into line_total(p, q, band).
3Introduce named constantBare numbers get names such as DELIVERY_CHARGE.
4Renameg, d, v, p, q and t get full names.

Commit 1: extract delivery_charge

The three lines that decide delivery become a function. The old place calls it. The rule is copied as it is, including the odd case-sensitive band check. We are not fixing anything.

git show for commit 1Captured from a real run
diff --git a/invoicing/totals.py b/invoicing/totals.py
index 195e4f0..6edd68e 100644
--- a/invoicing/totals.py
+++ b/invoicing/totals.py
@@ -6,2 +6,8 @@ from legacy.pricing_v1 import contract_unit_price
 
+def delivery_charge(goods, band):
+    if band == "Standard" and goods < Decimal("50.00"):
+        return Decimal("7.50")
+    return Decimal("0.00")
+
+
 def price_order(lines, band, account="", get_list_price=list_price, get_discount=contract_discount):
@@ -16,5 +22,3 @@ def price_order(lines, band, account="", get_list_price=list_price, get_discount
         g = g + t
-    d = Decimal("0.00")
-    if band == "Standard" and g < Decimal("50.00"):
-        d = Decimal("7.50")
+    d = delivery_charge(g, band)
     v = ((g + d) * Decimal("0.20")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)

Commit 2: extract line_total

git show for commit 2Captured from a real run
diff --git a/invoicing/totals.py b/invoicing/totals.py
index 6edd68e..850e610 100644
--- a/invoicing/totals.py
+++ b/invoicing/totals.py
@@ -12,2 +12,9 @@ def delivery_charge(goods, band):
 
+def line_total(p, q, band):
+    t = p * q
+    if band == "Volume" and q >= 20:
+        t = (t * Decimal("0.95")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
+    return t
+
+
 def price_order(lines, band, account="", get_list_price=list_price, get_discount=contract_discount):
@@ -18,6 +25,3 @@ def price_order(lines, band, account="", get_list_price=list_price, get_discount
             p = contract_unit_price(p, get_discount(account))
-        t = p * q
-        if band == "Volume" and q >= 20:
-            t = (t * Decimal("0.95")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
-        g = g + t
+        g = g + line_total(p, q, band)
     d = delivery_charge(g, band)

Commit 3: named constants

Now each bare number gets a name that says what it means. Note that FREE_DELIVERY_FROM is £50.00 and the check is still goods < FREE_DELIVERY_FROM, so an order of exactly £50.00 still gets free delivery.

git show for commit 3Captured from a real run
diff --git a/invoicing/totals.py b/invoicing/totals.py
index 850e610..1d12ead 100644
--- a/invoicing/totals.py
+++ b/invoicing/totals.py
@@ -5,6 +5,13 @@ from legacy.pricing_v1 import contract_unit_price
 
+DELIVERY_CHARGE = Decimal("7.50")
+FREE_DELIVERY_FROM = Decimal("50.00")
+VOLUME_DISCOUNT_QTY = 20
+VOLUME_DISCOUNT_MULTIPLIER = Decimal("0.95")
+VAT_RATE = Decimal("0.20")
+PENNY = Decimal("0.01")
+
 
 def delivery_charge(goods, band):
-    if band == "Standard" and goods < Decimal("50.00"):
-        return Decimal("7.50")
+    if band == "Standard" and goods < FREE_DELIVERY_FROM:
+        return DELIVERY_CHARGE
     return Decimal("0.00")
@@ -14,4 +21,4 @@ def line_total(p, q, band):
     t = p * q
-    if band == "Volume" and q >= 20:
-        t = (t * Decimal("0.95")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
+    if band == "Volume" and q >= VOLUME_DISCOUNT_QTY:
+        t = (t * VOLUME_DISCOUNT_MULTIPLIER).quantize(PENNY, rounding=ROUND_HALF_UP)
     return t
@@ -27,3 +34,3 @@ def price_order(lines, band, account="", get_list_price=list_price, get_discount
     d = delivery_charge(g, band)
-    v = ((g + d) * Decimal("0.20")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
+    v = ((g + d) * VAT_RATE).quantize(PENNY, rounding=ROUND_HALF_UP)
     return {"goods": g, "delivery": d, "vat": v, "total": g + d + v}

Commit 4: rename variables

This is the biggest diff by line count, but it is the safest kind of change. Only names change. Use your editor's rename feature, so that every use changes together.

git show for commit 4Captured from a real run
diff --git a/invoicing/totals.py b/invoicing/totals.py
index 1d12ead..f1a1bf6 100644
--- a/invoicing/totals.py
+++ b/invoicing/totals.py
@@ -19,7 +19,7 @@ def delivery_charge(goods, band):
 
-def line_total(p, q, band):
-    t = p * q
-    if band == "Volume" and q >= VOLUME_DISCOUNT_QTY:
-        t = (t * VOLUME_DISCOUNT_MULTIPLIER).quantize(PENNY, rounding=ROUND_HALF_UP)
-    return t
+def line_total(unit_price, qty, band):
+    total = unit_price * qty
+    if band == "Volume" and qty >= VOLUME_DISCOUNT_QTY:
+        total = (total * VOLUME_DISCOUNT_MULTIPLIER).quantize(PENNY, rounding=ROUND_HALF_UP)
+    return total
 
@@ -27,10 +27,10 @@ def line_total(p, q, band):
 def price_order(lines, band, account="", get_list_price=list_price, get_discount=contract_discount):
-    g = Decimal("0.00")
-    for sku, q in lines:
-        p = get_list_price(sku)
+    goods = Decimal("0.00")
+    for sku, qty in lines:
+        unit_price = get_list_price(sku)
         if band == "Contract":
-            p = contract_unit_price(p, get_discount(account))
-        g = g + line_total(p, q, band)
-    d = delivery_charge(g, band)
-    v = ((g + d) * VAT_RATE).quantize(PENNY, rounding=ROUND_HALF_UP)
-    return {"goods": g, "delivery": d, "vat": v, "total": g + d + v}
+            unit_price = contract_unit_price(unit_price, get_discount(account))
+        goods = goods + line_total(unit_price, qty, band)
+    delivery = delivery_charge(goods, band)
+    vat = ((goods + delivery) * VAT_RATE).quantize(PENNY, rounding=ROUND_HALF_UP)
+    return {"goods": goods, "delivery": delivery, "vat": vat, "total": goods + delivery + vat}

Step-by-step workflow: one refactoring, one commit

  1. Step 1: Start green

    Run all the tests. They must pass before you touch the code. If any fail, stop: record them as the baseline and do not refactor yet.

    Bash
    python -m pytest -q

    What you should see: All tests pass.

  2. Step 2: Choose one refactoring

    Name it before you start: 'Extract delivery_charge.' If you cannot name it in a few words, it is too big. Split it.

    What you should see: One named step.

  3. Step 3: Make the change, and only that change

    Move the code, or rename, or add the constant. Resist other cleanups that you spot on the way. Write them down for later.

    What you should see: A small diff.

  4. Step 4: Run the tests

    Run every test, including the golden master. Run them even when the change looks trivial.

    What you should see: Still green.

  5. Step 5: Read your own diff

    Ask: does this diff change what the code does? Look for changed comparisons, defaults and order of operations.

    What you should see: A diff that only moves or renames things.

  6. Step 6: Commit with a name that matches

    Write the refactoring in the message: 'Extract delivery_charge from price_order'. The commit message is part of the promise that behaviour did not change.

    What you should see: One commit per step.

  7. Step 7: If the tests go red, undo, do not debug

    Go back to the last green commit and try a smaller step. Debugging a red refactoring leads to hidden behaviour changes.

    What you should see: You are back on solid ground.

The refactoring loop
  1. Tests green

    Start here

  2. One refactoring

    Named in advance

  3. Tests again

    All of them

  4. Read the diff

    Behaviour the same?

  5. Commit

    One kind of change

Go round the loop once per commit.

Evidence: history, tests after each step, and the new structure

Here is the history of the scratch repository after the work. The top four commits are the refactorings. Hashes are the same on every run because the author and dates are fixed.

git log --onelineCaptured from a real run
d8c655b Rename one-letter variables in totals.py
6e108a0 Replace magic numbers in totals.py with named constants
92a15d7 Extract line_total from price_order
bbba8e1 Extract delivery_charge from price_order
68f9e81 Add golden master for price_order (60 synthetic orders)
10aa81c Add characterization tests for price_order
a60f654 Add get_list_price and get_discount parameters to price_order
08fa8f0 Add price_order with hard-wired database lookups
661fd99 Fix contract_unit_price to round half up with Decimal

Do the tests pass at every commit, not only at the end? You can check by visiting each commit and running the tests. This is the loop, in a clean clone.

Bash
for c in $(git rev-list --reverse HEAD | tail -n +4); do
  git checkout -q "$c"
  echo "$(git log -1 --format='%h %s') => $(python -m pytest -q | tail -1)"
done
git checkout -q main

Visit each commit from the tests commit onwards and run pytest.

Result (timings vary)Captured from a real run
10aa81c Add characterization tests for price_order => 15 passed in 0.02s
68f9e81 Add golden master for price_order (60 synthetic orders) => 16 passed in 0.03s
bbba8e1 Extract delivery_charge from price_order => 16 passed in 0.04s
92a15d7 Extract line_total from price_order => 16 passed in 0.03s
6e108a0 Replace magic numbers in totals.py with named constants => 16 passed in 0.03s
d8c655b Rename one-letter variables in totals.py => 16 passed in 0.02s

Every commit is green. If a reviewer asks which step caused a problem, each commit can be tested on its own.

Before and after: how the structure changed

Here is the final code. Compare it with the 'before' code above. The behaviour is the same. The shape is easier to read.

Pythoninvoicing/totals.py (after)
from decimal import Decimal, ROUND_HALF_UP

from catalogue.prices import contract_discount, list_price
from legacy.pricing_v1 import contract_unit_price

DELIVERY_CHARGE = Decimal("7.50")
FREE_DELIVERY_FROM = Decimal("50.00")
VOLUME_DISCOUNT_QTY = 20
VOLUME_DISCOUNT_MULTIPLIER = Decimal("0.95")
VAT_RATE = Decimal("0.20")
PENNY = Decimal("0.01")


def delivery_charge(goods, band):
    if band == "Standard" and goods < FREE_DELIVERY_FROM:
        return DELIVERY_CHARGE
    return Decimal("0.00")


def line_total(unit_price, qty, band):
    total = unit_price * qty
    if band == "Volume" and qty >= VOLUME_DISCOUNT_QTY:
        total = (total * VOLUME_DISCOUNT_MULTIPLIER).quantize(PENNY, rounding=ROUND_HALF_UP)
    return total


def price_order(lines, band, account="", get_list_price=list_price, get_discount=contract_discount):
    goods = Decimal("0.00")
    for sku, qty in lines:
        unit_price = get_list_price(sku)
        if band == "Contract":
            unit_price = contract_unit_price(unit_price, get_discount(account))
        goods = goods + line_total(unit_price, qty, band)
    delivery = delivery_charge(goods, band)
    vat = ((goods + delivery) * VAT_RATE).quantize(PENNY, rounding=ROUND_HALF_UP)
    return {"goods": goods, "delivery": delivery, "vat": vat, "total": goods + delivery + vat}
BeforeAfter
Functions1 (price_order, 15 lines)3 (price_order 10 lines, delivery_charge 4, line_total 5)
Bare numbers in the logic7.50, 50.00, 20, 0.95, 0.20, 0.01None. Each has a named constant.
Variable namesg, d, v, p, q, tgoods, delivery, vat, unit_price, qty, total
BehaviourAs recorded by the testsIdentical. 16 tests pass.
The two odditiesPresentStill present, on purpose
This is the before-and-after comparison your assignment asks for.

Undoing a step with git revert

Because each commit holds one idea, you can undo one. `git revert` makes a new commit that does the opposite of an earlier one. It does not rewrite history, so it is safe on shared branches. See the git-revert documentation (opens in a new tab).

Reverting the newest commitCaptured from a real run
[main 500ddeb] Revert "Rename one-letter variables in totals.py"
 Date: Thu Nov 19 12:00:00 2026 +0000
 1 file changed, 13 insertions(+), 13 deletions(-)
500ddeb Revert "Rename one-letter variables in totals.py"
d8c655b Rename one-letter variables in totals.py
6e108a0 Replace magic numbers in totals.py with named constants

That was easy: it was the newest commit. What about an older one? Later commits changed the same lines that commit 1 touched, so reverting commit 1 on its own cannot be done cleanly.

Trying to revert commit 1 after later commitsCaptured from a real run
Auto-merging invoicing/totals.py
CONFLICT (content): Merge conflict in invoicing/totals.py
error: could not revert bbba8e1... Extract delivery_charge from price_order
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git revert --continue".
hint: You can instead skip this commit with "git revert --skip".
hint: To abort and get back to the state before "git revert",
hint: run "git revert --abort".
hint: Disable this message with "git config set advice.mergeConflict false"

A conflict means git cannot decide how to combine two changes. You abort with git revert --abort, or you revert the newer commits first. The lesson: undo steps from the newest backwards, and do not leave a bad step sitting under later work.

Using an AI assistant for one refactoring at a time

An assistant can do the mechanical part of a refactoring quickly. The risk is that it does more than you asked. So ask for one named refactoring, and ask it to prove nothing else changed.

  • Name the refactoring and the target: 'Extract delivery_charge from price_order.'
  • Say what must not change: behaviour, public names, the odd cases.
  • Ask for a diff only, with no reformatting.
  • Ask it to state, in one line per hunk, why behaviour is unchanged.
  • Run all tests, read the diff, and commit yourself.

Conclusion and your next step

Refactoring changes structure, not behaviour. Start green, take one named step, run all tests, read the diff, and commit. If a step goes wrong, go back and take a smaller one. Small, single-purpose commits are the thing that makes a step reversible.

Your next step: an assistant will happily offer to 'tidy' code for you, and some of its tidying changes behaviour. Continue with Reviewing AI-Proposed Refactorings to learn how to catch that.

Further reading: the book *Refactoring* by Martin Fowler describes the catalogue in depth. On this site, see Legacy Modernization with AI: The Strangler Fig Pattern and the module overview Characterization Tests and Safe Refactoring.

Reusable prompt

Single refactoring step

Asks an assistant to perform exactly one named refactoring as a diff, and to state why behaviour is unchanged.

Perform ONE refactoring on the Python code below: "Extract function". Move the delivery rule (the lines that set d) into a function named delivery_charge(goods, band) and call it from price_order.

Rules:
- Behaviour must stay exactly the same. Keep the comparison band == "Standard" and goods < Decimal("50.00") as they are, even if they look odd.
- Change nothing else: no renames, no constants, no formatting, no new imports.
- Show a unified diff only.
- After the diff, add one line per changed hunk saying why behaviour is unchanged.
- If you think something in the code is a bug, list it separately under "Noticed, not changed".

Code (synthetic):
def price_order(lines, band, account="", get_list_price=list_price, get_discount=contract_discount):
    g = Decimal("0.00")
    for sku, q in lines:
        ...
    d = Decimal("0.00")
    if band == "Standard" and g < Decimal("50.00"):
        d = Decimal("7.50")
    v = ((g + d) * Decimal("0.20")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
    return {"goods": g, "delivery": d, "vat": v, "total": g + d + v}
Show the reusable template

Replace each {{placeholder}} with your own details.

Perform ONE refactoring on the {{language}} code below: "{{refactoring_name}}". {{what_to_move_and_where}}

Rules:
- Behaviour must stay exactly the same. Keep these conditions exactly as they are, even if they look odd: {{conditions_to_keep}}.
- Change nothing else: no renames, no constants, no formatting, no new imports.
- Show a unified diff only.
- After the diff, add one line per changed hunk saying why behaviour is unchanged.
- If you think something in the code is a bug, list it separately under "Noticed, not changed".

Code (code I am allowed to share):
{{code}}

Expected output and limitations

A unified diff that adds the new function and replaces the old lines with a call to it, then a short reason for each hunk, and a separate list of anything the assistant noticed but did not change.

Sample responseIllustrative — your output will differ
--- a/invoicing/totals.py
+++ b/invoicing/totals.py
@@
+def delivery_charge(goods, band):
+    if band == "Standard" and goods < Decimal("50.00"):
+        return Decimal("7.50")
+    return Decimal("0.00")
+
@@ def price_order(...)
-    d = Decimal("0.00")
-    if band == "Standard" and g < Decimal("50.00"):
-        d = Decimal("7.50")
+    d = delivery_charge(g, band)

Why behaviour is unchanged:
- New function: same condition and amounts as the removed lines.
- Call site: d gets the same value as before in both branches.

Noticed, not changed:
- band is compared with exact letter case, so "standard" gets no delivery charge.

Limitations to keep in mind

  • Check the diff yourself. Assistants sometimes change a comparison or a default while moving code.
  • 'Behaviour is unchanged' is a claim, not a proof. The tests are the proof.
  • It may also rename variables or reformat. Reject those parts, or ask again.
  • This sample is illustrative. Your assistant's answer will differ.

Common errors and how to fix them

A refactoring commit also fixes a bug

Why it happens: The bug was visible while the code was open.

Fix: Undo the fix, write it down, and make it a separate commit with its own tests and a clear label.

Tests are run only at the end

Why it happens: Each step seemed too small to be risky.

Fix: Run all tests after every step. Several small mistakes in a row are hard to untangle.

The step is too big to name

Why it happens: Several ideas were combined, such as extracting a function and renaming at once.

Fix: Split it. If the commit message needs the word 'and', it is probably two commits.

Validation checklist

Tick each item once you have confirmed it.

Hands-on exercise

Refactor your characterized function in four commits

Use the function you characterized in the earlier exercises. Refactor it in at least three commits, each a single named refactoring, with all tests passing after each one.

You will need

  • Your characterization tests and, if you built one, your golden master.
  • A clean git branch.
  • A notes file for odd behaviour.

Acceptance criteria

Your work is done when every one of these is true.

Hints (3)
  • If a step feels too big, extract just one block, or rename just one variable.
  • Use your editor's rename tool, not find and replace.
  • If an assistant helped, record any hunk you rejected.
Show a model answer

A good answer shows a short, boring git log: 'Extract X', 'Extract Y', 'Name constants', 'Rename variables'. Each commit is under about 30 changed lines, and the tests pass at each. The notes file lists the odd behaviour left in place. The before-and-after table shows fewer long lines and no bare numbers. A weak answer has one huge commit called 'Refactor', a fix hidden inside it, and tests run only once at the end.

Knowledge check

Choose an answer, then check it. Nothing is recorded — this is for you.

  1. 1.While extracting a function, you notice that a comparison looks wrong. What do you do?
    Show the answer and explanation

    Answer: B. A refactoring must not change behaviour, and a fix is a behaviour change. Mixing them makes a failing test impossible to interpret. Fixing it on the spot is tempting, but it is the very thing the rules forbid.

  2. 2.What makes a refactoring step reversible?
    Show the answer and explanation

    Answer: A. Size and isolation in version control decide whether a change can be undone cleanly. Approval and the source of the idea do not affect that. Bigger commits touch more lines, so later work is more likely to conflict.

  3. 3.After a step, the tests fail and the cause is not obvious. What is the best move?
    Show the answer and explanation

    Answer: B. A red refactoring means behaviour changed, so returning to green and trying smaller is cheapest. Debugging in place often ends in a hidden behaviour change. Editing the tests throws away your safety net.

Frequently asked questions

What is the difference between refactoring and rewriting?

Refactoring changes the structure in small steps and keeps the behaviour. A rewrite replaces the code in one go, and you must then prove that the new code does the same. Small steps are much safer on old code.

How small is 'small'?

Small enough that you can name it in a few words and review the diff in a minute or two. 'Rename g to goods' is small. 'Clean up pricing' is not.

Should I refactor and add a feature in the same pull request?

Better not. Put the refactoring in earlier commits, or an earlier pull request, and the feature after it. Reviewers can then check that the refactoring changed no behaviour, and see the feature on a tidy base.

What if the tests do not cover the code I want to change?

Do not refactor it yet. Add characterization tests first, using the earlier lessons in this module. A refactoring without tests is only a hope that nothing changed.

Written by
PromptFable Editorial
Last updated 19 Nov 2026
Review
Reviewed by Waseem Nadir, Technical Reviewer
Last reviewed 27 Nov 2026

References

Primary sources for the technical details in this lesson. Vendor platforms change — check the official page if anything here looks different from what you see.

PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.