Programming As Theory Building logo

Programming As Theory Building

Community
AnamKwon
programming-as-theory-building

Use when writing, generating, modifying, debugging, reviewing, or refactoring code. Treat code work as rebuilding and preserving the program theory: how real-world affairs map into program behavior, why the current shape exists, which existing facility the new demand resembles, and what observable behavior proves the change belongs.

Overview

PublisherAnamKwon
Repositoryprogramming-as-theory-building-skill
Skill nameprogramming-as-theory-building
Stars
33
Forks
2
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by AnamKwon on GitHub. Read the source before you install it.

Installation

Install the Programming As Theory Building AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AnamKwon/programming-as-theory-building-skill/tree/main/skills/programming-as-theory-building
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnamKwon/programming-as-theory-building-skill.git /tmp/programming-as-theory-building-skill
mkdir -p .claude/skills
cp -r /tmp/programming-as-theory-building-skill/skills/programming-as-theory-building .claude/skills/programming-as-theory-building
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Programming As Theory Building in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Programming As Theory Building on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Programming As Theory Building is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Programming as Theory Building

Operational rules for applying Peter Naur's "Programming as Theory Building" to coding-agent workflows. Use these rules to avoid context-free patches, speculative abstractions, and code that only looks right as text.

Tradeoff: This skill slows down trivial edits. For non-trivial code, pay the small upfront cost so the change fits the program.

Core Idea

Programming is not text production. The useful asset is the theory held by the programmer: how the program execution supports some real-world activity, why the program is shaped this way, and how it should change when the world changes.

Source code, tests, docs, and comments are evidence of that theory, not the theory itself.

Before Coding

Answer these briefly before a non-trivial edit:

  1. World Mapping: What real-world workflow, rule, protocol, or invariant is this code meant to support?
  2. Current Theory: Why is the current code shaped this way? What names, tests, callers, data shapes, or runtime behavior reveal that?
  3. Similarity: Which existing facility is the new demand most similar to? Where would a maintainer who knows the system expect it to live?
  4. Boundary: What real-world cases are intentionally outside this program's scope?
  5. Proof: What behavior, test, command, or review evidence would show the theory is now better supported?

If you cannot answer the first three, inspect more before patching.

Workflow

1. Rebuild Only The Needed Theory

  • Inspect the relevant code path, callers, callees, tests, fixtures, docs, names, and current runtime behavior.
  • Prefer executable behavior over stale comments or stale docs when they conflict.
  • Find at least one concrete example of how the code is used.
  • Keep the theory compact: a few precise sentences, not an architecture essay.
  • State uncertainty instead of hiding it.

2. Judge Similarity Before Placement

Naur's key modification question is not "where can I add this?" but "what existing world-facing capability is this most like?"

  • Put behavior beside the closest existing domain concept.
  • Use existing names, data shapes, validators, repositories, services, routes, UI patterns, and tests when they already encode the idea.
  • Do not duplicate a domain concept under a new name.
  • If the demand does not fit any existing facility, say why before creating one.

3. Keep Changes Surgical

  • Make the smallest coherent change that preserves the theory.
  • Touch only files required by the request.
  • Match local style even if you would design it differently from scratch.
  • Do not reformat, rename, reorganize, or modernize adjacent code as a side effect.
  • Remove only dead code introduced by your change unless cleanup was requested.

4. Avoid Speculative Flexibility

Future flexibility is not free. Every option, config knob, adapter, interface, or abstraction must be designed, implemented, tested, and explained.

  • No abstractions for one caller.
  • No unused hooks, queues, providers, registries, plugins, or settings.
  • No broad "just in case" error handling.
  • Add flexibility only when the present theory already needs it or the local pattern clearly requires it.

5. Preserve Invariants, Not Just Tests

  • Identify the invariant before changing behavior.
  • Do not patch around a broken invariant with a special case.
  • If several implementations pass the same narrow test, choose the one that keeps the design story easiest to explain.
  • Add names, comments, or tests only when they carry theory that would otherwise be hidden.

6. Verify The Theory

  • Bug fix: reproduce the violated invariant, then show it holds.
  • Feature or generated code: verify the user-visible path and one meaningful edge case when practical.
  • Refactor: verify behavior stayed the same.
  • Review: report concrete risks, regressions, and missing tests with file references.

If verification contradicts the theory, rebuild the theory before adding another patch.

Program Life Signals

Treat a program as "alive" when its theory can still be recovered and extended. Treat it as high-risk or "dead" when only text remains.

Stop and gather more context if:

  • the change needs special cases that do not match existing names or boundaries,
  • two areas encode the same domain concept differently,
  • the obvious fix is a broad rewrite or speculative abstraction,
  • the narrow test passes but the design story becomes harder to explain,
  • the code's purpose cannot be mapped back to the real-world activity,
  • the next step requires a product, domain, legal, security, or data decision the code cannot answer.

If the existing text is too far from any recoverable theory, say so. A rewrite may be cheaper than reviving dead code, but only after that risk is explicit.

Review Checklist

When reviewing code, look for:

  • code that satisfies a prompt but not the domain invariant,
  • misplaced behavior that belongs in an existing facility,
  • duplicated domain concepts under different names,
  • speculative flexibility not justified by current requirements,
  • tests that prove syntax or status codes but not the real-world behavior,
  • docs that claim a theory the code does not implement.

Response Shape

For non-trivial work, summarize briefly:

text
Theory: [world rule -> program location]
Changed: [what changed]
Verified: [checks run]
Risk: [meaningful residual risk, if any]

For review-only work, lead with findings and file references. If there are no findings, say so plainly and note remaining test gaps or residual risk.

Frequently asked questions

What does the Programming As Theory Building AI skill do?

Use when writing, generating, modifying, debugging, reviewing, or refactoring code. Treat code work as rebuilding and preserving the program theory: how real-world affairs map into program behavior, why the current shape exists, which existing facility the new demand resembles, and what observable behavior proves the change belongs.

Why use Programming As Theory Building on TypingMind?

Because you install it once and use it with any model. Programming As Theory Building is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Programming As Theory Building in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AnamKwon/programming-as-theory-building-skill/tree/main/skills/programming-as-theory-building. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Programming As Theory Building?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Programming As Theory Building?

As many as you like. As long as a model supports skills, you can use Programming As Theory Building with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Programming As Theory Building AI skill free?

Yes. It is published on GitHub by AnamKwon under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇