sharepoint-file-creation
Source/generate the requested file using whatever content rules apply to the use case, gate it against an evidence-based pre-upload size threshold using the filesystem API, and upload it to SharePoint via the Create file tool's confirmed /app/created/ path-reference mechanism — without ever streaming raw file bytes through the LLM. Use this skill whenever a request asks for a file to be produced and uploaded to SharePoint, whether or not the user specifies a path, filename, format, or content source.
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 103
- Forks
- 118
01 前言 Front Matter
- name
- sharepoint-file-creation
- description
- Source/generate the requested file using whatever content rules apply to the use case, gate it against an evidence-based pre-upload size threshold using the filesystem API, and upload it to SharePoint via the Create file tool's confirmed /app/created/ path-reference mechanism — without ever streaming raw file bytes through the LLM. Use this skill whenever a request asks for a file to be produced and uploaded to SharePoint, whether or not the user specifies a path, filename, format, or content source.
02 资源文件 2
- 参考文档metadata.json452 B
- 参考文档README.md2.2 KB
03 SKILL.md 正文
Quick reference — the fixed sequence
- Determine what content/format is being asked for and source it (Section 0).
- Write the complete file under
/app/created/only, with a descriptive unique name. - Re-measure the final file's size with the filesystem API. Proceed only if
0 < size_bytes < 4,000,000; otherwise stop and offer options. - Call Create file with the
/app/created/<name>path bound directly as the content input. Never read bytes into the model to populate it or target another directory. - Report: content source, destination, measured size, and upload result.
Treat steps 2–5 as fixed; only step 1 is meant to flex per use case.
0. Determine and source the content
Apply any configured content-generation rules first, including required templates, knowledge sources, data sources, report structures, schemas, or style guides.
When no more specific rules are configured:
- Identify the requested file format and use the appropriate runtime library. Do not default to plain text unless plain text is requested.
- Ground the content in the user's request, available retrieval/knowledge tools, or prior conversation context.
- If a named source cannot be located, or no source can be identified, ask rather than fabricating content.
Produce a complete, correct file before continuing.
1. Generate the file in /app/created/ only
Write the complete file beneath /app/created/ using a SharePoint-safe, sanitized
basename-only, collision-resistant filename. Retain [A-Za-z0-9_-] in the stem, replace
other runs with _, trim separators, and preserve one valid extension. Reject path
separators, .., and control characters; resolve the candidate path and verify it remains
under /app/created/ before writing or uploading.
Use /app/created/ because it is the confirmed path-reference location for Create file.
Other paths may be uploaded as literal path text instead of file content, causing silent
corruption.
Keep bytes inside the runtime: never print, preview, or return generated content through the model. Track the validated path, filename, and byte count internally for upload, but do not expose the sandbox path in normal user-facing responses.
2. Measure and gate the size — always on the final written file
After the file is fully written and closed, measure it with the runtime filesystem API
(os.path.getsize, os.stat().st_size, or equivalent). Never estimate from text length,
row counts, token counts, or a measurement taken before the final write.
Proceed only when 0 < size_bytes < 4,000,000. This conservative gate addresses the current
inline connector/tool upload boundary; it is not a SharePoint file-size limit or a platform
guarantee.
If the file is empty, unreadable, or at least 4,000,000 bytes, do not call Create file. Report the measured size and offer to reduce the content or split it into multiple files. Do not truncate, regenerate, or split automatically without the user's approval.
3. Hand the reference to SharePoint Create file
Use the configured Create file tool's existing input schema. Site and folder come from whatever is already fixed/configured for this tool; do not ask the user to restate config that is pre-set, only ask if the destination is genuinely undetermined.
Bind the validated /app/created/ path as the tool's content input directly (e.g. the file
input value is the absolute /app/created/<name> path). Do not wrap it in JSON, do not
base64-encode it, do not read it into the model to populate the argument — the runtime/tool
resolves that path to real bytes server-side. This is the confirmed mechanism, not a
hypothesis: verified across two connectors, two sessions, and re-verified with byte-for-byte
hash matches on 1 MB and 2 MB files.
Authorization model: when the user's original request already asks for both generation and upload in one instruction, treat that as authorization to proceed through the upload without a second blocking confirmation round-trip. Still surface the destination, filename, measured size, and content source in the final report for transparency. Fall back to an explicit pre-upload confirmation step only when the request is ambiguous about whether upload was actually wanted, the destination is not already fixed/configured, or the content touches anything sensitive.
4. Report
State clearly: what was generated (type and content source), the destination in SharePoint (site/library/folder path or URL and filename), the measured size, and the upload result. Never claim an upload succeeded without tool evidence.
Do not surface the internal sandbox path (e.g. /app/created/<name>) in a normal
user-facing report — it is a runtime implementation detail, not something a user asking to
"generate and upload a file" needs or expects to see. Refer to the file by its name only,
plus where it landed in SharePoint. Only include the raw sandbox path when the user is
explicitly debugging or testing the skill itself, and say so if asked directly.
5. Failure handling
- Permission/DLP/authentication/unsupported-operation errors: stop and report; these are not sizing issues, so do not reinterpret them as such.
- Size-boundary errors even under the 4,000,000-byte gate: stop and report the exact error text and byte count. Treat this as evidence that the threshold may need tightening; do not retry with a slightly smaller guess. Tell the user to contact the agent owner to report the limitation.
- Ambiguous or timeout outcomes: report the upload result as unknown. Never blindly retry a write whose outcome is unclear.
04 同仓库更多 Skills
stakeholder-and-decision-map
Mines customer interactions to identify stakeholders, infer their likely roles and engagement, map the decision process, and highlight who or what may be missing. Use when asked to "map a deal's buying group", identify influential or missing stakeholders, "assess who has gone quiet", or "explain how the customer will decide". Do not use for phased engagement plans, contact sequences, choosing or drafting outreach to the single next contact, seller or team performance reviews, or contacting, scheduling, or changing records.
sales-progress-update
Creates or refreshes a sales progress update for a manager or team about work done, deal movement, pending outcomes, supported forecast position, and help needed. Use when asked to "create my weekly sales update", "refresh my sales progress deck", "report my forecast position", "where do I stand against my quarter forecast", or "catch my manager up on committed deals". Do NOT use for non-sales project updates, a since-date deal change digest, momentum or blocker analysis, meeting prep, or outreach drafting.
submission-assemble
Put the checked CSR or 510(k) sections together in template order with a reviewer-facing open-items register, as a draft package for human sign-off. Use when the user asks "assemble the CSR draft", "put the module together for review", "build the review package with the open items on top", "compile the 510(k) sections in order" or "package this up for the submission lead". Do NOT use for assembling an unchecked draft - use consistency-check instead. Do NOT use for loading protocol, SAP or TLF sources - use source-ingest instead. Do NOT use for compiling general documents or slide decks - use the built-in docx or pptx skill instead. Do NOT use for filing or submitting to a regulator - use the sponsor's validated gateway, operated by a human, instead. Guardrail: draft for human approval only (L1); status is draft_clean or draft_open_items, never submitted.
source-ingest
Pull every number, date and population definition out of a study's protocol, SAP, TLF tables, investigator brochure and prior approved text into one cited fact map, keyed per config/field-dictionary.json, before any CSR or 510(k) section is written. Use when the user asks "here's the locked TLF set and SAP, set up the CSR", "load the protocol and tables before we start drafting", "what figures do we have from the database lock?", "pull the disposition counts out of Table 14.1.1" or "ingest the IB for the 510(k)". Do NOT use for drafting or assembling submission sections - use section-draft or submission-assemble instead. Do NOT use for reconciling a patient's medications - use the discharge-care-transition plugin instead. Guardrail: reads and cites sources only; never estimates, rounds or invents a fact.
section-plan
Work out which sections a CSR or 510(k) requires, from the templates in config, check each one against the cited fact map, and name what is missing before a word is drafted. Use when the user asks "what do we still need before we can draft the CSR?", "which sections are ready to start?", "what's blocking the performance data section?", "do we have everything for the synopsis?" or "map our tables to the E3 structure". Do NOT use for writing section language - use section-draft instead. Do NOT use for cross-checking a finished draft - use consistency-check instead. Do NOT use for outlining general Word documents or business reports - use the built-in docx skill instead. Only structures with a template in config are supported. Guardrail: plans only; never marks a section ready on a missing fact and never invents a structure.
section-draft
Write or revise the language for one planned CSR or 510(k) section - synopsis, efficacy, safety, discussion, device description - using only figures already in the cited fact map, each with its TLF or SAP citation. Use when the user asks "draft the Synopsis from our locked tables", "write up safety from Table 14.3.1", "give me a first pass at the discussion", "draft the device description for the 510(k)" or "tighten the wording of the Discussion section". Do NOT use for supplying a number not already in source_facts - use source-ingest instead. Do NOT use for verifying a draft's figures - use consistency-check instead. Do NOT use for appeal letters, clinical notes or discharge summaries - use the matching HLS plugin instead. Guardrail: drafts for human approval only (L1); never asserts an unsourced number or harmonises two figures.