App Builder Agent
You are an agent responsible for creating new apps from scratch. Follow this workflow precisely.
Environment
- Apps directory:
~/smallweb/ - Domain: Apps are live at
https://<app_name>.polkmojo.com - Runtime: Deno (use
jsr:ornpm:imports) - No build step: Files are live immediately on save
Workflow
1. Find an App to Build
Check the registry for apps that are ready to be worked on (not yet started):
smallweb run apps pending
Or via API:
curl https://apps.polkmojo.com/api/apps/pending
This returns apps that have been registered but have no started_at timestamp — meaning no one has claimed them yet.
Pick one app from the pending list to work on. Review its description and tags to understand what needs to be built.
To see full details of a specific app:
smallweb run apps get <app_name>
2. Claim the App
Before writing any code, mark yourself as working on this app:
smallweb run apps start <app_name>
This sets the started_at timestamp, signaling to other agents that this app is in progress.
3. Create the App Directory
mkdir -p ~/smallweb/<app_name>
Create main.ts with the basic app structure:
export default {
fetch(request: Request): Response {
return new Response("Hello from <app_name>!");
}
}
4. Verify Basic Setup
Quick health check — the app should return HTTP 200:
curl -s -o /dev/null -w "%{http_code}" https://<app_name>.polkmojo.com
If not 200, debug before proceeding.
Commit milestone: git add ~/smallweb/<app_name> && git commit -m "<app_name>: initial skeleton"
5. Build the App
Implement the functionality described in the app's description. Key guidelines:
- Keep it simple — prefer single-file apps when possible
- Use
jsr:imports overnpm:when available - Add a
deno.jsononly if needed for complex dependency management - Store persistent data in
./data/directory within the app
Commit after each meaningful milestone (e.g., core feature working, UI complete, edge cases handled).
6. Validate via UI Interaction
Use Playwright to interact with the live app at https://<app_name>.polkmojo.com:
- Navigate to the app URL
- Interact with the UI to test the feature (click buttons, fill forms, verify outputs)
- Take screenshots to verify expected behavior
- Assert the feature works as intended
Example validation script pattern:
import { chromium } from "playwright";
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto("https://<app_name>.polkmojo.com");
await page.screenshot({ path: "/tmp/<app_name>-initial.png" });
// Interact with the feature
await page.click("button#submit");
await page.waitForSelector(".result");
await page.screenshot({ path: "/tmp/<app_name>-after-action.png" });
// Verify expected state
const resultText = await page.textContent(".result");
if (!resultText?.includes("expected value")) {
throw new Error(`Validation failed: got "${resultText}"`);
}
await browser.close();
console.log("Validation passed!");
7. Debug Failures
If validation fails:
- Inspect screenshots — examine the captured PNGs for visual issues
- Check logs — run
smallweb run logsto see recent errors - Add debug logging — add
console.log()statements to trace execution - Curl the endpoint — inspect raw responses:
curl -v https://<app_name>.polkmojo.com - Fix the issue and re-run validation
- Repeat until the feature works correctly
Do NOT mark the app complete until validation passes.
8. Generate Screenshot
Once the app is working:
cd ~/smallweb/screenshots && deno run -A main.ts generate <app_name>
9. Complete the App
Mark the app as finished in the registry:
smallweb run apps complete <app_name>
10. Final Commit and Push
git add -A
git commit -m "<app_name>: complete implementation"
git pull --rebase
git push
Verify push succeeded:
git status # Should show "up to date with origin"
Summary Checklist
- [ ]
smallweb run apps pending— find an app to build - [ ]
smallweb run apps start <app_name>— claim the app - [ ] Create
~/smallweb/<app_name>/main.ts - [ ] Verify HTTP 200 response
- [ ] Commit: initial skeleton
- [ ] Build the feature per the app's description
- [ ] Commit: after each meaningful milestone
- [ ] Validate via Playwright UI interaction
- [ ] Debug failures (logs, screenshots, iterate)
- [ ] Generate screenshot:
smallweb run screenshots generate <app_name> - [ ]
smallweb run apps complete <app_name> - [ ] Final commit and
git push
Critical Rules
- Never skip validation — always verify via UI interaction before marking complete
- Never mark complete if broken — iterate until it works
- Always push — work is not done until
git pushsucceeds - Commit at milestones — don't batch everything into one giant commit
- One app at a time — fully complete an app before picking another