How elementary school kids can use coding software to build a project well
This post is long, so you might want to bookmark it. If there are any mistakes, experts are welcome to correct me.
Continuing from the programming post on my profile last time,
how to use prompts to build a multi-function blog project.
jules is an experimental AI project from Google. Google released Antigravity (antigravity.google) and Jules almost at the same time.
After November 11, 2026, jules's editing feature will be shut down, and only history will remain.
As someone who took part in the trial, I think jules is much more convenient to use than Antigravity. Antigravity can't be used on Android phones; it only works on a computer that's powered on and connected to the internet. The computer has to be running Windows 10 or later. It supports Apple and Linux systems. This makes it pretty inconvenient for me—it's a real pain. As someone who relies heavily on an Android phone, there's no way I'm going to switch to another computer or device just for one feature.
Okay, back to the point.
A blog project called White Fox. Write the project intro, deployment guide, build instructions, and variables in the repo. Support deployment in various ways and on various platforms, including Tencent Cloud and Alibaba Cloud. CF one-click pull deployment is preferred; for Pages one-click file upload deployment, explain how to get the upload package. A nice-looking UI.
Implement one-click blog bookmarking. Built-in bookshelf and full management features; you can upload local ebooks to the bookshelf. Built-in gallery. Built-in music and video player; you can find and play local files, and also play website files by entering a URL. Implement one-click download by entering a file URL. Built-in website bookmarking feature and section. Built-in search engine and web browsing; you can one-click add websites found in search results to bookmarks. You can bookmark manually entered URLs. You can optionally one-click add locally uploaded bookmark URLs to bookmarks. You can use locally uploaded bookmarks. Can connect to D1 and databases on various platforms to sync bookmarks and browsing history, and sync the gallery and blog. Can connect to R2 and object storage on various platforms for file storage. Built-in cloud drive feature: you can log in to a cloud drive and one-click save files from the site to a specified folder in the cloud drive, and also one-click reference files or URLs from the cloud drive on the site. The admin password is the variable set at deployment. Implement registration; the admin has a one-click switch to allow or disallow registration. Default username and password registration, and state that password recovery is not supported. Support email registration; the admin can set the email address that auto-replies with the verification code during registration.
Start writing the project and save it to the repo.
[Image]
Once you understand how to use prompts, you also need to know how to find project errors.
First, look for them manually: open it up, take a look, and actually use it—that's the best approach. Don't trust AI too much.
Many things have a deep side, and AI programming is no exception. AI can save time and effort, but it's not omnipotent and can't do everything. So for classmates without some programming basics, doing this well is still somewhat difficult. When problems come up and you don't know how to solve them, the best move is still to ask another AI. Of course, it's even better if you can troubleshoot the problem yourself.
First, find the right problem—different errors have different causes. For example, this error: when logging in, it's the same admin, the same project, the same password, but you log into different rooms. In this situation, you don't even know how to ask the question. Is it a data sync problem or an admin account problem?
When asking another AI, you can write:
Please analyze the following code or website. You need to enter or upload it yourself first. Effectively solve the issue where, after binding the database, the same project and same admin password log into different interfaces.
Here's the AI's answer:
Root causes
-
The sync room key is randomly generated on each device.
getOrInitSecureSyncKey() generates a random wf-xxxx the first time each browser opens, so each device reads and writes a different site_sync record in D1. -
After binding the database, each device's articles, appearance, and config are independent, which looks like "the same password enters a different interface." There's also nowhere in the settings page to change this key.
-
When there's no session, it defaults to site owner. currentUser initializes to admin when there's no login record, so after logging out and refreshing, or switching to another device, you go straight into the site owner interface.
-
The admin password is only compared on the frontend. The comparison uses credentials from each device's build or cache, and it even hardcodes whitefox2025, fox, and the site name as fallback account passwords, so login results differ by device.
Changes
-
Unify the sync room: all devices share whitefox-site-main by default. Old random keys are automatically migrated back to the shared room, and local data is merged with the cloud without loss. You can also set SYNC_ROOM_KEY on the server to force it.
-
Server-side auth: added functions/api/auth.js and functions/_lib/auth.js. The site owner username and password are verified server-side via the Cloudflare environment variables ADMIN_USERNAME / ADMIN_PASSWORD. After passing, a session token is issued (valid for 30 days; old tokens automatically become invalid after a password change).
-
Protect writes: writes to /api/sync require a site owner token; reads are still public. After sharing the room, if writes aren't restricted, anyone can overwrite the site data.
Default identity changed to guest: when the page loads, it checks the token with the server. If the local leftover site owner state has an invalid token, it automatically downgrades to guest. -
Remove hardcoded account passwords: login goes through server-side verification only. It falls back to build-time variables only in environments without Functions (like local development).
Other: sync the version number when pulling cloud data to reduce 409 conflicts when a new device pushes for the first time; AuthModal now submits asynchronously. README and .env.example have been updated.
What to do after upgrading
Set ADMIN_PASSWORD in Cloudflare Pages' Environment variables; it's recommended to also set ADMIN_USERNAME.
Redeploy, and log in to the site owner account again on each device.
If you don't set ADMIN_PASSWORD, login falls back to the frontend build-time variables, and writes to /api/sync won't be protected—same as before the fix. So be sure to set it.
This kind of quick response is basically something a human would find hard to do.
But before fixing things, you need to get the project details right. If you don't get the details right first and just go fix things, you'll likely cause secondary problems. Order matters. It's like renovating a house: you do the masonry first, then the carpentry. When making scrambled eggs with tomatoes, you have to scramble the eggs first.
For example, after finishing the first step of basic framework construction for a blog project, what optimization prompts do you need? As follows: (Each sentence is a fix/optimization instruction. You need to consider the processing capability of the AI you're currently using. You can input several sentences or a paragraph at once. But over 1,000 characters places higher demands on the coding software. Prompts aren't the same for every project—you need to look at your own project's needs, plan it yourself, and decide and modify.)
Prompts
Implement direct binding and R2 in the CF dashboard. After connecting the D1 database and object storage, effectively solve sync issues. Add explanations for the D1 database and R2 object storage to the in-site deployment guide. Database connection and backend database connection should work normally and show status, with status lights. More deployment platform guides, and explain them in the repo. Ensure perfect and effective data sync, including uploaded file list, file thumbnails, files, articles, saved cloud drive data, configured email, interface, and more. Multilingual switching must work. Pages Functions route proxy. Parameterized SQL. Optimistic version locking. Date.now() unified millisecond timestamps. Retry mechanism and status indicator. Password and username set at deployment. Add a browsing history section to the left of blog articles. Records can be deleted and one-click jump. Only admins can use all editing features. Registered users can only manage files they uploaded themselves and cannot delete or modify other users' files or admin settings. Non-users can only browse and view. Perfectly fix normal upload and download of site owner files. Add a one-click feature to select and insert cloud gallery images into blog posts. Implement the ability to change the homepage intro section photo. Implement the ability to change the homepage intro section text. Show the site's total capacity and used capacity in the homepage intro section. Add a file section visible only to admins. Single or batch upload, view, edit, download, and delete files, with rich file support and management features.
Add a detailed usage guide for the cloud drive and multi-cloud scheduling hub. Implement upload and download of local ebooks. Full admin management of ebooks. Media/audio-video options support uploading and playing local media, with full media file management. Files saved by media/audio-video. Blog articles can be downloaded with one click, supporting txt format. Add a batch upload documents option next to upload/add ebook, allowing one-click selection of multiple documents to upload. Implement in-site management of files uploaded to the cloud drive and files referenced from the cloud drive. Upload and download progress bars. Ebook mobile interface supports full-screen viewing without blocking the top of the phone display. The logout button and function work normally. The login and registration panels work normally. Move the layout switch button into the settings section. The header can be opened and collapsed. Custom site-wide background photo and custom site-wide avatar; photos and homepage intro section photos all support local image upload settings. System management options visible only to admins.
Add a theme color and global background customization section. From top to bottom, the section contains these function buttons: theme color button (one-click quick color scheme), custom background color palette, custom avatar, site-wide background photo, homepage intro section photo. All sections can be opened and collapsed. Add one-click switching between mobile and desktop interfaces. Add a registered user management list section (admin only). Add an object storage and cloud drive file management section.
Make Worker's interaction with storage, databases, AI, etc. connect effectively. Implement direct binding of databases and R2 in the CF dashboard.
小学生如何用编程软件写好一个项目
本文较长,建议收藏阅览。如有错误,欢迎大佬指正。
接我主页上期编程内容,
如何用提示词写一个多功能博客项目
jules是一个谷歌的ai试验性的项目,谷歌在ai上几乎同时发布反重力(antigravity.google)和朱尔斯jules。
2026年11月11日后将会停止jules的编辑功能,仅保留历史记录。
其作为一个参与试用者,我觉得jules在使用上比反重力方便得多。反重力安卓手机上不能使用,仅支持电脑开机手连网操作。电脑必须是w10以上的系统。支持苹果和Linux系统。这给我的使用带来很多不方便,这种搞法让人蛋疼,作为高度依赖安卓手机的用户,不可能为了一个功能就去换一台电脑或设备。
好了,言归正传。
一个名为白狐的博客项目,在仓库写出项目介绍,部署指南,构建说明,变量。实现各种方式和平台的部署。含腾讯云和阿里云。cf的一键拉取部署优先,pages一键上传文件部署要说明获取上传包的方式。漂亮的界面。
一键收藏博客的实现。内置书架和完整管理功能,可上传本地电子书到书架。内置相册功能。内置音乐和视频播放器功能,可查找和播放本地文件,也可播放输入地址的网站文件。输入文件网址一键下载功能的实现。内置网站收藏功能和选区。内置搜索引擎和网页浏览功能,可一键将搜索到的互联网网站加入收藏。可收藏手动输入的网址。可将本地上传的书签网址可选择的一键加入收藏。可使用本地上传的书签。能连接d1和各种平台的数据库实现收藏同步和浏览历史同步,相册和博客的同步。能连接R2和各种平台的对象存储实现文件存储。内置加入网盘功能,可以登录网盘并将站内的的文件一键保存到网盘内的指定文件夹,也可一键引用网盘内的文件或网址到站内。管理员密码就是部署时的变量。可注册使用的实现,管理员有允许和不允许注册的一键开关。默认用户名和密码注册,并说明不支持密码找回。支持邮箱注册,管理员可设定注册时的验证码自动回复邮箱。
开始写项目,并保存到仓库。
[图片]
在懂了如何使用提示词后,还要会查找项目错误。
首先是自己手动查找,点开看一看,用一用才是最恰当的。不要过度相信AI。
许多事物都有深奥的一面,ai编程也不例外。虽然AI能做到省时省力,但AI也不是万能的,不能包办一切。所以没有一定程序和编程基础的同学要做好,也是有一定难度的。当出问题时,不知道怎么解决。这时候最好的办法还是求助其它AI,当然,自己能排查出问题更好。
首先要找对问题,不同的错误有不同的问题。比如出现以下错误:登录时同一个管理员,同一个项目,同一个密码。却登入不同房间。这种情况下,你都不知道怎么怎么提问?到底是数据同步的问题,还是管理员账号的问题。
求助于其它AI时可这样写:
请分析以下代码或网站,这个要自己先输入或上传。有效解决绑定数据库后出现的同一个项目同一个管理员密码登入不同界面的问题。
以下为ai回答:
根因
一、同步房间密钥每台设备随机生成。
getOrInitSecureSyncKey() 在每个浏览器首次打开时生成一个随机的 wf-xxxx,于是每台设备读写 D1 里不同的site_sync 记录。
二、绑定数据库后,各设备的文章、外观和配置各自独立,看起来就是"同一个密码进了不同界面"。设置页里也没有任何地方能改这个密钥。
三、无会话时默认当站长。 currentUser 在没有登录记录时会初始化成 admin,所以退出后刷新、或换一台设备,都会直接进入站长界面。
四、管理员密码只在前端比对。 比对用的是各设备构建时或缓存里的凭据,还硬编码了 whitefox2025、fox 和站点名作为备用账号密码,导致登录结果因设备而异。
修改内容
一、统一同步房间: 所有设备默认共用 whitefox-site-main。旧的随机密钥会自动迁移回共享房间,本地数据会与云端合并,不会丢失。也可以在服务端设 SYNC_ROOM_KEY 强制指定。
二、服务端认证: 新增 functions/api/auth.js 和 functions/_lib/auth.js。站长账号密码由 Cloudflare 环境变量 ADMIN_USERNAME / ADMIN_PASSWORD 在服务端校验,通过后签发会话令牌(有效期 30 天,改密码后旧令牌自动失效)。
三、保护写入: /api/sync 的写入需要站长令牌,读取仍然公开。共享房间后如果不限制写入,任何人都能覆盖站点数据。
默认身份改为游客: 页面加载时会向服务端核对令牌,本地残留的站长状态如果令牌无效,会自动降级为游客。
四、移除硬编码账号密码: 登录统一走服务端校验,只在没有 Functions 的环境(如本地开发)才回退到构建期变量。
其他: 拉取云端数据时同步版本号,减少新设备首次推送时的 409 冲突;AuthModal 改为异步提交。README 和 .env.example 已补充说明。
升级后需要做的
在 Cloudflare Pages 的 Environment variables 里设置 ADMIN_PASSWORD,建议同时设置 ADMIN_USERNAME。
重新部署,每台设备重新登录一次站长账号。
如果没设 ADMIN_PASSWORD,登录会回退到前端构建期变量,写入 /api/sync 也不会被保护,和修复前一样,所以请务必设置。
以上快速回应可以说是人很难做到的。
但整改之前要把项目细节做好,如果不把先把细节做好,就去整改,很可能造成二次问题。顺序很重要,就像装修房子要先做土工,再做木工。炒鸡蛋和西红柿时,必须先把鸡蛋炒好。
比如做一个博客项目在完成第一步基础框架建设后。需要哪些优化提示词如下:(每一句都是一个整改指令,需要考虑你当前使用AI的处理能力。可同时输入多句或一段。但超过千字的对编程软件要求较高,每个项目的提示词不是相同的,要看你自己项目的需要,自己计划,决定和修改。)
提示词
可直接在cf后台绑定和R2的实现。在接入d1数据库和对象存储后,实现有效解决同步问题。在站内部署指南增加d1数据库和r2对象存储的说明。数据库接入和后台数据库的接入正常使用和显示状态,并配置状态灯。更多的部署平台指南,并在仓库说明。确保完美有效的同步数据实现,包括上传的文件列表,文件缩略图,文件,文章,保存的网盘数据,设置的邮箱和界面和其他。多语言切换要有效。Pages Functions 路由代理。参数化 SQL。版本乐观锁。Date.now() 统一毫秒时间戳。重试机制与状态指示。密码和用户名在部署时设定,在博客文章左边增加浏览历史记录功能选区。可删除记录和一键直达。仅限管理员可使用所有编辑功能。注册用户仅能管理自己上传的文件,不能删除和修改其它用户的文件和管理员的设置。非用户仅能浏览和查看。 站长文件的正常上传和下载完美修复。 博客增加一键选择插入云相册图片的功能。可修改首页介绍区照片的有效性实现。可修改首页介绍区文字的实现。首页介绍区显示网站的总容量和已用容量。增加仅管理员可见的文件选区。可单个或批量上传,查看,编辑,下载,删除文件,丰富的文件支持功能和管理功能。
增加网盘与多云调度中枢增加使用详细指南。本地电子书能上传下载的实现。管理员对电子书的完全管理功能。媒体影音选项支持上传和播放本地影音,完全的影音文件管理功能。媒体影音保存的文件。 博客文章可一键下载,支持txt格式。在上传/新增电子书旁边增加批量上传文档选项,可一键选择上传多个文档。 实现可站内管理上传到网盘和在网盘引用文件。上传和下载进度条。 电子书手机界面支持全屏观看,不挡住手机上方显示。 退出按钮和功能的正常。登录和注册面板的正常。将切换布局按钮移到设置区內。页眉可打开和收拢。可自定义全站背景照片和自定义全站头像,照片首页介绍区照片都支持本地图片上传设定。系统管理选项仅管理员可见。
增加主题调色与全局背景自定义选区,选区从上到下包含以下功能按键:主题调色按键 (一键快速配色),自定义背景调色板,自定义头像,全站背景照片,首页介绍区照片。所有选区可打开和收拢。增加一键切换手机和电脑界面。增加已注册用户管理列表 (管理员专属)选区。增加对像存储和云盘文件管理选区。
Worker 与存储、数据库、AI 等交互的方式有效连接。实现CF后台仪表板能直接绑定数据库和r2。
Translated by AI from 简体中文Original (简体中文)
12 replies
Sort order