## Overview
When you have access to a capable coding agent, the most powerful problem-solving technique is to reframe your problem as a code generation problem. Instead of asking the agent to reason abstractly, ask it to write code that solves the problem — then run the code. This leverages the agent's strongest capability (structured code generation with feedback loops) for any domain, not just software.
This is the operational technique that makes the [[Code Agent as General Agent Pattern]] work in practice. The thesis says "a coding agent is a general agent." This concept answers *how*: by translating non-code problems into code problems.
## Core Framework
> "1. turn your problem into a code generation problem
> 2. ask Claude to write code to solve it
> 3. profit"
The three-step pattern is deceptively simple but represents a fundamental shift in problem-solving approach:
**Traditional approach**: Describe problem → Ask for answer → Get reasoning/text output
**Code generation approach**: Describe problem → Ask for code that solves it → Run code → Get verified output
The key difference is *verifiability*. Code either runs or it doesn't. Output is concrete and testable. The agent can iterate against actual execution results rather than abstract reasoning.
### When to Apply
| Problem Type | Code Generation Reframing |
|-------------|--------------------------|
| Data analysis | "Write a Python script that parses this CSV and shows..." |
| Financial modeling | "Write code to calculate compound interest with these variables..." |
| Research synthesis | "Write a script that extracts key themes from these files..." |
| Document transformation | "Write code to convert this format to that format..." |
| Decision analysis | "Write a script that scores these options against these criteria..." |
## Cross-Domain Applications
### Personal Finance
Instead of asking "What's my monthly spending pattern?" → ask the agent to write code that parses bank statements, categorizes transactions, and generates a summary. The code is reusable, auditable, and produces precise numbers rather than estimates.
### Knowledge Management
Instead of asking "What are the common themes across these documents?" → ask for a script that reads the files, extracts key phrases, clusters them, and reports patterns. This is how batch synthesis at scale becomes tractable.
### Household Management
Instead of asking "When should I schedule maintenance?" → ask for code that reads equipment dates, calculates intervals, and generates a maintenance calendar. The output is a concrete schedule, not advice.
## Critical Analysis
**Strengths**:
- Produces verifiable, reproducible results (code runs identically each time)
- Leverages the agent's strongest capability rather than forcing general reasoning
- Creates reusable artifacts (scripts) as a byproduct of problem-solving
- Natural feedback loop: run → error → fix → run again
**Limitations**:
- Not all problems are computationally tractable (ethical judgments, creative direction, emotional decisions)
- Requires the problem to be formalizable — ambiguous problems resist code translation
- Can over-engineer simple questions that need a one-sentence answer
- Risk of "when you have a hammer" bias — not everything benefits from code
**The meta-insight**: This technique works because code is a form of *precise specification*. Asking an agent to write code forces both the human and the agent to think precisely about what "solving the problem" actually means. The code becomes a shared contract of the solution.
## Future Research Directions
- [ ] Catalog problem types that benefit most from code-generation reframing
- [ ] Identify problems where this approach fails or is counterproductive
- [ ] Explore whether this pattern generalizes to non-coding agents (e.g., reframe as structured output generation)
## Related Concepts
- [[Code Agent as General Agent Pattern]] — The thesis; this concept is the technique
- [[First-Principles Thinking]] — Both require decomposing problems to their formal structure
- [[Compound Engineering Method]] — Code artifacts from problem-solving compound into reusable tools
- [[Rewrite Over Maintain Paradigm]] — If code is cheap to generate, problem-solving code becomes disposable
## References
**Primary Sources**:
- [Turn problem into code generation](https://readwise.io/open/951594323) - Tweets From Thariq (October 2025)
## Personal Notes & Applications
This is already my default pattern for vault operations: financial analysis via Python scripts, batch document processing via code, data extraction via programmatic approaches. The insight is naming the pattern explicitly — it's not "using Claude Code for coding" but "reframing all problems as coding problems to leverage the agent's strongest mode."
**Last updated**: 2026-02-22
---
*Source: Thariq (@trq212), Anthropic — [x.com/trq212](https://x.com/trq212)*