Chapter 30 of 32

Appendix 14: Prompt Toolkit for Machine Coding

Concepts

WHAT YOU NEED TO KNOW

CRYSTALLIZATION FINISHES CODE

Polishing, testing, documenting, and simplifying turn working code into handoff-ready software. Final passes make machine-built systems trustworthy and maintainable.

FILE POLISHING IMPROVES READABILITY

Better naming, cleaner structure, and comments explaining purpose prepare a file for review. Functionality alone does not make code understandable to others.

TEST GENERATION PROVES BEHAVIOR

Pytest coverage with edge cases for major functions turns claims into checks. Generated tests expose assumptions while protecting future changes.

DOCUMENTATION ENABLES REUSE

Purpose summaries, function lists, usage examples, and setup steps let others adopt the work. Usable prose is part of finished software, not an accessory.

COMPLEXITY REDUCTION REMOVES WEIGHT

Identifying unnecessary parts and flagging overengineering keeps systems lean. Deleting dead weight improves clarity more than adding cleverness does.

polish → test → document
  → simplify → review → deploy

WORK FILE BY FILE

Final cleanup proceeds one file at a time rather than across the whole project at once. Narrow scope keeps quality control precise and reviewable.

TOOLKIT NEEDS CUSTOMIZATION

Reusable prompts become powerful when adapted to project, language, and team standards. A personal prompt library preserves the versions that actually worked.

POLISH BELONGS AT END

Cleanup follows real functionality rather than interrupting construction. A final checklist before handoff prevents premature shine on unstable foundations.

FINISHED MEANS REVIEW READY

Deployment or handoff happens only after review confirms clarity. Crystallized code earns trust by being clean, tested, documented, and lean.

Explain this chapter with AI

Copy this prompt into ChatGPT, Claude, Gemini, a local model, or another AI.

Apply this chapter with AI

Copy this prompt into ChatGPT, Claude, Gemini, a local model, or another AI.

These prompts are designed to support the crystallization phase of your AI-powered development process.
They’re reusable, customizable, and should become part of your personal prompt arsenal.


    flowchart TD
    Start([🧊 Crystallization Phase]) --> A{What do you need?}

    A --> B[🧠 File Polishing<br>Cleanup, naming, comments]
    A --> C[🧪 Test Generation<br>pytest unit tests]
    A --> D[📄 Documentation<br>Markdown summaries]
    A --> E[🧹 Complexity Reduction<br>Simplify, remove dead weight]

    B --> F[✅ Ready for Review]
    C --> F
    D --> F
    E --> F

    F --> G[📦 Deploy or Handoff]

    style Start fill:#e1f5fe,stroke:#333
    style A fill:#fff3e0,stroke:#333
    style B fill:#e8f5e9,stroke:#333
    style C fill:#fce4ec,stroke:#333
    style D fill:#f3e5f5,stroke:#333
    style E fill:#fff9c4,stroke:#333
    style F fill:#e0f7fa,stroke:#333
    style G fill:#4caf50,stroke:#333,color:#fff
  

🧠 File Polishing Prompt

Use when: a file is functionally complete, but needs cleanup and clarity.

Polish this file. Improve variable and function naming, clean up the structure, and add comments that explain why each part exists. Make it ready for review or handoff.

🧪 Test Generation Prompt

Use when: you want to auto-generate basic tests using pytest.

Write pytest unit tests for every major function in this file. Include at least one edge case for each.

📄 Documentation Prompt

Use when: you want AI to create usable markdown docs.

Summarize this file's purpose, list its main functions, and provide example usage in markdown. Include installation or setup steps if needed.

🧹 Complexity Reduction Prompt

Use when: the code is too long, messy, or hard to maintain.

What parts of this code are unnecessary or can be simplified while still achieving the goal? Remove dead weight or flag overengineering.

🧰 Tips for Using This Toolkit

  • Start with one file at a time during final cleanup.
  • Customize each prompt to match your project or language.
  • Save your personal best versions in a local prompt library.
  • Use these as part of a final polishing checklist before handoff or deployment.

👉 These prompts were introduced in Chapter 13: Machine Coding.
Refer back to that chapter to see how they’re used in context.