Move Dev to Tutorial Then Verify Every Block
In this article
Moving a developer from a coding project to writing tutorials, then verifying every block of code, is a workflow for turning working software into accurate documentation. The direct answer: yes, you can move a developer to tutorial writing, and you should verify every code block by running it, because unverified examples are the most common source of broken documentation. This article explains how to structure that transition, what verification actually involves, and how to avoid the pitfalls that make tutorials unreliable.
Why Move a Developer to Tutorials
Developers who know a codebase intimately are the best people to document it, but only if they approach tutorials differently from feature work. A feature is judged by whether it works; a tutorial is judged by whether a stranger can follow it. The same person can do both, but the mindset shift is real.
Common reasons to make this move:
- Reduce tribal knowledge: the person who built the system writes down how it actually works.
- Improve code quality: writing a tutorial forces you to use the public API, not internal shortcuts.
- Onboard faster: new hires get a tested path instead of guessing.
- Find design flaws: if you can't explain a step simply, the design may be too complex.
The key is to treat the tutorial as a product, not a byproduct. That means editing, testing, and maintaining it like code.
What "Verify Every Block" Really Means
Verifying a code block means executing the exact code shown, in the exact order shown, in a clean environment, and confirming the output matches the tutorial. It is not enough to read the code and say "that looks right."
Three levels of verification:
- Syntax check: the code parses without errors.
- Execution check: the code runs and produces the expected result.
- Context check: the code works when the reader starts from the tutorial's starting point, not from your current project state.
The third level is where most tutorials fail. A developer might verify a block while a variable from an earlier experiment is still in memory, or while a file exists that the reader won't have. The fix is to run each block in a fresh session, or to provide a complete setup script that recreates the starting state.
Setting Up the Tutorial Project
Before writing a single line, create a separate project directory that will become the tutorial's home. It should contain only the files the reader will see, not your full application.
Steps to set up:
- Create a minimal project skeleton (e.g.,
package.json,requirements.txt, or a single HTML file). - Write a README that states the exact versions of languages and libraries used.
- Add a
verifyscript that runs every code block in sequence and checks the output. - Use the same file names and folder structure in the tutorial and the project.
This project becomes your test harness. If the tutorial says "create a file called app.js", that file must exist in the project with the exact content shown. If the tutorial says "run npm start", the project must have that script defined.
How to Verify Each Block Efficiently
Manually copying and pasting every block is slow and error-prone. Instead, automate as much as possible.
Practical verification workflow:
- Write the tutorial text and code blocks in a version-controlled file (Markdown, reStructuredText, or AsciiDoc).
- Use a code extractor tool (like
markdown-code-runneror a simple script) to pull out every fenced code block. - Run each block in a clean interpreter or shell, capturing stdout and stderr.
- Compare the actual output to the expected output stated in the tutorial.
- If any block fails, fix the code or the explanation, then re-run from the start.
For interactive tutorials (like Jupyter notebooks or REPL sessions), the same principle applies: execute the notebook from top to bottom in a fresh kernel and confirm all outputs are present.
Common Problems and How to Avoid Them
Even with good intentions, tutorials end up with broken blocks. Here are the most frequent issues and their fixes.
- Hidden state: A block works because a previous block created a variable. Solution: run blocks in isolation, or explicitly state dependencies.
- Version drift: The tutorial was written with Python 3.8, but the reader has 3.12. Solution: pin versions in the README and test with the minimum supported version.
- Copy-paste errors: The code in the tutorial differs from the code you actually ran. Solution: generate the tutorial code from the verified project files, not by hand.
- Missing imports: A block uses
osbut the import was in a previous block. Solution: include all imports in each block, or state "this block assumes the previous imports." - Output mismatch: The tutorial says "prints 5" but the code prints
5.0. Solution: run the code and copy the exact output, including whitespace.
The most effective fix is to make the tutorial's code blocks the same files that your verification script runs. If you write the code once and include it in the document via a build step, you eliminate the copy-paste problem entirely.
When Verification Is Not Enough
Running code is necessary but not sufficient. A block can run and still be wrong for the reader because of context, environment, or assumptions.
Examples of "runs but wrong":
- Hard-coded absolute paths like
/Users/yourname/projectthat only work on your machine. - Commands that require sudo or admin rights without mentioning it.
- Code that works on Linux but not Windows (file paths, line endings, shell commands).
- Network calls that depend on an API key or a live server.
To catch these, have a second person (or a fresh virtual machine) follow the tutorial literally from the start. This is the ultimate test: a clean environment, no prior knowledge, and only the tutorial as a guide.
Costs and Time Investment
Moving a developer to tutorial writing is not free. Expect the first tutorial to take significantly longer than writing the feature did, because you are also building the verification infrastructure.
Typical time breakdown:
- Writing the tutorial text: 30%
- Creating the project skeleton and setup script: 20%
- Running and fixing code blocks: 30%
- Reviewing with a fresh reader: 20%
But the payoff is reduced support tickets, faster onboarding, and fewer "it doesn't work" issues. The tutorial becomes a living document that can be re-verified whenever dependencies change.
Alternatives to Full Manual Verification
If you don't have time to run every block manually, there are lighter-weight options, but they have trade-offs.
- Continuous integration (CI): Add a CI job that runs the tutorial's code blocks on every commit. This automates verification but only catches errors in the exact environment you set up.
- Literate programming tools: Tools like Jupyter, Org-mode, or R Markdown execute code embedded in the document. This guarantees the code runs, but the output may not match what a reader sees if they run it themselves.
- Code review: Have another developer read the tutorial and run the blocks manually. This catches context issues but is time-consuming.
- Do nothing: Publish and hope. This is the most common approach, which is why so many tutorials are broken.
For most projects, a hybrid approach works best: automate the execution check in CI, and manually test the first-time experience on a clean machine before each release.
Frequently Asked Questions
Do I need to verify every single block, even trivial ones?
Yes, but "verify" can be automatic. A trivial block like print("hello") can be verified by a script in milliseconds. The cost of skipping it is that a typo (like a missing quote) breaks the reader's flow, and they may not know it's a typo in the tutorial rather than their own mistake.
What if the tutorial uses a GUI or a browser?
GUI steps are harder to verify automatically. For those, use a scripted browser test (like Selenium or Playwright) if possible, or at minimum, write a checklist of exact clicks and screenshots. The same principle applies: the steps must be reproducible from a clean state.
How do I handle code blocks that depend on external services?
If a block requires an API key or a live server, either provide a mock or clearly state the prerequisite. Do not verify it against your production service, because the reader won't have your credentials. Instead, verify with a local test server or a sandbox.
Should I include the output of every code block?
Only include output if it is stable and deterministic. If the output includes timestamps, random numbers, or version strings, either omit it or replace it with a placeholder like .... Showing output that doesn't match what the reader gets is worse than showing no output.
How often should I re-verify the tutorial?
Re-verify whenever a dependency changes, or at least once per release cycle. If you use CI, this can be automatic. For manual verification, set a calendar reminder for every quarter or every major version bump.
Can I move a developer back to coding after writing tutorials?
Yes, and the experience often makes them a better coder. They will write more self-documenting code, use public APIs more carefully, and think about how other people will use their work. The tutorial-writing period is a temporary role, not a permanent career change.