SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

Turning Ideas into Reality: A Story of Using Generative AI to Create a Tool I Wished Existed

A personal account of how I, a programming beginner, used Claude and ChatGPT to develop an automatic ZIP file extraction and organization tool to solve the problem of managing Aviutl plugins and scripts. I share tips on using generative AI and effective prompting methods gained during the three-day development process.

Introduction

I love using the video editing software Aviutl, but its plugins and scripts are often published on GitHub and are typically downloaded as ZIP files. Due to Aviutl's specifications, these files need to be extracted into the same directory, which leads to a tricky problem.

Many repositories contain files with the same names, such as README.md or "LICENSE," so when you extract multiple ZIP files, it becomes impossible to tell which README belongs to which plugin or script. Furthermore, you cannot organize them into separate folders due to Aviutl's requirements.

Until now, I had been repeating the manual process of extracting them one by one, renaming them, and creating new folders to save them. Since I only download plugins and scripts occasionally, it was within an acceptable range, but I still couldn't shake the feeling that it was a hassle.

I thought, 'I wish there was a tool that could automate this kind of work,' and searched online, but I couldn't find any Windows 11-compatible tools that could automatically organize files after extraction and resolve conflicts with files of the same name.

So, I changed my perspective and, with the mindset of 'If it doesn't exist, I'll just make it,' I decided to take on the challenge of developing a tool using generative AI as a way to refresh myself between video editing sessions. I used Claude and ChatGPT (both free accounts), and my development environment was VSCode.

In this article, I have summarized the process of developing a "tool to automate ZIP file extraction and file organization" using generative AI, along with the insights I gained. I hope this serves as a reference for those who also want to turn their "I wish I had this" ideas into reality.

Also, if you like this article, please give it a like!!!

Features of the Developed Tool

The main features are as follows:

  • A function to rename and extract README and LICENSE files into separate folders.

  • A function to move the extracted ZIP files to a specified folder.

  • A design that makes it easy to add various features as needed.

There might be similar tools already in existence, but at least within the scope of my research, I could not find any tool that automates both extraction and organization and is compatible with Windows 11.

The development language was Python, and my own programming experience is limited to writing a few dozen lines of code in the past. The code is about 900 lines long, and since I worked on it as a break from my other tasks, it took about 3 days to complete. The functional implementation itself took only a few hours, but I spent time on the GUI design and implementation (it seems generative AI is not very good at GUI development).

It's not perfect, but I think I was able to create something sufficient for personal use.

Insights Gained from Tool Development Using Generative AI

I will introduce the effective ways of collaborating with AI that I learned through this development. These are concrete tips derived from practice.

1. Create a detailed specification document

Rather than making a rough request like "create a tool that does X," I found that asking the AI to "code based on the following specification" yielded results of overwhelmingly higher quality.

At first, I simply asked it to "create a tool to unzip and organize ZIP files," but the AI's output was not what I expected. So, I adopted a two-step approach: asking it to "create a specification based on the following information," and then requesting the code based on that specification.I adopted.

The quality of the output improves by including details in the specification such as "assumed error cases" and "specific examples of processing steps." For example, by clearly specifying how to handle duplicate files during extraction and the rules for folder structure, it became easier to get the expected results.

1.1 Having the AI re-verify the specification

The specification created often has missing information. Therefore, I have it
check the specification and make corrections as needed. It is accurate to have it perform the final coding after
improving the quality
to a certain extent. I use a prompt like the one below.

あなたはプロのシステムエンジニア、テクニカルライターです。与えられた仕様書の内容を、以下の観点に基づいてレビューし、問題点、疑問点、改善提案を出力してください。

# レビュー観点
以下の観点に基づいてレビューしてください。
- 正確性:技術的な記述や数値、用語などが正確であるか。
- 網羅性:必要な機能や要件が全て記述されているか。不足している情報はないか。
- 明確性:記述が曖昧でなく、誰が読んでも同じように理解できるか。専門用語の定義は明確か。
- 一貫性:仕様書全体を通して、記述内容に矛盾がないか。用語や表現が統一されているか。
- 実現可能性:技術的に実現可能であるか。無理な要求はないか。
- テスト容易性:テストの実施に必要な情報が記述されているか。テストしやすいように記述されているか。
- 可読性:文章が読みやすく、理解しやすいか。図や表などが適切に使用されているか。
- トレーサビリティ:もし関連する要求仕様が分かれば、それとの関連性(追跡可能性)も考慮してください。

# 出力形式
指摘事項は以下の形式で出力してください。

## 重要度: \[高、中、低]
**指摘箇所:** \[該当箇所(例:3.2項、〇〇の部分)]
**指摘内容:** \[具体的な問題点、疑問点、改善提案]
**改善案:** \[改善の方針、挿入置換できる形式の改善案]
**レビュー観点:** \[該当するレビュー観点(例:明確性)]

# 重要度
必要に応じて、指摘事項の重要度を判断してください。
- 高:修正が必須と思われる問題点(機能不全、矛盾など)
- 中:改善することで品質が向上すると思われる点(曖昧な記述、分かりにくい表現など)
- 低:些細な誤字脱字、表現の微調整など

# その他の指示

-重要度の高い指摘事項から順に出力してください。
-改善案は仕様書の既存の内容との整合性を意識し作成してください。
-改善案が明示的に置換や挿入ができる内容ならばDiff形式で提示してください。
-レビューの出力が完了したら、自己評価を行ってください。

2. Eliminating ambiguity in instructions

Since AI will proceed with its own interpretation if there are ambiguous expressions, specific instructions are important.

For example, rather than the abstract expression "organize files," clear instructions like "move the README.md file to the Docs folder as [ZIP name]_README.md" led to better results.

Also, instructing it in advance about possible exception cases (empty ZIP files, unextractable file formats, etc.) stabilizes the AI's response.

3. Presenting clear procedures

For complex tasks, showing the execution steps in stages is effective. For example, when pointing out problems in a specification, instructing in the order of "relevant section -> problem -> solution" deepened the AI's understanding.

As a specific example, when requesting to "add error handling for when a file does not exist":

  1. Problem situation: When a file does not exist

  2. Problem that occurs: The program stops due to an error

  3. Solution: Display an error message and skip the process

By showing such a step-by-step thought process, the AI becomes capable of more accurate responses.

4. Having the AI confirm the sufficiency of information

The main reason AI gives off-target answers is a lack of information. By adding "please ask if there is insufficient information needed for the answer," I was able to get appropriate feedback.

Because it can point out missing information by asking things like "please tell me more about X," my own thinking is also organized, and problem-solving becomes smoother. It is important to make the AI recognize the limits of its knowledge and encourage it to ask questions about unclear points.

5. Showing specific examples

Beyond abstract explanations, providing concrete examples dramatically improves AI comprehension. Real-world examples are particularly effective for exception handling and special cases.

For instance, when explaining "naming conventions for file collisions":
"If example.txt already exists, save it as example_1.txt. If example_1.txt also exists, make it example_2.txt."

By providing clear examples like this, the AI was able to grasp my intentions accurately.

6. Adjust the granularity of instructions appropriately

By switching between instructions like "explain in detail" and "state only the key points" depending on the situation, you can efficiently control the AI's output.

Especially in code modification, displaying the entire code can hit character limits, so formats like "show only the relevant part" and clarifying the structure were effective. Aim to set the appropriate granularity according to your goal.

7. Encourage the AI to self-verify

By asking, "Are there any potential issues with this code?", I prompted the AI to perform self-analysis, which helped me discover bugs and improvements I had overlooked.

AI is not good at going back to fix mistakes once they have been output, and sometimes it corrects itself later by saying, "There was a mistake in my previous answer." Therefore, explicitly requesting, "Please re-verify the logical consistency and accuracy of your answer" will yield higher-quality responses.

8. Seek solutions from multiple perspectives

When there are multiple possible approaches to a single problem, asking, "Are there any other ways to solve this problem?" helped me find more optimal solutions.

For example, in GUI design, requesting, "Are there any other simple and easy-to-use layout ideas?" allowed me to create a balanced design considered from multiple perspectives. It is effective for reducing bias and gaining a multi-faceted view.

9. Keep the feedback cycle short

It was more efficient to proceed by checking small changes sequentially rather than requesting large changes all at once. For example, proceeding in stages—"first implement only the basic functions" → "verify operation" → "implement additional functions"—makes it easier to correct course along the way.

Actively seeking feedback and providing clarification or additional information as needed streamlined the development process.

10. Utilize error messages

When code doesn't work as expected, sharing the generated error message directly with the AI allowed me to obtain accurate solutions. Error messages often contain the essence of the problem, and sharing them improves the AI's diagnostic accuracy.

Asking in the format, "I am getting this error (full error message). How should I fix it?" made it easier to get concrete correction proposals.

11. Divide and integrate tasks

For complex functions, requesting them in segments like "design → implementation → testing → integration" increased the success rate. For example, developing ZIP file processing and the GUI part separately and integrating them later was effective.

I learned that while AI can grasp the big picture, keeping the amount of information processed at one time appropriate allows it to produce higher-quality results.

12. Asking for code explanations

By asking the AI about the generated code, such as 'Please explain how this part works,' I was able to not only deepen my understanding of the code but also more easily identify potential issues and areas for improvement.

This was especially useful for me as a programming beginner, and it served as a learning opportunity rather than just using the code written by the AI.

13. Using custom prompts

You can write prompts in the settings to determine how the AI should respond. You can write a prompt that applies to all responses.

Conclusion

By utilizing generative AI, even a programming beginner like me was able to develop practical tools in a relatively short amount of time. The important point is 'how to master the use of AI.' AI is an excellent assistant for turning our ideas into reality, but to maximize its capabilities, clear goal setting and appropriate dialogue are essential.

With a clear purpose and effective instructions, AI becomes a powerful ally in making the things you 'wish existed' a reality. Why not try creating tools to solve your daily 'inconveniences' together with generative AI?

いいなと思ったら応援しよう!