Skip to content

Stage 0 — Foundations

This stage checks four tools that you will use later. If you already know them, skip ahead. If not, no problem: do the small practice below once.

When to skip this stage

Check these four things. You do not need to memorize commands. You do need to find information and finish each task yourself:

  • Use Python to get public data from an API (Application Programming Interface, an interface through which programs request a service) (an entry that lets a program get data), then find one value in the JSON (JavaScript Object Notation, a text format commonly used to exchange data).
  • Use Git to copy a project (clone), create a work line (branch), save a version (commit), and send it online (push). When two changes collide, know what a merge conflict is and what to keep.
  • Use the command line (text commands typed in a terminal) to change folders, create files, and run a Python script.
  • Read YAML and JSON. Both are text formats for saving data.

If all four are easy, go straight to Stage 1 — LLM Basics. If one is uncertain, do the main practice here. Open the extra sections only when you need them.

📌 Learning Goals

After this stage, you can:

  • Get data from an API with Python and read the needed part of the JSON.
  • Run a program from a terminal and find the file it created.
  • Save a version with Git and return to that version when needed.
  • Recognize YAML, JSON, and an API token (secret text that lets a program sign in), and know what must not be shared.

🛠 Hands-on Practice: Build a Small GitHub Data Tool

Outcome: Have Python get public data from GitHub, show it on screen, write it to a file, and save the result with Git. This main practice needs no account, API token, or paid service.

1. Create the program

Create a new folder. Save the following as github_profile.py:

import json
import sys
from pathlib import Path
from urllib.request import Request, urlopen

if hasattr(sys.stdout, "reconfigure"):
    sys.stdout.reconfigure(encoding="utf-8", errors="replace")

url = "https://api.github.com/users/torvalds"
request = Request(url, headers={"User-Agent": "stage-0-practice"})

with urlopen(request, timeout=10) as response:
    profile = json.load(response)

result = f"{profile['login']} has {profile['followers']} followers"
print(result)
Path("result.txt").write_text(result + "\n", encoding="utf-8")

An API is an entry that lets a program get data. JSON is the data format received this time.

2. Run the program

In a terminal, enter that folder and run:

python github_profile.py

The screen shows the account and follower count. The folder also gets result.txt. The count changes, so your screen does not need to match someone else's.

3. Save the result with Git

git init
git add github_profile.py result.txt
git commit -m "Add GitHub profile checker"

A commit is one saved Git version with a short note. If Git asks for your name or email the first time, follow the prompt and run git commit again. This information is an author label for the version, not a password.

✅ Completion Check

  • The terminal shows a GitHub account and follower count.
  • result.txt contains the same result.
  • git log --oneline shows the commit you just made.
  • The program and commit contain no password or API token.

When all four are done, go to Stage 1 — LLM Basics. If you are stuck, open the section below that matches the problem. You do not need to read everything.

⏱️ Time, environment, and why this stage exists

Time: If all of this is new, allow 1–2 weeks, about 5–15 hours. If you already know some parts, practice only what is new.

Environment: Prepare a supported Python 3, Git, a text editor, and a terminal. A terminal is a window for typing text commands. On Windows, use PowerShell. On macOS or Linux, use the system terminal.

First check that the tools run:

python --version
git --version

Later AI-agent lessons use Python, Git, the command line, and configuration files. Stage 0 does not teach everything. It helps you find what is unfamiliar and points you to a place to learn it.

🧰 Extra practice: Python, Git, command line, and YAML/JSON

Do only the items you do not know yet:

  1. Python: Replace torvalds in the main-practice URL with your own GitHub account or another public account. Check that the program still reads login and followers.
  2. Git: Create a new branch (a work line that does not directly change the original version), change the output text, and make another commit. Then put the practice in your own remote Git project and run git push.
  3. Command line: Create src, tests, and docs folders. Run the main practice from different paths and find where result.txt was actually written.
  4. JSON: Save the API response to a file. Find the name, public_repos, and followers fields.
  5. YAML: Create a small configuration file with username and output_file. Practice indentation, strings, and Boolean values. YAML cares about spaces, so do not indent with Tab.

When an error appears, read the last line first. Then check the current folder, file name, and Python version. Change one thing at a time so you know which change helped.

🔐 Optional: try GitHub API authentication safely

The main practice needs no token. A token is secret text that lets GitHub recognize you. Do this only if you want to understand a signed-in API.

  1. Follow GitHub's official guide to create a fine-grained personal access token. “Fine-grained” means you can grant only the permissions you need.
  2. Use the shortest useful expiration. Add no extra permissions. GET /user does not require a permission for a fine-grained token.
  3. Put the token in the GITHUB_TOKEN environment variable. An environment variable is a temporary place where a computer holds data for a program. Never write the token in Python, Markdown, screenshots, terminal history, or a Git commit.
  4. Call https://api.github.com/user twice. The first call has no token and should return 401, meaning you are not signed in. The second call has the token and should return 200, meaning GitHub accepted the request.
  5. When finished, revoke the token in GitHub settings and clear the environment variable.

Bash can avoid showing the input on screen:

read -s GITHUB_TOKEN && export GITHUB_TOKEN
curl -sS -o /dev/null -w "No token: %{http_code}\n" \
  -H "Accept: application/vnd.github+json" \
  https://api.github.com/user
curl -sS -o /dev/null -w "With token: %{http_code}\n" \
  -H "Authorization: Bearer $GITHUB_TOKEN" \
  -H "Accept: application/vnd.github+json" \
  https://api.github.com/user
unset GITHUB_TOKEN

PowerShell 7.1 and later can do this:

$env:GITHUB_TOKEN = Read-Host -MaskInput "Paste token"
$withoutToken = Invoke-WebRequest -Uri https://api.github.com/user `
  -Headers @{ Accept = "application/vnd.github+json" } `
  -SkipHttpErrorCheck
$withToken = Invoke-WebRequest -Uri https://api.github.com/user -Headers @{
  Authorization = "Bearer $env:GITHUB_TOKEN"
  Accept = "application/vnd.github+json"
} -SkipHttpErrorCheck
"No token: $($withoutToken.StatusCode)"
"With token: $($withToken.StatusCode)"
Remove-Item Env:GITHUB_TOKEN

A token is like a temporary key used by a program. Anyone who gets it may act as you. Fewer permissions and a shorter expiration are safer.

🗺️ Terms and the agent landscape
  • CLI (command-line interface): Type text commands in a terminal to control a computer.
  • API (application programming interface): An entry that lets two programs exchange data using fixed rules.
  • JSON/YAML: Two text formats for structured data. JSON is common in APIs. YAML is common in configuration files.
  • Git: A tool that records file versions. A commit is one version snapshot with a note.

For other unfamiliar words, check the glossary. To see why an agent may appear in a terminal, a chat app, or a device, read the Agent Landscape. Neither is required before the main practice.

🎯 Curated Learning Resources

Use an entry that matches the skill you need. You do not need to read all 18 resources.

Learning resources and GitHub verification guidance checked: 2026-08-27 UTC

Recommendation is the learning priority, not a GitHub popularity number. Under the project rules, ⭐⭐⭐⭐⭐ means “you will get stuck without it”; everything below is supplemental, so it honestly uses ⭐⭐⭐⭐ (strongly recommended) or ⭐⭐⭐ (solid reference), without fake five-star ratings.

TopicResourceWho it's forRecommendationWhy recommended / Notes
PythonPython Crash CourseWant to follow a book from the beginning⭐⭐⭐⭐Code and exercises are free; the complete book must be purchased.
Real PythonKnow a little and want to look up one topic⭐⭐⭐⭐Articles are grouped by topic, so they are easy to find when needed.
Corey Schafer YouTubeLike English videos⭐⭐⭐Uses videos to move from basic syntax to practical use.
Boot.devLike learning by doing⭐⭐⭐Some content is free; the complete backend path is paid.
Python official Traditional Chinese tutorialFinished the first exercise and want correct syntax⭐⭐⭐⭐Official reference material; it expects some programming knowledge.
GitPro Git bookWant to understand Git fully⭐⭐⭐⭐Free, complete reference book.
Atlassian Git TutorialsWant to understand branch, merge, and work order with pictures⭐⭐⭐⭐Common workflows explained with diagrams.
Pro Git — Undoing ThingsMade a Git mistake and want to recover safely⭐⭐⭐⭐Explains which actions can lose data before showing how to recover.
git-flight-rulesNeed more answers than the basics give⭐⭐⭐Collects more Git problems and ways to handle them.
CLI / ShellThe Art of Command LineWant to learn the command line in order⭐⭐⭐⭐Goes from beginner commands to more advanced use.
Microsoft Learn — PowerShellUse Windows and want to start from the first step⭐⭐⭐⭐Microsoft's official PowerShell beginner course.
tldr pagesOnly want to see how one command is used⭐⭐⭐⭐Short, copyable examples explain common commands.
REST APIMDN — HTTPWant to know how an API sends data⭐⭐⭐⭐Mozilla's maintained reference for HTTP.
Postman Learning CenterWant to try an API with a graphical tool⭐⭐⭐⭐See sent requests and received data without writing code first.
HTTPieWant to call an API from the command line⭐⭐⭐Commands are often easier to read than raw curl commands.
YAML / JSONYAML official siteNeed to check the correct YAML syntax⭐⭐⭐Official entry point for syntax and the formal specification.
JSON introductionMeeting JSON for the first time⭐⭐⭐⭐Short examples explain how JSON holds data.
jqWant to organize JSON from the command line⭐⭐⭐⭐Filters and organizes data returned by an API.

✅ Done with Stage 0? Continue to Stage 1 — LLM Basics to make your first LLM API call and learn about token, context window, and cost estimation.