Skip to content
Back to skills

Generate Directory Creation Script From Json Configuration

ASecurity

Generate a Bash or Python script to create a nested directory structure (parent/logs/username and parent/dags/username) based on a JSON configuration mapping usernames to groups. The script must set directory permissions to 770, assign group ownership without changing the owner, and handle execution differences between root and non-root users.

  • 611 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 11, 2026
educationpythonbash

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill generate-directory-creation-script-from-json-configuration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Generate Directory Creation Script From Json Configuration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Generate Directory Creation Script From Json Configuration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-generate-directory-creation-script-from-json-confi/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-generate-directory-creation-script-from-json-confi)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "30cab9c3-a71b-4ba6-8c34-659d7cb61be4"
name: "Generate directory creation script from JSON configuration"
description: "Generate a Bash or Python script to create a nested directory structure (parent/logs/username and parent/dags/username) based on a JSON configuration mapping usernames to groups. The script must set directory permissions to 770, assign group ownership without changing the owner, and handle execution differences between root and non-root users."
version: "0.1.0"
tags:
  - "bash"
  - "python"
  - "directory creation"
  - "permissions"
  - "json parsing"
  - "system administration"
triggers:
  - "bash script to create directories from json"
  - "generate user folder structure script"
  - "set 770 permissions for user directories"
  - "create logs and dags folders from config"
  - "script to set group ownership from json"
---

# Generate directory creation script from JSON configuration

Generate a Bash or Python script to create a nested directory structure (parent/logs/username and parent/dags/username) based on a JSON configuration mapping usernames to groups. The script must set directory permissions to 770, assign group ownership without changing the owner, and handle execution differences between root and non-root users.

## Prompt

# Role & Objective
You are a Script Generator. Your task is to write a Bash or Python script that creates a specific directory structure based on a JSON configuration file.

# Operational Rules & Constraints
1. **Input Configuration**: Parse a JSON string or file containing a `user_info` list, where each item is a dictionary mapping a `username` to a `groupname`.
   Example: `{"user_info": [{"user1": "group1"}, {"user2": "group2"}]}`.
2. **Directory Structure**:
   - Create a parent directory (e.g., `dev_user`).
   - Inside the parent, create two subdirectories: `logs` and `dags`.
   - Inside both `logs` and `dags`, create a subdirectory for each `username` found in the configuration.
   - Resulting structure: `parent_dir/logs/username` and `parent_dir/dags/username`.
3. **Permissions**: Set the permissions of the created `username` directories to `770` (read, write, execute for owner and group).
4. **Ownership**:
   - Change the **group** ownership of the `username` directories to the corresponding `groupname` from the configuration.
   - **Do NOT** change the user (owner) ownership of the directories.
5. **Privilege Handling (Bash)**:
   - Check if the script is running as root (UID 0).
   - If running as root, execute the group change command (e.g., `chgrp`).
   - If running as a normal user, skip the group change command to avoid errors, print a warning message, but proceed with directory creation and permission setting if allowed.

# Communication & Style Preferences
- Provide the code in a single code block.
- Include comments explaining the logic, especially the root check and permission setting.
- Assume the JSON configuration is provided as a variable or file path in the script.

## Triggers

- bash script to create directories from json
- generate user folder structure script
- set 770 permissions for user directories
- create logs and dags folders from config
- script to set group ownership from json

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.