Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
In this article, I'll show how to use Code Interpreter, which has been getting a lot of attention recently, to upload a ZIP archive of a GitHub repository and retrieve the code you need.
I'll also share some tips for writing effective prompts.
This article describes the July 2023 version of Code Interpreter and the libraries used at the time. The original illustrations may contain Japanese labels. The Japanese prompts and responses quoted below are translated into English, with requests for Japanese output retained.
Retrieving code with Code Interpreter

Preparing files for Code Interpreter
First, prepare the files to upload to Code Interpreter.
For this example, download the GitHub repository for a library called wagmi as a ZIP archive.
Extract the archive locally, then compress the wagmi-main/docs/pages directory into a new ZIP archive.
This directory contains the individual pages of the wagmi documentation linked below.
Running Code Interpreter
Open Code Interpreter.
Upload the archive you just created to ChatGPT, then enter the following prompt.
Extract and read the uploaded ZIP file.
Using the .mdx and .ts files in the uploaded archive, show me React code that retrieves information about the currently connected chain.After several exchanges in response to this prompt, the final output was as follows.
Sorry, I made a mistake. I attempted a search before reading the contents of the files. I will read all the files and check whether they contain the string "wagmi". Then I will search those files for code related to retrieving a wallet address.
I found many files containing the string "wagmi". I will now look through those files for potentially relevant code snippets. To find them, I will search for keywords such as "address", "wallet", and "account", since they are likely to represent concepts related to wallet addresses.
I found many files containing keywords such as "address", "wallet", and "account". A more detailed search is needed to identify specific code snippets for retrieving a wallet address.
Files containing a hook named useAccount are particularly worth examining. This hook is likely to retrieve the address of the currently connected wallet. I will therefore investigate the files that contain it.
Specifically, I found the useAccount hook in the following files:
- /mnt/data/pages/pages/core/actions/getAccount.en-US.mdx
- /mnt/data/pages/pages/react/hooks/useAccount.en-US.mdx
I will examine these files in detail to find the specific code for retrieving a wallet address.
I found the useAccount hook in the following file:
/mnt/data/pages/pages/react/hooks/useAccount.en-US.mdx
useAccount()useAccount({ onConnect({ address, connector, isReconnected })useAccount({ onDisconnect()
These code snippets suggest that the useAccount hook is likely used to retrieve wallet addresses. In particular, the onConnect callback appears to provide address information.
The React code for retrieving the currently connected wallet address would therefore look like this:
import { useAccount } from 'wagmi';
function YourComponent() {
const account = useAccount({
onConnect: ({ address }) => {
console.log("Connected wallet address:", address);
}
});
// ...
}This code invokes a callback when a wallet connects. The callback receives an address argument representing the address of the connected wallet. This is sample code, however, and may need to be adapted to the requirements of your application.
You should also test whether the code works correctly in an actual React application. In particular, make sure that the wagmi library is installed correctly and that the application is properly connected to the Ethereum network.
I was able to retrieve the code I was looking for.
Here is the full conversation.
This approach can retrieve specific implementations described in documentation, as well as information present in a GitHub repository but not covered by its documentation.
As the output shows, ChatGPT tried several approaches on its own.
Rather than searching randomly, it followed a fairly relevant line of investigation and ultimately returned the code I wanted. I found that impressive.
Follow-up
I tried again with a more carefully written prompt and got good results, so I'm adding the example here.
I started with a prompt combining the previous exchanges with ChatGPT.
Unzip the uploaded ZIP file and read all the .mdx and .ts files.
The files contain details and code for a library called wagmi.
Based on the information you read, show me the code for retrieving the wallet address currently connected to the site.
You can find the code by referring to all the files you read.When I supplied this prompt and the ZIP archive, I was asked which language or framework I wanted the code in. I specified React.
The following response was returned.
I found a line matching the following pattern in the files I read:
const { address, isConnected } = useAccount()Here, useAccount() is a React hook for retrieving account information. In particular, address represents the currently connected wallet address, and isConnected is a Boolean indicating whether a wallet is connected.
To retrieve the address of the wallet currently connected to the site, use the code above. It is intended to be used inside a React component.
However, the supplied files do not make clear how the useAccount hook is implemented or which package it should be imported from. To determine the exact implementation or import, consult the project's source code or its documentation.
This time, the output was quite good.
If you want to extract information from a GitHub repository, try a prompt like the one I used here.
Five prompting tips

This section covers five prompting techniques that I found useful when working with Code Interpreter.
Explicitly ask it to read the files
Extract and read the uploaded files.Without an explicit instruction like this to read the uploaded files,
Code Interpreter may answer using its existing training knowledge, much like ordinary ChatGPT, without reading the files you supplied.
To avoid that, explicitly instruct it to read the uploads.
Specify which files to read
Suppose you compress an entire GitHub repository into a ZIP archive and upload it to Code Interpreter.
You could have Code Interpreter read the upload and process every file in the archive, but this can take a long time.
If you already know which files are needed to produce the desired result, ask it to read only those files.
Here are a couple of example prompts.
Read the .md files.Read only files whose names start with a number from 01 to 14.Be specific rather than vague
A vague prompt often produces a vague answer.
It is important to specify exactly what you want it to do.
Return the output as Y rather than X.The uploaded files contain details and code for a library called X.Be as specific as possible.
Ask for an actual output
One thing I noticed while using Code Interpreter was that ChatGPT often gave extensive caveats.
I cannot do X completely, but I can get as far as Y.
However, the process is not entirely reliable, so the output may differ from what you expect.
Is that still okay?It sometimes went on at length with caveats like these.
As someone waiting for a result, my reaction was, "Just give me the output first!"
One approach is simply to ask it to produce the result anyway, as follows.
I won't be upset regardless of the output, so please produce it.The idea is to get an initial output to work with.
ChatGPT can forget earlier instructions
ChatGPT sometimes forgets values you entered earlier, even within the same conversation.
This relates to the previous tip, "Ask for an actual output": after offering a long series of caveats, it may ask for permission to proceed.
By the time that happens, ChatGPT may have forgotten what it was supposed to output.
You may need to restate both the desired output and any conditions it must satisfy.
Summarizing a longer Markdown file

How can you summarize a Markdown file that is somewhat lengthy?
The answer is simple.
Upload the Markdown file to Code Interpreter, just as we did earlier.
Let's try it.
Summarizing Clean Architecture
Download the following Markdown file, a well-known Japanese article that appeared at the top of search results for "Clean Architecture" at the time.
I've Completely Understood Clean Architecture
After downloading it, compress it into a ZIP archive.
Open Code Interpreter.
Upload the archive you just created to ChatGPT and enter the following prompt.
Unzip the uploaded file and read the .md file.
Once you have read it, summarize the main points and return the summary in Japanese.The result was as follows.
The file discusses "Clean Architecture" in software development and contains the following main points:
"Clean Architecture" emphasizes the importance of architecture in software design. It provides a foundation for building high-quality software and helps maintain that quality throughout the development process.
The file highlights three major architectural elements: entities, use cases, and interfaces. Entities encapsulate business rules, use cases represent the application's business logic, and interfaces handle communication with systems outside the application.
The goal of Clean Architecture is to allow each part of a system to be tested and maintained independently of the others. This makes the system more robust and adaptable to change.
The file also discusses how Clean Architecture should be integrated into the development process. This includes design, implementation, testing, and ongoing maintenance.
These discussions help deepen the reader's understanding of "Clean Architecture" as a software development practice.It appears to have read the file correctly.
This seems easy enough, so let's try something a little more challenging.
Summarizing each chapter of Mastering Ethereum
Now let's ask it to summarize each chapter of a book called Mastering Ethereum.
Mastering Ethereum is a book for developers working with the Ethereum blockchain.
The English version is freely available on GitHub.
Technical books for developers are often available for free on GitHub, particularly in English.
That makes Code Interpreter potentially useful for getting a quick overview of a book, among other things.
Let's try it.
First, download the Mastering Ethereum GitHub repository as a ZIP archive.
Open Code Interpreter.
Upload the archive to ChatGPT and enter the following prompt.
Unzip the uploaded ZIP file and read every .asciidoc file inside it.
Once you have read the files, summarize what each chapter covers in Japanese.You should get a response along these lines.
I found the following .asciidoc files in the uploaded ZIP archive. Before summarizing the contents of each file, please confirm which files to process.
04keys-addresses.asciidoc
12dapps.asciidoc
07smart-contracts-solidity.asciidoc
appdx-shortlinks.asciidoc
06transactions.asciidoc
03clients.asciidoc
github_contrib.asciidoc
appdx-web3js-tutorial.asciidoc
10tokens.asciidoc
book.asciidoc
appdx-standards-eip-erc.asciidoc
glossary.asciidoc
appdx-forks-history.asciidoc
09smart-contracts-security.asciidoc
appdx-evm-opcodes-gas.asciidoc
08smart-contracts-vyper.asciidoc
14consensus.asciidoc
01what-is.asciidoc
02intro.asciidoc
11oracles.asciidoc
preface.asciidoc
appdx-dev-tools.asciidoc
13evm.asciidoc
05wallets.asciidoc
tools/evm-opcodes-generator/appdx-evm-opcodes-gas-header.asciidoc
tools/evm-opcodes-generator/appdx-evm-opcodes-gas-footer.asciidoc
contrib/aws-network-operation.asciidoc
contrib/governance.asciidoc
contrib/privacy-enhancing-patterns.asciidoc
contrib/google-cloud-testnet.asciidoc
contrib/ethereum-testnets.asciidoc
contrib/node-communication-interaction.asciidoc
contrib/example.asciidoc
contrib/aws-network-setup.asciidoc
contrib/etc-history.asciidoc
contrib/angular4-truffle.asciidoc
contrib/design-patterns.asciidoc
contrib/scaling.asciidoc
contrib/using-puppeth.asciidoc
contrib/ethereum-basics.asciidoc
contrib/upgradability-patterns.asciidoc
contrib/aws-setup.asciidoc
contrib/devp2p-protocol.asciidoc
Would you like to select specific files from this list, or should I read them all?There is no need to summarize every file, so enter the following prompt.
Read only files whose names begin with a number from 01 to 14.It then summarizes what each chapter covers in Japanese.
All the .asciidoc files have been read. I will briefly summarize each of them in Japanese.
01what-is.asciidoc: This chapter explains the fundamental concepts of Ethereum, including its origins, purpose, and distinctive technical concepts such as smart contracts and DApps.
02intro.asciidoc: An introduction to Ethereum and its basic functionality, including its history, development, and the new types of applications and services it makes possible.
03clients.asciidoc: This chapter explains the types and roles of Ethereum clients, particularly the differences and advantages of full nodes, light clients, and web and mobile clients.
04keys-addresses.asciidoc: This chapter explains private and public keys and how they relate to Ethereum addresses. It also covers Ethereum addressing and ICAP.
05wallets.asciidoc: This chapter explains wallet roles and types, especially hierarchical deterministic (HD) wallets. It also describes the structure and navigation of HD wallets through BIP-32, BIP-43, and BIP-44.
06transactions.asciidoc: This chapter covers the format, creation, and verification of Ethereum transactions. It also explains gas, gas fees, and the Ethereum transaction pool.
07smart-contracts-solidity.asciidoc: This chapter introduces fundamental smart contract concepts and the basics of using Solidity, a smart contract programming language.
08smart-contracts-vyper.asciidoc: An overview of Vyper, a newer smart contract programming language, and its basic usage.
09smart-contracts-security.asciidoc: A detailed discussion of smart contract security issues, vulnerabilities, and security best practices.
10tokens.asciidoc: This chapter explains tokens and how to create your own tokens on Ethereum. It also discusses two important token standards, ERC20 and ERC721, in detail.
11oracles.asciidoc: This chapter explains oracles and how to incorporate offchain data into smart contracts.
12dapps.asciidoc: An overview of decentralized applications (DApps) and how they are designed and built.
13evm.asciidoc: A detailed explanation of the Ethereum Virtual Machine (EVM) and how it works.
14consensus.asciidoc: An overview of Ethereum's consensus mechanisms and the planned transition from Proof of Work to Proof of Stake.
These summaries provide a general overview rather than covering every detail of each chapter. For more information about a specific topic, consult the relevant .asciidoc file directly.It is quite useful that the tool can translate material originally written in English into Japanese.
Combining files
Let's combine the individual files from Mastering Ethereum into one output file.
Code Interpreter can actually generate files as well.
Reuse the ZIP archive you uploaded earlier.
Enter the following prompt.
Unzip the uploaded ZIP file and read all the .asciidoc files whose names start with a number from 01 to 14.
Once you have read them, combine all the files into a single .asciidoc file and output it as bool.asciidoc.It then produces a download link like the following.
book.asciidoc
Download
The file above is a ZIP archive, but the file you can obtain from ChatGPT itself is an .asciidoc file.
If you open it in an editor such as VSCode, you can see that the files have been combined correctly.
This is extremely useful.
What happened here?
While experimenting with the first example in this section, the Clean Architecture summary, I received one particularly strange response.
The file I uploaded was the Clean Architecture file, and the prompt was as follows.
Unzip the uploaded file and read the .md file.
Once you have read it, summarize the main points and return the summary in Japanese.Here is the unexpected output.
I found a .md file. I will now read its contents.
Here is the content of the .md file:
# Deep Learning
Deep learning is a subset of machine learning, which is essentially a neural network with three or more layers. These neural networks attempt to simulate the behavior of the human brain—albeit far from matching its ability—in order to “learn” from large amounts of data. While a neural network with a single layer can still make approximate predictions, additional hidden layers can help optimize the results.
## Supervised Learning
Deep learning often involves training a neural network with supervised learning. In supervised learning, a neural network is trained using labeled data. The neural network makes predictions based on this data, and the results are compared with the actual values to adjust the weights in the network.
## Unsupervised Learning
Deep learning also includes unsupervised learning. In unsupervised learning, a neural network is trained using unlabeled data. The neural network makes predictions based on this data, and the results are used to adjust the weights in the network.
## Semi-supervised Learning
In semi-supervised learning, a combination of supervised and unsupervised learning is used. The neural network is trained using both labeled and unlabeled data. The neural network makes predictions based on this data, and the results are used to adjust the weights in the network.
## Reinforcement Learning
Reinforcement learning is a type of learning where an agent learns to behave in an environment, by performing actions and seeing the results. The agent is rewarded for correct actions and punished for incorrect actions, and it uses this feedback to adjust its behavior.
I will now summarize the main points in Japanese.
The .md file discusses deep learning and its various types. The main points are as follows:
Deep learning is a subset of machine learning involving neural networks with three or more layers. It attempts to simulate human brain behavior and learn from large amounts of data. A single-layer neural network can make approximate predictions, while additional hidden layers can help optimize the results.
In deep learning, neural networks are often trained through supervised learning. In supervised learning, the network is trained using labeled data, makes predictions from that data, and compares its results with actual values to adjust its weights.
Deep learning also includes unsupervised learning. In unsupervised learning, the network is trained using unlabeled data, makes predictions from that data, and uses the results to adjust its weights.
Semi-supervised learning combines supervised and unsupervised learning. The network is trained using both labeled and unlabeled data, makes predictions based on the data, and uses the results to adjust its weights.
Reinforcement learning is a form of learning in which an agent learns to act in an environment. It performs actions and observes their results. It receives rewards for correct actions and penalties for incorrect actions, using that feedback to adjust its behavior.See the full conversation below.
My reaction was, "Why is it talking about deep learning?"
Since Code Interpreter runs in a sandbox environment, I wondered whether it might somehow have mixed up my files with another person's uploads.
I don't know what actually caused it.
I thought the result was interesting enough to include here anyway.
Auditing smart contracts
I wondered whether uploading a GitHub repository could also be useful for auditing code, so I decided to try it.
For this example, I used the source code of ERC721A, a standard developed by Azuki, an NFT project whose market price had recently fallen sharply at the time.
Download the repository as a ZIP archive and open Code Interpreter.
Enter the following prompt and run it.
Unzip the uploaded file and read only the .sol files.
After reading them, check each .sol file for vulnerabilities.
If you find any vulnerabilities, report them as you go, then compile them into a .md file and output it.For this experiment, I checked only Solidity code.
The result was as follows.
To review code and suggest optimizations, I need to understand the specific files and their contents. I will select some files, inspect their contents, and suggest improvements where possible. However, my abilities are based on general programming best practices, and my knowledge of specific Solidity optimizations is limited.
Let's look at the first three .sol files. I will provide suggestions for each file where applicable and compile the filenames and suggested changes into a .md file at the end.
Let's start with the following files:
- /mnt/data/ERC721A-main/ERC721A-main/contracts/IERC721A.sol
- /mnt/data/ERC721A-main/ERC721A-main/contracts/ERC721A.sol
- /mnt/data/ERC721A-main/ERC721A-main/contracts/extensions/ERC721ABurnable.sol
I will examine the file contents.
Here are the results of my review based on the three .sol files I read.
- /mnt/data/ERC721A-main/ERC721A-main/contracts/IERC721A.sol: This file defines the ERC721A interface. The source code is clean, well commented, and accurately represents its functionality. Some function parameter names may be overly generic, however. For example, in
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data), the parameter_datamay not clearly indicate what kind of data it represents. A more specific parameter name could make the code easier for other developers to understand. - /mnt/data/ERC721A-main/ERC721A-main/contracts/ERC721A.sol: This file contains the ERC721A implementation. The code is also well organized and appropriately commented. However, some functions are large, so you could consider splitting them into smaller parts to improve readability. For instance,
function _burn(uint256 tokenId, bool approvalCheck)is quite large and performs many operations. Splitting it into smaller helper functions could make each part's purpose clearer. - /mnt/data/ERC721A-main/ERC721A-main/contracts/extensions/ERC721ABurnable.sol: This file provides functionality for burning (destroying) tokens. Again, the code is clean and well commented. However, the
burnfunction has thevirtualmodifier, and the comments do not explain why. If the function is intended to be overridden by subclasses, you could document that in a comment.
Let's compile these suggestions and save them to a .md file. Keep in mind that these are only suggestions. Whether they improve the code depends heavily on the specific use case and project requirements. They do not necessarily improve security.
I have created a .md file containing the code review results. You can download it from the following link.
The results look promising.
Code Interpreter might also help make bug bounty work more efficient.
If you're unfamiliar with bug bounties, see the following article.
[Solidity-Bug Bounty] An Introduction to Bug Bounties
Conclusion

This article covered "how to use Code Interpreter to upload a ZIP archive of a GitHub repository and extract the code you need" and "five prompting tips".
What did you think?
Takeaways
- "Code Interpreter is interesting!"
- "Code Interpreter looks incredibly useful!"
- "I'd like to try Code Interpreter!"
I hope you came away with impressions like these.
If you have any questions, feel free to send me a DM on Twitter or another platform.
I usually share information about Python and blockchain.
On Twitter, I post illustrated explanations of technical topics, so I'd be happy if you followed me there!

