Agent Skills for Beginners: Automatically Sort and Rename Your Photos

    An introductory guide to Agent Skills, the mechanism that turns a natural-language request into an AI workflow that carries out multi-step tasks. It explains the three-layer structure behind a skill (metadata awareness, instruction parsing, and tool use), then walks through a photo-organizer skill that automatically classifies and semantically renames a travel photo collection. You'll learn how to structure the skill folder, write the SKILL.md instruction file, and run the workflow with an AI coding assistant. The article also covers how to combine the skill with cloud object storage, such as Baidu AI Cloud's BOS, for larger libraries, plus practical directory and naming conventions. Finally, it compares this approach with traditional Python scripts, covering robustness, natural-language interaction, and how easily the rules can adapt to new requirements.

    Your camera roll is full of files named “IMG_1234,” and finding that one travel photo can take forever. This is a familiar frustration in the digital life of many people. This article introduces the concept of an Agent Skill: think of it as a job description for AI. It works through three layers (metadata matching, instruction parsing, and tool use) so the AI can understand exactly what you mean when you ask it to organize your photos. Following a general technical approach, we’ll use object storage on Baidu AI Cloud together with an AI coding assistant to show how to build a photo-organizing workflow that automatically classifies and semantically renames images. Along the way, you’ll learn reusable directory conventions and tips for writing prompts, so you can stop sorting photos by hand.

    1. Why Your Photo Library Is Out of Control

    Mobile photography is everywhere, and each person now generates thousands of digital images every year. Yet most people still name their folders and files using the default serial numbers from their camera or phone, such as IMG_2024_01_01_143022.jpg. This naming scheme is unique to a machine, but it means nothing to a human.

    Suppose you want to look back at a sunset you watched by the sea in Yantai last year. You can’t search for it by filename, so you’re left relying on EXIF metadata (capture time and location), or worse, opening images one by one until you find it. This isn’t just an efficiency problem; it’s a data asset management problem. We need a smarter way to handle this kind of unstructured data.

    2. What Is an Agent Skill?

    To solve this problem, we need to go beyond a simple prompt and introduce the concept of an Agent Skill.

    You can think of an Agent Skill as a standard operating procedure (SOP) written for an AI. In the past, AI behaved more like a “know-it-all intern” that answered whatever you asked but didn’t understand your specific rules. An Agent Skill, by contrast, is the process of giving a specific AI model or AI coding assistant a dedicated capability for a defined job.

    1. How It Works: A Three-Layer Architecture

    A mature Agent Skill usually follows this three-layer interaction model:

    • Layer 1: Metadata Awareness

      When you give a command, the AI first scans the available skill library (usually a set of files in a specific directory). Instead of loading everything at once, it reads only each skill’s short description or name. For example, when you say “organize my photos,” the system detects a skill named photo-organizer that matches your intent and triggers it. This keeps the system scalable and prevents information overload from loading too much context at once.

    • Layer 2: Instruction Parsing and Planning

      Once the skill is triggered, the AI reads its core instruction file (often named SKILL.md or a similar configuration file). This file contains the logic rules you define:

      • Trigger conditions: When should this skill be used?
      • Workflow: First extract EXIF data, then classify by “year/month/location,” and finally rename each file using “location + scene description + sequence number.”
      • Constraints: What should happen if duplicate files are found?
    • Layer 3: Tool Use and Execution

      This is where the AI actually takes action. Based on the instructions it has parsed, it calls tools provided by its host environment. In a photo-organizing workflow, these tools may include:

      • Filesystem APIs: For creating folders and moving or renaming files.
      • Image processing libraries or cloud services: For reading EXIF metadata, or for uploading images to the cloud for content recognition (e.g., telling “food” from “landscape” or “architecture”).
      • A code execution engine: For running a Python script or shell commands to carry out batch operations.

    3. Hands-On: Building an Automatic Photo-Organizing Skill

    Let’s turn this theory into a concrete implementation. Suppose you have a folder containing 24 travel photos (food and scenery from Yantai, Beijing, and Hangzhou) and want them automatically sorted and renamed.

    1. Environment Setup and Resource Planning

    In a traditional local script, you might need to write complex regular expressions. In Agent Skill mode, we use a more modular structure instead:

    1. /project
    2. └── .skills/
    3. └── photo-organizer/
    4. ├── SKILL.md # Job description: defines the AI's behavior rules
    5. └── tools/
    6. ├── exif_reader.py # Helper tool: reads metadata
    7. └── image_classifier.json # Classification label set

    2. Writing the Core Instruction File (SKILL.md)

    This file is the heart of the whole skill. You need to describe the task to the AI with the same rigor you’d use when writing code.

    1. # Skill: Smart Photo Organizer
    2. ## 1. Overview
    3. Activate this skill when the user mentions "organize photos,"
    4. "sort an album," or "rename images."
    5. ## 2. Input Requirements
    6. - Target directory path
    7. - Classification dimensions (City / Category / Date)
    8. ## 3. Workflow
    9. 1. **Scan**: Traverse all `.jpg`, `.png`, and `.heic` files in the target directory.
    10. 2. **Analyze**:
    11. - Read GPS coordinates and capture time from the EXIF data.
    12. - If GPS is missing, use a vision model to recognize image content
    13. (e.g., seaside, palace, food).
    14. 3. **Classify**:
    15. - Place the images into three top-level folders: `Yantai`, `Beijing`, `Hangzhou`.
    16. - Inside each city folder, create second-level folders: `Scenery`, `Food`, `People`.
    17. 4. **Rename**:
    18. - Unified naming format: `{City}_{Category}_{CaptureDate}_{FourDigitSequence}.jpg`
    19. - Example: `Beijing_Food_20240510_0001.jpg`
    20. ## 4. Error Handling
    21. - If a file cannot be identified, move it to the `/unsorted` folder.

    3. Letting the AI Do the Work

    Now put the 24 photos in your “Downloads” folder and tell your AI coding assistant: “Use the photo-organizer skill to organize the photos in Downloads.“ Here is the technical process that happens behind the scenes:

    1. Intent recognition: The assistant picks up the keywords “organize photos” and matches them to photo-organizer.
    2. Context loading: The AI loads SKILL.md to understand the rules.
    3. Data preprocessing: The AI generates or calls code to traverse the files.
    4. Semantic analysis: For photos whose location can’t be determined from GPS, the AI uses vision understanding. For example, it sees a photo with red walls and golden roof tiles and classifies it as “Beijing_Scenery.” It sees a seafood platter and classifies it as “Yantai_Food.”
    5. Execution: The AI not only generates the classification logic but also actually runs the file-moving commands. Every file is transformed from a generic “IMG_1234” into a meaningful name like “Hangzhou_Scenery_20230815_0012.jpg.”

    4. Going Further: Cloud Storage and Agent Collaboration

    For very large collections (tens of thousands of photos), a local filesystem can become a bottleneck. In that case, you can bring in a cloud service architecture.

    Baidu AI Cloud’s object storage service (BOS) provides massive, secure, and highly reliable cloud storage. You can combine Agent Skills with cloud services as follows:

    • Storage layer: Keep only the last three months of photos on the local machine, and sync older photos to the cloud.
    • Compute layer: Use Baidu AI Cloud’s AI capabilities, such as content moderation and image recognition APIs, to do a first pass of classification in the cloud. The Agent Skill can run a script that calls these APIs and writes the recognition results back as metadata tags.
    • Retrieval layer: When you need to find “the West Lake vinegar fish I ate in Hangzhou last year,” you won’t have to dig through folders. The Agent Skill can connect to cloud search capabilities and use tags (Hangzhou + Food + 2023) to locate the original image in seconds.

    Example: Cloud Collaboration Logic

    1. Trigger: The user says, “Back up this week’s photos and clean up local storage.”
    2. Skill execution:
      • Compress the folder containing this week’s photos.
      • Call the cloud upload API to store the archive at bucket/travel/2024/.
      • Verify the hash value of the uploaded file in the cloud to ensure integrity.
      • Delete the uploaded temporary files from local storage to free up space.

    5. Why Is This Better Than a Traditional Script?

    You might ask: “I can rename files with a Python for loop. Why bother with an Agent Skill?”

    1. Robustness: A traditional script crashes as soon as it encounters corrupted EXIF data. An agent has “common sense” and can understand context. If the EXIF shows a date in 1970 (a common bug when a camera’s battery has died), the AI will automatically correct it to the file’s creation date instead of rigidly throwing an error.
    2. Natural language interaction: You don’t need to memorize complex command-line parameters. You can tell the AI, “Pick out all the cats in these photos and name them ‘Master_01,’” and it will understand and carry out the visual search.
    3. Adaptability: If you suddenly want to add “Xi’an” and “Chengdu” to your destinations, you just add two city names to SKILL.md instead of rebuilding the code logic.

    6. Conclusion

    The idea behind “Claude Agent Skills” (mentioned here as a stand-in for a broader technical trend) marks a shift in how we apply AI: from answering questions on demand to proactively carrying out tasks. It shows that AI isn’t some unreachable black-box technology. Instead, it can be a productivity tool that you “train” and define yourself.

    By writing a clear job description (SKILL.md) and combining it with capable file-handling and cloud collaboration features, you can build your own personal digital butler. Say goodbye to messy “IMG_1234” filenames, give every photo a meaningful name, and keep your memories neatly organized.