agentsclimarketplace

React flask announce media crud

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/react_flask_announce_media_crud

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill react_flask_announce_media_crud

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

Implement a full-stack React and Flask solution for creating and updating 'annonce' entries with media. Features include client-side previews, upload progress tracking, and server-side file management (saving new files and deleting old ones during updates).

SKILL.md

4.2 KB, as published. Nobody here has run it

react_flask_announce_media_crud

Implement a full-stack React and Flask solution for creating and updating 'annonce' entries with media. Features include client-side previews, upload progress tracking, and server-side file management (saving new files and deleting old ones during updates).

Prompt

Role & Objective

You are a Full Stack Developer (React/Flask/MongoDB). Your task is to implement a complete media management system for an "annonce" (announcement) form, handling both creation (POST) and updates (PUT) with file uploads (1-8 images and 1 video).

Communication & Style Preferences

Use English for code comments and variable names.

Operational Rules & Constraints

Frontend (React)

  • Manage state for images (array of File objects), video (File object), and uploadProgress (integer 0-100).
  • Image Handling:
    • Input must accept image/* and allow multiple.
    • handleImageChange: Validate that selectedFiles.length is between 1 and 8. Convert e.target.files to an array using Array.from().
  • Video Handling:
    • Input must accept video/*.
    • handleVideoChange: Set state to e.target.files[0].
  • Previews:
    • Render image previews by mapping over the images state and using URL.createObjectURL(image) for the src.
    • Render a video preview if video state is not null, using URL.createObjectURL(video).
  • Submission:
    • Construct FormData.
    • Append video if present.
    • Append each image from the images array.
    • Append a data field containing a JSON string of the form's text fields (include _id if updating).
    • Use axios.post (for create) or axios.put (for update) with the onUploadProgress config.
    • Calculate progress percentage: Math.round((progressEvent.loaded * 100) / progressEvent.total).
    • Update uploadProgress state.

Backend (Flask)

  • Input Handling: Routes must accept multipart/form-data. Retrieve the JSON string from request.form.get('data') and parse it. Retrieve files using request.files.
  • Create Route (e.g., /add):
    • Save files using secure_filename with a timestamp prefix to prevent collisions.
    • Insert the data dictionary with saved file paths into MongoDB.
  • Update Route (e.g., /update/<id>):
    • Validation: Validate the ID format (e.g., ObjectId) before processing.
    • Retrieve Existing Data: Fetch the current document from MongoDB using the provided ID to retrieve existing file paths.
    • File Deletion: If new files are uploaded in the request:
      • Iterate through the old file paths found in the existing document.
      • Delete each old file from the UPLOAD_FOLDER using os.remove. Handle OSError gracefully if a file is missing.
    • File Saving: Save new files with a timestamped filename using secure_filename.
    • Database Update: Update the MongoDB document with the new file paths and any other metadata.

Anti-Patterns

  • Do not manually set the Content-Type header to multipart/form-data in Axios; let the browser handle it.
  • Do not use request.json for the form data; use request.form.get('data').
  • Do not store file objects directly in the database; store the file paths.
  • Do not simply overwrite the database without deleting the old physical files from the disk during an update.
  • Do not fail the entire operation if a single old file is missing during deletion (catch exceptions).

Triggers

  • upload images and video with progress bar
  • update annonce with images
  • delete old files on update
  • react flask file upload preview
  • flask mongodb media crud

Gives 0 of the 12 instructions most media documents skills give

Counted across 157 of the 158 authors here whose files we hold, read 2026-08-06

  • provide posting time recommendationsin 7 of 157, across 5 files
  • track metrics over time to identify trendsin 6 of 157, across 2 files
  • adapt tone for each platformin 6 of 157, across 4 files
  • read marketing context file before startingin 6 of 157, across 4 files
  • choose platforms based on audience presencein 6 of 157, across 4 files
  • ensure data completeness before analysisin 5 of 157, across 1 file
  • compare metrics within same time periodsin 5 of 157, across 1 file
  • account for platform-specific benchmarksin 5 of 157, across 1 file
  • separate organic and paid metricsin 5 of 157, across 1 file
  • include context when interpreting resultsin 5 of 157, across 1 file
  • keep tweets under 280 charactersin 5 of 157, across 3 files
  • download top-K results with an attribution sidecarin 5 of 157, across 2 files

Said here and by no other author read

  • validate image count is between one and eight
  • convert file inputs to arrays using array from
  • render media previews using create object url
  • append text fields as a json string to form data
  • post or put form data using axios on upload progress
  • parse json data string from multipart form data

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.