skills/theory-building-review/SKILL.md
Manually triggered weekly or post-change repository audit based on Peter Naur's "Programming as Theory Building." Use this skill only when the user explicitly names `theory-building-review`, asks to run the theory-building review skill, or says to run the weekly/post-change theory-building review. Do not trigger automatically just because the conversation mentions Naur, domain modeling, refactoring, architecture, craft, or code review. When explicitly invoked, inspect recent diffs or scoped repository areas, reconstruct the system theory, find places where code and domain language diverge, and return actionable refactor, test, documentation, and modeling improvements. For active design, implementation, refactor, review, or AI-code acceptance on a specific change, use `theory-building` instead when explicitly invoked.
npx skillsauth add ferueda/agent-skills theory-building-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill to turn Naur's idea into a practical repository habit: after a week of work, a few merged changes, or a meaningful feature, review whether the code still preserves the team's theory of the domain.
This skill is intentionally manual. Do not apply it unless the user explicitly invokes this skill or asks to run the weekly theory-building review.
Use theory-building instead when the user is actively designing,
implementing, refactoring, reviewing, or accepting a specific change and wants
the theory-building lens applied at that point of work.
The goal is not to produce generic architecture advice. The goal is to answer: "Does the code still express the real-world model clearly enough that future programmers can change it intelligently?"
Use this skill as the periodic audit ritual:
Pair it with theory-building this way:
theory-building-review to find theory gaps across recent work.theory-building to design or implement a specific fix from the review.Use this skill when the user wants to step back from one or more changes and audit whether the repository still expresses the domain theory clearly.
| Situation | Use this skill for | |---|---| | Weekly review | Inspect recent diffs and produce one or two theory-preserving improvements. | | After a feature lands | Check whether new concepts, names, tests, and docs fit the model. | | Before a refactor | Find the real theory gaps before moving code. | | After several AI-assisted changes | Detect copied abstractions, hidden assumptions, and vocabulary drift. | | Personal craft practice | Turn one recent module or feature into a theory-building exercise. |
Do not use this skill for active design, implementation, PR review, debugging,
or accepting one specific generated change. Use theory-building for those.
Treat source code as an artifact of a human theory. Your review should recover that theory, compare it to the code, and identify where the theory is missing, distorted, duplicated, or hard to transfer.
Use this framing throughout:
Prefer concrete repository evidence over broad speculation.
If the user points to files, features, commits, or a branch, use that scope.
Use these scope presets when the user does not specify one:
git diff and changed tests/docs. Best for
uncommitted work.Keep the review narrow enough that the action items are doable this week. If the scope is too broad, state the chosen slice before reviewing.
If the user says "weekly review", "after recent changes", or gives no explicit scope, inspect the repository for recent change context:
git status --short
git diff --stat
git diff
git log --oneline -n 10
If the repository has no Git history or the diff is empty, inspect high-signal files instead:
rg --files
rg -n "TODO|FIXME|HACK|domain|model|policy|rule|invariant|workflow|event|command|service|manager"
Then read only the files needed to understand the domain surface. Prefer tests, domain modules, service/application layers, API handlers, schema/migration files, docs, and recent diffs.
Choose the smallest depth that fits the request.
Avoid turning the review into a broad architecture wishlist. The output should help the next week of work.
Before making recommendations, write a private or visible theory sketch. Keep it short but specific:
World problem:
Main domain concepts:
Core workflows:
Rules and invariants:
Bounded contexts or ownership areas:
How the current code expresses the model:
Where the model is unclear:
If important facts are uncertain, label them as assumptions. Do not invent business rules that are not supported by code, tests, docs, or user-provided context.
Use these questions to inspect the code. Prioritize findings that affect future modification, not only local cleanliness.
User, Account, Status, Type, Manager, or Handler?Watch for these signs that the theory is weakening:
Use severity to communicate practical risk, not taste.
Skip findings that are only style preferences. Every finding should connect repository evidence to a modification risk.
Use this structure for repository reviews:
**Theory Summary**
[Short explanation of the domain theory you recovered.]
**Strong Signals**
- [Where the code expresses the theory well.]
**Findings**
- [Severity] [Finding title] - [file/line reference when possible]
[Why this weakens the theory or future modification path.]
**Action Items**
- [Concrete change: refactor, rename, test, doc, ADR, or investigation.]
**This Week's Practice**
- [One to three small exercises the engineer/team should do next.]
**Open Questions**
- [Questions that require domain owner or maintainer confirmation.]
Keep findings grounded. Each finding should connect code evidence to one of these impacts:
For a light weekly pass, cap the output at three findings and three action items. Prefer one high-leverage improvement over a long list.
Make action items small enough to do. Prefer:
Avoid vague recommendations like "improve architecture", "add documentation", or "clean this up" unless they are followed by an exact target and reason.
Treat this skill as a review artifact that should evolve from actual reviews.
theory-building.Make one or two edits after a real review, then validate them on the next weekly or post-feature review.
First produce the theory-building review unless the user explicitly asks to skip it. Then implement only tightly scoped changes that are supported by the review.
Good implementation candidates:
Risky candidates that need extra care:
After implementation, run the repository's relevant tests and summarize what changed.
If the user is not asking about a specific repository and instead wants to improve their craft, run this as a personal exercise:
Return a short practice plan with one exercise, one artifact to create, and one review question to carry into their next code review.
A good theory-building review should feel like a senior engineer looked at the code and asked whether it still makes sense as a model of the world.
It should be concrete, scoped, and useful even if no code is changed immediately. The best output gives the user one or two improvements they can make this week and a sharper vocabulary for future design discussions.
tools
Evaluate, analyze, and systematically react to an adversarial code review report. Decide on the action for each finding (Implement, Adapt, Decline), provide clear justifications, and define the plan to implement the accepted changes.
development
Manually invoked point-of-work workflow for applying Peter Naur's "programming as theory building" during active software work. Use this skill only when the user explicitly names `theory-building`, asks to use the theory-building skill, or explicitly says to apply programming-as-theory- building to the current design, implementation, refactor, review, or AI-generated code. Do not trigger automatically for ordinary architecture, implementation, refactor, review, debug, documentation, AI-code, domain model, or maintainability tasks.
documentation
Summarize work done in a spec/plan document.
development
Review a spec document against codebase reality, identifying gaps and ensuring sound, robust implementations.