feat(practice): add build-and-break, predict-before-run, and code-tracing protocols
- Add skills/practice/references/project-labs.md covering Ugly Heartbeat spikes, primary spec reading, 30-line scratch/ isolation labs, Predict-Before-Run hypothesis discipline, and Code-Tracing drills - Update skills/practice/SKILL.md (57 lines) to route stretch builds, isolation labs, and Predict-Before-Run attempts - Add Reasoning trap bullet to skills/practice/references/practice-record.md to log recurring reasoning errors - Add test_practice_project_labs_protocol in tests/fixtures/test_skills_behavioral_contracts.py (38/38 tests passing)
This commit is contained in:
1 parent
5881541a82
commit
7c482fe3ca
4 files changed
+61
-6
No files matched your search
@@ -20,15 +20,21 @@ description: >-
|
|||||||
`docs/` if present). If any exist, surface up to 3 and ask whether to review one or start a
|
`docs/` if present). If any exist, surface up to 3 and ask whether to review one or start a
|
||||||
new topic. When reviewing, execute recall-before-reveal per
|
new topic. When reviewing, execute recall-before-reveal per
|
||||||
[references/revisit-protocol.md](references/revisit-protocol.md).
|
[references/revisit-protocol.md](references/revisit-protocol.md).
|
||||||
2. **Establish target.** For a new topic or algorithm problem, ask what I want to understand
|
2. **Establish target.** For a new topic, stretch build, code-tracing drill, or algorithm
|
||||||
or build, and what my current mental model is.
|
problem, ask what I want to understand or build and what my current mental model is. For
|
||||||
|
stretch builds, isolation labs, or code-tracing, read
|
||||||
|
[references/project-labs.md](references/project-labs.md) and start with an **ugly heartbeat**
|
||||||
|
(thin input -> output spike) before upfront architecture.
|
||||||
3. **Help at lowest level that works**, moving up only when I am stuck:
|
3. **Help at lowest level that works**, moving up only when I am stuck:
|
||||||
1. A question that makes me check my own assumption.
|
1. A question that makes me check my own assumption.
|
||||||
2. Where to look: file/line range, docs section, or inspection tool.
|
2. Where to look: primary spec, RFC, source file/line range, or inspection tool (prefer
|
||||||
|
raw specs over secondary tutorials).
|
||||||
3. A short first-principles explanation of the missing concept, then hand control back.
|
3. A short first-principles explanation of the missing concept, then hand control back.
|
||||||
4. A minimal demo in an unrelated example (never in working code).
|
4. A learner-run **30-line `scratch/` isolation lab** (or an agent demo in an unrelated
|
||||||
4. **Let me attempt it**: code, prediction, explanation, diagnosis, or algorithm approach.
|
example) when guessing or when two unknowns collide.
|
||||||
Ask me to read my own result before you comment.
|
4. **Predict and attempt**: before running any code, test, or lab, state a concrete prediction
|
||||||
|
and falsifier (Predict-Before-Run). Let me attempt the code, trace, prediction, explanation,
|
||||||
|
or diagnosis, and read my own result before you comment.
|
||||||
5. **Review what I produced**: report calibration (rubric checklist + assistance level),
|
5. **Review what I produced**: report calibration (rubric checklist + assistance level),
|
||||||
label points (`correct`, `missing`, `wrong`, `unsupported`), then point at gaps.
|
label points (`correct`, `missing`, `wrong`, `unsupported`), then point at gaps.
|
||||||
6. **Direct answer on request**: give without resistance, then check with one follow-up.
|
6. **Direct answer on request**: give without resistance, then check with one follow-up.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ The question, bug, or mechanism I set out to understand.
|
|||||||
## How my mental model changed
|
## How my mental model changed
|
||||||
- Before: what I assumed.
|
- Before: what I assumed.
|
||||||
- After: the mechanism, invariant, or rule that clicked.
|
- After: the mechanism, invariant, or rule that clicked.
|
||||||
|
- Reasoning trap: how my prediction or assumption got fooled (if applicable).
|
||||||
|
|
||||||
## Evidence I understood it
|
## Evidence I understood it
|
||||||
Transfer challenges, predictions, or explanations I got right without direct help.
|
Transfer challenges, predictions, or explanations I got right without direct help.
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Build-and-Break, Predict-Before-Run, and Code-Tracing Protocols
|
||||||
|
|
||||||
|
Used by `practice` when building stretch projects above your current skill level, debugging unknowns, or sharpening code-reading fluency.
|
||||||
|
|
||||||
|
## 1. Build-and-Break (Stretch Projects)
|
||||||
|
|
||||||
|
1. **Ugly Heartbeat (Vertical Flow First):**
|
||||||
|
- Skip upfront architecture, config layers, and abstractions until data moves end-to-end.
|
||||||
|
- Write the smallest working input -> output path (~30 ugly lines) in one sitting, touching raw primitives rather than hiding behind wrappers when learning is the goal.
|
||||||
|
- Layer error handling, concurrency, and edge cases one at a time after the heartbeat runs.
|
||||||
|
2. **Read the Raw Spec ("Close the Tab"):**
|
||||||
|
- When stuck on a protocol, runtime, or library, close secondary tutorials and inspect the primary specification, RFC, or upstream source directly.
|
||||||
|
- State the exact contract or invariant from the primary source in your own words before writing code.
|
||||||
|
3. **Learner-Run 30-Line `scratch/` Isolation Labs:**
|
||||||
|
- **Trigger:** Two unknowns interact, or you start guessing how a primitive behaves.
|
||||||
|
- **Protocol:** Pause edits in the main project. Create an isolated ~30-line script in `scratch/` testing only the single unknown component.
|
||||||
|
- **Break it on purpose:** Force boundary conditions (e.g., 1-byte buffers, empty input, timeouts, malformed payloads) until you predict every outcome accurately, then return to the main build.
|
||||||
|
|
||||||
|
## 2. Predict-Before-Run (Hypothesis Discipline)
|
||||||
|
|
||||||
|
Before running a test, command, or `scratch/` experiment, state your hypothesis explicitly:
|
||||||
|
- **Prediction:** "I expect `X` because of mechanism `Y`."
|
||||||
|
- **Falsifier:** "If `Z` happens instead, my assumption about `W` is wrong."
|
||||||
|
- After running, compare actual output against the prediction before changing a single line. Change one variable at a time.
|
||||||
|
|
||||||
|
## 3. Code-Tracing Drills (Read Before Running)
|
||||||
|
|
||||||
|
1. Select 25-50 lines of real code (from an active repo or standard library).
|
||||||
|
2. Given one normal input and one edge-case input, trace variables, branches, and return values on paper or in chat without executing the code.
|
||||||
|
3. State where the code could fail or misbehave, then run it to verify your trace and log any mismatch as a reasoning trap.
|
||||||
@@ -557,6 +557,24 @@ class TestSkillsBehavioralContracts(unittest.TestCase):
|
|||||||
self.assertIn("git config --bool gitea.sovereign", profile_agents)
|
self.assertIn("git config --bool gitea.sovereign", profile_agents)
|
||||||
self.assertIn("project_number:", profile_agents)
|
self.assertIn("project_number:", profile_agents)
|
||||||
|
|
||||||
|
def test_practice_project_labs_protocol(self):
|
||||||
|
"""Proves practice links project-labs.md covering Ugly Heartbeat, scratch labs, Predict-Before-Run, and Code-Tracing."""
|
||||||
|
practice_dir = REPO_ROOT / "skills" / "practice"
|
||||||
|
practice_md = (practice_dir / "SKILL.md").read_text()
|
||||||
|
labs_md = (practice_dir / "references" / "project-labs.md").read_text()
|
||||||
|
record_md = (practice_dir / "references" / "practice-record.md").read_text()
|
||||||
|
|
||||||
|
self.assertNotIn("—", labs_md)
|
||||||
|
self.assertNotIn("/home/", labs_md)
|
||||||
|
self.assertIn("references/project-labs.md", practice_md)
|
||||||
|
self.assertIn("Predict-Before-Run", practice_md)
|
||||||
|
self.assertIn("Ugly Heartbeat", labs_md)
|
||||||
|
self.assertIn("scratch/", labs_md)
|
||||||
|
self.assertIn("Read the Raw Spec", labs_md)
|
||||||
|
self.assertIn("Predict-Before-Run", labs_md)
|
||||||
|
self.assertIn("Code-Tracing", labs_md)
|
||||||
|
self.assertIn("Reasoning trap:", record_md)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user