Lightning-Fast Workflow Improvement with Claude Code: How I Used AI to Reduce Permissions Management Overhead

Ryosuke TsujiRyosuke Tsuji
7 min read

Hello! I'm Tsuji, CTO at AirCloset, Inc. Today, I'd like to share my experience automating tedious tasks using Claude Code.

In this article, I'll introduce a case study where I used Claude Code to reduce the effort of SQL permission management:

  • Claude Code basics and setup methods

  • The flow of specific business automation

  • Tips and precautions for AI utilization

  • How much time and cost we saved

Introduction

Do you have any of these tedious tasks?

  • The workload per task isn't significant (about 5-10 minutes), but a certain volume occurs every month

  • Since strong permissions are required, it's difficult to delegate authority

  • There are many conditional branches and tools involved, making it too time-consuming to create a program from scratch

I'll introduce a case study where I improved efficiency in such tasks using generative AI.

Self-Introduction

I'm Tsuji, serving as CTO at AirCloset, Inc. While our company uses generative AI in parts of our development process and customer services, today I'll talk about developing a program to automate my own tasks using Claude Code.

What is Claude Code?

Claude Code is a tool that allows you to use "Claude," an AI assistant provided by Anthropic, in your terminal. It supports various programming tasks from code creation to debugging and refactoring. Unlike regular chat interfaces, you can generate and edit code while directly interacting in the terminal, making it easy to integrate naturally into your development workflow.

Setup Method

Claude Code is easy to set up.

Installation using Homebrew

brew install anthropic/tools/claude

When using AWS Bedrock

When using AWS Bedrock, set appropriate IAM permissions, configure AWS CLI, and then set environment variables as follows:

export CLAUDE_API_KEY=your_key_here
export CLAUDE_API_URL=https://bedrock-runtime.[region].amazonaws.com/model/anthropic.claude-3-opus-20240229-v1:0/invoke

This way, billing is consolidated with your regular AWS usage, which is personally a nice benefit.

Background: Database Account Management Challenges

At our company, we grant access to read-only separate databases for analysis purposes not only to engineers but also to members who can use SQL. Additionally, some engineers are granted create/update/delete permissions for contingencies.

However, since granting such permissions comes with significant responsibility, they cannot be easily granted to everyone. For security reasons, the decision and actual processing of permission grants were difficult tasks to delegate to individual members.

Therefore, database account creation was managed through workflow applications, and after my final approval, I needed to perform various processes myself. This work was cumbersome for the following reasons:

  • Accounts have multiple types: read-only, editable, deletable, etc.

  • There are more than ten databases to manage

  • In addition to the sheer volume, these are tasks where mistakes cannot be tolerated

Specific Work Content

When there was an application, I performed the following workflow:

  1. Check the application in Jobcan workflow (if approving)

  2. Open the corresponding spreadsheet according to the application content (target database, required permissions)

    1. If the applicant's information is not listed:

      1. Add a new row and enter the applicant's information

      2. Execute GAS for adding new accounts → SQL for account creation and a Google Document for sharing access information are generated (viewing period: 1 month)

      3. Retrieve the generated SQL and execute it on the target database to create the account

    2. If the applicant's information is already listed:

      1. Delete the Google Document access expiration date in the corresponding row

      2. Execute GAS for updating access expiration → Grant viewing permissions for the Google Document to the applicant

  3. Retrieve the public key for the bastion server from the workflow

  4. Register the applicant's information on the bastion server (skip if existing)

  5. Get the Google Document URL from the spreadsheet

  6. Paste the Google Document URL in the Jobcan workflow and approve

Automation Challenges

The following challenges existed in automating this work:

  • Many conditional branches, making implementation cumbersome

  • Many related tools, requiring understanding of each specification and authentication setup

  • Need for both MySQL and PostgreSQL clients

  • Some parts were already automated with GAS, making it halfway efficient

  • Implementing a program from scratch to solve all of these would be too cost-ineffective

Utilizing Claude Code

With the background of wanting to thoroughly try AI editors, I decided to tackle this challenge using Claude Code.

Preparation: Quality Prompt Design

When utilizing generative AI, designing quality prompts is important. So I made the following preparations:

  1. Organized patterns of information retrievable from workflows in a Markdown table

  2. Expressed the desired system flow (initially only new creation) in a Mermaid Sequence Diagram

  3. Instructed to store configuration information in a .env file

Based on this information, I requested Claude Code to build the base code. Thanks to sufficient preparation, I was able to build a high-precision program from the start.

Hybrid Development with AI

In the development process, I divided roles between AI and humans as follows:

  • I implemented fine-tuning (exception handling, lowercase conversion of input data, etc.) myself

  • Delegated major features like adding update processing to AI

  • Divided into small tasks as much as possible to improve accuracy

Benefits of Using Claude Code

1. Understanding of Special API Specifications

The Jobcan API is not common knowledge, but Claude understood it just by providing the API documentation URL. Its learning ability from documentation was high, making special system integration easy.

2. Smooth Implementation of Authentication

Google OAuth authentication setup was needed to execute GAS, but since it created a command-line tool for authentication processing and refresh token acquisition, I could implement it almost without thinking.

3. Capability Across Broad Technical Areas

Even in technical areas I don't usually touch (DB connection via SSH, Spreadsheet API operations, logging into SSH servers to create accounts, etc.), it could quickly build code upon request, dramatically improving time efficiency.

4. Reverse Engineering and Documentation

After understanding the implementation content, it updated the pre-prepared system flow and prerequisite information to the final system flow and definition information. This made the project easier for other engineers to understand.

Tips for Using Claude Code Well

1. Aim for Clear Instructions

While generative AI just needs to return "plausible" answers, we expect AI editors to produce code that definitely works. With ambiguous instructions, you cannot expect accurate implementation. It's important to organize what you want to do and communicate it as specific tasks.

2. Don't Expect Perfect Work

AI sometimes reports "completed" even when work isn't finished, or compilation errors occur after saying "implemented." It seems there's a limit to the amount of code it can read at once, and it may judge only within that range. Whether it's actually complete needs to be confirmed with separate instructions or by yourself. Be especially careful with processes involving many steps.

3. Don't Accept Suggestions Blindly

Claude Code sometimes asks, "I'd like to proceed this way, is that okay?" Initially, I often chose "Yes" without thinking deeply, but upon closer inspection, there were questionable contents or processes that consumed enormous token amounts. Always check the proposal content. There's also an option to "always choose Yes," but this is particularly dangerous, so I recommend reading the content carefully before deciding.

4. Commit Frequently

Especially when requesting large-scale modifications like refactoring, it may eventually stop working. Since it's troublesome if you can't return to the original state in such cases, I recommend committing frequently. You can also request AI to auto-commit.

Claude Code Results

Work that would have taken about 2 weeks if researched and implemented from scratch was completed in about 8 hours of my time. Token billing was less than $200 even including final refactoring, so I feel the cost-performance was very high.

Specific Results

The tedious work described above has changed to the following flow!

  1. Execute command by passing the jobcan workflow ID in CLI.

  2. The Google Document URL is displayed as a command result, so paste it and complete approval.

Conclusion: The Future of Collaboration with AI

As AI becomes commonplace in the future, how well we can utilize it will become important. At present, I realized that utilization efficiency varies greatly depending on whether you have development skills. With technical skills, you can build systems that work exactly as expected rather than just "plausible" ones, and you can fix mistakes.

Finally

I've written in detail about survival strategies in the generative AI era in another article. Please take a look if you're interested. https://zenn.dev/aircloset_dev/articles/5e4dd182775dae


I hope this article helps improve your work efficiency. If you have any questions or feedback, please let me know in the comments!

0
Subscribe to my newsletter

Read articles from Ryosuke Tsuji directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ryosuke Tsuji
Ryosuke Tsuji