Building Five Types of Local Tools with AI-Assisted Programming: A Practical Guide
This article explores how to leverage AI-assisted programming to build lightweight, local tools for everyday tasks such as image processing, time management, and subscription tracking. It outlines a framework for evaluating whether a requirement is suitable for self-implementation, introduces a unified local architecture separating UI, business logic, and storage, and details the implementation of five specific tools. The guide emphasizes data privacy, exception handling, verifiable constraints, and iterative prompt engineering to help developers create reliable, personalized utilities.
Tasks like image compression, teleprompter scrolling, or reconciling subscription expenses at the end of the month are small, well-defined chores. If each task requires creating an account, adapting to a complex interface, or purchasing a long-term subscription, the usage cost may outweigh the value of the feature itself.
AI-assisted programming offers an alternative approach to these problems: rather than attempting to replicate a complete product, you can build a small tool with limited functionality and clear inputs and outputs tailored to your own workflow.
However, “generating a page” does not equate to “completing a tool.” A truly reliable implementation requires considering requirement constraints, data processing, exception handling, and subsequent maintenance. Below, using five specific requirements—batch image processing, a Pomodoro timer, a random meal selector, a teleprompter, and a subscription ledger—we introduce a reusable set of practical methods.
I. Determine if the Requirement is Suitable for Self-Implementation
Not all premium features are worth developing yourself. Lightweight tools suitable for individual construction typically share three characteristics.
First, clear business rules. For example, limiting the longest edge of an image to a specified range, recording a focus session, or randomly selecting a dish from a candidate menu. These tasks do not rely on complex external business systems.
Second, manageable data scale. Processing dozens of personal photos at a time differs significantly in engineering requirements from providing an image service to a large number of users. The former can usually be accomplished in a browser, while the latter requires consideration of resource scheduling, concurrency control, service stability, and operational support.
Third, acceptable error consequences. An animation glitch in an entertainment spinner is not on the same level as an error in financial settlement. A subscription ledger can assist in organizing expenses, but it should not take on official accounting or automatic deduction responsibilities without verification.
Self-development is not without cost. Requirement communication, code generation, testing, debugging, and data backup all require time. If the usage frequency is very low, or the feature relies on constantly updated professional knowledge, a mature service may still be more appropriate.
Therefore, the reasonable goal is not to “replace all subscriptions,” but to reduce the extra burden of low-complexity, low-risk, repetitive operations.
II. Unified Architecture: Separating UI, Business, and Storage
For lightweight tools used by a single person, a browser-based local runtime architecture can be prioritized:
User Input → Parameter Validation → Local Processing → Result Preview → Download or Save
It is recommended to split the implementation into three layers:
- UI Layer: Responsible for input, buttons, progress, prompts, and result display.
- Business Layer: Responsible for image processing, time calculation, random selection, and fee summarization.
- Storage Layer: Responsible for saving preferences, history records, and import/export.
The value of layering is reducing the cost of modification. For instance, adjusting the font size of a teleprompter should not affect the scrolling logic; modifying the subscription ledger interface should not change the fee calculation results.
It is important to note that “used in a browser” and “data not uploaded” are not the same thing. A page might load remote scripts, send tracking requests, or hand files over to external APIs for processing. If the goal is local processing, you should check whether the implementation contains unnecessary network requests and confirm that the core functionality remains available offline.
The initial loading of application files may require a network connection, but whether user business data leaves the device must be verified separately.
III. Batch Image Processing: Turning Goals into Verifiable Constraints
1. Distinguish Dimensions, Quality, and File Size
The pixel dimensions, encoding quality, and file size of an image are interrelated but cannot be simply equated.
Reducing width and height usually reduces file size; lowering lossy encoding quality may also reduce file size, but different images have different textures, noise, and color distributions, meaning the same parameters do not guarantee the same results. For lossless encoding formats, lowering a “quality parameter” may not be effective either.
Therefore, the requirements should be explicitly defined as:
- Limit the longest edge and maintain the aspect ratio;
- Default to shrinking only, do not enlarge small images;
- Set a target file size for each image;
- Clearly prompt the reason when the target cannot be met;
- Output new files, do not overwrite original files.
If the original image width and height are w and h, and the longest edge limit is L, the following ratio can be used for calculation:
r = min(1, L / max(w, h))
The target width and height are rounded from w × r and h × r, ensuring the result is at least one pixel. This prevents stretching caused by independent horizontal and vertical scaling.
2. Adopt a Bounded Iterative Strategy
For output formats that support lossy quality adjustment, you can first fix the dimensions, attempt encoding within a limited quality range, and check the actual byte size of the generated file.
If the file still exceeds the target at the acceptable minimum quality, ask the user whether further dimension reduction is allowed. Do not secretly shrink the image to an unreadable size just to display “success.”
It is recommended to output the following statuses:
- Target met;
- Exceeds target, further shrinking required;
- Format unsupported or decoding failed;
- User canceled.
The size unit should also be clarified here. Interpreting “2MB” in decimal versus binary might affect whether it ultimately meets the upload system’s limit. A more reliable approach is to display the actual byte count and allow setting a safety target slightly below the limit.
3. Handle Transparency, Orientation, and Memory
When converting transparent images to formats that do not support transparency, the user should first be allowed to choose a background color and see a preview; otherwise, unexpected background colors may appear.
Photos with shooting orientation metadata need verification that the preview and export orientations match. When dealing with location and other metadata, you should also check whether it is retained in the output, rather than assuming privacy information has been deleted based solely on the processing method.
Batch tasks should also limit concurrency. The memory footprint of an image after decoding can be significantly larger than the compressed file size; processing multiple large images simultaneously can easily cause stuttering. Sequential processing or small-scale concurrency, while releasing temporary resources upon completion, is usually more stable.
4. Establish Acceptance Samples
Prepare at least standard photos, transparent images, oversized images, already small images, and corrupted files. Verify the output size, dimensions, orientation, and transparent background item by item. When downloading in bulk, also verify that files with the same name do not overwrite each other, and that single downloads are still available if packaging fails.
IV. Pomodoro Timer and Break Timer: Time Source Matters More Than Animation
The most common mistake with timers is treating “subtracting one second per callback” as real time. When a browser enters the background, timed callbacks may be delayed, leading to deviations over long periods.
A more reliable method is to save the target end time:
Remaining Time = max(0, Target End Time − Current Time)
The timed callback is only responsible for refreshing the display, not accumulating time. When pausing, save the remaining duration; when resuming, recalculate the target end time based on that duration.
The application also needs to define clear states:
Not Started → Focusing → Paused → Completed → On Break
Different states correspond to different button behaviors, preventing multiple timer tasks from being created by repeatedly clicking “Start.”
For scenarios like device sleep or system time adjustments, processing rules should also be defined. For example, after waking up, the countdown may have already ended; if the system time is modified, calculations based on local timestamps may be affected. Lightweight personal tools can accept certain limitations, but they must not hide these boundaries.
Alert sounds and desktop notifications should be viewed as optional enhancements, as they cannot be guaranteed to trigger accurately across all device states. The interface should also provide visual cues and allow users to disable sound.
V. Random Meal Selector: Determine the Result First, Then Design the Animation
A random meal selector seems simple, but you should separate the “selection logic” from the “spinner display.”
The correct flow is:
Validate Candidates → Generate Draw Result → Calculate Target Angle → Play Animation → Display Result
Do not let the animation stop arbitrarily first and then reverse-engineer the result based on the visual position, as this easily causes display inconsistencies at boundary angles.
The basic version can use equal-probability selection. If you need to account for budget, dietary preferences, or repetition frequency, weights and exclusion conditions can be added. For example, filter out options that do not meet the budget first, then draw from the remaining set.
Three boundary conditions should be prioritized:
- When no options are available, do not start the draw;
- When only one option remains, display the result directly;
- When all options are filtered out, prompt to adjust conditions rather than returning an empty result.
This type of random mechanism is suitable for daily entertainment decisions and should not be described as suitable for lottery auditing or high-risk fairness scenarios.
VI. Teleprompter: Design Around Reading Continuity
The core of a teleprompter is not just text moving automatically, but achieving a balance between reading distance, scrolling speed, and operational interference.
Basic features should include font size, line height, text width, foreground and background colors, scrolling speed, pause/resume, and optional mirrored display. Mirroring primarily serves specific reflective use cases and should not be enabled by default.
Scrolling can be calculated based on the elapsed time between frames:
Movement Distance This Frame = Scroll Speed Per Second × Elapsed Time This Frame
This reduces the impact of different refresh conditions on scroll speed. When a page recovers from the background, abnormally large time intervals should also be capped to prevent the text from suddenly skipping a large section.
For interaction, it is recommended to provide a prominent pause button and keyboard shortcuts, and to pause auto-scrolling when the user is editing text, preventing input and reading operations from interfering with each other.
Text should be treated as plain text. Pasted content should not be executed directly as page structure to avoid script injection risks. While saving local drafts is convenient, a clear reset option should be provided, and users of shared devices should be reminded to delete sensitive scripts promptly.
VII. Subscription Ledger: Separate Budget Estimates from Actual Expenses
The most common confusion in subscription management is between “monthly prorated cost” and “actual payment this month.”
For example, an annual fee can be divided by twelve to estimate the monthly burden; however, the actual cash outflow still occurs in the payment month. Therefore, the ledger should ideally display:
- Monthly prorated cost;
- Actual payment this month;
- Upcoming expected renewals;
- Annual expected expenditure.
Each record should contain at least the service name, amount, currency, billing cycle, next deduction date, auto-renewal status, and remarks.
Different currencies cannot be directly added. If there is no reliable exchange rate source, statistics should be kept per currency; if users are allowed to manually enter conversion rates, the conversion date must be recorded, and the result should be marked as an estimate only.
Renewal dates should also not be universally advanced by a fixed number of days. Monthly and annual payments should explicitly use calendar rules, handling month-end and leap year boundaries. Canceling auto-renewal may also differ from immediately stopping usage; data fields should separate “renewal status” from “current validity period.”
Such tools do not need to collect account passwords or full payment card information. Not saving unnecessary data is an effective way to reduce risk.
VIII. How to Describe Tasks to AI Programming Tools
Presenting “make a useful small tool” in one go usually fails to yield stable results. A more effective approach is to organize the requirements into six parts:
- Usage Scenario: Who uses it, what problem it solves.
- Input Data: What types are supported, what is the scale limit.
- Core Rules: What calculation and processing logic must be followed.
- Output Results: How the user determines the task is complete.
- Exception Paths: How failures, cancellations, and empty inputs are handled.
- Delivery Requirements: How to run it, how to test it, what known limitations exist.
You can use the following generic template:
“Please implement a browser-based local tool for personal use, prioritizing a minimum viable version. First, list the requirement understanding, technical plan, and limitations, then generate runnable files. Business data is not uploaded by default, and unnecessary network dependencies are not introduced. Provide test samples for core calculation logic, covering empty inputs, invalid inputs, and processing failures. Upon delivery, explain how to start it, where data is saved, how to clear it, and what items require manual verification.”
Subsequently, iterate in the order of “correct functionality → controllable exceptions → smooth interaction → visual refinement.” Modifying only one category of issue per round makes it easier to determine whether a new change has broken existing capabilities.
IX. Final Checks Before Delivery
Whether a lightweight tool is worth keeping long-term can be judged using an acceptance checklist:
- Can the core calculations be independently verified?
- Is there clear feedback for invalid inputs?
- Does large data volume cause the page to become unresponsive?
- Does the data genuinely stay local as declared?
- Is export, backup, and recovery supported?
- Is the data truly cleared after deletion?
- Does the behavior match expectations after refreshing, closing, and reopening?
- Are known limitations clearly communicated to the user?
AI-assisted programming lowers the barrier from idea to initial version, not the requirements for correctness and security. For these small daily needs, the most valuable outcome is not a feature-rich page, but a workflow with clear boundaries, verifiable results, and controllable data.
Starting from a minimal feature set, retaining essential capabilities, proactively handling failure paths, and gradually expanding based on real usage feedback makes it easier to create personal tools that are genuinely handy and can be continuously used.
