DEV Community

tdk-cli
tdk-cli

Posted on

Prompts for Claude Code and Codex That Work With TDK CLI: Build the App, Then Run the Stack

Claude Code and Codex work inside your project folder, so they can read the code, run commands, and edit files. TDK CLI gives them a local stack they can control. The prompts below ask for an app shaped so TDK can describe and run it, and the steps after them connect the agent to the stack.

I have not run these prompts in Claude Code or Codex for this article, so check the output. The MCP setup for Codex comes from the TDK agent tooling docs. For Claude Code, follow that guide's own steps.

Before you start

Create the project with TDK first, so the agent starts from the same layout TDK expects:

tdk project --yes
tdk resource api --type backend -y
tdk resource web --type frontend -y
Enter fullscreen mode Exit fullscreen mode

Confirm the machine can run the stack, and read the plan before the first start:

tdk doctor --json
tdk up main --dry-run
Enter fullscreen mode Exit fullscreen mode

Connect the MCP server, so the agent can use the stack directly. For Codex, add this to .codex/config.toml in the project:

[mcp_servers.tdk]
command = "tdk"
args = ["mcp"]
cwd = "/absolute/path/to/your/tdk-project"
Enter fullscreen mode Exit fullscreen mode

For Claude Code, follow the agent tooling guide. The working directory must be the project folder either way.

Prompt 1: start and check the stack

Use the TDK tools to check this project.
1. Call doctor. If canUp is false, stop and tell me why.
2. Call up for the api and web services.
3. Call status until readiness.ready is true, or until failures appear.
4. If a service fails, call logs for that service with tail 200 and quote the first error line.
Do not edit any file under .autogenerated/.
Report the status output, not a summary of it.
Enter fullscreen mode Exit fullscreen mode

Why it works: it gives the agent a procedure with a clear finish line, and it asks for evidence.

Prompt 2: add a service without touching the generated files

Add a worker service called order-emails with TDK.
Run: tdk resource order-emails --type worker -y
Make it depend on the api service by adding it to dependsOn in its service.json.
Do not edit anything under .autogenerated/.
Then run tdk up main --dry-run and confirm the api starts before order-emails.
If the dry run shows an error, stop and report it.
Enter fullscreen mode Exit fullscreen mode

Why it works: the dependency is declared, the generated files are off limits, and the agent checks the start order against the plan TDK prints.

Prompt 3: fix a failing service with a bounded loop

The api service is failing. Work on it this way:
1. Call logs for api with tail 200. Find the first error line.
2. Fix that error in the source under services/, not in generated files.
3. Call status until api is ready, or stop after three attempts.
4. After three failed attempts, stop and report what you tried and the latest log lines.
Do not change service.json ports or the health path without asking me.
Enter fullscreen mode Exit fullscreen mode

Why it works: it limits retries, keeps the fix in the source, and stops before the agent starts changing configuration you have not approved.

Prompt 4: check the change before you accept it

Show me the list of files you changed, then the diff for each one.
Run the tests for the service you changed and paste the output.
Call status and confirm the service is ready after your change.
Tell me anything you did not verify.
Enter fullscreen mode Exit fullscreen mode

Why it works: it turns "done" into a list you can read, and it asks for the gaps.

Prompt 5: stop cleanly

We are finished. Call down to stop the stack, then call status and confirm nothing is running.
Enter fullscreen mode Exit fullscreen mode

Why it works: a stack left running holds ports for the next start, and the status call confirms the stop.

Rules to put in your project instructions

Add these to AGENTS.md or your Claude Code instructions, so every session follows them:

  • Start with doctor, then up, then status.
  • Never edit files under .autogenerated/.
  • Stop after three failed attempts and report.
  • Ask before changing ports, health paths, or secrets.
  • Call down when the task is finished.

Common problems

  • doctor says canUp is false. The machine cannot run the stack. The agent should stop there, not retry.
  • up returns, but nothing is ready. It returns before readiness. The agent must poll status.
  • The agent edits a generated file. The next generation overwrites it. Restate the rule, and check the drift output.
  • Two stacks fight over ports. Run down on the old one.

Summary

Give Claude Code and Codex a project created by TDK, connect the MCP server from the project folder, and use prompts that ask for a procedure, a finish line, a retry limit, and evidence. The agent does the typing. TDK keeps the stack in a shape it can check.

Top comments (0)